Natural numbers with infinity #
The natural numbers and an extra top element ⊤. This implementation uses Part ℕ as an
implementation. Use ℕ∞ instead unless you care about computability.
Main definitions #
The following instances are defined:
There is no additive analogue of MonoidWithZero; if there were then PartENat could
be an AddMonoidWithTop.
-
toWithTop: the map fromPartENattoℕ∞, with theorems that it plays well with+and≤. -
withTopAddEquiv : PartENat ≃+ ℕ∞ -
withTopOrderIso : PartENat ≃o ℕ∞
Implementation details #
PartENat is defined to be Part ℕ.
+ and ≤ are defined on PartENat, 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 PartENat.
Before the open Classical line, various proofs are made with decidability assumptions.
This can cause issues -- see for example the non-simp lemma toWithTopZero proved by rfl,
followed by @[simp] lemma toWithTopZero' whose proof uses convert.
Tags #
PartENat, ℕ∞
The computable embedding ℕ → PartENat.
This coincides with the coercion coe : ℕ → PartENat, see PartENat.some_eq_natCast.
Equations
- PartENat.some = Part.some
Instances For
Equations
- PartENat.instZeroPartENat = { zero := ↑0 }
Equations
- PartENat.instInhabitedPartENat = { default := 0 }
Equations
- PartENat.instOnePartENat = { one := ↑1 }
Equations
Equations
- PartENat.instAddCommMonoidWithOnePartENat = let src := PartENat.addCommMonoid; AddCommMonoidWithOne.mk (_ : ∀ (a b : PartENat), a + b = b + a)
Equations
- One or more equations did not get rendered due to their size.
Equations
- PartENat.instLEPartENat = { le := fun x y => ∃ h, ∀ (hy : y.Dom), Part.get x (_ : x.Dom) ≤ Part.get y hy }
Equations
- PartENat.instTopPartENat = { top := Part.none }
Equations
- PartENat.instBotPartENat = { bot := 0 }
The coercion ℕ → PartENat preserves 0 and addition.
Equations
- PartENat.natCast_AddMonoidHom = { toZeroHom := { toFun := PartENat.some, map_zero' := PartENat.natCast_AddMonoidHom.proof_1 }, map_add' := PartENat.natCast_AddMonoidHom.proof_2 }
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Equations
- PartENat.boundedOrder = let src := PartENat.orderTop; let src_1 := PartENat.orderBot; BoundedOrder.mk
Equations
- One or more equations did not get rendered due to their size.
Equations
Equations
- One or more equations did not get rendered due to their size.
Equations
- PartENat.instCoeENatPartENat = { coe := PartENat.ofENat }
Equiv between PartENat and ℕ∞ (for the order isomorphism see
withTopOrderIso).
Equations
- PartENat.withTopEquiv = { toFun := fun x => PartENat.toWithTop x, invFun := fun x => ↑x, left_inv := PartENat.withTopEquiv.proof_1, right_inv := PartENat.withTopEquiv.proof_2 }
Instances For
Equations
- PartENat.wellFoundedRelation = { rel := fun x x_1 => x < x_1, wf := PartENat.lt_wf }
The smallest PartENat satisfying a (decidable) predicate P : ℕ → Prop
Equations
- PartENat.find P = { Dom := ∃ n, P n, get := Nat.find }
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.