The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V02. Numbers

Mathlib.Data.Num.Lemmas

153 declarations. Mathlib docs · Source

Properties of the binary representation of integers

theorem PosNum.testBit.match_1.congr_eq_4 E1 #

∀ (motive : PosNum → ℕ → Sort u_1) (x : PosNum) (x_1 : ℕ) (h_1 : Unit → motive PosNum.one 0)
  (h_2 : (x : ℕ) → motive PosNum.one x) (h_3 : (a : PosNum) → motive a.bit0 0)
  (h_4 : (p : PosNum) → (n : ℕ) → motive p.bit0 n.succ) (h_5 : (a : PosNum) → motive a.bit1 0)
  (h_6 : (p : PosNum) → (n : ℕ) → motive p.bit1 n.succ) (p : PosNum) (n : ℕ),
  x = p.bit0 →
    x_1 = n.succ →
      (match x, x_1 with
        | PosNum.one, 0 => h_1 ()
        | PosNum.one, x => h_2 x
        | a.bit0, 0 => h_3 a
        | p.bit0, n.succ => h_4 p n
        | a.bit1, 0 => h_5 a
        | p.bit1, n.succ => h_6 p n) ≍
        h_4 p n

theorem PosNum.pred'.match_1.congr_eq_2 E1 #

∀ (motive : PosNum → Sort u_1) (x : PosNum) (h_1 : Unit → motive PosNum.one) (h_2 : (n : PosNum) → motive n.bit0)
  (h_3 : (n : PosNum) → motive n.bit1) (n : PosNum),
  x = n.bit0 →
    (match x with
      | PosNum.one => h_1 ()
      | n.bit0 => h_2 n
      | n.bit1 => h_3 n) ≍
      h_2 n

theorem PosNum.cmp.match_1.congr_eq_3 E1 #

∀ (motive : PosNum → PosNum → Sort u_1) (x x_1 : PosNum) (h_1 : Unit → motive PosNum.one PosNum.one)
  (h_2 : (x : PosNum) → motive x PosNum.one) (h_3 : (x : PosNum) → motive PosNum.one x)
  (h_4 : (a b : PosNum) → motive a.bit0 b.bit0) (h_5 : (a b : PosNum) → motive a.bit0 b.bit1)
  (h_6 : (a b : PosNum) → motive a.bit1 b.bit0) (h_7 : (a b : PosNum) → motive a.bit1 b.bit1) (x_2 : PosNum),
  x = PosNum.one →
    x_1 = x_2 →
      (x_2 = PosNum.one → False) →
        (match x, x_1 with
          | PosNum.one, PosNum.one => h_1 ()
          | x, PosNum.one => h_2 x
          | PosNum.one, x => h_3 x
          | a.bit0, b.bit0 => h_4 a b
          | a.bit0, b.bit1 => h_5 a b
          | a.bit1, b.bit0 => h_6 a b
          | a.bit1, b.bit1 => h_7 a b) ≍
          h_3 x_2

theorem PosNum.cmp.match_1.congr_eq_2 E1 #

∀ (motive : PosNum → PosNum → Sort u_1) (x x_1 : PosNum) (h_1 : Unit → motive PosNum.one PosNum.one)
  (h_2 : (x : PosNum) → motive x PosNum.one) (h_3 : (x : PosNum) → motive PosNum.one x)
  (h_4 : (a b : PosNum) → motive a.bit0 b.bit0) (h_5 : (a b : PosNum) → motive a.bit0 b.bit1)
  (h_6 : (a b : PosNum) → motive a.bit1 b.bit0) (h_7 : (a b : PosNum) → motive a.bit1 b.bit1) (x_2 : PosNum),
  x = x_2 →
    x_1 = PosNum.one →
      (x_2 = PosNum.one → False) →
        (match x, x_1 with
          | PosNum.one, PosNum.one => h_1 ()
          | x, PosNum.one => h_2 x
          | PosNum.one, x => h_3 x
          | a.bit0, b.bit0 => h_4 a b
          | a.bit0, b.bit1 => h_5 a b
          | a.bit1, b.bit0 => h_6 a b
          | a.bit1, b.bit1 => h_7 a b) ≍
          h_2 x_2

theorem PosNum.pred'.match_1.congr_eq_1 E1 #

∀ (motive : PosNum → Sort u_1) (x : PosNum) (h_1 : Unit → motive PosNum.one) (h_2 : (n : PosNum) → motive n.bit0)
  (h_3 : (n : PosNum) → motive n.bit1),
  x = PosNum.one →
    (match x with
      | PosNum.one => h_1 ()
      | n.bit0 => h_2 n
      | n.bit1 => h_3 n) ≍
      h_1 ()

theorem PosNum.testBit.match_1.congr_eq_2 E1 #

∀ (motive : PosNum → ℕ → Sort u_1) (x : PosNum) (x_1 : ℕ) (h_1 : Unit → motive PosNum.one 0)
  (h_2 : (x : ℕ) → motive PosNum.one x) (h_3 : (a : PosNum) → motive a.bit0 0)
  (h_4 : (p : PosNum) → (n : ℕ) → motive p.bit0 n.succ) (h_5 : (a : PosNum) → motive a.bit1 0)
  (h_6 : (p : PosNum) → (n : ℕ) → motive p.bit1 n.succ) (x_2 : ℕ),
  x = PosNum.one →
    x_1 = x_2 →
      (x_2 = 0 → False) →
        (match x, x_1 with
          | PosNum.one, 0 => h_1 ()
          | PosNum.one, x => h_2 x
          | a.bit0, 0 => h_3 a
          | p.bit0, n.succ => h_4 p n
          | a.bit1, 0 => h_5 a
          | p.bit1, n.succ => h_6 p n) ≍
          h_2 x_2

theorem PosNum.testBit.match_1.congr_eq_6 E1 #

∀ (motive : PosNum → ℕ → Sort u_1) (x : PosNum) (x_1 : ℕ) (h_1 : Unit → motive PosNum.one 0)
  (h_2 : (x : ℕ) → motive PosNum.one x) (h_3 : (a : PosNum) → motive a.bit0 0)
  (h_4 : (p : PosNum) → (n : ℕ) → motive p.bit0 n.succ) (h_5 : (a : PosNum) → motive a.bit1 0)
  (h_6 : (p : PosNum) → (n : ℕ) → motive p.bit1 n.succ) (p : PosNum) (n : ℕ),
  x = p.bit1 →
    x_1 = n.succ →
      (match x, x_1 with
        | PosNum.one, 0 => h_1 ()
        | PosNum.one, x => h_2 x
        | a.bit0, 0 => h_3 a
        | p.bit0, n.succ => h_4 p n
        | a.bit1, 0 => h_5 a
        | p.bit1, n.succ => h_6 p n) ≍
        h_6 p n

theorem castNum.match_1.congr_eq_2 E1 #

∀ (motive : Num → Sort u_1) (x : Num) (h_1 : Unit → motive Num.zero) (h_2 : (p : PosNum) → motive (Num.pos p))
  (p : PosNum),
  x = Num.pos p →
    (match x with
      | Num.zero => h_1 ()
      | Num.pos p => h_2 p) ≍
      h_2 p

theorem castNum.match_1.congr_eq_1 E1 #

∀ (motive : Num → Sort u_1) (x : Num) (h_1 : Unit → motive Num.zero) (h_2 : (p : PosNum) → motive (Num.pos p)),
  x = Num.zero →
    (match x with
      | Num.zero => h_1 ()
      | Num.pos p => h_2 p) ≍
      h_1 ()

theorem PosNum.testBit.match_1.congr_eq_1 E1 #

∀ (motive : PosNum → ℕ → Sort u_1) (x : PosNum) (x_1 : ℕ) (h_1 : Unit → motive PosNum.one 0)
  (h_2 : (x : ℕ) → motive PosNum.one x) (h_3 : (a : PosNum) → motive a.bit0 0)
  (h_4 : (p : PosNum) → (n : ℕ) → motive p.bit0 n.succ) (h_5 : (a : PosNum) → motive a.bit1 0)
  (h_6 : (p : PosNum) → (n : ℕ) → motive p.bit1 n.succ),
  x = PosNum.one →
    x_1 = 0 →
      (match x, x_1 with
        | PosNum.one, 0 => h_1 ()
        | PosNum.one, x => h_2 x
        | a.bit0, 0 => h_3 a
        | p.bit0, n.succ => h_4 p n
        | a.bit1, 0 => h_5 a
        | p.bit1, n.succ => h_6 p n) ≍
        h_1 ()

theorem PosNum.pred'.match_1.congr_eq_3 E1 #

∀ (motive : PosNum → Sort u_1) (x : PosNum) (h_1 : Unit → motive PosNum.one) (h_2 : (n : PosNum) → motive n.bit0)
  (h_3 : (n : PosNum) → motive n.bit1) (n : PosNum),
  x = n.bit1 →
    (match x with
      | PosNum.one => h_1 ()
      | n.bit0 => h_2 n
      | n.bit1 => h_3 n) ≍
      h_3 n

theorem PosNum.testBit.match_1.congr_eq_3 E1 #

∀ (motive : PosNum → ℕ → Sort u_1) (x : PosNum) (x_1 : ℕ) (h_1 : Unit → motive PosNum.one 0)
  (h_2 : (x : ℕ) → motive PosNum.one x) (h_3 : (a : PosNum) → motive a.bit0 0)
  (h_4 : (p : PosNum) → (n : ℕ) → motive p.bit0 n.succ) (h_5 : (a : PosNum) → motive a.bit1 0)
  (h_6 : (p : PosNum) → (n : ℕ) → motive p.bit1 n.succ) (a : PosNum),
  x = a.bit0 →
    x_1 = 0 →
      (match x, x_1 with
        | PosNum.one, 0 => h_1 ()
        | PosNum.one, x => h_2 x
        | a.bit0, 0 => h_3 a
        | p.bit0, n.succ => h_4 p n
        | a.bit1, 0 => h_5 a
        | p.bit1, n.succ => h_6 p n) ≍
        h_3 a

theorem PosNum.testBit.match_1.congr_eq_5 E1 #

∀ (motive : PosNum → ℕ → Sort u_1) (x : PosNum) (x_1 : ℕ) (h_1 : Unit → motive PosNum.one 0)
  (h_2 : (x : ℕ) → motive PosNum.one x) (h_3 : (a : PosNum) → motive a.bit0 0)
  (h_4 : (p : PosNum) → (n : ℕ) → motive p.bit0 n.succ) (h_5 : (a : PosNum) → motive a.bit1 0)
  (h_6 : (p : PosNum) → (n : ℕ) → motive p.bit1 n.succ) (a : PosNum),
  x = a.bit1 →
    x_1 = 0 →
      (match x, x_1 with
        | PosNum.one, 0 => h_1 ()
        | PosNum.one, x => h_2 x
        | a.bit0, 0 => h_3 a
        | p.bit0, n.succ => h_4 p n
        | a.bit1, 0 => h_5 a
        | p.bit1, n.succ => h_6 p n) ≍
        h_5 a

theorem PosNum.succ.match_1.congr_eq_3 E1 #

∀ (motive : PosNum → Sort u_1) (x : PosNum) (h_1 : Unit → motive PosNum.one) (h_2 : (n : PosNum) → motive n.bit1)
  (h_3 : (n : PosNum) → motive n.bit0) (n : PosNum),
  x = n.bit0 →
    (match x with
      | PosNum.one => h_1 ()
      | n.bit1 => h_2 n
      | n.bit0 => h_3 n) ≍
      h_3 n

theorem PosNum.succ.match_1.congr_eq_2 E1 #

∀ (motive : PosNum → Sort u_1) (x : PosNum) (h_1 : Unit → motive PosNum.one) (h_2 : (n : PosNum) → motive n.bit1)
  (h_3 : (n : PosNum) → motive n.bit0) (n : PosNum),
  x = n.bit1 →
    (match x with
      | PosNum.one => h_1 ()
      | n.bit1 => h_2 n
      | n.bit0 => h_3 n) ≍
      h_2 n

theorem PosNum.succ.match_1.congr_eq_1 E1 #

∀ (motive : PosNum → Sort u_1) (x : PosNum) (h_1 : Unit → motive PosNum.one) (h_2 : (n : PosNum) → motive n.bit1)
  (h_3 : (n : PosNum) → motive n.bit0),
  x = PosNum.one →
    (match x with
      | PosNum.one => h_1 ()
      | n.bit1 => h_2 n
      | n.bit0 => h_3 n) ≍
      h_1 ()

theorem PosNum.cast_one E0 #

∀ {α : Type u_1} [inst : One α] [inst_1 : Add α], ↑1 = 1

theorem PosNum.cast_one' E0 #

∀ {α : Type u_1} [inst : One α] [inst_1 : Add α], ↑PosNum.one = 1

theorem PosNum.cast_bit0 E0 #

∀ {α : Type u_1} [inst : One α] [inst_1 : Add α] (n : PosNum), ↑n.bit0 = ↑n + ↑n

theorem PosNum.cast_bit1 E0 #

∀ {α : Type u_1} [inst : One α] [inst_1 : Add α] (n : PosNum), ↑n.bit1 = ↑n + ↑n + 1

theorem PosNum.cast_to_nat E0 #

∀ {α : Type u_1} [inst : AddMonoidWithOne α] (n : PosNum), ↑↑n = ↑n

theorem PosNum.to_nat_to_int E1 #

∀ (n : PosNum), ↑↑n = ↑n

theorem PosNum.cast_to_int E0 #

∀ {α : Type u_1} [inst : AddGroupWithOne α] (n : PosNum), ↑↑n = ↑n

theorem PosNum.succ_to_nat E1 #

∀ (n : PosNum), ↑n.succ = ↑n + 1

theorem PosNum.one_add E1 #

∀ (n : PosNum), 1 + n = n.succ

theorem PosNum.add_one E1 #

∀ (n : PosNum), n + 1 = n.succ

theorem PosNum.add_to_nat E1 #

∀ (m n : PosNum), ↑(m + n) = ↑m + ↑n

theorem PosNum.add_succ E1 #

∀ (m n : PosNum), m + n.succ = (m + n).succ

theorem PosNum.bit0_of_bit0 E1 #

∀ (n : PosNum), n + n = n.bit0

theorem PosNum.bit1_of_bit1 E1 #

∀ (n : PosNum), n + n + 1 = n.bit1

theorem PosNum.mul_to_nat E1 #

∀ (m n : PosNum), ↑(m * n) = ↑m * ↑n

theorem PosNum.to_nat_pos E1 #

∀ (n : PosNum), 0 < ↑n

theorem PosNum.cmp_to_nat_lemma E1 #

∀ {m n : PosNum}, ↑m < ↑n → ↑m.bit1 < ↑n.bit0

theorem PosNum.cmp_swap E1 #

∀ (m n : PosNum), (m.cmp n).swap = n.cmp m

theorem PosNum.cmp_to_nat E1 #

∀ (m n : PosNum), Ordering.casesOn (m.cmp n) (↑m < ↑n) (m = n) (↑n < ↑m)

theorem PosNum.lt_to_nat E1 #

∀ {m n : PosNum}, ↑m < ↑n ↔ m < n

theorem PosNum.le_to_nat E1 #

∀ {m n : PosNum}, ↑m ≤ ↑n ↔ m ≤ n

theorem Num.add_zero E1 #

∀ (n : Num), n + 0 = n

theorem Num.zero_add E1 #

∀ (n : Num), 0 + n = n

theorem Num.add_one E1 #

∀ (n : Num), n + 1 = n.succ

theorem Num.add_succ E1 #

∀ (m n : Num), m + n.succ = (m + n).succ

theorem Num.bit0_of_bit0 E1 #

∀ (n : Num), n + n = n.bit0

theorem Num.bit1_of_bit1 E1 #

∀ (n : Num), n + n + 1 = n.bit1

theorem Num.ofNat'_zero E0 #

Num.ofNat' 0 = 0

theorem Num.ofNat'_bit E1 #

∀ (b : Bool) (n : ℕ), Num.ofNat' (Nat.bit b n) = (bif b then Num.bit1 else Num.bit0) (Num.ofNat' n)

theorem Num.ofNat'_one E0 #

Num.ofNat' 1 = 1

theorem Num.bit1_succ E1 #

∀ (n : Num), n.bit1.succ = n.succ.bit0

theorem Num.ofNat'_succ E1 #

∀ {n : ℕ}, Num.ofNat' (n + 1) = Num.ofNat' n + 1

theorem Num.add_ofNat' E0 #

∀ (m n : ℕ), Num.ofNat' (m + n) = Num.ofNat' m + Num.ofNat' n

theorem Num.cast_zero E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : One α] [inst_2 : Add α], ↑0 = 0

theorem Num.cast_zero' E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : One α] [inst_2 : Add α], ↑Num.zero = 0

theorem Num.cast_one E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : One α] [inst_2 : Add α], ↑1 = 1

theorem Num.cast_pos E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : One α] [inst_2 : Add α] (n : PosNum), ↑(Num.pos n) = ↑n

theorem Num.succ'_to_nat E1 #

∀ (n : Num), ↑n.succ' = ↑n + 1

theorem Num.succ_to_nat E1 #

∀ (n : Num), ↑n.succ = ↑n + 1

theorem Num.cast_to_nat E0 #

∀ {α : Type u_1} [inst : AddMonoidWithOne α] (n : Num), ↑↑n = ↑n

theorem Num.add_to_nat E1 #

∀ (m n : Num), ↑(m + n) = ↑m + ↑n

theorem Num.mul_to_nat E1 #

∀ (m n : Num), ↑(m * n) = ↑m * ↑n

theorem Num.cmp_to_nat E1 #

∀ (m n : Num), Ordering.casesOn (m.cmp n) (↑m < ↑n) (m = n) (↑n < ↑m)

theorem Num.lt_to_nat E1 #

∀ {m n : Num}, ↑m < ↑n ↔ m < n

theorem Num.le_to_nat E1 #

∀ {m n : Num}, ↑m ≤ ↑n ↔ m ≤ n

theorem PosNum.of_to_nat' E0 #

∀ (n : PosNum), Num.ofNat' ↑n = Num.pos n

theorem Num.of_to_nat' E0 #

∀ (n : Num), Num.ofNat' ↑n = n

theorem Num.toNat_injective E1 #

Function.Injective castNum

theorem Num.to_nat_inj E1 #

∀ {m n : Num}, ↑m = ↑n ↔ m = n

def Num.transfer_rw E1 #

Lean.ParserDescr

This tactic tries to turn an (in)equality about Nums to one about Nats by rewriting.

example (n : Num) (m : Num) : n ≤ n + m := by
  transfer_rw
  exact Nat.le_add_right _ _

def Num.transfer E1 #

Lean.ParserDescr

This tactic tries to prove (in)equalities about Nums by transferring them to the Nat world and then trying to call grind.

example (n : Num) (m : Num) : n ≤ n + m := by transfer

instance Num.addMonoid E0 #

AddMonoid Num

instance Num.addMonoidWithOne E0 #

AddMonoidWithOne Num

instance Num.commSemiring E0 #

CommSemiring Num

instance Num.partialOrder E0 #

PartialOrder Num

instance Num.isOrderedCancelAddMonoid E0 #

IsOrderedCancelAddMonoid Num

instance Num.linearOrder E0 #

LinearOrder Num

instance Num.isStrictOrderedRing E0 #

IsStrictOrderedRing Num

theorem Num.add_of_nat E1 #

∀ (m n : ℕ), ↑(m + n) = ↑m + ↑n

theorem Num.to_nat_to_int E1 #

∀ (n : Num), ↑↑n = ↑n

theorem Num.cast_to_int E0 #

∀ {α : Type u_1} [inst : AddGroupWithOne α] (n : Num), ↑↑n = ↑n

theorem Num.to_of_nat E1 #

∀ (n : ℕ), ↑↑n = n

theorem Num.of_natCast E0 #

∀ {α : Type u_1} [inst : AddMonoidWithOne α] (n : ℕ), ↑↑n = ↑n

theorem Num.of_nat_inj E1 #

∀ {m n : ℕ}, ↑m = ↑n ↔ m = n

theorem Num.of_to_nat E0 #

∀ (n : Num), ↑↑n = n

theorem Num.dvd_to_nat E1 #

∀ (m n : Num), ↑m ∣ ↑n ↔ m ∣ n

theorem PosNum.of_to_nat E0 #

∀ (n : PosNum), ↑↑n = Num.pos n

theorem PosNum.to_nat_inj E1 #

∀ {m n : PosNum}, ↑m = ↑n ↔ m = n

theorem PosNum.pred'_to_nat E1 #

∀ (n : PosNum), ↑n.pred' = (↑n).pred

theorem PosNum.pred'_succ' E0 #

∀ (n : Num), n.succ'.pred' = n

theorem PosNum.succ'_pred' E0 #

∀ (n : PosNum), n.pred'.succ' = n

instance PosNum.dvd E0 #

Dvd PosNum

theorem PosNum.dvd_to_nat E1 #

∀ {m n : PosNum}, ↑m ∣ ↑n ↔ m ∣ n

theorem PosNum.size_to_nat E1 #

∀ (n : PosNum), ↑n.size = (↑n).size

theorem PosNum.size_eq_natSize E1 #

∀ (n : PosNum), ↑n.size = n.natSize

theorem PosNum.natSize_to_nat E1 #

∀ (n : PosNum), n.natSize = (↑n).size

theorem PosNum.natSize_pos E1 #

∀ (n : PosNum), 0 < n.natSize

def PosNum.transfer_rw E1 #

Lean.ParserDescr

This tactic tries to turn an (in)equality about PosNums to one about Nats by rewriting.

example (n : PosNum) (m : PosNum) : n ≤ n + m := by
  transfer_rw
  exact Nat.le_add_right _ _

def PosNum.transfer E1 #

Lean.ParserDescr

This tactic tries to prove (in)equalities about PosNums by transferring them to the Nat world and then trying to call grind.

example (n : PosNum) (m : PosNum) : n ≤ n + m := by transfer

instance PosNum.addCommSemigroup E0 #

AddCommSemigroup PosNum

instance PosNum.commMonoid E0 #

CommMonoid PosNum

instance PosNum.distrib E0 #

Distrib PosNum

instance PosNum.linearOrder E0 #

LinearOrder PosNum

theorem PosNum.cast_to_num E0 #

∀ (n : PosNum), ↑n = Num.pos n

theorem PosNum.bit_to_nat E0 #

∀ (b : Bool) (n : PosNum), ↑(PosNum.bit b n) = Nat.bit b ↑n

theorem PosNum.cast_add E0 #

∀ {α : Type u_1} [inst : AddMonoidWithOne α] (m n : PosNum), ↑(m + n) = ↑m + ↑n

theorem PosNum.cast_succ E0 #

∀ {α : Type u_1} [inst : AddMonoidWithOne α] (n : PosNum), ↑n.succ = ↑n + 1

theorem PosNum.cast_inj E0 #

∀ {α : Type u_1} [inst : AddMonoidWithOne α] [CharZero α] {m n : PosNum}, ↑m = ↑n ↔ m = n

theorem PosNum.one_le_cast E0 #

∀ {α : Type u_1} [inst : Semiring α] [inst_1 : PartialOrder α] [IsStrictOrderedRing α] (n : PosNum), 1 ≤ ↑n

theorem PosNum.cast_pos E0 #

∀ {α : Type u_1} [inst : Semiring α] [inst_1 : PartialOrder α] [IsStrictOrderedRing α] (n : PosNum), 0 < ↑n

theorem PosNum.cast_mul E0 #

∀ {α : Type u_1} [inst : NonAssocSemiring α] (m n : PosNum), ↑(m * n) = ↑m * ↑n

theorem PosNum.cmp_eq E0 #

∀ (m n : PosNum), m.cmp n = Ordering.eq ↔ m = n

theorem PosNum.cast_lt E0 #

∀ {α : Type u_1} [inst : Semiring α] [inst_1 : PartialOrder α] [IsStrictOrderedRing α] {m n : PosNum}, ↑m < ↑n ↔ m < n

theorem PosNum.cast_le E0 #

∀ {α : Type u_1} [inst : Semiring α] [inst_1 : LinearOrder α] [IsStrictOrderedRing α] {m n : PosNum}, ↑m ≤ ↑n ↔ m ≤ n

theorem Num.bit_to_nat E1 #

∀ (b : Bool) (n : Num), ↑(Num.bit b n) = Nat.bit b ↑n

theorem Num.cast_succ' E1 #

∀ {α : Type u_1} [inst : AddMonoidWithOne α] (n : Num), ↑n.succ' = ↑n + 1

theorem Num.cast_succ E1 #

∀ {α : Type u_1} [inst : AddMonoidWithOne α] (n : Num), ↑n.succ = ↑n + 1

theorem Num.cast_add E0 #

∀ {α : Type u_1} [inst : AddMonoidWithOne α] (m n : Num), ↑(m + n) = ↑m + ↑n

theorem Num.cast_bit0 E0 #

∀ {α : Type u_1} [inst : NonAssocSemiring α] (n : Num), ↑n.bit0 = 2 * ↑n

theorem Num.cast_bit1 E0 #

∀ {α : Type u_1} [inst : NonAssocSemiring α] (n : Num), ↑n.bit1 = 2 * ↑n + 1

theorem Num.cast_mul E0 #

∀ {α : Type u_1} [inst : NonAssocSemiring α] (m n : Num), ↑(m * n) = ↑m * ↑n

theorem Num.size_to_nat E1 #

∀ (n : Num), ↑n.size = (↑n).size

theorem Num.size_eq_natSize E1 #

∀ (n : Num), ↑n.size = n.natSize

theorem Num.natSize_to_nat E1 #

∀ (n : Num), n.natSize = (↑n).size

theorem Num.ofNat'_eq E0 #

∀ (n : ℕ), Num.ofNat' n = ↑n

theorem Num.zneg_toZNum E1 #

∀ (n : Num), -n.toZNum = n.toZNumNeg

theorem Num.zneg_toZNumNeg E1 #

∀ (n : Num), -n.toZNumNeg = n.toZNum

theorem Num.toZNum_inj E1 #

∀ {m n : Num}, m.toZNum = n.toZNum ↔ m = n

theorem Num.cast_toZNum E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : One α] [inst_2 : Add α] [inst_3 : Neg α] (n : Num), ↑n.toZNum = ↑n

theorem Num.cast_toZNumNeg E0 #

∀ {α : Type u_1} [inst : SubtractionMonoid α] [inst_1 : One α] (n : Num), ↑n.toZNumNeg = -↑n

theorem Num.add_toZNum E0 #

∀ (m n : Num), (m + n).toZNum = m.toZNum + n.toZNum

theorem PosNum.pred_to_nat E1 #

∀ {n : PosNum}, 1 < n → ↑n.pred = (↑n).pred

theorem PosNum.sub'_one E1 #

∀ (a : PosNum), a.sub' 1 = a.pred'.toZNum

theorem PosNum.one_sub' E1 #

∀ (a : PosNum), PosNum.sub' 1 a = a.pred'.toZNumNeg

theorem PosNum.lt_iff_cmp E1 #

∀ {m n : PosNum}, m < n ↔ m.cmp n = Ordering.lt

theorem PosNum.le_iff_cmp E1 #

∀ {m n : PosNum}, m ≤ n ↔ m.cmp n ≠ Ordering.gt

theorem Num.pred_to_nat E1 #

∀ (n : Num), ↑n.pred = (↑n).pred

theorem Num.ppred_to_nat E1 #

∀ (n : Num), castNum <$> n.ppred = (↑n).ppred

theorem Num.cmp_swap E1 #

∀ (m n : Num), (m.cmp n).swap = n.cmp m

theorem Num.cmp_eq E0 #

∀ (m n : Num), m.cmp n = Ordering.eq ↔ m = n

theorem Num.cast_lt E0 #

∀ {α : Type u_1} [inst : Semiring α] [inst_1 : PartialOrder α] [IsStrictOrderedRing α] {m n : Num}, ↑m < ↑n ↔ m < n

theorem Num.cast_le E0 #

∀ {α : Type u_1} [inst : Semiring α] [inst_1 : LinearOrder α] [IsStrictOrderedRing α] {m n : Num}, ↑m ≤ ↑n ↔ m ≤ n

theorem Num.cast_inj E0 #

∀ {α : Type u_1} [inst : Semiring α] [inst_1 : PartialOrder α] [IsStrictOrderedRing α] {m n : Num}, ↑m = ↑n ↔ m = n

theorem Num.lt_iff_cmp E1 #

∀ {m n : Num}, m < n ↔ m.cmp n = Ordering.lt

theorem Num.le_iff_cmp E1 #

∀ {m n : Num}, m ≤ n ↔ m.cmp n ≠ Ordering.gt

theorem Num.castNum_eq_bitwise E1 #

∀ {f : Num → Num → Num} {g : Bool → Bool → Bool} (p : PosNum → PosNum → Num),
  g false false = false →
    f 0 0 = 0 →
      (∀ (n : PosNum), f 0 (Num.pos n) = bif g false true then Num.pos n else 0) →
        (∀ (n : PosNum), f (Num.pos n) 0 = bif g true false then Num.pos n else 0) →
          (∀ (m n : PosNum), f (Num.pos m) (Num.pos n) = p m n) →
            (p 1 1 = bif g true true then 1 else 0) →
              (∀ (b : Bool) (n : PosNum),
                  p 1 (PosNum.bit b n) = Num.bit (g true b) (bif g false true then Num.pos n else 0)) →
                (∀ (a : Bool) (m : PosNum),
                    p (PosNum.bit a m) 1 = Num.bit (g a true) (bif g true false then Num.pos m else 0)) →
                  (∀ (a b : Bool) (m n : PosNum), p (PosNum.bit a m) (PosNum.bit b n) = Num.bit (g a b) (p m n)) →
                    ∀ (m n : Num), ↑(f m n) = Nat.bitwise g ↑m ↑n

theorem Num.castNum_or E0 #

∀ (m n : Num), ↑(m ||| n) = ↑m ||| ↑n

theorem Num.castNum_and E0 #

∀ (m n : Num), ↑(m &&& n) = ↑m &&& ↑n

theorem Num.castNum_ldiff E0 #

∀ (m n : Num), ↑(m.ldiff n) = (↑m).ldiff ↑n

theorem Num.castNum_xor E0 #

∀ (m n : Num), ↑(m ^^^ n) = ↑m ^^^ ↑n

theorem Num.castNum_shiftLeft E0 #

∀ (m : Num) (n : ℕ), ↑(m <<< n) = ↑m <<< n

theorem Num.castNum_shiftRight E0 #

∀ (m : Num) (n : ℕ), ↑(m >>> n) = ↑m >>> n

theorem Num.castNum_testBit E0 #

∀ (m : Num) (n : ℕ), m.testBit n = (↑m).testBit n

def Int.ofSnum E1 #

SNum → ℤ

Cast a SNum to the corresponding integer.

instance Int.snumCoe E0 #

Coe SNum ℤ

instance SNum.lt E0 #

LT SNum

instance SNum.le E0 #

LE SNum