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 y → ZFSet.zrel x y
        @[reducible, inline]

        Imported ZFLean declaration.

        Equations
        Instances For
          @[reducible, inline]

          Imported ZFLean declaration.

          Equations
          Instances For
            @[instance_reducible]
            Equations
            @[instance_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
              @[instance_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
                @[instance_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
                  @[instance_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 - c → a = b
                  theorem ZFSet.ZFInt.sub_right_cancel (a b c : ZFInt) :
                  c - a = c - b → a = b
                  theorem ZFSet.ZFInt.add_eq_sub_iff {a b c : ZFInt} :
                  a + b = c ↔ a = c - b
                  @[reducible, inline]
                  noncomputable abbrev ZFSet.ZFInt.nsmul :
                  ℕ → ZFInt → ZFInt

                  Repeated addition by a natural-number scalar.

                  Equations
                  Instances For
                    @[reducible, inline]
                    noncomputable abbrev ZFSet.ZFInt.zsmul (n : ℤ) (x : ZFInt) :

                    Integer scalar multiplication defined using repeated addition and negation.

                    Equations
                    Instances For
                      @[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
                        @[instance_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
                        @[instance_reducible]
                        noncomputable instance ZFSet.ZFInt.instCommRing :
                        Equations
                        • One or more equations did not get rendered due to their size.
                        @[instance_reducible]
                        Equations
                        • One or more equations did not get rendered due to their size.
                        @[instance_reducible]
                        Equations
                        theorem ZFSet.ZFInt.lt_succ {n : ZFInt} :
                        n < n + 1
                        theorem ZFSet.ZFInt.lt_trans {a b c : ZFInt} :
                        a < b → b < c → a < 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 ≤ b → b ≤ c → a ≤ c
                        theorem ZFSet.ZFInt.le_antisymm {a b : ZFInt} :
                        a ≤ b → b ≤ a → a = 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
                        @[instance_reducible]
                        Equations
                        • One or more equations did not get rendered due to their size.
                        @[instance_reducible]
                        Equations
                        • One or more equations did not get rendered due to their size.
                        @[instance_reducible]
                        Equations
                        • One or more equations did not get rendered due to their size.
                        theorem ZFSet.ZFInt.ind {P : ZFNat → ZFNat → Prop} (n : ZFNat) (m : ZFNat) (zero : P 0 0) (succ_l : ∀ (n : ZFNat) (m : ZFNat), P n m → P (n + 1) m) (succ_r : ∀ (n : ZFNat) (m : ZFNat), P n m → P n (m + 1)) :
                        P n m
                        theorem ZFSet.ZFInt.induction_pos {P : ZFInt → Prop} (n : ZFInt) (n_pos : 0 ≤ n) (zero : P 0) (succ : ∀ (k : ZFInt), P k → P (k + 1)) :
                        P n
                        theorem ZFSet.ZFInt.induction_neg {P : ZFInt → Prop} (n : ZFInt) (n_neg : n ≤ 0) (zero : P 0) (succ : ∀ (k : ZFInt), P k → P (k - 1)) :
                        P n
                        theorem ZFSet.ZFInt.induction {P : ZFInt → Prop} (n : ZFInt) (zero : P 0) (pos : ∀ (k : ZFInt), P k → P (k + 1)) (neg : ∀ (k : ZFInt), P k → P (k - 1)) :
                        P n
                        theorem ZFSet.ZFInt.sign_cases {P : ZFInt → Prop} (n : ZFInt) (zero : P 0) (neg : n < 0 → P n) (pos : 0 < n → P n) :
                        P n
                        theorem ZFSet.ZFInt.cases {P : ZFInt → Prop} (n : ZFInt) (pos : 0 ≤ n → P n) (neg : n < 0 → P n) :
                        P n
                        theorem ZFSet.ZFInt.add_eq_add_sub_eq_sub {a b c d : ZFNat} :
                        a + b = c + d → a - c = d - b
                        theorem ZFSet.ZFInt.le_of_lt_succ (n m : ZFInt) :
                        n < m + 1 → n ≤ m
                        theorem ZFSet.ZFInt.lt_succ_of_le (n m : ZFInt) :
                        n ≤ m → n < 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 = 0 → a ≠ 0 → b = 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
                        @[instance_reducible]
                        noncomputable instance ZFSet.ZFInt.instCommRing_1 :
                        Equations
                        • One or more equations did not get rendered due to their size.
                        @[instance_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

                                The pre-set representative of an integer in the set-theoretic encoding.

                                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) :
                                          ∃ n ∈ Nat, x.π₁ = ∅ ∧ x.π₂ = n ∨ x.π₁ = n ∧ x.π₂ = ∅
                                          noncomputable def ZFSet.ZFInt.outof :
                                          ↥Int → ZFInt

                                          Decode a member of the set-theoretic integers into its quotient representation.

                                          Equations
                                          Instances For
                                            theorem ZFSet.ZFInt.outof_inj (x y : ↥Int) :
                                            outof x = outof y → x = y
                                            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.into → x = y

                                              Embedding from ZF integers into the ZF integer set.

                                              Equations
                                              Instances For

                                                Imported ZFLean declaration.

                                                Equations
                                                Instances For
                                                  @[instance_reducible]

                                                  Imported ZFLean declaration.

                                                  Equations
                                                  theorem ZFSet.ZFInt.exists_mono_bij :
                                                  Nonempty { f : ZFInt → ↥Int // 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 : ZFInt → ↥Int // 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
                                                    @[instance_reducible]
                                                    noncomputable instance ZFSet.instCoeSubtypeMemIntZFInt :
                                                    Equations
                                                    @[instance_reducible]
                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    @[instance_reducible]
                                                    Equations
                                                    • One or more equations did not get rendered due to their size.