theorem
proved
fromNat_succ
show as:
view math explainer →
open explainer
Generate a durable explainer page for this declaration.
open lean source
IndisputableMonolith.Foundation.ArithmeticFromLogic on GitHub at line 233.
browse module
All declarations in this module, on Recognition.
explainer page
depends on
used by
formal source
230@[simp] theorem toNat_zero : toNat zero = 0 := rfl
231@[simp] theorem toNat_succ (n : LogicNat) : toNat (succ n) = Nat.succ (toNat n) := rfl
232@[simp] theorem fromNat_zero : fromNat 0 = zero := rfl
233@[simp] theorem fromNat_succ (n : Nat) : fromNat (Nat.succ n) = succ (fromNat n) := rfl
234
235theorem fromNat_toNat : ∀ n : LogicNat, fromNat (toNat n) = n := by
236 intro n
237 induction n with
238 | identity => rfl
239 | step n ih =>
240 show fromNat (toNat (succ n)) = succ n
241 rw [toNat_succ, fromNat_succ, ih]
242
243theorem toNat_fromNat : ∀ n : Nat, toNat (fromNat n) = n := by
244 intro n
245 induction n with
246 | zero => rfl
247 | succ n ih =>
248 show toNat (fromNat (Nat.succ n)) = Nat.succ n
249 rw [fromNat_succ, toNat_succ, ih]
250
251/-- **Recovery theorem (carrier)**: `LogicNat` and `Nat` have the same
252underlying set, witnessed by the round-trip equalities. -/
253def equivNat : LogicNat ≃ Nat where
254 toFun := toNat
255 invFun := fromNat
256 left_inv := fromNat_toNat
257 right_inv := toNat_fromNat
258
259/-- **Recovery theorem (addition)**: the addition `LogicNat` carries
260agrees with `Nat` addition under the equivalence. -/
261theorem toNat_add (a b : LogicNat) :
262 toNat (a + b) = toNat a + toNat b := by
263 induction b with