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
.
Implementation details #
+
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 := enat.some 0}
Equations
- enat.inhabited = {default := 0}
Equations
- enat.has_one = {one := enat.some 1}
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, nsmul := add_monoid.nsmul._default 0 has_add.add enat.add_comm_monoid._proof_4 enat.add_comm_monoid._proof_5, nsmul_zero' := enat.add_comm_monoid._proof_6, nsmul_succ' := enat.add_comm_monoid._proof_7, add_comm := enat.add_comm_monoid._proof_8}
The coercion ℕ → enat
preserves 0
and addition.
Equations
- enat.coe_hom = {to_fun := coe coe_to_lift, map_zero' := _, map_add' := enat.coe_hom._proof_1}
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 = {sup := has_sup.sup enat.has_sup, 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_sup_left := enat.semilattice_sup._proof_1, le_sup_right := enat.semilattice_sup._proof_2, sup_le := enat.semilattice_sup._proof_3}
Equations
- enat.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.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), max := has_sup.sup enat.has_sup, max_def := enat.linear_order._proof_2, min := min_default (λ (a b : enat), classical.dec_rel has_le.le a b), min_def := enat.linear_order._proof_3}
Equations
- enat.bounded_order = {top := order_top.top enat.order_top, le_top := _, bot := order_bot.bot enat.order_bot, bot_le := _}
Equations
- enat.lattice = {sup := semilattice_sup.sup enat.semilattice_sup, le := semilattice_sup.le enat.semilattice_sup, lt := semilattice_sup.lt enat.semilattice_sup, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_sup_left := _, le_sup_right := _, sup_le := _, inf := min enat.linear_order, inf_le_left := _, inf_le_right := _, le_inf := enat.lattice._proof_1}
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 := _, nsmul := add_comm_monoid.nsmul enat.add_comm_monoid, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, le := linear_order.le enat.linear_order, lt := linear_order.lt enat.linear_order, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, add_le_add_left := enat.ordered_add_comm_monoid._proof_1}
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 := _, nsmul := ordered_add_comm_monoid.nsmul enat.ordered_add_comm_monoid, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, le := semilattice_sup.le enat.semilattice_sup, lt := semilattice_sup.lt enat.semilattice_sup, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, add_le_add_left := _, bot := order_bot.bot enat.order_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}
Equations
- enat.linear_ordered_add_comm_monoid_with_top = {le := linear_order.le enat.linear_order, lt := linear_order.lt enat.linear_order, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_total := _, decidable_le := linear_order.decidable_le enat.linear_order, decidable_eq := linear_order.decidable_eq enat.linear_order, decidable_lt := linear_order.decidable_lt enat.linear_order, max := max enat.linear_order, max_def := _, min := min enat.linear_order, min_def := _, 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 := _, nsmul := ordered_add_comm_monoid.nsmul enat.ordered_add_comm_monoid, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, add_le_add_left := _, top := order_top.top enat.order_top, le_top := _, top_add' := enat.top_add}