Documentation

EstimateTools.analysis.Section_2_1

Analysis I, Section 2.1 #

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" for pedagogical purposes.

inductive Chapter2.Nat :

Assumption 2.6 (Existence of natural numbers)

Instances For

    Axiom 2.1 (0 is a natural number)

    Equations

    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
    theorem Chapter2.two_succ :
    2++ = 3

    Proposition 2.1.4 (3 is a natural number)

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

    Axiom 2.3 (0 is not the successor of any natural number)

    theorem Chapter2.four_ne :
    4 0

    Proposition 2.1.6 (4 is not equal to zero)

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

    Axiom 2.4 (Different natural numbers have different successors)

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

    Axiom 2.4 (Different natural numbers have different successors)

    Proposition 2.1.8 (6 is not equal to 2)

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

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

    Axiom 2.5 (principle of mathematical induction).

    @[reducible, inline]
    abbrev Chapter2.Nat.recurse (f : NatNatNat) (c : Nat) :
    NatNat
    Equations
    Instances For
      theorem Chapter2.recurse_zero (f : NatNatNat) (c : Nat) :
      Nat.recurse f c 0 = c

      Proposition 2.1.16 (recursive definitions).

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

      Proposition 2.1.16 (recursive definitions).

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

      Proposition 2.1.16 (recursive definitions).

      theorem Chapter2.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).