theorem
proved
toNat_fromNat
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 243.
browse module
All declarations in this module, on Recognition.
explainer page
depends on
used by
formal source
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
264 | identity =>
265 show toNat (a + zero) = toNat a + toNat zero
266 rw [add_zero, toNat_zero, Nat.add_zero]
267 | step b ih =>
268 show toNat (a + succ b) = toNat a + toNat (succ b)
269 rw [add_succ, toNat_succ, toNat_succ, ih, Nat.add_succ]
270
271/-- **Recovery theorem (multiplication)**: the multiplication
272`LogicNat` carries agrees with `Nat` multiplication under the
273equivalence. -/