Definition and basic properties of extended natural numbers #
In this file we define ENat
(notation: ℕ∞
) to be WithTop ℕ
and prove some basic lemmas
about this type.
Implementation details #
There are two natural coercions from ℕ
to WithTop ℕ = ENat
: WithTop.some
and Nat.cast
. In
Lean 3, this difference was hidden in typeclass instances. Since these instances were definitionally
equal, we did not duplicate generic lemmas about WithTop α
and WithTop.some
coercion for ENat
and Nat.cast
coercion. If you need to apply a lemma about WithTop
, you may either rewrite back
and forth using ENat.some_eq_coe
, or restate the lemma for ENat
.
TODO #
Unify ENat.add_iSup
/ENat.iSup_add
with ENNReal.add_iSup
/ENNReal.iSup_add
. The key property
of ENat
and ENNReal
we are using is that all a
are either absorbing for addition (a + b = a
for all b
), or that it's order-cancellable (a + b ≤ a + c → b ≤ c
for all b
, c
), and
similarly for multiplication.
Equations
- instENatCanonicallyOrderedCommSemiring = WithTop.instCanonicallyOrderedCommSemiringOfNontrivial
Equations
- instENatLinearOrder = WithTop.linearOrder
Equations
- instENatCanonicallyLinearOrderedAddCommMonoid = WithTop.instCanonicallyLinearOrderedAddCommMonoid
Equations
- instENatLinearOrderedAddCommMonoidWithTop = WithTop.linearOrderedAddCommMonoidWithTop
Equations
- instENatWellFoundedRelation = instWellFoundedRelationOfSizeOf
Equations
Lemmas about WithTop
expect (and can output) WithTop.some
but the normal form for coercion
ℕ → ℕ∞
is Nat.cast
.
Equations
- ENat.instWellFoundedRelation = { rel := fun (x1 x2 : ℕ∞) => x1 < x2, wf := ENat.instWellFoundedRelation.proof_1 }
Conversion of ℕ∞
to ℕ
sending ∞
to 0
.
Equations
Instances For
Homomorphism from ℕ∞
to ℕ
sending ∞
to 0
.
Equations
- ENat.toNatHom = { toFun := ENat.toNat, map_zero' := ENat.toNatHom.proof_1, map_one' := ENat.toNatHom.proof_2, map_mul' := ENat.toNatHom.proof_3 }
Instances For
Alias of the reverse direction of ENat.coe_toNat_eq_self
.
Alias of ENat.natCast_ne_coe_top
.
A version of WithTop.map
for AddMonoidHom
s.
Instances For
A version of ENat.map
for MonoidWithZeroHom
s.
Instances For
A version of ENat.map
for RingHom
s.
Equations
- f.ENatMap hf = { toFun := (↑(f.toMonoidWithZeroHom.ENatMap hf)).toFun, map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ }