Natural numbers with infinity
The natural numbers and an extra top
element ⊤
.
Main definitions
The following instances are defined:
There is no additive analogue of monoid_with_zero
; if there were then enat
could
be an add_monoid_with_top
.
to_with_top
: the map fromenat
towith_top ℕ
, with theorems that it plays well with+
and≤
.with_top_order_iso : enat ≃o with_top ℕ
Implementation details
enat
is defined to be roption ℕ
.
+
and ≤
are defined on enat
, but there is an issue with *
because it's not
clear what 0 * ⊤
should be. mul
is hence left undefined. Similarly ⊤ - ⊤
is ambiguous
so there is no -
defined on enat
.
Before the open_locale classical
line, various proofs are made with decidability assumptions.
This can cause issues -- see for example the non-simp lemma to_with_top_zero
proved by rfl
,
followed by @[simp] lemma to_with_top_zero'
whose proof uses convert
.
Tags
enat, with_top ℕ
Equations
- enat.has_zero = {zero := roption.some 0}
Equations
- enat.has_coe = {coe := roption.some ℕ}
Equations
Equations
- enat.add_comm_monoid = {add := has_add.add enat.has_add, add_assoc := enat.add_comm_monoid._proof_1, zero := 0, zero_add := enat.add_comm_monoid._proof_2, add_zero := enat.add_comm_monoid._proof_3, add_comm := enat.add_comm_monoid._proof_4}
Equations
- enat.partial_order = {le := has_le.le enat.has_le, lt := preorder.lt._default has_le.le, le_refl := enat.partial_order._proof_1, le_trans := enat.partial_order._proof_2, lt_iff_le_not_le := enat.partial_order._proof_3, le_antisymm := enat.partial_order._proof_4}
Equations
- enat.semilattice_sup_bot = {bot := ⊥, le := partial_order.le enat.partial_order, lt := partial_order.lt enat.partial_order, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, bot_le := enat.semilattice_sup_bot._proof_1, sup := has_sup.sup enat.has_sup, le_sup_left := enat.semilattice_sup_bot._proof_2, le_sup_right := enat.semilattice_sup_bot._proof_3, sup_le := enat.semilattice_sup_bot._proof_4}
Equations
- enat.order_top = {top := ⊤, le := semilattice_sup_bot.le enat.semilattice_sup_bot, lt := semilattice_sup_bot.lt enat.semilattice_sup_bot, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_top := enat.order_top._proof_1}
Equations
- enat.decidable_linear_order = {le := partial_order.le enat.partial_order, lt := partial_order.lt enat.partial_order, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_total := enat.decidable_linear_order._proof_1, decidable_le := classical.dec_rel has_le.le, decidable_eq := decidable_eq_of_decidable_le (classical.dec_rel has_le.le), decidable_lt := decidable_lt_of_decidable_le (classical.dec_rel has_le.le)}
Equations
- enat.bounded_lattice = {sup := semilattice_sup_bot.sup enat.semilattice_sup_bot, le := order_top.le enat.order_top, lt := order_top.lt enat.order_top, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_sup_left := _, le_sup_right := _, sup_le := _, inf := min enat.decidable_linear_order, inf_le_left := _, inf_le_right := _, le_inf := enat.bounded_lattice._proof_1, top := order_top.top enat.order_top, le_top := _, bot := semilattice_sup_bot.bot enat.semilattice_sup_bot, bot_le := _}
Equations
- enat.ordered_add_comm_monoid = {add := add_comm_monoid.add enat.add_comm_monoid, add_assoc := _, zero := add_comm_monoid.zero enat.add_comm_monoid, zero_add := _, add_zero := _, add_comm := _, le := decidable_linear_order.le enat.decidable_linear_order, lt := decidable_linear_order.lt enat.decidable_linear_order, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, add_le_add_left := enat.ordered_add_comm_monoid._proof_1, lt_of_add_lt_add_left := enat.ordered_add_comm_monoid._proof_2}
Equations
- enat.canonically_ordered_add_monoid = {add := ordered_add_comm_monoid.add enat.ordered_add_comm_monoid, add_assoc := _, zero := ordered_add_comm_monoid.zero enat.ordered_add_comm_monoid, zero_add := _, add_zero := _, add_comm := _, le := semilattice_sup_bot.le enat.semilattice_sup_bot, lt := semilattice_sup_bot.lt enat.semilattice_sup_bot, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, add_le_add_left := _, lt_of_add_lt_add_left := _, bot := semilattice_sup_bot.bot enat.semilattice_sup_bot, bot_le := _, le_iff_exists_add := enat.canonically_ordered_add_monoid._proof_1}
to_with_top
induces an order isomorphism between enat
and with_top ℕ
.
Equations
- enat.with_top_order_iso = {to_equiv := {to_fun := enat.with_top_equiv.to_fun, inv_fun := enat.with_top_equiv.inv_fun, left_inv := enat.with_top_order_iso._proof_1, right_inv := enat.with_top_order_iso._proof_2}, map_rel_iff' := enat.with_top_order_iso._proof_3}
to_with_top
induces an additive monoid isomorphism between enat
and with_top ℕ
.
Equations
- enat.with_top_add_equiv = {to_fun := enat.with_top_equiv.to_fun, inv_fun := enat.with_top_equiv.inv_fun, left_inv := enat.with_top_add_equiv._proof_1, right_inv := enat.with_top_add_equiv._proof_2, map_add' := enat.with_top_add_equiv._proof_3}
Equations
- enat.has_well_founded = {r := has_lt.lt (preorder.to_has_lt enat), wf := enat.lt_wf}