Documentation

LeanPool.ZFLean.Integers

ZFC Integers #

This file provides a construction of the integers in ZFC based on the construction of natural numbers. It follows the usual construction of integers as equivalence classes of pairs of natural numbers. The theory also comes with usual theorems and arithmetic operations on integers and wraps everything in a commutative ring structure. Finally, we show that that the ZFInt type is isomorphic to the type of elements contained in ZFSet.Int type using the Schröder-Bernstein theorem.

@[reducible, inline]
abbrev ZFSet.zrel (a b : ZFNat × ZFNat) :

Imported ZFLean declaration.

Equations
Instances For
    @[reducible, inline]
    abbrev ZFSet.ZFInt :
    Type (u_1 + 1)

    Imported ZFLean declaration.

    Equations
    Instances For

      Imported ZFLean declaration.

      Equations
      Instances For
        @[simp]
        @[simp]
        theorem ZFSet.ZFInt.sound {x y : ZFNat × ZFNat} (h : ZFSet.zrel x y) :
        mk x = mk y
        theorem ZFSet.ZFInt.exact {x y : ZFNat × ZFNat} :
        mk x = mk yZFSet.zrel x y
        @[reducible, inline]

        Imported ZFLean declaration.

        Equations
        Instances For
          @[reducible, inline]

          Imported ZFLean declaration.

          Equations
          Instances For
            @[implicit_reducible]
            Equations
            @[implicit_reducible]
            Equations
            theorem ZFSet.ZFInt.mk_eq_zero_iff {n m : ZFNat} :
            mk (n, m) = 0 n = m
            @[reducible, inline]
            noncomputable abbrev ZFSet.ZFInt.add (n m : ZFInt) :

            Imported ZFLean declaration.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              @[implicit_reducible]
              noncomputable instance ZFSet.ZFInt.instAdd :
              Equations
              theorem ZFSet.ZFInt.add_eq (n m : ZFNat × ZFNat) :
              mk n + mk m = mk (n.1 + m.1, n.2 + m.2)
              theorem ZFSet.ZFInt.add_assoc (n m k : ZFInt) :
              n + (m + k) = n + m + k
              theorem ZFSet.ZFInt.add_comm (n m : ZFInt) :
              n + m = m + n
              theorem ZFSet.ZFInt.add_left_comm (n m k : ZFInt) :
              n + (m + k) = m + (n + k)
              theorem ZFSet.ZFInt.add_right_comm (n m k : ZFInt) :
              n + m + k = n + k + m
              theorem ZFSet.ZFInt.add_zero {x : ZFInt} :
              x + 0 = x
              theorem ZFSet.ZFInt.zero_add {x : ZFInt} :
              0 + x = x
              @[reducible, inline]

              Imported ZFLean declaration.

              Equations
              Instances For
                @[implicit_reducible]
                Equations
                theorem ZFSet.ZFInt.neg_eq (n : ZFNat × ZFNat) :
                -mk n = mk (n.2, n.1)
                theorem ZFSet.ZFInt.neg_neg (n : ZFInt) :
                - -n = n
                theorem ZFSet.ZFInt.neg_inj {a b : ZFInt} :
                -a = -b a = b
                theorem ZFSet.ZFInt.neg_eq_zero {a : ZFInt} :
                -a = 0 a = 0
                theorem ZFSet.ZFInt.neg_eq_of_add_eq_zero {a b : ZFInt} (h : a + b = 0) :
                -a = b
                theorem ZFSet.ZFInt.eq_neg_of_eq_neg {a b : ZFInt} (h : a = -b) :
                b = -a
                theorem ZFSet.ZFInt.eq_neg_comm {a b : ZFInt} :
                a = -b b = -a
                theorem ZFSet.ZFInt.neg_eq_comm {a b : ZFInt} :
                -a = b -b = a
                theorem ZFSet.ZFInt.neg_add_cancel_left (a b : ZFInt) :
                -a + (a + b) = b
                theorem ZFSet.ZFInt.add_neg_cancel_left (a b : ZFInt) :
                a + (-a + b) = b
                theorem ZFSet.ZFInt.add_left_cancel {a b c : ZFInt} (h : a + b = a + c) :
                b = c
                theorem ZFSet.ZFInt.neg_add {a b : ZFInt} :
                -(a + b) = -a + -b
                @[reducible, inline]
                noncomputable abbrev ZFSet.ZFInt.sub (n m : ZFInt) :

                Integer subtraction in the ZF integer model.

                Equations
                Instances For
                  @[implicit_reducible]
                  noncomputable instance ZFSet.ZFInt.instSub :

                  Imported ZFLean declaration.

                  Equations
                  theorem ZFSet.ZFInt.sub_eq (n m : ZFNat × ZFNat) :
                  mk n - mk m = mk (n.1 + m.2, n.2 + m.1)
                  theorem ZFSet.ZFInt.sub_eq_add_neg {a b : ZFInt} :
                  a - b = a + -b
                  theorem ZFSet.ZFInt.add_neg_one (i : ZFInt) :
                  i + -1 = i - 1
                  theorem ZFSet.ZFInt.sub_self (a : ZFInt) :
                  a - a = 0
                  theorem ZFSet.ZFInt.sub_zero (a : ZFInt) :
                  a - 0 = a
                  theorem ZFSet.ZFInt.zero_sub (a : ZFInt) :
                  0 - a = -a
                  theorem ZFSet.ZFInt.sub_eq_zero_of_eq {a b : ZFInt} (h : a = b) :
                  a - b = 0
                  theorem ZFSet.ZFInt.eq_of_sub_eq_zero {a b : ZFInt} (h : a - b = 0) :
                  a = b
                  theorem ZFSet.ZFInt.sub_eq_zero {a b : ZFInt} :
                  a - b = 0 a = b
                  theorem ZFSet.ZFInt.sub_sub (a b c : ZFInt) :
                  a - b - c = a - (b + c)
                  theorem ZFSet.ZFInt.neg_sub (a b : ZFInt) :
                  -(a - b) = b - a
                  theorem ZFSet.ZFInt.sub_sub_self (a b : ZFInt) :
                  a - (a - b) = b
                  theorem ZFSet.ZFInt.sub_neg (a b : ZFInt) :
                  a - -b = a + b
                  theorem ZFSet.ZFInt.sub_add_cancel (a b : ZFInt) :
                  a - b + b = a
                  theorem ZFSet.ZFInt.add_sub_cancel (a b : ZFInt) :
                  a + b - b = a
                  theorem ZFSet.ZFInt.add_sub_assoc (a b c : ZFInt) :
                  a + b - c = a + (b - c)
                  theorem ZFSet.ZFInt.sub_left_cancel (a b c : ZFInt) :
                  a - c = b - ca = b
                  theorem ZFSet.ZFInt.sub_right_cancel (a b c : ZFInt) :
                  c - a = c - ba = b
                  theorem ZFSet.ZFInt.add_eq_sub_iff {a b c : ZFInt} :
                  a + b = c a = c - b
                  @[reducible, inline]
                  noncomputable abbrev ZFSet.ZFInt.mul (n m : ZFInt) :

                  Integer multiplication in the ZF integer model.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[implicit_reducible]
                    noncomputable instance ZFSet.ZFInt.instMul :

                    Imported ZFLean declaration.

                    Equations
                    theorem ZFSet.ZFInt.mul_eq (n m : ZFNat × ZFNat) :
                    mk n * mk m = mk (n.1 * m.1 + n.2 * m.2, n.1 * m.2 + n.2 * m.1)
                    theorem ZFSet.ZFInt.mul_comm (n m : ZFInt) :
                    n * m = m * n
                    theorem ZFSet.ZFInt.left_distrib (a b c : ZFInt) :
                    a * (b + c) = a * b + a * c
                    theorem ZFSet.ZFInt.right_distrib (a b c : ZFInt) :
                    (a + b) * c = a * c + b * c
                    theorem ZFSet.ZFInt.zero_mul (a : ZFInt) :
                    0 * a = 0
                    theorem ZFSet.ZFInt.mul_zero (a : ZFInt) :
                    a * 0 = 0
                    theorem ZFSet.ZFInt.mul_assoc (a b c : ZFInt) :
                    a * b * c = a * (b * c)
                    theorem ZFSet.ZFInt.one_mul (a : ZFInt) :
                    1 * a = a
                    theorem ZFSet.ZFInt.mul_one (a : ZFInt) :
                    a * 1 = a
                    @[implicit_reducible]
                    noncomputable instance ZFSet.ZFInt.instCommRing :
                    Equations
                    • One or more equations did not get rendered due to their size.
                    @[implicit_reducible]
                    Equations
                    • One or more equations did not get rendered due to their size.
                    @[implicit_reducible]
                    Equations
                    theorem ZFSet.ZFInt.lt_succ {n : ZFInt} :
                    n < n + 1
                    theorem ZFSet.ZFInt.lt_trans {a b c : ZFInt} :
                    a < bb < ca < c
                    theorem ZFSet.ZFInt.lt_zero_iff {n m : ZFNat} :
                    m < n 0 < mk (n, m)
                    theorem ZFSet.ZFInt.le_trans {a b c : ZFInt} :
                    a bb ca c
                    theorem ZFSet.ZFInt.le_antisymm {a b : ZFInt} :
                    a bb aa = b
                    theorem ZFSet.ZFInt.le_total {a b : ZFInt} :
                    a b b a
                    theorem ZFSet.ZFInt.lt_neg_iff {a b : ZFInt} :
                    a < b -b < -a
                    @[implicit_reducible]
                    Equations
                    • One or more equations did not get rendered due to their size.
                    @[implicit_reducible]
                    Equations
                    • One or more equations did not get rendered due to their size.
                    @[implicit_reducible]
                    Equations
                    • One or more equations did not get rendered due to their size.
                    theorem ZFSet.ZFInt.ind {P : ZFNatZFNatProp} (n : ZFNat) (m : ZFNat) (zero : P 0 0) (succ_l : ∀ (n : ZFNat) (m : ZFNat), P n mP (n + 1) m) (succ_r : ∀ (n : ZFNat) (m : ZFNat), P n mP n (m + 1)) :
                    P n m
                    theorem ZFSet.ZFInt.induction_pos {P : ZFIntProp} (n : ZFInt) (n_pos : 0 n) (zero : P 0) (succ : ∀ (k : ZFInt), P kP (k + 1)) :
                    P n
                    theorem ZFSet.ZFInt.induction_neg {P : ZFIntProp} (n : ZFInt) (n_neg : n 0) (zero : P 0) (succ : ∀ (k : ZFInt), P kP (k - 1)) :
                    P n
                    theorem ZFSet.ZFInt.induction {P : ZFIntProp} (n : ZFInt) (zero : P 0) (pos : ∀ (k : ZFInt), P kP (k + 1)) (neg : ∀ (k : ZFInt), P kP (k - 1)) :
                    P n
                    theorem ZFSet.ZFInt.sign_cases {P : ZFIntProp} (n : ZFInt) (zero : P 0) (neg : n < 0P n) (pos : 0 < nP n) :
                    P n
                    theorem ZFSet.ZFInt.cases {P : ZFIntProp} (n : ZFInt) (pos : 0 nP n) (neg : n < 0P n) :
                    P n
                    theorem ZFSet.ZFInt.add_eq_add_sub_eq_sub {a b c d : ZFNat} :
                    a + b = c + da - c = d - b
                    theorem ZFSet.ZFInt.le_of_lt_succ (n m : ZFInt) :
                    n < m + 1n m
                    theorem ZFSet.ZFInt.lt_succ_of_le (n m : ZFInt) :
                    n mn < m + 1
                    theorem ZFSet.ZFInt.lt_succ_of_le_iff (n m : ZFInt) :
                    n m n < m + 1
                    theorem ZFSet.ZFInt.intLe.dest {n m : ZFInt} :
                    n m∃ (k : ZFInt), 0 k n + k = m
                    theorem ZFSet.ZFInt.mul_pos_pos_pos (a b : ZFInt) (ha : 0 < a) (hb : 0 < b) :
                    0 < a * b
                    theorem ZFSet.ZFInt.neg_one_mul (a : ZFInt) :
                    -1 * a = -a
                    theorem ZFSet.ZFInt.mul_neg_neg (a b : ZFInt) :
                    a * b = -a * -b
                    theorem ZFSet.ZFInt.neg_mul_distrib (a b : ZFInt) :
                    -(a * b) = -a * b
                    theorem ZFSet.ZFInt.mul_neg_neg_pos (a b : ZFInt) (ha : a < 0) (hb : b < 0) :
                    0 < a * b
                    theorem ZFSet.ZFInt.neg_flip_lt (a : ZFInt) :
                    a < 0 0 < -a
                    theorem ZFSet.ZFInt.mul_neg_pos_neg (a b : ZFInt) (ha : a < 0) (hb : 0 < b) :
                    a * b < 0
                    theorem ZFSet.ZFInt.mul_pos_neg_neg (a b : ZFInt) (ha : 0 < a) (hb : b < 0) :
                    a * b < 0
                    theorem ZFSet.ZFInt.mul_nonneg_nonneg_nonneg (a b : ZFInt) (ha : 0 a) (hb : 0 b) :
                    0 a * b
                    theorem ZFSet.ZFInt.mul_nonpos_nonneg_nonpos (a b : ZFInt) (ha : a 0) (hb : 0 b) :
                    a * b 0
                    theorem ZFSet.ZFInt.mul_nonneg_nonpos_nonpos (a b : ZFInt) (ha : 0 a) (hb : b 0) :
                    a * b 0
                    theorem ZFSet.ZFInt.mul_nonpos_nonpos_nonneg (a b : ZFInt) (ha : a 0) (hb : b 0) :
                    0 a * b
                    theorem ZFSet.ZFInt.mul_le_mul_left {n m : ZFInt} (k : ZFInt) (h : n m) (h' : 0 k) :
                    k * n k * m
                    theorem ZFSet.ZFInt.mul_lt_mul_of_pos_left {n m k : ZFInt} (h : n < m) (hk : k > 0) :
                    k * n < k * m
                    theorem ZFSet.ZFInt.pos_of_mul_pos {a b : ZFInt} (h : 0 < a * b) (ha : 0 < a) :
                    0 < b
                    theorem ZFSet.ZFInt.mul_lt_mul_of_pos_right {n m k : ZFInt} (h : n < m) (hk : k > 0) :
                    n * k < m * k
                    theorem ZFSet.ZFInt.mul_pos_iff {a b : ZFInt} :
                    0 < a * b 0 < a 0 < b a < 0 b < 0
                    theorem ZFSet.ZFInt.eq_le_iff {a b : ZFInt} :
                    a = b a b b a
                    theorem ZFSet.ZFInt.mul_eq_zero_iff {a b : ZFInt} :
                    a * b = 0 a = 0 b = 0
                    theorem ZFSet.ZFInt.mul_eq_zero_of_ne_zero {a b : ZFInt} :
                    a * b = 0a 0b = 0
                    theorem ZFSet.ZFInt.mul_left_cancel_iff {a b n : ZFInt} (h : n 0) :
                    n * a = n * b a = b
                    theorem ZFSet.ZFInt.mul_right_cancel_iff {a b n : ZFInt} (h : n 0) :
                    a * n = b * n a = b
                    @[implicit_reducible]
                    noncomputable instance ZFSet.ZFInt.instCommRing_1 :
                    Equations
                    • One or more equations did not get rendered due to their size.
                    @[implicit_reducible]
                    Equations
                    • One or more equations did not get rendered due to their size.
                    @[reducible, inline]
                    noncomputable abbrev ZFSet.Int :

                    The ZF set of integer representatives.

                    Equations
                    Instances For

                      Embeds a ZF natural number as a ZF integer.

                      Equations
                      Instances For
                        noncomputable def ZFSet.ofInt :

                        Encodes a Lean integer as a ZF set.

                        Equations
                        Instances For
                          noncomputable def ZFSet.toZFInt :

                          Imported ZFLean declaration.

                          Equations
                          Instances For

                            A pre-set encoding of Lean integers.

                            Equations
                            Instances For

                              Imported ZFLean declaration.

                              Equations
                              Instances For

                                First projection from the Kuratowski ordered pair encoding.

                                Equations
                                Instances For
                                  noncomputable def ZFSet.π₂ (x : ZFSet.{u_1}) :

                                  Imported ZFLean declaration.

                                  Equations
                                  Instances For
                                    @[simp]
                                    theorem ZFSet.π₁_pair (x y : ZFSet.{u_1}) :
                                    (x.pair y).π₁ = x
                                    @[simp]
                                    theorem ZFSet.pair_inter {x y : ZFSet.{u_1}} :
                                    {x} {x, y} = {x}
                                    @[simp]
                                    theorem ZFSet.pair_union {x y : ZFSet.{u_1}} :
                                    {x} {x, y} = {x, y}
                                    @[simp]
                                    theorem ZFSet.pair_minus {x y : ZFSet.{u_1}} :
                                    x y{x, y} \ {x} = {y}
                                    @[simp]
                                    theorem ZFSet.π₂_pair (x y : ZFSet.{u_1}) :
                                    (x.pair y).π₂ = y
                                    theorem ZFSet.pair_eta {z A B : ZFSet.{u_1}} (h : z A.prod B) :
                                    theorem ZFSet.mem_Int_proj {x : ZFSet.{u_1}} (h : x Int) :
                                    nNat, x.π₁ = x.π₂ = n x.π₁ = n x.π₂ =
                                    theorem ZFSet.ZFNat.mem_Nat_sub {n m : ZFNat} :
                                    ↑(n - m) Nat

                                    Well-definedness of ZFInt with respect to ZFSet.Int #

                                    noncomputable def ZFSet.ZFInt.into (x : ZFInt) :
                                    Int

                                    This function maps ZFInt to Int by taking the first projection of the pair.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      theorem ZFSet.ZFInt.into_inj (x y : ZFInt) :
                                      x.into = y.intox = y

                                      Embedding from ZF integers into the ZF integer set.

                                      Equations
                                      Instances For

                                        Imported ZFLean declaration.

                                        Equations
                                        Instances For
                                          @[implicit_reducible]

                                          Imported ZFLean declaration.

                                          Equations
                                          theorem ZFSet.ZFInt.exists_mono_bij :
                                          Nonempty { f : ZFIntInt // Function.Bijective f ∀ (x y : ZFInt), f x < f y x < y }

                                          The Schröder-Bernstein theorem provides a bijection between ZFInt and {x // x ∈ Int}, but we need an isomorphism in order to preserve the order structure, so that the order on ZFInt and {x // x ∈ Int} is the same.

                                          theorem ZFSet.ZFInt.exists_mono_bij_zero_eq :
                                          Nonempty { f : ZFIntInt // Function.Bijective f (∀ (x y : ZFInt), f x < f y x < y) f 0 = ofInt 0, }
                                          @[reducible]
                                          noncomputable def ZFSet.instEquivZFIntInt :

                                          The type ZFInt correctly represents the set ZFSet.Int. NOTE: There is a constructive proof of the Schröder-Bernstein theorem stating the equi-computability of sets. It is called the Myhill isomorphism and applies to countable sets only.

                                          Equations
                                          Instances For
                                            @[implicit_reducible]
                                            noncomputable instance ZFSet.instCoeSubtypeMemIntZFInt :
                                            Equations
                                            @[implicit_reducible]
                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            @[implicit_reducible]
                                            Equations
                                            • One or more equations did not get rendered due to their size.