Documentation

Analysis.Section_2_1

Analysis I, Section 2.1: The Peano Axioms #

This file is a translation of Section 2.1 of Analysis I to Lean 4. All numbering refers to the original text.

I have attempted to make the translation as faithful a paraphrasing as possible of the original text. When there is a choice between a more idiomatic Lean solution and a more faithful translation, I have generally chosen the latter. In particular, there will be places where the Lean code could be "golfed" to be more elegant and idiomatic, but I have consciously avoided doing so.

Main constructions and results of this section:

Note: at the end of this chapter, the Chapter2.Nat class will be deprecated in favor of the standard Mathlib class _root_.Nat, or . However, we will develop the properties of Chapter2.Nat "by hand" in the next few sections for pedagogical purposes.

inductive Chapter2.Nat :

Assumption 2.6 (Existence of natural numbers). Here we use an explicit construction of the natural numbers (using an inductive type). For a more axiomatic approach, see the epilogue to this chapter.

Instances For
    Equations
    Instances For
      @[implicit_reducible]
      Equations
      @[implicit_reducible]

      Axiom 2.1 (0 is a natural number)

      Equations

      Axiom 2.2 (Successor of a natural number is a natural number)

      Equations
      Instances For
        @[implicit_reducible]

        Definition 2.1.3 (Definition of the numerals 0, 1, 2, etc.). Note: to avoid ambiguity, one may need to use explicit casts such as (0:Nat), (1:Nat), etc. to refer to this chapter's version of the natural numbers.

        Equations
        @[implicit_reducible]
        Equations

        Proposition 2.1.4 (3 is a natural number)

        theorem Chapter2.Nat.succ_ne (n : Nat) :
        n++ 0

        Axiom 2.3 (0 is not the successor of any natural number). Compare with Lean's Nat.succ_ne_zero.

        Proposition 2.1.6 (4 is not equal to zero)

        theorem Chapter2.Nat.succ_cancel {n m : Nat} (hnm : n++ = m++) :
        n = m

        Axiom 2.4 (Different natural numbers have different successors). Compare with Mathlib's Nat.succ_inj.

        theorem Chapter2.Nat.succ_ne_succ (n m : Nat) :
        n mn++ m++

        Axiom 2.4 (Different natural numbers have different successors). Compare with Mathlib's Nat.succ_ne_succ.

        Proposition 2.1.8 (6 is not equal to 2)

        One can also prove this sort of result by the decide tactic

        theorem Chapter2.Nat.induction (P : NatProp) (hbase : P 0) (hind : ∀ (n : Nat), P nP (n++)) (n : Nat) :
        P n

        Axiom 2.5 (Principle of mathematical induction). The induction (or induction') tactic in Mathlib serves as a substitute for this axiom.

        @[reducible, inline]
        abbrev Chapter2.Nat.recurse (f : NatNatNat) (c : Nat) :
        NatNat

        Recursion. Analogous to the inbuilt Mathlib method Nat.rec associated to the Mathlib natural numbers

        Equations
        Instances For
          theorem Chapter2.Nat.recurse_zero (f : NatNatNat) (c : Nat) :
          recurse f c 0 = c

          Proposition 2.1.16 (recursive definitions). Compare with Mathlib's Nat.rec_zero.

          theorem Chapter2.Nat.recurse_succ (f : NatNatNat) (c n : Nat) :
          recurse f c (n++) = f n (recurse f c n)

          Proposition 2.1.16 (recursive definitions). Compare with Mathlib's Nat.rec_add_one.

          theorem Chapter2.Nat.eq_recurse (f : NatNatNat) (c : Nat) (a : NatNat) :
          (a 0 = c ∀ (n : Nat), a (n++) = f n (a n)) a = recurse f c

          Proposition 2.1.16 (recursive definitions).

          theorem Chapter2.Nat.recurse_uniq (f : NatNatNat) (c : Nat) :
          ∃! a : NatNat, a 0 = c ∀ (n : Nat), a (n++) = f n (a n)

          Proposition 2.1.16 (recursive definitions).