data.num.lemmas
⟷
Mathlib.Data.Num.Lemmas
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -600,11 +600,11 @@ theorem to_of_nat : ∀ n : ℕ, ((n : Num) : ℕ) = n
#align num.to_of_nat Num.to_of_nat
-/
-#print Num.of_nat_cast /-
+#print Num.of_natCast /-
@[simp, norm_cast]
-theorem of_nat_cast {α} [AddMonoidWithOne α] (n : ℕ) : ((n : Num) : α) = n := by
+theorem of_natCast {α} [AddMonoidWithOne α] (n : ℕ) : ((n : Num) : α) = n := by
rw [← cast_to_nat, to_of_nat]
-#align num.of_nat_cast Num.of_nat_cast
+#align num.of_nat_cast Num.of_natCast
-/
#print Num.of_nat_inj /-
@@ -1927,18 +1927,18 @@ theorem of_nat_toZNumNeg (n : ℕ) : Num.toZNumNeg n = -n := by rw [← of_nat_t
#align znum.of_nat_to_znum_neg ZNum.of_nat_toZNumNeg
-/
-#print ZNum.of_int_cast /-
+#print ZNum.of_intCast /-
@[simp, norm_cast]
-theorem of_int_cast [AddGroupWithOne α] (n : ℤ) : ((n : ZNum) : α) = n := by
+theorem of_intCast [AddGroupWithOne α] (n : ℤ) : ((n : ZNum) : α) = n := by
rw [← cast_to_int, to_of_int]
-#align znum.of_int_cast ZNum.of_int_cast
+#align znum.of_int_cast ZNum.of_intCast
-/
-#print ZNum.of_nat_cast /-
+#print ZNum.of_natCast /-
@[simp, norm_cast]
-theorem of_nat_cast [AddGroupWithOne α] (n : ℕ) : ((n : ZNum) : α) = n := by
+theorem of_natCast [AddGroupWithOne α] (n : ℕ) : ((n : ZNum) : α) = n := by
rw [← Int.cast_natCast, of_int_cast, Int.cast_natCast]
-#align znum.of_nat_cast ZNum.of_nat_cast
+#align znum.of_nat_cast ZNum.of_natCast
-/
#print ZNum.dvd_to_int /-
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -72,7 +72,7 @@ theorem to_nat_to_int (n : PosNum) : ((n : ℕ) : ℤ) = n :=
#print PosNum.cast_to_int /-
@[simp, norm_cast]
theorem cast_to_int [AddGroupWithOne α] (n : PosNum) : ((n : ℤ) : α) = n := by
- rw [← to_nat_to_int, Int.cast_ofNat, cast_to_nat]
+ rw [← to_nat_to_int, Int.cast_natCast, cast_to_nat]
#align pos_num.cast_to_int PosNum.cast_to_int
-/
@@ -589,7 +589,7 @@ theorem to_nat_to_int (n : Num) : ((n : ℕ) : ℤ) = n :=
#print Num.cast_to_int /-
@[simp, norm_cast]
theorem cast_to_int {α} [AddGroupWithOne α] (n : Num) : ((n : ℤ) : α) = n := by
- rw [← to_nat_to_int, Int.cast_ofNat, cast_to_nat]
+ rw [← to_nat_to_int, Int.cast_natCast, cast_to_nat]
#align num.cast_to_int Num.cast_to_int
-/
@@ -1937,7 +1937,7 @@ theorem of_int_cast [AddGroupWithOne α] (n : ℤ) : ((n : ZNum) : α) = n := by
#print ZNum.of_nat_cast /-
@[simp, norm_cast]
theorem of_nat_cast [AddGroupWithOne α] (n : ℕ) : ((n : ZNum) : α) = n := by
- rw [← Int.cast_ofNat, of_int_cast, Int.cast_ofNat]
+ rw [← Int.cast_natCast, of_int_cast, Int.cast_natCast]
#align znum.of_nat_cast ZNum.of_nat_cast
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -5,8 +5,8 @@ Authors: Mario Carneiro
-/
import Data.Num.Bitwise
import Data.Int.CharZero
-import Data.Nat.Gcd.Basic
-import Data.Nat.Psub
+import Data.Nat.GCD.Basic
+import Data.Nat.PSub
import Data.Nat.Size
#align_import data.num.lemmas from "leanprover-community/mathlib"@"25a9423c6b2c8626e91c688bfd6c1d0a986a3e6e"
@@ -1962,7 +1962,7 @@ theorem divMod_to_nat_aux {n d : PosNum} {q r : Num} (h₁ : (r : ℕ) + d * bit
by
intro r₂
apply num.mem_of_znum'.trans
- rw [← ZNum.to_int_inj, Num.cast_toZNum, Num.cast_sub', sub_eq_iff_eq_add, ← Int.coe_nat_inj']
+ rw [← ZNum.to_int_inj, Num.cast_toZNum, Num.cast_sub', sub_eq_iff_eq_add, ← Int.natCast_inj]
simp
cases' e : Num.ofZNum' (Num.sub' r (Num.pos d)) with r₂ <;> simp [divmod_aux]
· refine' ⟨h₁, lt_of_not_ge fun h => _⟩
@@ -2070,7 +2070,7 @@ theorem gcd_to_nat_aux :
exact le_of_lt (Nat.mod_lt _ (PosNum.cast_pos _))
rw [nat_size_to_nat, mul_to_nat, Nat.size_le] at h ⊢
rw [mod_to_nat, mul_comm]
- rw [pow_succ', ← Nat.mod_add_div b (Pos a)] at h
+ rw [pow_succ, ← Nat.mod_add_div b (Pos a)] at h
refine' lt_of_mul_lt_mul_right (lt_of_le_of_lt _ h) (Nat.zero_le 2)
rw [mul_two, mul_add]
refine'
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -218,8 +218,8 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
theorem lt_to_nat {m n : PosNum} : (m : ℕ) < n ↔ m < n :=
show (m : ℕ) < n ↔ cmp m n = Ordering.lt from
match cmp m n, cmp_to_nat m n with
- | Ordering.lt, h => by simp at h <;> simp [h]
- | Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
+ | Ordering.lt, h => by simp at h <;> simp [h]
+ | Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
| Ordering.gt, h => by simp [not_lt_of_gt h] <;> exact by decide
#align pos_num.lt_to_nat PosNum.lt_to_nat
-/
@@ -409,8 +409,8 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
theorem lt_to_nat {m n : Num} : (m : ℕ) < n ↔ m < n :=
show (m : ℕ) < n ↔ cmp m n = Ordering.lt from
match cmp m n, cmp_to_nat m n with
- | Ordering.lt, h => by simp at h <;> simp [h]
- | Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
+ | Ordering.lt, h => by simp at h <;> simp [h]
+ | Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
| Ordering.gt, h => by simp [not_lt_of_gt h] <;> exact by decide
#align num.lt_to_nat Num.lt_to_nat
-/
@@ -860,7 +860,7 @@ theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n :=
by
have := cmp_to_nat m n
cases cmp m n <;> simp at this ⊢ <;> try exact this <;>
- · simp [show m ≠ n from fun e => by rw [e] at this <;> exact lt_irrefl _ this]
+ · simp [show m ≠ n from fun e => by rw [e] at this <;> exact lt_irrefl _ this]
#align pos_num.cmp_eq PosNum.cmp_eq
-/
@@ -1016,7 +1016,7 @@ theorem pred_to_nat {n : PosNum} (h : 1 < n) : (pred n : ℕ) = Nat.pred n :=
have := pred'_to_nat n
cases e : pred' n
· have : (1 : ℕ) ≤ Nat.pred n := Nat.pred_le_pred ((@cast_lt ℕ _ _ _).2 h)
- rw [← pred'_to_nat, e] at this
+ rw [← pred'_to_nat, e] at this
exact absurd this (by decide)
· rw [← pred'_to_nat, e]; rfl
#align pos_num.pred_to_nat PosNum.pred_to_nat
@@ -1080,7 +1080,7 @@ theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n :=
by
have := cmp_to_nat m n
cases cmp m n <;> simp at this ⊢ <;> try exact this <;>
- · simp [show m ≠ n from fun e => by rw [e] at this <;> exact lt_irrefl _ this]
+ · simp [show m ≠ n from fun e => by rw [e] at this <;> exact lt_irrefl _ this]
#align num.cmp_eq Num.cmp_eq
-/
@@ -1408,9 +1408,9 @@ theorem cast_bit1 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit1 : α) = bit1 n
| neg p => by
rw [ZNum.bit1, cast_neg, cast_neg]
cases' e : pred' p with a <;> have : p = _ := (succ'_pred' p).symm.trans (congr_arg Num.succ' e)
- · change p = 1 at this ; subst p
+ · change p = 1 at this; subst p
simp [_root_.bit1, _root_.bit0]
- · rw [Num.succ'] at this ; subst p
+ · rw [Num.succ'] at this; subst p
have : (↑(-↑a : ℤ) : α) = -1 + ↑(-↑a + 1 : ℤ) := by simp [add_comm]
simpa [_root_.bit1, _root_.bit0, -add_comm]
#align znum.cast_bit1 ZNum.cast_bit1
@@ -1708,8 +1708,8 @@ theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n
theorem lt_to_int {m n : ZNum} : (m : ℤ) < n ↔ m < n :=
show (m : ℤ) < n ↔ cmp m n = Ordering.lt from
match cmp m n, cmp_to_int m n with
- | Ordering.lt, h => by simp at h <;> simp [h]
- | Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
+ | Ordering.lt, h => by simp at h <;> simp [h]
+ | Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
| Ordering.gt, h => by simp [not_lt_of_gt h] <;> exact by decide
#align znum.lt_to_int ZNum.lt_to_int
-/
@@ -1967,12 +1967,12 @@ theorem divMod_to_nat_aux {n d : PosNum} {q r : Num} (h₁ : (r : ℕ) + d * bit
cases' e : Num.ofZNum' (Num.sub' r (Num.pos d)) with r₂ <;> simp [divmod_aux]
· refine' ⟨h₁, lt_of_not_ge fun h => _⟩
cases' Nat.le.dest h with r₂ e'
- rw [← Num.to_of_nat r₂, add_comm] at e'
+ rw [← Num.to_of_nat r₂, add_comm] at e'
cases e.symm.trans (this.2 e'.symm)
· have := this.1 e
constructor
· rwa [_root_.bit1, add_comm _ 1, mul_add, mul_one, ← add_assoc, ← this]
- · rwa [this, two_mul, add_lt_add_iff_right] at h₂
+ · rwa [this, two_mul, add_lt_add_iff_right] at h₂
#align pos_num.divmod_to_nat_aux PosNum.divMod_to_nat_aux
-/
@@ -2070,7 +2070,7 @@ theorem gcd_to_nat_aux :
exact le_of_lt (Nat.mod_lt _ (PosNum.cast_pos _))
rw [nat_size_to_nat, mul_to_nat, Nat.size_le] at h ⊢
rw [mod_to_nat, mul_comm]
- rw [pow_succ', ← Nat.mod_add_div b (Pos a)] at h
+ rw [pow_succ', ← Nat.mod_add_div b (Pos a)] at h
refine' lt_of_mul_lt_mul_right (lt_of_le_of_lt _ h) (Nat.zero_le 2)
rw [mul_two, mul_add]
refine'
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -1213,7 +1213,7 @@ theorem castNum_shiftRight (m n) : (shiftr m n : ℕ) = Nat.shiftr m n :=
induction' n with n IH generalizing m; · cases m <;> rfl
cases' m with m m <;> dsimp only [PosNum.shiftr]
· rw [Nat.shiftRight_eq_div_pow]; symm; apply Nat.div_eq_of_lt
- exact @Nat.pow_lt_pow_of_lt_right 2 (by decide) 0 (n + 1) (Nat.succ_pos _)
+ exact @pow_lt_pow_right 2 (by decide) 0 (n + 1) (Nat.succ_pos _)
· trans; apply IH
change Nat.shiftr m n = Nat.shiftr (bit1 m) (n + 1)
rw [add_comm n 1, Nat.shiftr_add]
mathlib commit https://github.com/leanprover-community/mathlib/commit/b1abe23ae96fef89ad30d9f4362c307f72a55010
@@ -1117,29 +1117,29 @@ theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
#align num.le_iff_cmp Num.le_iff_cmp
-/
-#print Num.bitwise'_to_nat /-
-theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (p : PosNum → PosNum → Num)
- (gff : g false false = false) (f00 : f 0 0 = 0)
+#print Num.castNum_eq_bitwise /-
+theorem castNum_eq_bitwise {f : Num → Num → Num} {g : Bool → Bool → Bool}
+ (p : PosNum → PosNum → Num) (gff : g false false = false) (f00 : f 0 0 = 0)
(f0n : ∀ n, f 0 (pos n) = cond (g false true) (pos n) 0)
(fn0 : ∀ n, f (pos n) 0 = cond (g true false) (pos n) 0)
(fnn : ∀ m n, f (pos m) (pos n) = p m n) (p11 : p 1 1 = cond (g true true) 1 0)
(p1b : ∀ b n, p 1 (PosNum.bit b n) = bit (g true b) (cond (g false true) (pos n) 0))
(pb1 : ∀ a m, p (PosNum.bit a m) 1 = bit (g a true) (cond (g true false) (pos m) 0))
(pbb : ∀ a b m n, p (PosNum.bit a m) (PosNum.bit b n) = bit (g a b) (p m n)) :
- ∀ m n : Num, (f m n : ℕ) = Nat.bitwise' g m n :=
+ ∀ m n : Num, (f m n : ℕ) = Nat.bitwise g m n :=
by
intros;
cases' m with m <;> cases' n with n <;> try change zero with 0 <;>
try change ((0 : Num) : ℕ) with 0
- · rw [f00, Nat.bitwise'_zero] <;> rfl
- · unfold Nat.bitwise'; rw [f0n, Nat.binaryRec_zero]
+ · rw [f00, Nat.bitwise_zero] <;> rfl
+ · unfold Nat.bitwise; rw [f0n, Nat.binaryRec_zero]
cases g ff tt <;> rfl
- · unfold Nat.bitwise'
+ · unfold Nat.bitwise
generalize h : (Pos m : ℕ) = m'; revert h
apply Nat.bitCasesOn m' _; intro b m' h
rw [fn0, Nat.binaryRec_eq, Nat.binaryRec_zero, ← h]
cases g tt ff <;> rfl
- apply Nat.bitwise'_bit_aux gff
+ apply Nat.bitwise_bit_aux gff
· rw [fnn]
have : ∀ (b) (n : PosNum), (cond b (↑n) 0 : ℕ) = ↑(cond b (Pos n) 0 : Num) := by
intros <;> cases b <;> rfl
@@ -1152,60 +1152,62 @@ theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (
all_goals
repeat'
rw [show ∀ b n, (Pos (PosNum.bit b n) : ℕ) = Nat.bit b ↑n by intros <;> cases b <;> rfl]
- rw [Nat.bitwise'_bit]
+ rw [Nat.bitwise_bit]
any_goals assumption
- any_goals rw [Nat.bitwise'_zero, p11]; cases g tt tt <;> rfl
- any_goals rw [Nat.bitwise'_zero_left, this, ← bit_to_nat, p1b]
- any_goals rw [Nat.bitwise'_zero_right _ gff, this, ← bit_to_nat, pb1]
+ any_goals rw [Nat.bitwise_zero, p11]; cases g tt tt <;> rfl
+ any_goals rw [Nat.bitwise_zero_left, this, ← bit_to_nat, p1b]
+ any_goals rw [Nat.bitwise_zero_right _ gff, this, ← bit_to_nat, pb1]
all_goals
- rw [← show ∀ n, ↑(p m n) = Nat.bitwise' g ↑m ↑n from IH]
+ rw [← show ∀ n, ↑(p m n) = Nat.bitwise g ↑m ↑n from IH]
rw [← bit_to_nat, pbb]
-#align num.bitwise_to_nat Num.bitwise'_to_nat
+#align num.bitwise_to_nat Num.castNum_eq_bitwise
-/
-#print Num.lor'_to_nat /-
+#print Num.castNum_or /-
@[simp, norm_cast]
-theorem lor'_to_nat : ∀ m n, (or m n : ℕ) = Nat.lor' m n := by
+theorem castNum_or : ∀ m n, (or m n : ℕ) = Nat.lor m n := by
apply bitwise_to_nat fun x y => Pos (PosNum.lor x y) <;> intros <;> try cases a <;>
try cases b <;>
rfl
-#align num.lor_to_nat Num.lor'_to_nat
+#align num.lor_to_nat Num.castNum_or
-/
-#print Num.land'_to_nat /-
+#print Num.castNum_and /-
@[simp, norm_cast]
-theorem land'_to_nat : ∀ m n, (land m n : ℕ) = Nat.land' m n := by
+theorem castNum_and : ∀ m n, (land m n : ℕ) = Nat.land m n := by
apply bitwise_to_nat PosNum.land <;> intros <;> try cases a <;> try cases b <;> rfl
-#align num.land_to_nat Num.land'_to_nat
+#align num.land_to_nat Num.castNum_and
-/
-#print Num.ldiff'_to_nat /-
+#print Num.castNum_ldiff /-
@[simp, norm_cast]
-theorem ldiff'_to_nat : ∀ m n, (ldiff m n : ℕ) = Nat.ldiff' m n := by
+theorem castNum_ldiff : ∀ m n, (ldiff m n : ℕ) = Nat.ldiff m n := by
apply bitwise_to_nat PosNum.ldiff <;> intros <;> try cases a <;> try cases b <;> rfl
-#align num.ldiff_to_nat Num.ldiff'_to_nat
+#align num.ldiff_to_nat Num.castNum_ldiff
-/
-#print Num.lxor'_to_nat /-
+/- warning: num.lxor_to_nat clashes with num.ldiff_to_nat -> Num.castNum_ldiff
+Case conversion may be inaccurate. Consider using '#align num.lxor_to_nat Num.castNum_ldiffₓ'. -/
+#print Num.castNum_ldiff /-
@[simp, norm_cast]
-theorem lxor'_to_nat : ∀ m n, (lxor m n : ℕ) = Nat.lxor' m n := by
+theorem castNum_ldiff : ∀ m n, (lxor m n : ℕ) = Nat.xor m n := by
apply bitwise_to_nat PosNum.lxor <;> intros <;> try cases a <;> try cases b <;> rfl
-#align num.lxor_to_nat Num.lxor'_to_nat
+#align num.lxor_to_nat Num.castNum_ldiff
-/
-#print Num.shiftl_to_nat /-
+#print Num.castNum_shiftLeft /-
@[simp, norm_cast]
-theorem shiftl_to_nat (m n) : (shiftl m n : ℕ) = Nat.shiftl m n :=
+theorem castNum_shiftLeft (m n) : (shiftl m n : ℕ) = Nat.shiftl m n :=
by
cases m <;> dsimp only [shiftl]; · symm; apply Nat.zero_shiftLeft
simp; induction' n with n IH; · rfl
simp [PosNum.shiftl, Nat.shiftl_succ]; rw [← IH]
-#align num.shiftl_to_nat Num.shiftl_to_nat
+#align num.shiftl_to_nat Num.castNum_shiftLeft
-/
-#print Num.shiftr_to_nat /-
+#print Num.castNum_shiftRight /-
@[simp, norm_cast]
-theorem shiftr_to_nat (m n) : (shiftr m n : ℕ) = Nat.shiftr m n :=
+theorem castNum_shiftRight (m n) : (shiftr m n : ℕ) = Nat.shiftr m n :=
by
cases' m with m <;> dsimp only [shiftr]; · symm; apply Nat.zero_shiftr
induction' n with n IH generalizing m; · cases m <;> rfl
@@ -1224,12 +1226,12 @@ theorem shiftr_to_nat (m n) : (shiftr m n : ℕ) = Nat.shiftr m n :=
apply congr_arg fun x => Nat.shiftr x n; unfold Nat.shiftr
change (bit0 ↑m : ℕ) with Nat.bit ff m
rw [Nat.div2_bit]
-#align num.shiftr_to_nat Num.shiftr_to_nat
+#align num.shiftr_to_nat Num.castNum_shiftRight
-/
-#print Num.testBit_to_nat /-
+#print Num.castNum_testBit /-
@[simp]
-theorem testBit_to_nat (m n) : testBit m n = Nat.testBit m n :=
+theorem castNum_testBit (m n) : testBit m n = Nat.testBit m n :=
by
cases' m with m <;> unfold test_bit Nat.testBit
· change (zero : Nat) with 0; rw [Nat.zero_shiftr]; rfl
@@ -1246,7 +1248,7 @@ theorem testBit_to_nat (m n) : testBit m n = Nat.testBit m n :=
· change PosNum.testBit m n = Nat.bodd (Nat.shiftr (Nat.bit ff m) (n + 1))
rw [add_comm, Nat.shiftr_add]; unfold Nat.shiftr
rw [Nat.div2_bit]; apply IH
-#align num.test_bit_to_nat Num.testBit_to_nat
+#align num.test_bit_to_nat Num.castNum_testBit
-/
end Num
mathlib commit https://github.com/leanprover-community/mathlib/commit/19c869efa56bbb8b500f2724c0b77261edbfa28c
@@ -1165,7 +1165,7 @@ theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (
#print Num.lor'_to_nat /-
@[simp, norm_cast]
-theorem lor'_to_nat : ∀ m n, (lor m n : ℕ) = Nat.lor' m n := by
+theorem lor'_to_nat : ∀ m n, (or m n : ℕ) = Nat.lor' m n := by
apply bitwise_to_nat fun x y => Pos (PosNum.lor x y) <;> intros <;> try cases a <;>
try cases b <;>
rfl
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,11 +3,11 @@ Copyright (c) 2014 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/
-import Mathbin.Data.Num.Bitwise
-import Mathbin.Data.Int.CharZero
-import Mathbin.Data.Nat.Gcd.Basic
-import Mathbin.Data.Nat.Psub
-import Mathbin.Data.Nat.Size
+import Data.Num.Bitwise
+import Data.Int.CharZero
+import Data.Nat.Gcd.Basic
+import Data.Nat.Psub
+import Data.Nat.Size
#align_import data.num.lemmas from "leanprover-community/mathlib"@"25a9423c6b2c8626e91c688bfd6c1d0a986a3e6e"
@@ -454,7 +454,7 @@ theorem to_nat_inj {m n : Num} : (m : ℕ) = n ↔ m = n :=
#align num.to_nat_inj Num.to_nat_inj
-/
-/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:337:4: warning: unsupported (TODO): `[tacs] -/
/-- This tactic tries to turn an (in)equality about `num`s to one about `nat`s by rewriting.
```lean
example (n : num) (m : num) : n ≤ n + m :=
@@ -468,7 +468,7 @@ unsafe def transfer_rw : tactic Unit :=
sorry
#align num.transfer_rw num.transfer_rw
-/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:337:4: warning: unsupported (TODO): `[tacs] -/
/--
This tactic tries to prove (in)equalities about `num`s by transfering them to the `nat` world and
then trying to call `simp`.
@@ -717,7 +717,7 @@ theorem natSize_pos (n) : 0 < natSize n := by cases n <;> apply Nat.succ_pos
#align pos_num.nat_size_pos PosNum.natSize_pos
-/
-/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:337:4: warning: unsupported (TODO): `[tacs] -/
/-- This tactic tries to turn an (in)equality about `pos_num`s to one about `nat`s by rewriting.
```lean
example (n : pos_num) (m : pos_num) : n ≤ n + m :=
@@ -731,7 +731,7 @@ unsafe def transfer_rw : tactic Unit :=
sorry
#align pos_num.transfer_rw pos_num.transfer_rw
-/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:337:4: warning: unsupported (TODO): `[tacs] -/
/--
This tactic tries to prove (in)equalities about `pos_num`s by transferring them to the `nat` world
and then trying to call `simp`.
@@ -1739,7 +1739,7 @@ theorem cast_inj [LinearOrderedRing α] {m n : ZNum} : (m : α) = n ↔ m = n :=
#align znum.cast_inj ZNum.cast_inj
-/
-/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:337:4: warning: unsupported (TODO): `[tacs] -/
/-- This tactic tries to turn an (in)equality about `znum`s to one about `int`s by rewriting.
```lean
example (n : znum) (m : znum) : n ≤ n + m * m :=
@@ -1753,7 +1753,7 @@ unsafe def transfer_rw : tactic Unit :=
sorry
#align znum.transfer_rw znum.transfer_rw
-/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:337:4: warning: unsupported (TODO): `[tacs] -/
/--
This tactic tries to prove (in)equalities about `znum`s by transfering them to the `int` world and
then trying to call `simp`.
mathlib commit https://github.com/leanprover-community/mathlib/commit/32a7e535287f9c73f2e4d2aef306a39190f0b504
@@ -1197,7 +1197,7 @@ theorem lxor'_to_nat : ∀ m n, (lxor m n : ℕ) = Nat.lxor' m n := by
@[simp, norm_cast]
theorem shiftl_to_nat (m n) : (shiftl m n : ℕ) = Nat.shiftl m n :=
by
- cases m <;> dsimp only [shiftl]; · symm; apply Nat.zero_shiftl
+ cases m <;> dsimp only [shiftl]; · symm; apply Nat.zero_shiftLeft
simp; induction' n with n IH; · rfl
simp [PosNum.shiftl, Nat.shiftl_succ]; rw [← IH]
#align num.shiftl_to_nat Num.shiftl_to_nat
@@ -1210,7 +1210,7 @@ theorem shiftr_to_nat (m n) : (shiftr m n : ℕ) = Nat.shiftr m n :=
cases' m with m <;> dsimp only [shiftr]; · symm; apply Nat.zero_shiftr
induction' n with n IH generalizing m; · cases m <;> rfl
cases' m with m m <;> dsimp only [PosNum.shiftr]
- · rw [Nat.shiftr_eq_div_pow]; symm; apply Nat.div_eq_of_lt
+ · rw [Nat.shiftRight_eq_div_pow]; symm; apply Nat.div_eq_of_lt
exact @Nat.pow_lt_pow_of_lt_right 2 (by decide) 0 (n + 1) (Nat.succ_pos _)
· trans; apply IH
change Nat.shiftr m n = Nat.shiftr (bit1 m) (n + 1)
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,11 +2,6 @@
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module data.num.lemmas
-! leanprover-community/mathlib commit 25a9423c6b2c8626e91c688bfd6c1d0a986a3e6e
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Num.Bitwise
import Mathbin.Data.Int.CharZero
@@ -14,6 +9,8 @@ import Mathbin.Data.Nat.Gcd.Basic
import Mathbin.Data.Nat.Psub
import Mathbin.Data.Nat.Size
+#align_import data.num.lemmas from "leanprover-community/mathlib"@"25a9423c6b2c8626e91c688bfd6c1d0a986a3e6e"
+
/-!
# Properties of the binary representation of integers
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -56,12 +56,14 @@ theorem cast_bit1 [One α] [Add α] (n : PosNum) : (n.bit1 : α) = bit1 n :=
#align pos_num.cast_bit1 PosNum.cast_bit1
-/
+#print PosNum.cast_to_nat /-
@[simp, norm_cast]
theorem cast_to_nat [AddMonoidWithOne α] : ∀ n : PosNum, ((n : ℕ) : α) = n
| 1 => Nat.cast_one
| bit0 p => (Nat.cast_bit0 _).trans <| congr_arg bit0 p.cast_to_nat
| bit1 p => (Nat.cast_bit1 _).trans <| congr_arg bit1 p.cast_to_nat
#align pos_num.cast_to_nat PosNum.cast_to_nat
+-/
#print PosNum.to_nat_to_int /-
@[simp, norm_cast]
@@ -70,10 +72,12 @@ theorem to_nat_to_int (n : PosNum) : ((n : ℕ) : ℤ) = n :=
#align pos_num.to_nat_to_int PosNum.to_nat_to_int
-/
+#print PosNum.cast_to_int /-
@[simp, norm_cast]
theorem cast_to_int [AddGroupWithOne α] (n : PosNum) : ((n : ℤ) : α) = n := by
rw [← to_nat_to_int, Int.cast_ofNat, cast_to_nat]
#align pos_num.cast_to_int PosNum.cast_to_int
+-/
#print PosNum.succ_to_nat /-
theorem succ_to_nat : ∀ n, (succ n : ℕ) = n + 1
@@ -363,11 +367,13 @@ theorem succ_to_nat (n) : (succ n : ℕ) = n + 1 :=
#align num.succ_to_nat Num.succ_to_nat
-/
+#print Num.cast_to_nat /-
@[simp, norm_cast]
theorem cast_to_nat [AddMonoidWithOne α] : ∀ n : Num, ((n : ℕ) : α) = n
| 0 => Nat.cast_zero
| Pos p => p.cast_to_nat
#align num.cast_to_nat Num.cast_to_nat
+-/
#print Num.add_to_nat /-
@[norm_cast]
@@ -583,10 +589,12 @@ theorem to_nat_to_int (n : Num) : ((n : ℕ) : ℤ) = n :=
#align num.to_nat_to_int Num.to_nat_to_int
-/
+#print Num.cast_to_int /-
@[simp, norm_cast]
theorem cast_to_int {α} [AddGroupWithOne α] (n : Num) : ((n : ℤ) : α) = n := by
rw [← to_nat_to_int, Int.cast_ofNat, cast_to_nat]
#align num.cast_to_int Num.cast_to_int
+-/
#print Num.to_of_nat /-
theorem to_of_nat : ∀ n : ℕ, ((n : Num) : ℕ) = n
@@ -595,10 +603,12 @@ theorem to_of_nat : ∀ n : ℕ, ((n : Num) : ℕ) = n
#align num.to_of_nat Num.to_of_nat
-/
+#print Num.of_nat_cast /-
@[simp, norm_cast]
theorem of_nat_cast {α} [AddMonoidWithOne α] (n : ℕ) : ((n : Num) : α) = n := by
rw [← cast_to_nat, to_of_nat]
#align num.of_nat_cast Num.of_nat_cast
+-/
#print Num.of_nat_inj /-
@[simp, norm_cast]
@@ -805,35 +815,47 @@ theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by cases b <;> rfl
#align pos_num.bit_to_nat PosNum.bit_to_nat
-/
+#print PosNum.cast_add /-
@[simp, norm_cast]
theorem cast_add [AddMonoidWithOne α] (m n) : ((m + n : PosNum) : α) = m + n := by
rw [← cast_to_nat, add_to_nat, Nat.cast_add, cast_to_nat, cast_to_nat]
#align pos_num.cast_add PosNum.cast_add
+-/
+#print PosNum.cast_succ /-
@[simp, norm_cast]
theorem cast_succ [AddMonoidWithOne α] (n : PosNum) : (succ n : α) = n + 1 := by
rw [← add_one, cast_add, cast_one]
#align pos_num.cast_succ PosNum.cast_succ
+-/
+#print PosNum.cast_inj /-
@[simp, norm_cast]
theorem cast_inj [AddMonoidWithOne α] [CharZero α] {m n : PosNum} : (m : α) = n ↔ m = n := by
rw [← cast_to_nat m, ← cast_to_nat n, Nat.cast_inj, to_nat_inj]
#align pos_num.cast_inj PosNum.cast_inj
+-/
+#print PosNum.one_le_cast /-
@[simp]
theorem one_le_cast [LinearOrderedSemiring α] (n : PosNum) : (1 : α) ≤ n := by
rw [← cast_to_nat, ← Nat.cast_one, Nat.cast_le] <;> apply to_nat_pos
#align pos_num.one_le_cast PosNum.one_le_cast
+-/
+#print PosNum.cast_pos /-
@[simp]
theorem cast_pos [LinearOrderedSemiring α] (n : PosNum) : 0 < (n : α) :=
lt_of_lt_of_le zero_lt_one (one_le_cast n)
#align pos_num.cast_pos PosNum.cast_pos
+-/
+#print PosNum.cast_mul /-
@[simp, norm_cast]
theorem cast_mul [Semiring α] (m n) : ((m * n : PosNum) : α) = m * n := by
rw [← cast_to_nat, mul_to_nat, Nat.cast_mul, cast_to_nat, cast_to_nat]
#align pos_num.cast_mul PosNum.cast_mul
+-/
#print PosNum.cmp_eq /-
@[simp]
@@ -845,15 +867,19 @@ theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n :=
#align pos_num.cmp_eq PosNum.cmp_eq
-/
+#print PosNum.cast_lt /-
@[simp, norm_cast]
theorem cast_lt [LinearOrderedSemiring α] {m n : PosNum} : (m : α) < n ↔ m < n := by
rw [← cast_to_nat m, ← cast_to_nat n, Nat.cast_lt, lt_to_nat]
#align pos_num.cast_lt PosNum.cast_lt
+-/
+#print PosNum.cast_le /-
@[simp, norm_cast]
theorem cast_le [LinearOrderedSemiring α] {m n : PosNum} : (m : α) ≤ n ↔ m ≤ n := by
rw [← not_lt] <;> exact not_congr cast_lt
#align pos_num.cast_le PosNum.cast_le
+-/
end PosNum
@@ -868,29 +894,40 @@ theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by cases b <;> cases
#align num.bit_to_nat Num.bit_to_nat
-/
+#print Num.cast_succ' /-
theorem cast_succ' [AddMonoidWithOne α] (n) : (succ' n : α) = n + 1 := by
rw [← PosNum.cast_to_nat, succ'_to_nat, Nat.cast_add_one, cast_to_nat]
#align num.cast_succ' Num.cast_succ'
+-/
+#print Num.cast_succ /-
theorem cast_succ [AddMonoidWithOne α] (n) : (succ n : α) = n + 1 :=
cast_succ' n
#align num.cast_succ Num.cast_succ
+-/
+#print Num.cast_add /-
@[simp, norm_cast]
theorem cast_add [Semiring α] (m n) : ((m + n : Num) : α) = m + n := by
rw [← cast_to_nat, add_to_nat, Nat.cast_add, cast_to_nat, cast_to_nat]
#align num.cast_add Num.cast_add
+-/
+#print Num.cast_bit0 /-
@[simp, norm_cast]
theorem cast_bit0 [Semiring α] (n : Num) : (n.bit0 : α) = bit0 n := by
rw [← bit0_of_bit0, _root_.bit0, cast_add] <;> rfl
#align num.cast_bit0 Num.cast_bit0
+-/
+#print Num.cast_bit1 /-
@[simp, norm_cast]
theorem cast_bit1 [Semiring α] (n : Num) : (n.bit1 : α) = bit1 n := by
rw [← bit1_of_bit1, _root_.bit1, bit0_of_bit0, cast_add, cast_bit0] <;> rfl
#align num.cast_bit1 Num.cast_bit1
+-/
+#print Num.cast_mul /-
@[simp, norm_cast]
theorem cast_mul [Semiring α] : ∀ m n, ((m * n : Num) : α) = m * n
| 0, 0 => (MulZeroClass.zero_mul _).symm
@@ -898,6 +935,7 @@ theorem cast_mul [Semiring α] : ∀ m n, ((m * n : Num) : α) = m * n
| Pos p, 0 => (MulZeroClass.mul_zero _).symm
| Pos p, Pos q => PosNum.cast_mul _ _
#align num.cast_mul Num.cast_mul
+-/
#print Num.size_to_nat /-
theorem size_to_nat : ∀ n, (size n : ℕ) = Nat.size n
@@ -953,11 +991,13 @@ theorem cast_toZNum [Zero α] [One α] [Add α] [Neg α] : ∀ n : Num, (n.toZNu
#align num.cast_to_znum Num.cast_toZNum
-/
+#print Num.cast_toZNumNeg /-
@[simp]
theorem cast_toZNumNeg [AddGroup α] [One α] : ∀ n : Num, (n.toZNumNeg : α) = -n
| 0 => neg_zero.symm
| Num.pos p => rfl
#align num.cast_to_znum_neg Num.cast_toZNumNeg
+-/
#print Num.add_toZNum /-
@[simp]
@@ -1022,6 +1062,7 @@ theorem pred_to_nat : ∀ n : Num, (pred n : ℕ) = Nat.pred n
#align num.pred_to_nat Num.pred_to_nat
-/
+#print Num.ppred_to_nat /-
theorem ppred_to_nat : ∀ n : Num, coe <$> ppred n = Nat.ppred n
| 0 => rfl
| Pos p => by
@@ -1029,6 +1070,7 @@ theorem ppred_to_nat : ∀ n : Num, coe <$> ppred n = Nat.ppred n
rw [PosNum.pred'_to_nat, Nat.succ_pred_eq_of_pos (PosNum.to_nat_pos _)] <;>
rfl
#align num.ppred_to_nat Num.ppred_to_nat
+-/
#print Num.cmp_swap /-
theorem cmp_swap (m n) : (cmp m n).symm = cmp n m := by
@@ -1045,20 +1087,26 @@ theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n :=
#align num.cmp_eq Num.cmp_eq
-/
+#print Num.cast_lt /-
@[simp, norm_cast]
theorem cast_lt [LinearOrderedSemiring α] {m n : Num} : (m : α) < n ↔ m < n := by
rw [← cast_to_nat m, ← cast_to_nat n, Nat.cast_lt, lt_to_nat]
#align num.cast_lt Num.cast_lt
+-/
+#print Num.cast_le /-
@[simp, norm_cast]
theorem cast_le [LinearOrderedSemiring α] {m n : Num} : (m : α) ≤ n ↔ m ≤ n := by
rw [← not_lt] <;> exact not_congr cast_lt
#align num.cast_le Num.cast_le
+-/
+#print Num.cast_inj /-
@[simp, norm_cast]
theorem cast_inj [LinearOrderedSemiring α] {m n : Num} : (m : α) = n ↔ m = n := by
rw [← cast_to_nat m, ← cast_to_nat n, Nat.cast_inj, to_nat_inj]
#align num.cast_inj Num.cast_inj
+-/
#print Num.lt_iff_cmp /-
theorem lt_iff_cmp {m n} : m < n ↔ cmp m n = Ordering.lt :=
@@ -1247,12 +1295,14 @@ theorem cast_neg [Zero α] [One α] [Add α] [Neg α] (n : PosNum) : (neg n : α
#align znum.cast_neg ZNum.cast_neg
-/
+#print ZNum.cast_zneg /-
@[simp, norm_cast]
theorem cast_zneg [AddGroup α] [One α] : ∀ n, ((-n : ZNum) : α) = -n
| 0 => neg_zero.symm
| Pos p => rfl
| neg p => (neg_neg _).symm
#align znum.cast_zneg ZNum.cast_zneg
+-/
#print ZNum.neg_zero /-
theorem neg_zero : (-0 : ZNum) = 0 :=
@@ -1316,12 +1366,14 @@ theorem abs_toZNum : ∀ n : Num, abs n.toZNum = n
#align znum.abs_to_znum ZNum.abs_toZNum
-/
+#print ZNum.cast_to_int /-
@[simp, norm_cast]
theorem cast_to_int [AddGroupWithOne α] : ∀ n : ZNum, ((n : ℤ) : α) = n
| 0 => by rw [cast_zero, cast_zero, Int.cast_zero]
| Pos p => by rw [cast_pos, cast_pos, PosNum.cast_to_int]
| neg p => by rw [cast_neg, cast_neg, Int.cast_neg, PosNum.cast_to_int]
#align znum.cast_to_int ZNum.cast_to_int
+-/
#print ZNum.bit0_of_bit0 /-
theorem bit0_of_bit0 : ∀ n : ZNum, bit0 n = n.bit0
@@ -1339,6 +1391,7 @@ theorem bit1_of_bit1 : ∀ n : ZNum, bit1 n = n.bit1
#align znum.bit1_of_bit1 ZNum.bit1_of_bit1
-/
+#print ZNum.cast_bit0 /-
@[simp, norm_cast]
theorem cast_bit0 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit0 : α) = bit0 n
| 0 => (add_zero _).symm
@@ -1346,7 +1399,9 @@ theorem cast_bit0 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit0 : α) = bit0 n
| neg p => by
rw [ZNum.bit0, cast_neg, cast_neg, PosNum.cast_bit0, _root_.bit0, _root_.bit0, neg_add_rev]
#align znum.cast_bit0 ZNum.cast_bit0
+-/
+#print ZNum.cast_bit1 /-
@[simp, norm_cast]
theorem cast_bit1 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit1 : α) = bit1 n
| 0 => by simp [ZNum.bit1, _root_.bit1, _root_.bit0]
@@ -1360,7 +1415,9 @@ theorem cast_bit1 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit1 : α) = bit1 n
have : (↑(-↑a : ℤ) : α) = -1 + ↑(-↑a + 1 : ℤ) := by simp [add_comm]
simpa [_root_.bit1, _root_.bit0, -add_comm]
#align znum.cast_bit1 ZNum.cast_bit1
+-/
+#print ZNum.cast_bitm1 /-
@[simp]
theorem cast_bitm1 [AddGroupWithOne α] (n : ZNum) : (n.bitm1 : α) = bit0 n - 1 :=
by
@@ -1371,6 +1428,7 @@ theorem cast_bitm1 [AddGroupWithOne α] (n : ZNum) : (n.bitm1 : α) = bit0 n - 1
have : ((-1 + n + n : ℤ) : α) = (n + n + -1 : ℤ) := by simp [add_comm, add_left_comm]
simpa [_root_.bit1, _root_.bit0, sub_eq_add_neg, -Int.add_neg_one]
#align znum.cast_bitm1 ZNum.cast_bitm1
+-/
#print ZNum.add_zero /-
theorem add_zero (n : ZNum) : n + 0 = n := by cases n <;> rfl
@@ -1406,6 +1464,7 @@ theorem cast_to_znum : ∀ n : PosNum, (n : ZNum) = ZNum.pos n
attribute [-simp] Int.add_neg_one
+#print PosNum.cast_sub' /-
theorem cast_sub' [AddGroupWithOne α] : ∀ m n : PosNum, (sub' m n : α) = m - n
| a, 1 => by
rw [sub'_one, Num.cast_toZNum, ← Num.cast_to_nat, pred'_to_nat, ← Nat.sub_one] <;>
@@ -1433,6 +1492,7 @@ theorem cast_sub' [AddGroupWithOne α] : ∀ m n : PosNum, (sub' m n : α) = m -
have : ((-b + (a + -b) : ℤ) : α) = a + (-b + -b) := by simp [add_left_comm]
simpa [_root_.bit1, _root_.bit0, sub_eq_add_neg]
#align pos_num.cast_sub' PosNum.cast_sub'
+-/
#print PosNum.to_nat_eq_succ_pred /-
theorem to_nat_eq_succ_pred (n : PosNum) : (n : ℕ) = n.pred' + 1 := by
@@ -1452,6 +1512,7 @@ namespace Num
variable {α : Type _}
+#print Num.cast_sub' /-
@[simp]
theorem cast_sub' [AddGroupWithOne α] : ∀ m n : Num, (sub' m n : α) = m - n
| 0, 0 => (sub_zero _).symm
@@ -1459,6 +1520,7 @@ theorem cast_sub' [AddGroupWithOne α] : ∀ m n : Num, (sub' m n : α) = m - n
| 0, Pos b => (zero_sub _).symm
| Pos a, Pos b => PosNum.cast_sub' _ _
#align num.cast_sub' Num.cast_sub'
+-/
#print Num.toZNum_succ /-
theorem toZNum_succ : ∀ n : Num, n.succ.toZNum = n.toZNum.succ
@@ -1513,6 +1575,7 @@ theorem mem_ofZNum' : ∀ {m : Num} {n : ZNum}, m ∈ ofZNum' n ↔ n = toZNum m
#align num.mem_of_znum' Num.mem_ofZNum'
-/
+#print Num.ofZNum'_toNat /-
theorem ofZNum'_toNat : ∀ n : ZNum, coe <$> ofZNum' n = Int.toNat' n
| 0 => rfl
| ZNum.pos p => show _ = Int.toNat' p by rw [← PosNum.to_nat_to_int p] <;> rfl
@@ -1520,6 +1583,7 @@ theorem ofZNum'_toNat : ∀ n : ZNum, coe <$> ofZNum' n = Int.toNat' n
(congr_arg fun x => Int.toNat' (-x)) <|
show ((p.pred' + 1 : ℕ) : ℤ) = p by rw [← succ'_to_nat] <;> simp
#align num.of_znum'_to_nat Num.ofZNum'_toNat
+-/
#print Num.ofZNum_toNat /-
@[simp]
@@ -1532,10 +1596,12 @@ theorem ofZNum_toNat : ∀ n : ZNum, (ofZNum n : ℕ) = Int.toNat n
#align num.of_znum_to_nat Num.ofZNum_toNat
-/
+#print Num.cast_ofZNum /-
@[simp]
theorem cast_ofZNum [AddGroupWithOne α] (n : ZNum) : (ofZNum n : α) = Int.toNat n := by
rw [← cast_to_nat, of_znum_to_nat]
#align num.cast_of_znum Num.cast_ofZNum
+-/
#print Num.sub_to_nat /-
@[simp, norm_cast]
@@ -1551,6 +1617,7 @@ namespace ZNum
variable {α : Type _}
+#print ZNum.cast_add /-
@[simp, norm_cast]
theorem cast_add [AddGroupWithOne α] : ∀ m n, ((m + n : ZNum) : α) = m + n
| 0, a => by cases a <;> exact (_root_.zero_add _).symm
@@ -1567,11 +1634,14 @@ theorem cast_add [AddGroupWithOne α] : ∀ m n, ((m + n : ZNum) : α) = m + n
rw [PosNum.cast_add, neg_eq_iff_eq_neg, neg_add_rev, neg_neg, neg_neg, ← PosNum.cast_to_int a,
← PosNum.cast_to_int b, ← Int.cast_add, ← Int.cast_add, add_comm]
#align znum.cast_add ZNum.cast_add
+-/
+#print ZNum.cast_succ /-
@[simp]
theorem cast_succ [AddGroupWithOne α] (n) : ((succ n : ZNum) : α) = n + 1 := by
rw [← add_one, cast_add, cast_one]
#align znum.cast_succ ZNum.cast_succ
+-/
#print ZNum.mul_to_int /-
@[simp, norm_cast]
@@ -1585,9 +1655,11 @@ theorem mul_to_int : ∀ m n, ((m * n : ZNum) : ℤ) = m * n
#align znum.mul_to_int ZNum.mul_to_int
-/
+#print ZNum.cast_mul /-
theorem cast_mul [Ring α] (m n) : ((m * n : ZNum) : α) = m * n := by
rw [← cast_to_int, mul_to_int, Int.cast_mul, cast_to_int, cast_to_int]
#align znum.cast_mul ZNum.cast_mul
+-/
#print ZNum.ofInt'_neg /-
theorem ofInt'_neg : ∀ n : ℤ, ofInt' (-n) = -ofInt' n
@@ -1649,20 +1721,26 @@ theorem le_to_int {m n : ZNum} : (m : ℤ) ≤ n ↔ m ≤ n := by
#align znum.le_to_int ZNum.le_to_int
-/
+#print ZNum.cast_lt /-
@[simp, norm_cast]
theorem cast_lt [LinearOrderedRing α] {m n : ZNum} : (m : α) < n ↔ m < n := by
rw [← cast_to_int m, ← cast_to_int n, Int.cast_lt, lt_to_int]
#align znum.cast_lt ZNum.cast_lt
+-/
+#print ZNum.cast_le /-
@[simp, norm_cast]
theorem cast_le [LinearOrderedRing α] {m n : ZNum} : (m : α) ≤ n ↔ m ≤ n := by
rw [← not_lt] <;> exact not_congr cast_lt
#align znum.cast_le ZNum.cast_le
+-/
+#print ZNum.cast_inj /-
@[simp, norm_cast]
theorem cast_inj [LinearOrderedRing α] {m n : ZNum} : (m : α) = n ↔ m = n := by
rw [← cast_to_int m, ← cast_to_int n, Int.cast_inj, to_int_inj]
#align znum.cast_inj ZNum.cast_inj
+-/
/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
/-- This tactic tries to turn an (in)equality about `znum`s to one about `int`s by rewriting.
@@ -1798,17 +1876,22 @@ instance : LinearOrderedCommRing ZNum :=
apply mul_pos
zero_le_one := by decide }
+#print ZNum.cast_sub /-
@[simp, norm_cast]
theorem cast_sub [Ring α] (m n) : ((m - n : ZNum) : α) = m - n := by simp [sub_eq_neg_add]
#align znum.cast_sub ZNum.cast_sub
+-/
+#print ZNum.neg_of_int /-
@[simp, norm_cast]
theorem neg_of_int : ∀ n, ((-n : ℤ) : ZNum) = -n
| (n + 1 : ℕ) => rfl
| 0 => by rw [Int.cast_neg, Int.cast_zero]
| -[n+1] => (zneg_zneg _).symm
#align znum.neg_of_int ZNum.neg_of_int
+-/
+#print ZNum.ofInt'_eq /-
@[simp]
theorem ofInt'_eq : ∀ n : ℤ, ZNum.ofInt' n = n
| (n : ℕ) => rfl
@@ -1818,6 +1901,7 @@ theorem ofInt'_eq : ∀ n : ℤ, ZNum.ofInt' n = n
Nat.cast_succ, ZNum.add_one]
rfl
#align znum.of_int'_eq ZNum.ofInt'_eq
+-/
#print ZNum.of_nat_toZNum /-
@[simp]
@@ -1826,13 +1910,17 @@ theorem of_nat_toZNum (n : ℕ) : Num.toZNum n = n :=
#align znum.of_nat_to_znum ZNum.of_nat_toZNum
-/
+#print ZNum.of_to_int /-
@[simp, norm_cast]
theorem of_to_int (n : ZNum) : ((n : ℤ) : ZNum) = n := by rw [← of_int'_eq, of_to_int']
#align znum.of_to_int ZNum.of_to_int
+-/
+#print ZNum.to_of_int /-
theorem to_of_int (n : ℤ) : ((n : ZNum) : ℤ) = n :=
Int.inductionOn' n 0 (by simp) (by simp) (by simp)
#align znum.to_of_int ZNum.to_of_int
+-/
#print ZNum.of_nat_toZNumNeg /-
@[simp]
@@ -1840,20 +1928,26 @@ theorem of_nat_toZNumNeg (n : ℕ) : Num.toZNumNeg n = -n := by rw [← of_nat_t
#align znum.of_nat_to_znum_neg ZNum.of_nat_toZNumNeg
-/
+#print ZNum.of_int_cast /-
@[simp, norm_cast]
theorem of_int_cast [AddGroupWithOne α] (n : ℤ) : ((n : ZNum) : α) = n := by
rw [← cast_to_int, to_of_int]
#align znum.of_int_cast ZNum.of_int_cast
+-/
+#print ZNum.of_nat_cast /-
@[simp, norm_cast]
theorem of_nat_cast [AddGroupWithOne α] (n : ℕ) : ((n : ZNum) : α) = n := by
rw [← Int.cast_ofNat, of_int_cast, Int.cast_ofNat]
#align znum.of_nat_cast ZNum.of_nat_cast
+-/
+#print ZNum.dvd_to_int /-
@[simp, norm_cast]
theorem dvd_to_int (m n : ZNum) : (m : ℤ) ∣ n ↔ m ∣ n :=
⟨fun ⟨k, e⟩ => ⟨k, by rw [← of_to_int n, e] <;> simp⟩, fun ⟨k, e⟩ => ⟨k, by simp [e]⟩⟩
#align znum.dvd_to_int ZNum.dvd_to_int
+-/
end ZNum
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -451,7 +451,7 @@ theorem to_nat_inj {m n : Num} : (m : ℕ) = n ↔ m = n :=
#align num.to_nat_inj Num.to_nat_inj
-/
-/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
/-- This tactic tries to turn an (in)equality about `num`s to one about `nat`s by rewriting.
```lean
example (n : num) (m : num) : n ≤ n + m :=
@@ -465,7 +465,7 @@ unsafe def transfer_rw : tactic Unit :=
sorry
#align num.transfer_rw num.transfer_rw
-/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
/--
This tactic tries to prove (in)equalities about `num`s by transfering them to the `nat` world and
then trying to call `simp`.
@@ -710,7 +710,7 @@ theorem natSize_pos (n) : 0 < natSize n := by cases n <;> apply Nat.succ_pos
#align pos_num.nat_size_pos PosNum.natSize_pos
-/
-/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
/-- This tactic tries to turn an (in)equality about `pos_num`s to one about `nat`s by rewriting.
```lean
example (n : pos_num) (m : pos_num) : n ≤ n + m :=
@@ -724,7 +724,7 @@ unsafe def transfer_rw : tactic Unit :=
sorry
#align pos_num.transfer_rw pos_num.transfer_rw
-/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
/--
This tactic tries to prove (in)equalities about `pos_num`s by transferring them to the `nat` world
and then trying to call `simp`.
@@ -1664,7 +1664,7 @@ theorem cast_inj [LinearOrderedRing α] {m n : ZNum} : (m : α) = n ↔ m = n :=
rw [← cast_to_int m, ← cast_to_int n, Int.cast_inj, to_int_inj]
#align znum.cast_inj ZNum.cast_inj
-/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
/-- This tactic tries to turn an (in)equality about `znum`s to one about `int`s by rewriting.
```lean
example (n : znum) (m : znum) : n ≤ n + m * m :=
@@ -1678,7 +1678,7 @@ unsafe def transfer_rw : tactic Unit :=
sorry
#align znum.transfer_rw znum.transfer_rw
-/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:336:4: warning: unsupported (TODO): `[tacs] -/
/--
This tactic tries to prove (in)equalities about `znum`s by transfering them to the `int` world and
then trying to call `simp`.
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -217,8 +217,8 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
theorem lt_to_nat {m n : PosNum} : (m : ℕ) < n ↔ m < n :=
show (m : ℕ) < n ↔ cmp m n = Ordering.lt from
match cmp m n, cmp_to_nat m n with
- | Ordering.lt, h => by simp at h <;> simp [h]
- | Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
+ | Ordering.lt, h => by simp at h <;> simp [h]
+ | Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
| Ordering.gt, h => by simp [not_lt_of_gt h] <;> exact by decide
#align pos_num.lt_to_nat PosNum.lt_to_nat
-/
@@ -397,7 +397,7 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
| Pos a, Pos b =>
by
have := PosNum.cmp_to_nat a b <;> revert this <;> dsimp [cmp] <;> cases PosNum.cmp a b
- exacts[id, congr_arg Pos, id]
+ exacts [id, congr_arg Pos, id]
#align num.cmp_to_nat Num.cmp_to_nat
-/
@@ -406,8 +406,8 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
theorem lt_to_nat {m n : Num} : (m : ℕ) < n ↔ m < n :=
show (m : ℕ) < n ↔ cmp m n = Ordering.lt from
match cmp m n, cmp_to_nat m n with
- | Ordering.lt, h => by simp at h <;> simp [h]
- | Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
+ | Ordering.lt, h => by simp at h <;> simp [h]
+ | Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
| Ordering.gt, h => by simp [not_lt_of_gt h] <;> exact by decide
#align num.lt_to_nat Num.lt_to_nat
-/
@@ -504,7 +504,7 @@ instance : CommSemiring Num := by
add := (· + ·)
zero := 0
npow := @npowRec Num ⟨1⟩ ⟨(· * ·)⟩ } <;>
- try intros ; rfl <;>
+ try intros; rfl <;>
try
run_tac
transfer <;>
@@ -738,7 +738,7 @@ unsafe def transfer : tactic Unit :=
/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic pos_num.transfer -/
instance : AddCommSemigroup PosNum := by
- refine' { add := (· + ·).. } <;>
+ refine' { add := (· + ·) .. } <;>
run_tac
transfer
@@ -748,7 +748,7 @@ instance : CommMonoid PosNum := by
{ mul := (· * ·)
one := (1 : PosNum)
npow := @npowRec PosNum ⟨1⟩ ⟨(· * ·)⟩ } <;>
- try intros ; rfl <;>
+ try intros; rfl <;>
run_tac
transfer
@@ -756,7 +756,7 @@ instance : CommMonoid PosNum := by
instance : Distrib PosNum := by
refine'
{ add := (· + ·)
- mul := (· * ·).. } <;>
+ mul := (· * ·) .. } <;>
·
run_tac
transfer;
@@ -840,8 +840,8 @@ theorem cast_mul [Semiring α] (m n) : ((m * n : PosNum) : α) = m * n := by
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n :=
by
have := cmp_to_nat m n
- cases cmp m n <;> simp at this⊢ <;> try exact this <;>
- · simp [show m ≠ n from fun e => by rw [e] at this <;> exact lt_irrefl _ this]
+ cases cmp m n <;> simp at this ⊢ <;> try exact this <;>
+ · simp [show m ≠ n from fun e => by rw [e] at this <;> exact lt_irrefl _ this]
#align pos_num.cmp_eq PosNum.cmp_eq
-/
@@ -922,7 +922,7 @@ theorem natSize_to_nat (n) : natSize n = Nat.size n := by rw [← size_eq_nat_si
@[simp]
theorem ofNat'_eq : ∀ n, Num.ofNat' n = n :=
Nat.binaryRec (by simp) fun b n IH => by
- rw [of_nat'] at IH⊢
+ rw [of_nat'] at IH ⊢
rw [Nat.binaryRec_eq, IH]
· cases b <;> simp [Nat.bit, bit0_of_bit0, bit1_of_bit1]
· rfl
@@ -979,7 +979,7 @@ theorem pred_to_nat {n : PosNum} (h : 1 < n) : (pred n : ℕ) = Nat.pred n :=
have := pred'_to_nat n
cases e : pred' n
· have : (1 : ℕ) ≤ Nat.pred n := Nat.pred_le_pred ((@cast_lt ℕ _ _ _).2 h)
- rw [← pred'_to_nat, e] at this
+ rw [← pred'_to_nat, e] at this
exact absurd this (by decide)
· rw [← pred'_to_nat, e]; rfl
#align pos_num.pred_to_nat PosNum.pred_to_nat
@@ -1040,8 +1040,8 @@ theorem cmp_swap (m n) : (cmp m n).symm = cmp n m := by
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n :=
by
have := cmp_to_nat m n
- cases cmp m n <;> simp at this⊢ <;> try exact this <;>
- · simp [show m ≠ n from fun e => by rw [e] at this <;> exact lt_irrefl _ this]
+ cases cmp m n <;> simp at this ⊢ <;> try exact this <;>
+ · simp [show m ≠ n from fun e => by rw [e] at this <;> exact lt_irrefl _ this]
#align num.cmp_eq Num.cmp_eq
-/
@@ -1083,7 +1083,7 @@ theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (
(pbb : ∀ a b m n, p (PosNum.bit a m) (PosNum.bit b n) = bit (g a b) (p m n)) :
∀ m n : Num, (f m n : ℕ) = Nat.bitwise' g m n :=
by
- intros ;
+ intros;
cases' m with m <;> cases' n with n <;> try change zero with 0 <;>
try change ((0 : Num) : ℕ) with 0
· rw [f00, Nat.bitwise'_zero] <;> rfl
@@ -1354,9 +1354,9 @@ theorem cast_bit1 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit1 : α) = bit1 n
| neg p => by
rw [ZNum.bit1, cast_neg, cast_neg]
cases' e : pred' p with a <;> have : p = _ := (succ'_pred' p).symm.trans (congr_arg Num.succ' e)
- · change p = 1 at this; subst p
+ · change p = 1 at this ; subst p
simp [_root_.bit1, _root_.bit0]
- · rw [Num.succ'] at this; subst p
+ · rw [Num.succ'] at this ; subst p
have : (↑(-↑a : ℤ) : α) = -1 + ↑(-↑a + 1 : ℤ) := by simp [add_comm]
simpa [_root_.bit1, _root_.bit0, -add_comm]
#align znum.cast_bit1 ZNum.cast_bit1
@@ -1618,11 +1618,11 @@ theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n
| Pos a, Pos b => by
have := PosNum.cmp_to_nat a b <;> revert this <;> dsimp [cmp] <;> cases PosNum.cmp a b <;>
dsimp <;>
- [simp;exact congr_arg Pos;simp [GT.gt]]
+ [simp; exact congr_arg Pos; simp [GT.gt]]
| neg a, neg b => by
have := PosNum.cmp_to_nat b a <;> revert this <;> dsimp [cmp] <;> cases PosNum.cmp b a <;>
dsimp <;>
- [simp;simp (config := { contextual := true });simp [GT.gt]]
+ [simp; simp (config := { contextual := true }); simp [GT.gt]]
| Pos a, 0 => PosNum.cast_pos _
| Pos a, neg b => lt_trans (neg_lt_zero.2 <| PosNum.cast_pos _) (PosNum.cast_pos _)
| 0, neg b => neg_lt_zero.2 <| PosNum.cast_pos _
@@ -1637,8 +1637,8 @@ theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n
theorem lt_to_int {m n : ZNum} : (m : ℤ) < n ↔ m < n :=
show (m : ℤ) < n ↔ cmp m n = Ordering.lt from
match cmp m n, cmp_to_int m n with
- | Ordering.lt, h => by simp at h <;> simp [h]
- | Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
+ | Ordering.lt, h => by simp at h <;> simp [h]
+ | Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
| Ordering.gt, h => by simp [not_lt_of_gt h] <;> exact by decide
#align znum.lt_to_int ZNum.lt_to_int
-/
@@ -1874,12 +1874,12 @@ theorem divMod_to_nat_aux {n d : PosNum} {q r : Num} (h₁ : (r : ℕ) + d * bit
cases' e : Num.ofZNum' (Num.sub' r (Num.pos d)) with r₂ <;> simp [divmod_aux]
· refine' ⟨h₁, lt_of_not_ge fun h => _⟩
cases' Nat.le.dest h with r₂ e'
- rw [← Num.to_of_nat r₂, add_comm] at e'
+ rw [← Num.to_of_nat r₂, add_comm] at e'
cases e.symm.trans (this.2 e'.symm)
· have := this.1 e
constructor
· rwa [_root_.bit1, add_comm _ 1, mul_add, mul_one, ← add_assoc, ← this]
- · rwa [this, two_mul, add_lt_add_iff_right] at h₂
+ · rwa [this, two_mul, add_lt_add_iff_right] at h₂
#align pos_num.divmod_to_nat_aux PosNum.divMod_to_nat_aux
-/
@@ -1893,7 +1893,7 @@ theorem divMod_to_nat (d n : PosNum) :
exact
divmod_to_nat_aux (by simp <;> rfl) (Nat.mul_le_mul_left 2 (PosNum.cast_pos d : (0 : ℕ) < d))
· unfold divmod
- cases' divmod d n with q r; simp only [divmod] at IH⊢
+ cases' divmod d n with q r; simp only [divmod] at IH ⊢
apply divmod_to_nat_aux <;> simp
·
rw [_root_.bit1, _root_.bit1, add_right_comm, bit0_eq_two_mul (n : ℕ), ← IH.1, mul_add, ←
@@ -1901,7 +1901,7 @@ theorem divMod_to_nat (d n : PosNum) :
· rw [← bit0_eq_two_mul]
exact Nat.bit1_lt_bit0 IH.2
· unfold divmod
- cases' divmod d n with q r; simp only [divmod] at IH⊢
+ cases' divmod d n with q r; simp only [divmod] at IH ⊢
apply divmod_to_nat_aux <;> simp
·
rw [bit0_eq_two_mul (n : ℕ), ← IH.1, mul_add, ← bit0_eq_two_mul, mul_left_comm, ←
@@ -1975,9 +1975,9 @@ theorem gcd_to_nat_aux :
rw [Nat.gcd_rec, gcd_to_nat_aux, mod_to_nat]; · rfl
· rw [← le_to_nat, mod_to_nat]
exact le_of_lt (Nat.mod_lt _ (PosNum.cast_pos _))
- rw [nat_size_to_nat, mul_to_nat, Nat.size_le] at h⊢
+ rw [nat_size_to_nat, mul_to_nat, Nat.size_le] at h ⊢
rw [mod_to_nat, mul_comm]
- rw [pow_succ', ← Nat.mod_add_div b (Pos a)] at h
+ rw [pow_succ', ← Nat.mod_add_div b (Pos a)] at h
refine' lt_of_mul_lt_mul_right (lt_of_le_of_lt _ h) (Nat.zero_le 2)
rw [mul_two, mul_add]
refine'
@@ -2033,7 +2033,11 @@ namespace ZNum
#print ZNum.div_zero /-
@[simp]
protected theorem div_zero (n : ZNum) : n / 0 = 0 :=
- show n.div 0 = 0 by cases n <;> first |rfl|simp [ZNum.div]
+ show n.div 0 = 0 by
+ cases n <;>
+ first
+ | rfl
+ | simp [ZNum.div]
#align znum.div_zero ZNum.div_zero
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -56,12 +56,6 @@ theorem cast_bit1 [One α] [Add α] (n : PosNum) : (n.bit1 : α) = bit1 n :=
#align pos_num.cast_bit1 PosNum.cast_bit1
-/
-/- warning: pos_num.cast_to_nat -> PosNum.cast_to_nat is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1)))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PosNum Nat (HasLiftT.mk.{1, 1} PosNum Nat (CoeTCₓ.coe.{1, 1} PosNum Nat (posNumCoe.{0} Nat Nat.hasOne Nat.hasAdd))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1) (castPosNum.{0} Nat (CanonicallyOrderedCommSemiring.toOne.{0} Nat Nat.canonicallyOrderedCommSemiring) instAddNat n)) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) n)
-Case conversion may be inaccurate. Consider using '#align pos_num.cast_to_nat PosNum.cast_to_natₓ'. -/
@[simp, norm_cast]
theorem cast_to_nat [AddMonoidWithOne α] : ∀ n : PosNum, ((n : ℕ) : α) = n
| 1 => Nat.cast_one
@@ -76,12 +70,6 @@ theorem to_nat_to_int (n : PosNum) : ((n : ℕ) : ℤ) = n :=
#align pos_num.to_nat_to_int PosNum.to_nat_to_int
-/
-/- warning: pos_num.cast_to_int -> PosNum.cast_to_int is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Int α (HasLiftT.mk.{1, succ u1} Int α (CoeTCₓ.coe.{1, succ u1} Int α (Int.castCoe.{u1} α (AddGroupWithOne.toHasIntCast.{u1} α _inst_1)))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PosNum Int (HasLiftT.mk.{1, 1} PosNum Int (CoeTCₓ.coe.{1, 1} PosNum Int (posNumCoe.{0} Int Int.hasOne Int.hasAdd))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) (castPosNum.{0} Int (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt n)) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) n)
-Case conversion may be inaccurate. Consider using '#align pos_num.cast_to_int PosNum.cast_to_intₓ'. -/
@[simp, norm_cast]
theorem cast_to_int [AddGroupWithOne α] (n : PosNum) : ((n : ℤ) : α) = n := by
rw [← to_nat_to_int, Int.cast_ofNat, cast_to_nat]
@@ -375,12 +363,6 @@ theorem succ_to_nat (n) : (succ n : ℕ) = n + 1 :=
#align num.succ_to_nat Num.succ_to_nat
-/
-/- warning: num.cast_to_nat -> Num.cast_to_nat is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1)))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Num Nat (HasLiftT.mk.{1, 1} Num Nat (CoeTCₓ.coe.{1, 1} Num Nat (numNatCoe.{0} Nat Nat.hasOne Nat.hasAdd Nat.hasZero))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Num), Eq.{succ u1} α (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1) (castNum.{0} Nat (CanonicallyOrderedCommSemiring.toOne.{0} Nat Nat.canonicallyOrderedCommSemiring) instAddNat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero) n)) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddMonoid.toZero.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)) n)
-Case conversion may be inaccurate. Consider using '#align num.cast_to_nat Num.cast_to_natₓ'. -/
@[simp, norm_cast]
theorem cast_to_nat [AddMonoidWithOne α] : ∀ n : Num, ((n : ℕ) : α) = n
| 0 => Nat.cast_zero
@@ -601,12 +583,6 @@ theorem to_nat_to_int (n : Num) : ((n : ℕ) : ℤ) = n :=
#align num.to_nat_to_int Num.to_nat_to_int
-/
-/- warning: num.cast_to_int -> Num.cast_to_int is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Int α (HasLiftT.mk.{1, succ u1} Int α (CoeTCₓ.coe.{1, succ u1} Int α (Int.castCoe.{u1} α (AddGroupWithOne.toHasIntCast.{u1} α _inst_1)))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Num Int (HasLiftT.mk.{1, 1} Num Int (CoeTCₓ.coe.{1, 1} Num Int (numNatCoe.{0} Int Int.hasOne Int.hasAdd Int.hasZero))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Num), Eq.{succ u1} α (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) (castNum.{0} Int (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) n)) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) n)
-Case conversion may be inaccurate. Consider using '#align num.cast_to_int Num.cast_to_intₓ'. -/
@[simp, norm_cast]
theorem cast_to_int {α} [AddGroupWithOne α] (n : Num) : ((n : ℤ) : α) = n := by
rw [← to_nat_to_int, Int.cast_ofNat, cast_to_nat]
@@ -619,12 +595,6 @@ theorem to_of_nat : ∀ n : ℕ, ((n : Num) : ℕ) = n
#align num.to_of_nat Num.to_of_nat
-/
-/- warning: num.of_nat_cast -> Num.of_nat_cast is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Nat), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Num (HasLiftT.mk.{1, 1} Nat Num (CoeTCₓ.coe.{1, 1} Nat Num (Nat.castCoe.{0} Num (AddMonoidWithOne.toNatCast.{0} Num Num.addMonoidWithOne)))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1)))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Nat), Eq.{succ u1} α (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddMonoid.toZero.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)) (Nat.cast.{0} Num (Semiring.toNatCast.{0} Num (StrictOrderedSemiring.toSemiring.{0} Num (LinearOrderedSemiring.toStrictOrderedSemiring.{0} Num Num.linearOrderedSemiring))) n)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1) n)
-Case conversion may be inaccurate. Consider using '#align num.of_nat_cast Num.of_nat_castₓ'. -/
@[simp, norm_cast]
theorem of_nat_cast {α} [AddMonoidWithOne α] (n : ℕ) : ((n : Num) : α) = n := by
rw [← cast_to_nat, to_of_nat]
@@ -835,67 +805,31 @@ theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by cases b <;> rfl
#align pos_num.bit_to_nat PosNum.bit_to_nat
-/
-/- warning: pos_num.cast_add -> PosNum.cast_add is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (m : PosNum) (n : PosNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) (HAdd.hAdd.{0, 0, 0} PosNum PosNum PosNum (instHAdd.{0} PosNum PosNum.hasAdd) m n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (m : PosNum) (n : PosNum), Eq.{succ u1} α (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (HAdd.hAdd.{0, 0, 0} PosNum PosNum PosNum (instHAdd.{0} PosNum PosNum.instAddPosNum) m n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) m) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) n))
-Case conversion may be inaccurate. Consider using '#align pos_num.cast_add PosNum.cast_addₓ'. -/
@[simp, norm_cast]
theorem cast_add [AddMonoidWithOne α] (m n) : ((m + n : PosNum) : α) = m + n := by
rw [← cast_to_nat, add_to_nat, Nat.cast_add, cast_to_nat, cast_to_nat]
#align pos_num.cast_add PosNum.cast_add
-/- warning: pos_num.cast_succ -> PosNum.cast_succ is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) (PosNum.succ n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1)))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (PosNum.succ n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1))))
-Case conversion may be inaccurate. Consider using '#align pos_num.cast_succ PosNum.cast_succₓ'. -/
@[simp, norm_cast]
theorem cast_succ [AddMonoidWithOne α] (n : PosNum) : (succ n : α) = n + 1 := by
rw [← add_one, cast_add, cast_one]
#align pos_num.cast_succ PosNum.cast_succ
-/- warning: pos_num.cast_inj -> PosNum.cast_inj is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] [_inst_2 : CharZero.{u1} α _inst_1] {m : PosNum} {n : PosNum}, Iff (Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n)) (Eq.{1} PosNum m n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] [_inst_2 : CharZero.{u1} α _inst_1] {m : PosNum} {n : PosNum}, Iff (Eq.{succ u1} α (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) m) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) n)) (Eq.{1} PosNum m n)
-Case conversion may be inaccurate. Consider using '#align pos_num.cast_inj PosNum.cast_injₓ'. -/
@[simp, norm_cast]
theorem cast_inj [AddMonoidWithOne α] [CharZero α] {m n : PosNum} : (m : α) = n ↔ m = n := by
rw [← cast_to_nat m, ← cast_to_nat n, Nat.cast_inj, to_nat_inj]
#align pos_num.cast_inj PosNum.cast_inj
-/- warning: pos_num.one_le_cast -> PosNum.one_le_cast is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) n)
-Case conversion may be inaccurate. Consider using '#align pos_num.one_le_cast PosNum.one_le_castₓ'. -/
@[simp]
theorem one_le_cast [LinearOrderedSemiring α] (n : PosNum) : (1 : α) ≤ n := by
rw [← cast_to_nat, ← Nat.cast_one, Nat.cast_le] <;> apply to_nat_pos
#align pos_num.one_le_cast PosNum.one_le_cast
-/- warning: pos_num.cast_pos -> PosNum.cast_pos is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) n)
-Case conversion may be inaccurate. Consider using '#align pos_num.cast_pos PosNum.cast_posₓ'. -/
@[simp]
theorem cast_pos [LinearOrderedSemiring α] (n : PosNum) : 0 < (n : α) :=
lt_of_lt_of_le zero_lt_one (one_le_cast n)
#align pos_num.cast_pos PosNum.cast_pos
-/- warning: pos_num.cast_mul -> PosNum.cast_mul is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (m : PosNum) (n : PosNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) (HMul.hMul.{0, 0, 0} PosNum PosNum PosNum (instHMul.{0} PosNum PosNum.hasMul) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (Distrib.toHasMul.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (m : PosNum) (n : PosNum), Eq.{succ u1} α (castPosNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (HMul.hMul.{0, 0, 0} PosNum PosNum PosNum (instHMul.{0} PosNum PosNum.instMulPosNum) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (castPosNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) m) (castPosNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) n))
-Case conversion may be inaccurate. Consider using '#align pos_num.cast_mul PosNum.cast_mulₓ'. -/
@[simp, norm_cast]
theorem cast_mul [Semiring α] (m n) : ((m * n : PosNum) : α) = m * n := by
rw [← cast_to_nat, mul_to_nat, Nat.cast_mul, cast_to_nat, cast_to_nat]
@@ -911,23 +845,11 @@ theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n :=
#align pos_num.cmp_eq PosNum.cmp_eq
-/
-/- warning: pos_num.cast_lt -> PosNum.cast_lt is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LT.lt.{0} PosNum PosNum.hasLt m n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) m) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) n)) (LT.lt.{0} PosNum PosNum.instLTPosNum m n)
-Case conversion may be inaccurate. Consider using '#align pos_num.cast_lt PosNum.cast_ltₓ'. -/
@[simp, norm_cast]
theorem cast_lt [LinearOrderedSemiring α] {m n : PosNum} : (m : α) < n ↔ m < n := by
rw [← cast_to_nat m, ← cast_to_nat n, Nat.cast_lt, lt_to_nat]
#align pos_num.cast_lt PosNum.cast_lt
-/- warning: pos_num.cast_le -> PosNum.cast_le is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LE.le.{0} PosNum PosNum.hasLe m n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) m) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) n)) (LE.le.{0} PosNum PosNum.instLEPosNum m n)
-Case conversion may be inaccurate. Consider using '#align pos_num.cast_le PosNum.cast_leₓ'. -/
@[simp, norm_cast]
theorem cast_le [LinearOrderedSemiring α] {m n : PosNum} : (m : α) ≤ n ↔ m ≤ n := by
rw [← not_lt] <;> exact not_congr cast_lt
@@ -946,65 +868,29 @@ theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by cases b <;> cases
#align num.bit_to_nat Num.bit_to_nat
-/
-/- warning: num.cast_succ' -> Num.cast_succ' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) (Num.succ' n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1)))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Num), Eq.{succ u1} α (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (Num.succ' n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddMonoid.toZero.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1))))
-Case conversion may be inaccurate. Consider using '#align num.cast_succ' Num.cast_succ'ₓ'. -/
theorem cast_succ' [AddMonoidWithOne α] (n) : (succ' n : α) = n + 1 := by
rw [← PosNum.cast_to_nat, succ'_to_nat, Nat.cast_add_one, cast_to_nat]
#align num.cast_succ' Num.cast_succ'
-/- warning: num.cast_succ -> Num.cast_succ is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) (Num.succ n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1)))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Num), Eq.{succ u1} α (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddMonoid.toZero.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)) (Num.succ n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddMonoid.toZero.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1))))
-Case conversion may be inaccurate. Consider using '#align num.cast_succ Num.cast_succₓ'. -/
theorem cast_succ [AddMonoidWithOne α] (n) : (succ n : α) = n + 1 :=
cast_succ' n
#align num.cast_succ Num.cast_succ
-/- warning: num.cast_add -> Num.cast_add is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (m : Num) (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) (HAdd.hAdd.{0, 0, 0} Num Num Num (instHAdd.{0} Num Num.hasAdd) m n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (m : Num) (n : Num), Eq.{succ u1} α (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) (HAdd.hAdd.{0, 0, 0} Num Num Num (instHAdd.{0} Num Num.instAddNum) m n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))) (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) m) (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) n))
-Case conversion may be inaccurate. Consider using '#align num.cast_add Num.cast_addₓ'. -/
@[simp, norm_cast]
theorem cast_add [Semiring α] (m n) : ((m + n : Num) : α) = m + n := by
rw [← cast_to_nat, add_to_nat, Nat.cast_add, cast_to_nat, cast_to_nat]
#align num.cast_add Num.cast_add
-/- warning: num.cast_bit0 -> Num.cast_bit0 is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) (Num.bit0 n)) (bit0.{u1} α (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (n : Num), Eq.{succ u1} α (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) (Num.bit0 n)) (bit0.{u1} α (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) n))
-Case conversion may be inaccurate. Consider using '#align num.cast_bit0 Num.cast_bit0ₓ'. -/
@[simp, norm_cast]
theorem cast_bit0 [Semiring α] (n : Num) : (n.bit0 : α) = bit0 n := by
rw [← bit0_of_bit0, _root_.bit0, cast_add] <;> rfl
#align num.cast_bit0 Num.cast_bit0
-/- warning: num.cast_bit1 -> Num.cast_bit1 is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) (Num.bit1 n)) (bit1.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (n : Num), Eq.{succ u1} α (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) (Num.bit1 n)) (bit1.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) n))
-Case conversion may be inaccurate. Consider using '#align num.cast_bit1 Num.cast_bit1ₓ'. -/
@[simp, norm_cast]
theorem cast_bit1 [Semiring α] (n : Num) : (n.bit1 : α) = bit1 n := by
rw [← bit1_of_bit1, _root_.bit1, bit0_of_bit0, cast_add, cast_bit0] <;> rfl
#align num.cast_bit1 Num.cast_bit1
-/- warning: num.cast_mul -> Num.cast_mul is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (m : Num) (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) (HMul.hMul.{0, 0, 0} Num Num Num (instHMul.{0} Num Num.hasMul) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (Distrib.toHasMul.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (m : Num) (n : Num), Eq.{succ u1} α (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) (HMul.hMul.{0, 0, 0} Num Num Num (instHMul.{0} Num Num.instMulNum) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) m) (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) n))
-Case conversion may be inaccurate. Consider using '#align num.cast_mul Num.cast_mulₓ'. -/
@[simp, norm_cast]
theorem cast_mul [Semiring α] : ∀ m n, ((m * n : Num) : α) = m * n
| 0, 0 => (MulZeroClass.zero_mul _).symm
@@ -1067,12 +953,6 @@ theorem cast_toZNum [Zero α] [One α] [Add α] [Neg α] : ∀ n : Num, (n.toZNu
#align num.cast_to_znum Num.cast_toZNum
-/
-/- warning: num.cast_to_znum_neg -> Num.cast_toZNumNeg is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] [_inst_2 : One.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) _inst_2 (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1))))) (Num.toZNumNeg n)) (Neg.neg.{u1} α (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α _inst_2 (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1))))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] [_inst_2 : One.{u1} α] (n : Num), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) _inst_2 (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (Num.toZNumNeg n)) (Neg.neg.{u1} α (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (castNum.{u1} α _inst_2 (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) n))
-Case conversion may be inaccurate. Consider using '#align num.cast_to_znum_neg Num.cast_toZNumNegₓ'. -/
@[simp]
theorem cast_toZNumNeg [AddGroup α] [One α] : ∀ n : Num, (n.toZNumNeg : α) = -n
| 0 => neg_zero.symm
@@ -1142,12 +1022,6 @@ theorem pred_to_nat : ∀ n : Num, (pred n : ℕ) = Nat.pred n
#align num.pred_to_nat Num.pred_to_nat
-/
-/- warning: num.ppred_to_nat -> Num.ppred_to_nat is a dubious translation:
-lean 3 declaration is
- forall (n : Num), Eq.{1} (Option.{0} Nat) (Functor.map.{0, 0} Option.{0} (Traversable.toFunctor.{0} Option.{0} Option.traversable.{0}) Num Nat ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Num Nat (HasLiftT.mk.{1, 1} Num Nat (CoeTCₓ.coe.{1, 1} Num Nat (numNatCoe.{0} Nat Nat.hasOne Nat.hasAdd Nat.hasZero)))) (Num.ppred n)) (Nat.ppred ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Num Nat (HasLiftT.mk.{1, 1} Num Nat (CoeTCₓ.coe.{1, 1} Num Nat (numNatCoe.{0} Nat Nat.hasOne Nat.hasAdd Nat.hasZero))) n))
-but is expected to have type
- forall (n : Num), Eq.{1} (Option.{0} Nat) (Functor.map.{0, 0} Option.{0} instFunctorOption.{0} Num Nat (castNum.{0} Nat (CanonicallyOrderedCommSemiring.toOne.{0} Nat Nat.canonicallyOrderedCommSemiring) instAddNat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Num.ppred n)) (Nat.ppred (castNum.{0} Nat (CanonicallyOrderedCommSemiring.toOne.{0} Nat Nat.canonicallyOrderedCommSemiring) instAddNat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero) n))
-Case conversion may be inaccurate. Consider using '#align num.ppred_to_nat Num.ppred_to_natₓ'. -/
theorem ppred_to_nat : ∀ n : Num, coe <$> ppred n = Nat.ppred n
| 0 => rfl
| Pos p => by
@@ -1171,34 +1045,16 @@ theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n :=
#align num.cmp_eq Num.cmp_eq
-/
-/- warning: num.cast_lt -> Num.cast_lt is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LT.lt.{0} Num Num.hasLt m n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) m) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) n)) (LT.lt.{0} Num Num.instLTNum m n)
-Case conversion may be inaccurate. Consider using '#align num.cast_lt Num.cast_ltₓ'. -/
@[simp, norm_cast]
theorem cast_lt [LinearOrderedSemiring α] {m n : Num} : (m : α) < n ↔ m < n := by
rw [← cast_to_nat m, ← cast_to_nat n, Nat.cast_lt, lt_to_nat]
#align num.cast_lt Num.cast_lt
-/- warning: num.cast_le -> Num.cast_le is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LE.le.{0} Num Num.hasLe m n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) m) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) n)) (LE.le.{0} Num Num.instLENum m n)
-Case conversion may be inaccurate. Consider using '#align num.cast_le Num.cast_leₓ'. -/
@[simp, norm_cast]
theorem cast_le [LinearOrderedSemiring α] {m n : Num} : (m : α) ≤ n ↔ m ≤ n := by
rw [← not_lt] <;> exact not_congr cast_lt
#align num.cast_le Num.cast_le
-/- warning: num.cast_inj -> Num.cast_inj is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (Eq.{1} Num m n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (Eq.{succ u1} α (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) m) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) n)) (Eq.{1} Num m n)
-Case conversion may be inaccurate. Consider using '#align num.cast_inj Num.cast_injₓ'. -/
@[simp, norm_cast]
theorem cast_inj [LinearOrderedSemiring α] {m n : Num} : (m : α) = n ↔ m = n := by
rw [← cast_to_nat m, ← cast_to_nat n, Nat.cast_inj, to_nat_inj]
@@ -1391,12 +1247,6 @@ theorem cast_neg [Zero α] [One α] [Add α] [Neg α] (n : PosNum) : (neg n : α
#align znum.cast_neg ZNum.cast_neg
-/
-/- warning: znum.cast_zneg -> ZNum.cast_zneg is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] [_inst_2 : One.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) _inst_2 (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1))))) (Neg.neg.{0} ZNum ZNum.hasNeg n)) (Neg.neg.{u1} α (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) _inst_2 (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] [_inst_2 : One.{u1} α] (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) _inst_2 (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (Neg.neg.{0} ZNum ZNum.instNegZNum n)) (Neg.neg.{u1} α (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) _inst_2 (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) n))
-Case conversion may be inaccurate. Consider using '#align znum.cast_zneg ZNum.cast_znegₓ'. -/
@[simp, norm_cast]
theorem cast_zneg [AddGroup α] [One α] : ∀ n, ((-n : ZNum) : α) = -n
| 0 => neg_zero.symm
@@ -1466,12 +1316,6 @@ theorem abs_toZNum : ∀ n : Num, abs n.toZNum = n
#align znum.abs_to_znum ZNum.abs_toZNum
-/
-/- warning: znum.cast_to_int -> ZNum.cast_to_int is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Int α (HasLiftT.mk.{1, succ u1} Int α (CoeTCₓ.coe.{1, succ u1} Int α (Int.castCoe.{u1} α (AddGroupWithOne.toHasIntCast.{u1} α _inst_1)))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt n)) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n)
-Case conversion may be inaccurate. Consider using '#align znum.cast_to_int ZNum.cast_to_intₓ'. -/
@[simp, norm_cast]
theorem cast_to_int [AddGroupWithOne α] : ∀ n : ZNum, ((n : ℤ) : α) = n
| 0 => by rw [cast_zero, cast_zero, Int.cast_zero]
@@ -1495,12 +1339,6 @@ theorem bit1_of_bit1 : ∀ n : ZNum, bit1 n = n.bit1
#align znum.bit1_of_bit1 ZNum.bit1_of_bit1
-/
-/- warning: znum.cast_bit0 -> ZNum.cast_bit0 is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (ZNum.bit0 n)) (bit0.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (ZNum.bit0 n)) (bit0.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n))
-Case conversion may be inaccurate. Consider using '#align znum.cast_bit0 ZNum.cast_bit0ₓ'. -/
@[simp, norm_cast]
theorem cast_bit0 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit0 : α) = bit0 n
| 0 => (add_zero _).symm
@@ -1509,12 +1347,6 @@ theorem cast_bit0 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit0 : α) = bit0 n
rw [ZNum.bit0, cast_neg, cast_neg, PosNum.cast_bit0, _root_.bit0, _root_.bit0, neg_add_rev]
#align znum.cast_bit0 ZNum.cast_bit0
-/- warning: znum.cast_bit1 -> ZNum.cast_bit1 is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (ZNum.bit1 n)) (bit1.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (ZNum.bit1 n)) (bit1.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n))
-Case conversion may be inaccurate. Consider using '#align znum.cast_bit1 ZNum.cast_bit1ₓ'. -/
@[simp, norm_cast]
theorem cast_bit1 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit1 : α) = bit1 n
| 0 => by simp [ZNum.bit1, _root_.bit1, _root_.bit0]
@@ -1529,12 +1361,6 @@ theorem cast_bit1 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit1 : α) = bit1 n
simpa [_root_.bit1, _root_.bit0, -add_comm]
#align znum.cast_bit1 ZNum.cast_bit1
-/- warning: znum.cast_bitm1 -> ZNum.cast_bitm1 is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (ZNum.bitm1 n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))) (bit0.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) n)) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (ZNum.bitm1 n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (AddGroupWithOne.toSub.{u1} α _inst_1)) (bit0.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n)) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))))
-Case conversion may be inaccurate. Consider using '#align znum.cast_bitm1 ZNum.cast_bitm1ₓ'. -/
@[simp]
theorem cast_bitm1 [AddGroupWithOne α] (n : ZNum) : (n.bitm1 : α) = bit0 n - 1 :=
by
@@ -1580,12 +1406,6 @@ theorem cast_to_znum : ∀ n : PosNum, (n : ZNum) = ZNum.pos n
attribute [-simp] Int.add_neg_one
-/- warning: pos_num.cast_sub' -> PosNum.cast_sub' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (m : PosNum) (n : PosNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (PosNum.sub' m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (m : PosNum) (n : PosNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (PosNum.sub' m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (AddGroupWithOne.toSub.{u1} α _inst_1)) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) m) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) n))
-Case conversion may be inaccurate. Consider using '#align pos_num.cast_sub' PosNum.cast_sub'ₓ'. -/
theorem cast_sub' [AddGroupWithOne α] : ∀ m n : PosNum, (sub' m n : α) = m - n
| a, 1 => by
rw [sub'_one, Num.cast_toZNum, ← Num.cast_to_nat, pred'_to_nat, ← Nat.sub_one] <;>
@@ -1632,12 +1452,6 @@ namespace Num
variable {α : Type _}
-/- warning: num.cast_sub' -> Num.cast_sub' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (m : Num) (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (Num.sub' m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (m : Num) (n : Num), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (Num.sub' m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (AddGroupWithOne.toSub.{u1} α _inst_1)) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) m) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) n))
-Case conversion may be inaccurate. Consider using '#align num.cast_sub' Num.cast_sub'ₓ'. -/
@[simp]
theorem cast_sub' [AddGroupWithOne α] : ∀ m n : Num, (sub' m n : α) = m - n
| 0, 0 => (sub_zero _).symm
@@ -1699,12 +1513,6 @@ theorem mem_ofZNum' : ∀ {m : Num} {n : ZNum}, m ∈ ofZNum' n ↔ n = toZNum m
#align num.mem_of_znum' Num.mem_ofZNum'
-/
-/- warning: num.of_znum'_to_nat -> Num.ofZNum'_toNat is a dubious translation:
-lean 3 declaration is
- forall (n : ZNum), Eq.{1} (Option.{0} Nat) (Functor.map.{0, 0} Option.{0} (Traversable.toFunctor.{0} Option.{0} Option.traversable.{0}) Num Nat ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Num Nat (HasLiftT.mk.{1, 1} Num Nat (CoeTCₓ.coe.{1, 1} Num Nat (numNatCoe.{0} Nat Nat.hasOne Nat.hasAdd Nat.hasZero)))) (Num.ofZNum' n)) (Int.toNat' ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n))
-but is expected to have type
- forall (n : ZNum), Eq.{1} (Option.{0} Nat) (Functor.map.{0, 0} Option.{0} instFunctorOption.{0} Num Nat (castNum.{0} Nat (CanonicallyOrderedCommSemiring.toOne.{0} Nat Nat.canonicallyOrderedCommSemiring) instAddNat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Num.ofZNum' n)) (Int.toNat' (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt n))
-Case conversion may be inaccurate. Consider using '#align num.of_znum'_to_nat Num.ofZNum'_toNatₓ'. -/
theorem ofZNum'_toNat : ∀ n : ZNum, coe <$> ofZNum' n = Int.toNat' n
| 0 => rfl
| ZNum.pos p => show _ = Int.toNat' p by rw [← PosNum.to_nat_to_int p] <;> rfl
@@ -1724,12 +1532,6 @@ theorem ofZNum_toNat : ∀ n : ZNum, (ofZNum n : ℕ) = Int.toNat n
#align num.of_znum_to_nat Num.ofZNum_toNat
-/
-/- warning: num.cast_of_znum -> Num.cast_ofZNum is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) (Num.ofZNum n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) (Int.toNat ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (Num.ofZNum n)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (Int.toNat (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt n)))
-Case conversion may be inaccurate. Consider using '#align num.cast_of_znum Num.cast_ofZNumₓ'. -/
@[simp]
theorem cast_ofZNum [AddGroupWithOne α] (n : ZNum) : (ofZNum n : α) = Int.toNat n := by
rw [← cast_to_nat, of_znum_to_nat]
@@ -1749,12 +1551,6 @@ namespace ZNum
variable {α : Type _}
-/- warning: znum.cast_add -> ZNum.cast_add is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (HAdd.hAdd.{0, 0, 0} ZNum ZNum ZNum (instHAdd.{0} ZNum ZNum.hasAdd) m n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (HAdd.hAdd.{0, 0, 0} ZNum ZNum ZNum (instHAdd.{0} ZNum ZNum.instAddZNum) m n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) m) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n))
-Case conversion may be inaccurate. Consider using '#align znum.cast_add ZNum.cast_addₓ'. -/
@[simp, norm_cast]
theorem cast_add [AddGroupWithOne α] : ∀ m n, ((m + n : ZNum) : α) = m + n
| 0, a => by cases a <;> exact (_root_.zero_add _).symm
@@ -1772,12 +1568,6 @@ theorem cast_add [AddGroupWithOne α] : ∀ m n, ((m + n : ZNum) : α) = m + n
← PosNum.cast_to_int b, ← Int.cast_add, ← Int.cast_add, add_comm]
#align znum.cast_add ZNum.cast_add
-/- warning: znum.cast_succ -> ZNum.cast_succ is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (ZNum.succ n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (ZNum.succ n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))))
-Case conversion may be inaccurate. Consider using '#align znum.cast_succ ZNum.cast_succₓ'. -/
@[simp]
theorem cast_succ [AddGroupWithOne α] (n) : ((succ n : ZNum) : α) = n + 1 := by
rw [← add_one, cast_add, cast_one]
@@ -1795,12 +1585,6 @@ theorem mul_to_int : ∀ m n, ((m * n : ZNum) : ℤ) = m * n
#align znum.mul_to_int ZNum.mul_to_int
-/
-/- warning: znum.cast_mul -> ZNum.cast_mul is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) (HMul.hMul.{0, 0, 0} ZNum ZNum ZNum (instHMul.{0} ZNum ZNum.hasMul) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (Distrib.toHasMul.{u1} α (Ring.toDistrib.{u1} α _inst_1))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (Semiring.toOne.{u1} α (Ring.toSemiring.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) (HMul.hMul.{0, 0, 0} ZNum ZNum ZNum (instHMul.{0} ZNum ZNum.instMulZNum) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (NonUnitalNonAssocRing.toMul.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (Semiring.toOne.{u1} α (Ring.toSemiring.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (Semiring.toOne.{u1} α (Ring.toSemiring.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) n))
-Case conversion may be inaccurate. Consider using '#align znum.cast_mul ZNum.cast_mulₓ'. -/
theorem cast_mul [Ring α] (m n) : ((m * n : ZNum) : α) = m * n := by
rw [← cast_to_int, mul_to_int, Int.cast_mul, cast_to_int, cast_to_int]
#align znum.cast_mul ZNum.cast_mul
@@ -1865,34 +1649,16 @@ theorem le_to_int {m n : ZNum} : (m : ℤ) ≤ n ↔ m ≤ n := by
#align znum.le_to_int ZNum.le_to_int
-/
-/- warning: znum.cast_lt -> ZNum.cast_lt is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommGroup.toPartialOrder.{u1} α (StrictOrderedRing.toOrderedAddCommGroup.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) n)) (LT.lt.{0} ZNum ZNum.hasLt m n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedRing.toPartialOrder.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (LT.lt.{0} ZNum ZNum.instLTZNum m n)
-Case conversion may be inaccurate. Consider using '#align znum.cast_lt ZNum.cast_ltₓ'. -/
@[simp, norm_cast]
theorem cast_lt [LinearOrderedRing α] {m n : ZNum} : (m : α) < n ↔ m < n := by
rw [← cast_to_int m, ← cast_to_int n, Int.cast_lt, lt_to_int]
#align znum.cast_lt ZNum.cast_lt
-/- warning: znum.cast_le -> ZNum.cast_le is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommGroup.toPartialOrder.{u1} α (StrictOrderedRing.toOrderedAddCommGroup.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) n)) (LE.le.{0} ZNum ZNum.hasLe m n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedRing.toPartialOrder.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (LE.le.{0} ZNum ZNum.instLEZNum m n)
-Case conversion may be inaccurate. Consider using '#align znum.cast_le ZNum.cast_leₓ'. -/
@[simp, norm_cast]
theorem cast_le [LinearOrderedRing α] {m n : ZNum} : (m : α) ≤ n ↔ m ≤ n := by
rw [← not_lt] <;> exact not_congr cast_lt
#align znum.cast_le ZNum.cast_le
-/- warning: znum.cast_inj -> ZNum.cast_inj is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) n)) (Eq.{1} ZNum m n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (Eq.{succ u1} α (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (Eq.{1} ZNum m n)
-Case conversion may be inaccurate. Consider using '#align znum.cast_inj ZNum.cast_injₓ'. -/
@[simp, norm_cast]
theorem cast_inj [LinearOrderedRing α] {m n : ZNum} : (m : α) = n ↔ m = n := by
rw [← cast_to_int m, ← cast_to_int n, Int.cast_inj, to_int_inj]
@@ -2032,22 +1798,10 @@ instance : LinearOrderedCommRing ZNum :=
apply mul_pos
zero_le_one := by decide }
-/- warning: znum.cast_sub -> ZNum.cast_sub is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) (HSub.hSub.{0, 0, 0} ZNum ZNum ZNum (instHSub.{0} ZNum (SubNegMonoid.toHasSub.{0} ZNum (AddGroup.toSubNegMonoid.{0} ZNum (AddGroupWithOne.toAddGroup.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) n))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (Semiring.toOne.{u1} α (Ring.toSemiring.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) (HSub.hSub.{0, 0, 0} ZNum ZNum ZNum (instHSub.{0} ZNum (Ring.toSub.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (Ring.toSub.{u1} α _inst_1)) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (Semiring.toOne.{u1} α (Ring.toSemiring.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (Semiring.toOne.{u1} α (Ring.toSemiring.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) n))
-Case conversion may be inaccurate. Consider using '#align znum.cast_sub ZNum.cast_subₓ'. -/
@[simp, norm_cast]
theorem cast_sub [Ring α] (m n) : ((m - n : ZNum) : α) = m - n := by simp [sub_eq_neg_add]
#align znum.cast_sub ZNum.cast_sub
-/- warning: znum.neg_of_int -> ZNum.neg_of_int is a dubious translation:
-lean 3 declaration is
- forall (n : Int), Eq.{1} ZNum ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) (Neg.neg.{0} Int Int.hasNeg n)) (Neg.neg.{0} ZNum ZNum.hasNeg ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) n))
-but is expected to have type
- forall (n : Int), Eq.{1} ZNum (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) (Neg.neg.{0} Int Int.instNegInt n)) (Neg.neg.{0} ZNum ZNum.instNegZNum (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) n))
-Case conversion may be inaccurate. Consider using '#align znum.neg_of_int ZNum.neg_of_intₓ'. -/
@[simp, norm_cast]
theorem neg_of_int : ∀ n, ((-n : ℤ) : ZNum) = -n
| (n + 1 : ℕ) => rfl
@@ -2055,12 +1809,6 @@ theorem neg_of_int : ∀ n, ((-n : ℤ) : ZNum) = -n
| -[n+1] => (zneg_zneg _).symm
#align znum.neg_of_int ZNum.neg_of_int
-/- warning: znum.of_int'_eq -> ZNum.ofInt'_eq is a dubious translation:
-lean 3 declaration is
- forall (n : Int), Eq.{1} ZNum (ZNum.ofInt' n) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) n)
-but is expected to have type
- forall (n : Int), Eq.{1} ZNum (ZNum.ofInt' n) (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) n)
-Case conversion may be inaccurate. Consider using '#align znum.of_int'_eq ZNum.ofInt'_eqₓ'. -/
@[simp]
theorem ofInt'_eq : ∀ n : ℤ, ZNum.ofInt' n = n
| (n : ℕ) => rfl
@@ -2078,22 +1826,10 @@ theorem of_nat_toZNum (n : ℕ) : Num.toZNum n = n :=
#align znum.of_nat_to_znum ZNum.of_nat_toZNum
-/
-/- warning: znum.of_to_int -> ZNum.of_to_int is a dubious translation:
-lean 3 declaration is
- forall (n : ZNum), Eq.{1} ZNum ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n)) n
-but is expected to have type
- forall (n : ZNum), Eq.{1} ZNum (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt n)) n
-Case conversion may be inaccurate. Consider using '#align znum.of_to_int ZNum.of_to_intₓ'. -/
@[simp, norm_cast]
theorem of_to_int (n : ZNum) : ((n : ℤ) : ZNum) = n := by rw [← of_int'_eq, of_to_int']
#align znum.of_to_int ZNum.of_to_int
-/- warning: znum.to_of_int -> ZNum.to_of_int is a dubious translation:
-lean 3 declaration is
- forall (n : Int), Eq.{1} Int ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) n)) n
-but is expected to have type
- forall (n : Int), Eq.{1} Int (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) n)) n
-Case conversion may be inaccurate. Consider using '#align znum.to_of_int ZNum.to_of_intₓ'. -/
theorem to_of_int (n : ℤ) : ((n : ZNum) : ℤ) = n :=
Int.inductionOn' n 0 (by simp) (by simp) (by simp)
#align znum.to_of_int ZNum.to_of_int
@@ -2104,34 +1840,16 @@ theorem of_nat_toZNumNeg (n : ℕ) : Num.toZNumNeg n = -n := by rw [← of_nat_t
#align znum.of_nat_to_znum_neg ZNum.of_nat_toZNumNeg
-/
-/- warning: znum.of_int_cast -> ZNum.of_int_cast is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Int), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Int α (HasLiftT.mk.{1, succ u1} Int α (CoeTCₓ.coe.{1, succ u1} Int α (Int.castCoe.{u1} α (AddGroupWithOne.toHasIntCast.{u1} α _inst_1)))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Int), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) n)) (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) n)
-Case conversion may be inaccurate. Consider using '#align znum.of_int_cast ZNum.of_int_castₓ'. -/
@[simp, norm_cast]
theorem of_int_cast [AddGroupWithOne α] (n : ℤ) : ((n : ZNum) : α) = n := by
rw [← cast_to_int, to_of_int]
#align znum.of_int_cast ZNum.of_int_cast
-/- warning: znum.of_nat_cast -> ZNum.of_nat_cast is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Nat), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat ZNum (HasLiftT.mk.{1, 1} Nat ZNum (CoeTCₓ.coe.{1, 1} Nat ZNum (Nat.castCoe.{0} ZNum (AddMonoidWithOne.toNatCast.{0} ZNum ZNum.addMonoidWithOne)))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) n)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Nat), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (Nat.cast.{0} ZNum (Semiring.toNatCast.{0} ZNum (StrictOrderedSemiring.toSemiring.{0} ZNum (LinearOrderedSemiring.toStrictOrderedSemiring.{0} ZNum (LinearOrderedCommSemiring.toLinearOrderedSemiring.{0} ZNum (LinearOrderedCommRing.toLinearOrderedCommSemiring.{0} ZNum ZNum.linearOrderedCommRing))))) n)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) n)
-Case conversion may be inaccurate. Consider using '#align znum.of_nat_cast ZNum.of_nat_castₓ'. -/
@[simp, norm_cast]
theorem of_nat_cast [AddGroupWithOne α] (n : ℕ) : ((n : ZNum) : α) = n := by
rw [← Int.cast_ofNat, of_int_cast, Int.cast_ofNat]
#align znum.of_nat_cast ZNum.of_nat_cast
-/- warning: znum.dvd_to_int -> ZNum.dvd_to_int is a dubious translation:
-lean 3 declaration is
- forall (m : ZNum) (n : ZNum), Iff (Dvd.Dvd.{0} Int (semigroupDvd.{0} Int Int.semigroup) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) m) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n)) (Dvd.Dvd.{0} ZNum (semigroupDvd.{0} ZNum (SemigroupWithZero.toSemigroup.{0} ZNum (NonUnitalSemiring.toSemigroupWithZero.{0} ZNum (NonUnitalRing.toNonUnitalSemiring.{0} ZNum (NonUnitalCommRing.toNonUnitalRing.{0} ZNum (CommRing.toNonUnitalCommRing.{0} ZNum (StrictOrderedCommRing.toCommRing.{0} ZNum (LinearOrderedCommRing.toStrictOrderedCommRing.{0} ZNum ZNum.linearOrderedCommRing)))))))) m n)
-but is expected to have type
- forall (m : ZNum) (n : ZNum), Iff (Dvd.dvd.{0} Int Int.instDvdInt (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt m) (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt n)) (Dvd.dvd.{0} ZNum (semigroupDvd.{0} ZNum (SemigroupWithZero.toSemigroup.{0} ZNum (NonUnitalSemiring.toSemigroupWithZero.{0} ZNum (NonUnitalCommSemiring.toNonUnitalSemiring.{0} ZNum (NonUnitalCommRing.toNonUnitalCommSemiring.{0} ZNum (CommRing.toNonUnitalCommRing.{0} ZNum (StrictOrderedCommRing.toCommRing.{0} ZNum (LinearOrderedCommRing.toStrictOrderedCommRing.{0} ZNum ZNum.linearOrderedCommRing)))))))) m n)
-Case conversion may be inaccurate. Consider using '#align znum.dvd_to_int ZNum.dvd_to_intₓ'. -/
@[simp, norm_cast]
theorem dvd_to_int (m n : ZNum) : (m : ℤ) ∣ n ↔ m ∣ n :=
⟨fun ⟨k, e⟩ => ⟨k, by rw [← of_to_int n, e] <;> simp⟩, fun ⟨k, e⟩ => ⟨k, by simp [e]⟩⟩
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -208,15 +208,13 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
dsimp [cmp]
have := cmp_to_nat a b; revert this; cases cmp a b <;> dsimp <;> intro
· exact Nat.le_succ_of_le (add_lt_add this this)
- · rw [this]
- apply Nat.lt_succ_self
+ · rw [this]; apply Nat.lt_succ_self
· exact cmp_to_nat_lemma this
| bit1 a, bit0 b => by
dsimp [cmp]
have := cmp_to_nat a b; revert this; cases cmp a b <;> dsimp <;> intro
· exact cmp_to_nat_lemma this
- · rw [this]
- apply Nat.lt_succ_self
+ · rw [this]; apply Nat.lt_succ_self
· exact Nat.le_succ_of_le (add_lt_add this this)
| bit1 a, bit1 b => by
have := cmp_to_nat a b; revert this; cases cmp a b <;> dsimp <;> intro
@@ -539,35 +537,30 @@ instance : CommSemiring Num := by
instance : OrderedCancelAddCommMonoid Num :=
{ Num.commSemiring with
lt := (· < ·)
- lt_iff_le_not_le := by
- intro a b
+ lt_iff_le_not_le := by intro a b;
run_tac
- transfer_rw
+ transfer_rw;
apply lt_iff_le_not_le
le := (· ≤ ·)
le_refl := by
run_tac
transfer
- le_trans := by
- intro a b c
+ le_trans := by intro a b c;
run_tac
- transfer_rw
+ transfer_rw;
apply le_trans
- le_antisymm := by
- intro a b
+ le_antisymm := by intro a b;
run_tac
- transfer_rw
+ transfer_rw;
apply le_antisymm
add_le_add_left := by
- intro a b h c
- revert h
+ intro a b h c; revert h;
run_tac
transfer_rw
exact fun h => add_le_add_left h c
- le_of_add_le_add_left := by
- intro a b c
+ le_of_add_le_add_left := by intro a b c;
run_tac
- transfer_rw
+ transfer_rw;
apply le_of_add_le_add_left }
/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic num.transfer_rw -/
@@ -576,21 +569,18 @@ instance : OrderedCancelAddCommMonoid Num :=
instance : LinearOrderedSemiring Num :=
{ Num.commSemiring,
Num.orderedCancelAddCommMonoid with
- le_total := by
- intro a b
+ le_total := by intro a b;
run_tac
- transfer_rw
+ transfer_rw;
apply le_total
zero_le_one := by decide
- mul_lt_mul_of_pos_left := by
- intro a b c
+ mul_lt_mul_of_pos_left := by intro a b c;
run_tac
- transfer_rw
+ transfer_rw;
apply mul_lt_mul_of_pos_left
- mul_lt_mul_of_pos_right := by
- intro a b c
+ mul_lt_mul_of_pos_right := by intro a b c;
run_tac
- transfer_rw
+ transfer_rw;
apply mul_lt_mul_of_pos_right
decidableLt := Num.decidableLT
decidableLe := Num.decidableLE
@@ -797,8 +787,9 @@ instance : Distrib PosNum := by
refine'
{ add := (· + ·)
mul := (· * ·).. } <;>
- · run_tac
- transfer
+ ·
+ run_tac
+ transfer;
simp [mul_add, mul_comm]
/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic pos_num.transfer_rw -/
@@ -808,29 +799,25 @@ instance : Distrib PosNum := by
/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic pos_num.transfer_rw -/
instance : LinearOrder PosNum where
lt := (· < ·)
- lt_iff_le_not_le := by
- intro a b
+ lt_iff_le_not_le := by intro a b;
run_tac
- transfer_rw
+ transfer_rw;
apply lt_iff_le_not_le
le := (· ≤ ·)
le_refl := by
run_tac
transfer
- le_trans := by
- intro a b c
+ le_trans := by intro a b c;
run_tac
- transfer_rw
+ transfer_rw;
apply le_trans
- le_antisymm := by
- intro a b
+ le_antisymm := by intro a b;
run_tac
- transfer_rw
+ transfer_rw;
apply le_antisymm
- le_total := by
- intro a b
+ le_total := by intro a b;
run_tac
- transfer_rw
+ transfer_rw;
apply le_total
decidableLt := by infer_instance
decidableLe := by infer_instance
@@ -1114,8 +1101,7 @@ theorem pred_to_nat {n : PosNum} (h : 1 < n) : (pred n : ℕ) = Nat.pred n :=
· have : (1 : ℕ) ≤ Nat.pred n := Nat.pred_le_pred ((@cast_lt ℕ _ _ _).2 h)
rw [← pred'_to_nat, e] at this
exact absurd this (by decide)
- · rw [← pred'_to_nat, e]
- rfl
+ · rw [← pred'_to_nat, e]; rfl
#align pos_num.pred_to_nat PosNum.pred_to_nat
-/
@@ -1245,14 +1231,11 @@ theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (
cases' m with m <;> cases' n with n <;> try change zero with 0 <;>
try change ((0 : Num) : ℕ) with 0
· rw [f00, Nat.bitwise'_zero] <;> rfl
- · unfold Nat.bitwise'
- rw [f0n, Nat.binaryRec_zero]
+ · unfold Nat.bitwise'; rw [f0n, Nat.binaryRec_zero]
cases g ff tt <;> rfl
· unfold Nat.bitwise'
- generalize h : (Pos m : ℕ) = m'
- revert h
- apply Nat.bitCasesOn m' _
- intro b m' h
+ generalize h : (Pos m : ℕ) = m'; revert h
+ apply Nat.bitCasesOn m' _; intro b m' h
rw [fn0, Nat.binaryRec_eq, Nat.binaryRec_zero, ← h]
cases g tt ff <;> rfl
apply Nat.bitwise'_bit_aux gff
@@ -1313,9 +1296,7 @@ theorem lxor'_to_nat : ∀ m n, (lxor m n : ℕ) = Nat.lxor' m n := by
@[simp, norm_cast]
theorem shiftl_to_nat (m n) : (shiftl m n : ℕ) = Nat.shiftl m n :=
by
- cases m <;> dsimp only [shiftl];
- · symm
- apply Nat.zero_shiftl
+ cases m <;> dsimp only [shiftl]; · symm; apply Nat.zero_shiftl
simp; induction' n with n IH; · rfl
simp [PosNum.shiftl, Nat.shiftl_succ]; rw [← IH]
#align num.shiftl_to_nat Num.shiftl_to_nat
@@ -1325,29 +1306,21 @@ theorem shiftl_to_nat (m n) : (shiftl m n : ℕ) = Nat.shiftl m n :=
@[simp, norm_cast]
theorem shiftr_to_nat (m n) : (shiftr m n : ℕ) = Nat.shiftr m n :=
by
- cases' m with m <;> dsimp only [shiftr];
- · symm
- apply Nat.zero_shiftr
+ cases' m with m <;> dsimp only [shiftr]; · symm; apply Nat.zero_shiftr
induction' n with n IH generalizing m; · cases m <;> rfl
cases' m with m m <;> dsimp only [PosNum.shiftr]
- · rw [Nat.shiftr_eq_div_pow]
- symm
- apply Nat.div_eq_of_lt
+ · rw [Nat.shiftr_eq_div_pow]; symm; apply Nat.div_eq_of_lt
exact @Nat.pow_lt_pow_of_lt_right 2 (by decide) 0 (n + 1) (Nat.succ_pos _)
- · trans
- apply IH
+ · trans; apply IH
change Nat.shiftr m n = Nat.shiftr (bit1 m) (n + 1)
rw [add_comm n 1, Nat.shiftr_add]
- apply congr_arg fun x => Nat.shiftr x n
- unfold Nat.shiftr
+ apply congr_arg fun x => Nat.shiftr x n; unfold Nat.shiftr
change (bit1 ↑m : ℕ) with Nat.bit tt m
rw [Nat.div2_bit]
- · trans
- apply IH
+ · trans; apply IH
change Nat.shiftr m n = Nat.shiftr (bit0 m) (n + 1)
rw [add_comm n 1, Nat.shiftr_add]
- apply congr_arg fun x => Nat.shiftr x n
- unfold Nat.shiftr
+ apply congr_arg fun x => Nat.shiftr x n; unfold Nat.shiftr
change (bit0 ↑m : ℕ) with Nat.bit ff m
rw [Nat.div2_bit]
#align num.shiftr_to_nat Num.shiftr_to_nat
@@ -1358,27 +1331,20 @@ theorem shiftr_to_nat (m n) : (shiftr m n : ℕ) = Nat.shiftr m n :=
theorem testBit_to_nat (m n) : testBit m n = Nat.testBit m n :=
by
cases' m with m <;> unfold test_bit Nat.testBit
- · change (zero : Nat) with 0
- rw [Nat.zero_shiftr]
- rfl
+ · change (zero : Nat) with 0; rw [Nat.zero_shiftr]; rfl
induction' n with n IH generalizing m <;> cases m <;> dsimp only [PosNum.testBit]
· rfl
· exact (Nat.bodd_bit _ _).symm
· exact (Nat.bodd_bit _ _).symm
· change ff = Nat.bodd (Nat.shiftr 1 (n + 1))
- rw [add_comm, Nat.shiftr_add]
- change Nat.shiftr 1 1 with 0
+ rw [add_comm, Nat.shiftr_add]; change Nat.shiftr 1 1 with 0
rw [Nat.zero_shiftr] <;> rfl
· change PosNum.testBit m n = Nat.bodd (Nat.shiftr (Nat.bit tt m) (n + 1))
- rw [add_comm, Nat.shiftr_add]
- unfold Nat.shiftr
- rw [Nat.div2_bit]
- apply IH
+ rw [add_comm, Nat.shiftr_add]; unfold Nat.shiftr
+ rw [Nat.div2_bit]; apply IH
· change PosNum.testBit m n = Nat.bodd (Nat.shiftr (Nat.bit ff m) (n + 1))
- rw [add_comm, Nat.shiftr_add]
- unfold Nat.shiftr
- rw [Nat.div2_bit]
- apply IH
+ rw [add_comm, Nat.shiftr_add]; unfold Nat.shiftr
+ rw [Nat.div2_bit]; apply IH
#align num.test_bit_to_nat Num.testBit_to_nat
-/
@@ -1556,11 +1522,9 @@ theorem cast_bit1 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit1 : α) = bit1 n
| neg p => by
rw [ZNum.bit1, cast_neg, cast_neg]
cases' e : pred' p with a <;> have : p = _ := (succ'_pred' p).symm.trans (congr_arg Num.succ' e)
- · change p = 1 at this
- subst p
+ · change p = 1 at this; subst p
simp [_root_.bit1, _root_.bit0]
- · rw [Num.succ'] at this
- subst p
+ · rw [Num.succ'] at this; subst p
have : (↑(-↑a : ℤ) : α) = -1 + ↑(-↑a + 1 : ℤ) := by simp [add_comm]
simpa [_root_.bit1, _root_.bit0, -add_comm]
#align znum.cast_bit1 ZNum.cast_bit1
@@ -1971,29 +1935,25 @@ unsafe def transfer : tactic Unit :=
/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer_rw -/
instance : LinearOrder ZNum where
lt := (· < ·)
- lt_iff_le_not_le := by
- intro a b
+ lt_iff_le_not_le := by intro a b;
run_tac
- transfer_rw
+ transfer_rw;
apply lt_iff_le_not_le
le := (· ≤ ·)
le_refl := by
run_tac
transfer
- le_trans := by
- intro a b c
+ le_trans := by intro a b c;
run_tac
- transfer_rw
+ transfer_rw;
apply le_trans
- le_antisymm := by
- intro a b
+ le_antisymm := by intro a b;
run_tac
- transfer_rw
+ transfer_rw;
apply le_antisymm
- le_total := by
- intro a b
+ le_total := by intro a b;
run_tac
- transfer_rw
+ transfer_rw;
apply le_total
DecidableEq := ZNum.decidableEq
decidableLe := ZNum.decidableLE
@@ -2049,31 +2009,26 @@ instance : LinearOrderedCommRing ZNum :=
mul_one := by
run_tac
transfer
- left_distrib :=
- by
+ left_distrib := by
run_tac
- transfer
+ transfer;
simp [mul_add]
- right_distrib :=
- by
+ right_distrib := by
run_tac
- transfer
+ transfer;
simp [mul_add, mul_comm]
mul_comm := by
run_tac
transfer
exists_pair_ne := ⟨0, 1, by decide⟩
- add_le_add_left := by
- intro a b h c
- revert h
+ add_le_add_left := by intro a b h c; revert h;
run_tac
- transfer_rw
+ transfer_rw;
exact fun h => add_le_add_left h c
mul_pos := fun a b =>
- show 0 < a → 0 < b → 0 < a * b
- by
+ show 0 < a → 0 < b → 0 < a * b by
run_tac
- transfer_rw
+ transfer_rw;
apply mul_pos
zero_le_one := by decide }
@@ -2220,8 +2175,7 @@ theorem divMod_to_nat (d n : PosNum) :
exact
divmod_to_nat_aux (by simp <;> rfl) (Nat.mul_le_mul_left 2 (PosNum.cast_pos d : (0 : ℕ) < d))
· unfold divmod
- cases' divmod d n with q r
- simp only [divmod] at IH⊢
+ cases' divmod d n with q r; simp only [divmod] at IH⊢
apply divmod_to_nat_aux <;> simp
·
rw [_root_.bit1, _root_.bit1, add_right_comm, bit0_eq_two_mul (n : ℕ), ← IH.1, mul_add, ←
@@ -2229,8 +2183,7 @@ theorem divMod_to_nat (d n : PosNum) :
· rw [← bit0_eq_two_mul]
exact Nat.bit1_lt_bit0 IH.2
· unfold divmod
- cases' divmod d n with q r
- simp only [divmod] at IH⊢
+ cases' divmod d n with q r; simp only [divmod] at IH⊢
apply divmod_to_nat_aux <;> simp
·
rw [bit0_eq_two_mul (n : ℕ), ← IH.1, mul_add, ← bit0_eq_two_mul, mul_left_comm, ←
@@ -2261,10 +2214,7 @@ namespace Num
#print Num.div_zero /-
@[simp]
protected theorem div_zero (n : Num) : n / 0 = 0 :=
- show n.div 0 = 0 by
- cases n
- rfl
- simp [Num.div]
+ show n.div 0 = 0 by cases n; rfl; simp [Num.div]
#align num.div_zero Num.div_zero
-/
@@ -2281,10 +2231,7 @@ theorem div_to_nat : ∀ n d, ((n / d : Num) : ℕ) = n / d
#print Num.mod_zero /-
@[simp]
protected theorem mod_zero (n : Num) : n % 0 = n :=
- show n.mod 0 = n by
- cases n
- rfl
- simp [Num.mod]
+ show n.mod 0 = n by cases n; rfl; simp [Num.mod]
#align num.mod_zero Num.mod_zero
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/8d33f09cd7089ecf074b4791907588245aec5d1b
@@ -1870,11 +1870,11 @@ theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n
| Pos a, Pos b => by
have := PosNum.cmp_to_nat a b <;> revert this <;> dsimp [cmp] <;> cases PosNum.cmp a b <;>
dsimp <;>
- [simp, exact congr_arg Pos, simp [GT.gt]]
+ [simp;exact congr_arg Pos;simp [GT.gt]]
| neg a, neg b => by
have := PosNum.cmp_to_nat b a <;> revert this <;> dsimp [cmp] <;> cases PosNum.cmp b a <;>
dsimp <;>
- [simp, simp (config := { contextual := true }), simp [GT.gt]]
+ [simp;simp (config := { contextual := true });simp [GT.gt]]
| Pos a, 0 => PosNum.cast_pos _
| Pos a, neg b => lt_trans (neg_lt_zero.2 <| PosNum.cast_pos _) (PosNum.cast_pos _)
| 0, neg b => neg_lt_zero.2 <| PosNum.cast_pos _
mathlib commit https://github.com/leanprover-community/mathlib/commit/0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
@@ -883,7 +883,7 @@ theorem cast_inj [AddMonoidWithOne α] [CharZero α] {m n : PosNum} : (m : α) =
/- warning: pos_num.one_le_cast -> PosNum.one_le_cast is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) n)
Case conversion may be inaccurate. Consider using '#align pos_num.one_le_cast PosNum.one_le_castₓ'. -/
@@ -894,7 +894,7 @@ theorem one_le_cast [LinearOrderedSemiring α] (n : PosNum) : (1 : α) ≤ n :=
/- warning: pos_num.cast_pos -> PosNum.cast_pos is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) n)
Case conversion may be inaccurate. Consider using '#align pos_num.cast_pos PosNum.cast_posₓ'. -/
@@ -926,7 +926,7 @@ theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n :=
/- warning: pos_num.cast_lt -> PosNum.cast_lt is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LT.lt.{0} PosNum PosNum.hasLt m n)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LT.lt.{0} PosNum PosNum.hasLt m n)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) m) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) n)) (LT.lt.{0} PosNum PosNum.instLTPosNum m n)
Case conversion may be inaccurate. Consider using '#align pos_num.cast_lt PosNum.cast_ltₓ'. -/
@@ -937,7 +937,7 @@ theorem cast_lt [LinearOrderedSemiring α] {m n : PosNum} : (m : α) < n ↔ m <
/- warning: pos_num.cast_le -> PosNum.cast_le is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LE.le.{0} PosNum PosNum.hasLe m n)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LE.le.{0} PosNum PosNum.hasLe m n)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) m) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) n)) (LE.le.{0} PosNum PosNum.instLEPosNum m n)
Case conversion may be inaccurate. Consider using '#align pos_num.cast_le PosNum.cast_leₓ'. -/
@@ -1187,7 +1187,7 @@ theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n :=
/- warning: num.cast_lt -> Num.cast_lt is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LT.lt.{0} Num Num.hasLt m n)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LT.lt.{0} Num Num.hasLt m n)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) m) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) n)) (LT.lt.{0} Num Num.instLTNum m n)
Case conversion may be inaccurate. Consider using '#align num.cast_lt Num.cast_ltₓ'. -/
@@ -1198,7 +1198,7 @@ theorem cast_lt [LinearOrderedSemiring α] {m n : Num} : (m : α) < n ↔ m < n
/- warning: num.cast_le -> Num.cast_le is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LE.le.{0} Num Num.hasLe m n)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LE.le.{0} Num Num.hasLe m n)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) m) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) n)) (LE.le.{0} Num Num.instLENum m n)
Case conversion may be inaccurate. Consider using '#align num.cast_le Num.cast_leₓ'. -/
@@ -1903,7 +1903,7 @@ theorem le_to_int {m n : ZNum} : (m : ℤ) ≤ n ↔ m ≤ n := by
/- warning: znum.cast_lt -> ZNum.cast_lt is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommGroup.toPartialOrder.{u1} α (StrictOrderedRing.toOrderedAddCommGroup.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) n)) (LT.lt.{0} ZNum ZNum.hasLt m n)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommGroup.toPartialOrder.{u1} α (StrictOrderedRing.toOrderedAddCommGroup.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) n)) (LT.lt.{0} ZNum ZNum.hasLt m n)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedRing.toPartialOrder.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (LT.lt.{0} ZNum ZNum.instLTZNum m n)
Case conversion may be inaccurate. Consider using '#align znum.cast_lt ZNum.cast_ltₓ'. -/
@@ -1914,7 +1914,7 @@ theorem cast_lt [LinearOrderedRing α] {m n : ZNum} : (m : α) < n ↔ m < n :=
/- warning: znum.cast_le -> ZNum.cast_le is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommGroup.toPartialOrder.{u1} α (StrictOrderedRing.toOrderedAddCommGroup.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) n)) (LE.le.{0} ZNum ZNum.hasLe m n)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommGroup.toPartialOrder.{u1} α (StrictOrderedRing.toOrderedAddCommGroup.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) n)) (LE.le.{0} ZNum ZNum.hasLe m n)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedRing.toPartialOrder.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (LE.le.{0} ZNum ZNum.instLEZNum m n)
Case conversion may be inaccurate. Consider using '#align znum.cast_le ZNum.cast_leₓ'. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/08e1d8d4d989df3a6df86f385e9053ec8a372cc1
@@ -80,7 +80,7 @@ theorem to_nat_to_int (n : PosNum) : ((n : ℕ) : ℤ) = n :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Int α (HasLiftT.mk.{1, succ u1} Int α (CoeTCₓ.coe.{1, succ u1} Int α (Int.castCoe.{u1} α (AddGroupWithOne.toHasIntCast.{u1} α _inst_1)))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PosNum Int (HasLiftT.mk.{1, 1} PosNum Int (CoeTCₓ.coe.{1, 1} PosNum Int (posNumCoe.{0} Int Int.hasOne Int.hasAdd))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) n)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) (castPosNum.{0} Int (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt n)) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) n)
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) (castPosNum.{0} Int (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt n)) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) n)
Case conversion may be inaccurate. Consider using '#align pos_num.cast_to_int PosNum.cast_to_intₓ'. -/
@[simp, norm_cast]
theorem cast_to_int [AddGroupWithOne α] (n : PosNum) : ((n : ℤ) : α) = n := by
@@ -615,7 +615,7 @@ theorem to_nat_to_int (n : Num) : ((n : ℕ) : ℤ) = n :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Int α (HasLiftT.mk.{1, succ u1} Int α (CoeTCₓ.coe.{1, succ u1} Int α (Int.castCoe.{u1} α (AddGroupWithOne.toHasIntCast.{u1} α _inst_1)))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Num Int (HasLiftT.mk.{1, 1} Num Int (CoeTCₓ.coe.{1, 1} Num Int (numNatCoe.{0} Int Int.hasOne Int.hasAdd Int.hasZero))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) n)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Num), Eq.{succ u1} α (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) (castNum.{0} Int (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) n)) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) n)
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Num), Eq.{succ u1} α (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) (castNum.{0} Int (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) n)) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) n)
Case conversion may be inaccurate. Consider using '#align num.cast_to_int Num.cast_to_intₓ'. -/
@[simp, norm_cast]
theorem cast_to_int {α} [AddGroupWithOne α] (n : Num) : ((n : ℤ) : α) = n := by
@@ -1504,7 +1504,7 @@ theorem abs_toZNum : ∀ n : Num, abs n.toZNum = n
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Int α (HasLiftT.mk.{1, succ u1} Int α (CoeTCₓ.coe.{1, succ u1} Int α (Int.castCoe.{u1} α (AddGroupWithOne.toHasIntCast.{u1} α _inst_1)))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) n)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt n)) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n)
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt n)) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n)
Case conversion may be inaccurate. Consider using '#align znum.cast_to_int ZNum.cast_to_intₓ'. -/
@[simp, norm_cast]
theorem cast_to_int [AddGroupWithOne α] : ∀ n : ZNum, ((n : ℤ) : α) = n
@@ -1739,7 +1739,7 @@ theorem mem_ofZNum' : ∀ {m : Num} {n : ZNum}, m ∈ ofZNum' n ↔ n = toZNum m
lean 3 declaration is
forall (n : ZNum), Eq.{1} (Option.{0} Nat) (Functor.map.{0, 0} Option.{0} (Traversable.toFunctor.{0} Option.{0} Option.traversable.{0}) Num Nat ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Num Nat (HasLiftT.mk.{1, 1} Num Nat (CoeTCₓ.coe.{1, 1} Num Nat (numNatCoe.{0} Nat Nat.hasOne Nat.hasAdd Nat.hasZero)))) (Num.ofZNum' n)) (Int.toNat' ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n))
but is expected to have type
- forall (n : ZNum), Eq.{1} (Option.{0} Nat) (Functor.map.{0, 0} Option.{0} instFunctorOption.{0} Num Nat (castNum.{0} Nat (CanonicallyOrderedCommSemiring.toOne.{0} Nat Nat.canonicallyOrderedCommSemiring) instAddNat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Num.ofZNum' n)) (Int.toNat' (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt n))
+ forall (n : ZNum), Eq.{1} (Option.{0} Nat) (Functor.map.{0, 0} Option.{0} instFunctorOption.{0} Num Nat (castNum.{0} Nat (CanonicallyOrderedCommSemiring.toOne.{0} Nat Nat.canonicallyOrderedCommSemiring) instAddNat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Num.ofZNum' n)) (Int.toNat' (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt n))
Case conversion may be inaccurate. Consider using '#align num.of_znum'_to_nat Num.ofZNum'_toNatₓ'. -/
theorem ofZNum'_toNat : ∀ n : ZNum, coe <$> ofZNum' n = Int.toNat' n
| 0 => rfl
@@ -1764,7 +1764,7 @@ theorem ofZNum_toNat : ∀ n : ZNum, (ofZNum n : ℕ) = Int.toNat n
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) (Num.ofZNum n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) (Int.toNat ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n)))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (Num.ofZNum n)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (Int.toNat (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt n)))
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (Num.ofZNum n)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (Int.toNat (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt n)))
Case conversion may be inaccurate. Consider using '#align num.cast_of_znum Num.cast_ofZNumₓ'. -/
@[simp]
theorem cast_ofZNum [AddGroupWithOne α] (n : ZNum) : (ofZNum n : α) = Int.toNat n := by
@@ -1835,7 +1835,7 @@ theorem mul_to_int : ∀ m n, ((m * n : ZNum) : ℤ) = m * n
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) (HMul.hMul.{0, 0, 0} ZNum ZNum ZNum (instHMul.{0} ZNum ZNum.hasMul) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (Distrib.toHasMul.{u1} α (Ring.toDistrib.{u1} α _inst_1))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) n))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) (HMul.hMul.{0, 0, 0} ZNum ZNum ZNum (instHMul.{0} ZNum ZNum.instMulZNum) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (NonUnitalNonAssocRing.toMul.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) n))
+ forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (Semiring.toOne.{u1} α (Ring.toSemiring.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) (HMul.hMul.{0, 0, 0} ZNum ZNum ZNum (instHMul.{0} ZNum ZNum.instMulZNum) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (NonUnitalNonAssocRing.toMul.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (Semiring.toOne.{u1} α (Ring.toSemiring.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (Semiring.toOne.{u1} α (Ring.toSemiring.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) n))
Case conversion may be inaccurate. Consider using '#align znum.cast_mul ZNum.cast_mulₓ'. -/
theorem cast_mul [Ring α] (m n) : ((m * n : ZNum) : α) = m * n := by
rw [← cast_to_int, mul_to_int, Int.cast_mul, cast_to_int, cast_to_int]
@@ -1905,7 +1905,7 @@ theorem le_to_int {m n : ZNum} : (m : ℤ) ≤ n ↔ m ≤ n := by
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommGroup.toPartialOrder.{u1} α (StrictOrderedRing.toOrderedAddCommGroup.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) n)) (LT.lt.{0} ZNum ZNum.hasLt m n)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedRing.toPartialOrder.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (LT.lt.{0} ZNum ZNum.instLTZNum m n)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedRing.toPartialOrder.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (LT.lt.{0} ZNum ZNum.instLTZNum m n)
Case conversion may be inaccurate. Consider using '#align znum.cast_lt ZNum.cast_ltₓ'. -/
@[simp, norm_cast]
theorem cast_lt [LinearOrderedRing α] {m n : ZNum} : (m : α) < n ↔ m < n := by
@@ -1916,7 +1916,7 @@ theorem cast_lt [LinearOrderedRing α] {m n : ZNum} : (m : α) < n ↔ m < n :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommGroup.toPartialOrder.{u1} α (StrictOrderedRing.toOrderedAddCommGroup.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) n)) (LE.le.{0} ZNum ZNum.hasLe m n)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedRing.toPartialOrder.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (LE.le.{0} ZNum ZNum.instLEZNum m n)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedRing.toPartialOrder.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (LE.le.{0} ZNum ZNum.instLEZNum m n)
Case conversion may be inaccurate. Consider using '#align znum.cast_le ZNum.cast_leₓ'. -/
@[simp, norm_cast]
theorem cast_le [LinearOrderedRing α] {m n : ZNum} : (m : α) ≤ n ↔ m ≤ n := by
@@ -1927,7 +1927,7 @@ theorem cast_le [LinearOrderedRing α] {m n : ZNum} : (m : α) ≤ n ↔ m ≤ n
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) n)) (Eq.{1} ZNum m n)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (Eq.{succ u1} α (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (Eq.{1} ZNum m n)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (Eq.{succ u1} α (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (Eq.{1} ZNum m n)
Case conversion may be inaccurate. Consider using '#align znum.cast_inj ZNum.cast_injₓ'. -/
@[simp, norm_cast]
theorem cast_inj [LinearOrderedRing α] {m n : ZNum} : (m : α) = n ↔ m = n := by
@@ -2081,7 +2081,7 @@ instance : LinearOrderedCommRing ZNum :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) (HSub.hSub.{0, 0, 0} ZNum ZNum ZNum (instHSub.{0} ZNum (SubNegMonoid.toHasSub.{0} ZNum (AddGroup.toSubNegMonoid.{0} ZNum (AddGroupWithOne.toAddGroup.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) n))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) (HSub.hSub.{0, 0, 0} ZNum ZNum ZNum (instHSub.{0} ZNum (Ring.toSub.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (Ring.toSub.{u1} α _inst_1)) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) n))
+ forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (Semiring.toOne.{u1} α (Ring.toSemiring.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) (HSub.hSub.{0, 0, 0} ZNum ZNum ZNum (instHSub.{0} ZNum (Ring.toSub.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (Ring.toSub.{u1} α _inst_1)) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (Semiring.toOne.{u1} α (Ring.toSemiring.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (Semiring.toOne.{u1} α (Ring.toSemiring.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) n))
Case conversion may be inaccurate. Consider using '#align znum.cast_sub ZNum.cast_subₓ'. -/
@[simp, norm_cast]
theorem cast_sub [Ring α] (m n) : ((m - n : ZNum) : α) = m - n := by simp [sub_eq_neg_add]
@@ -2127,7 +2127,7 @@ theorem of_nat_toZNum (n : ℕ) : Num.toZNum n = n :=
lean 3 declaration is
forall (n : ZNum), Eq.{1} ZNum ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n)) n
but is expected to have type
- forall (n : ZNum), Eq.{1} ZNum (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt n)) n
+ forall (n : ZNum), Eq.{1} ZNum (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt n)) n
Case conversion may be inaccurate. Consider using '#align znum.of_to_int ZNum.of_to_intₓ'. -/
@[simp, norm_cast]
theorem of_to_int (n : ZNum) : ((n : ℤ) : ZNum) = n := by rw [← of_int'_eq, of_to_int']
@@ -2137,7 +2137,7 @@ theorem of_to_int (n : ZNum) : ((n : ℤ) : ZNum) = n := by rw [← of_int'_eq,
lean 3 declaration is
forall (n : Int), Eq.{1} Int ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) n)) n
but is expected to have type
- forall (n : Int), Eq.{1} Int (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) n)) n
+ forall (n : Int), Eq.{1} Int (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) n)) n
Case conversion may be inaccurate. Consider using '#align znum.to_of_int ZNum.to_of_intₓ'. -/
theorem to_of_int (n : ℤ) : ((n : ZNum) : ℤ) = n :=
Int.inductionOn' n 0 (by simp) (by simp) (by simp)
@@ -2164,7 +2164,7 @@ theorem of_int_cast [AddGroupWithOne α] (n : ℤ) : ((n : ZNum) : α) = n := by
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Nat), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat ZNum (HasLiftT.mk.{1, 1} Nat ZNum (CoeTCₓ.coe.{1, 1} Nat ZNum (Nat.castCoe.{0} ZNum (AddMonoidWithOne.toNatCast.{0} ZNum ZNum.addMonoidWithOne)))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) n)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Nat), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (Nat.cast.{0} ZNum (NonAssocRing.toNatCast.{0} ZNum (Ring.toNonAssocRing.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))) n)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) n)
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Nat), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (Nat.cast.{0} ZNum (Semiring.toNatCast.{0} ZNum (StrictOrderedSemiring.toSemiring.{0} ZNum (LinearOrderedSemiring.toStrictOrderedSemiring.{0} ZNum (LinearOrderedCommSemiring.toLinearOrderedSemiring.{0} ZNum (LinearOrderedCommRing.toLinearOrderedCommSemiring.{0} ZNum ZNum.linearOrderedCommRing))))) n)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) n)
Case conversion may be inaccurate. Consider using '#align znum.of_nat_cast ZNum.of_nat_castₓ'. -/
@[simp, norm_cast]
theorem of_nat_cast [AddGroupWithOne α] (n : ℕ) : ((n : ZNum) : α) = n := by
@@ -2175,7 +2175,7 @@ theorem of_nat_cast [AddGroupWithOne α] (n : ℕ) : ((n : ZNum) : α) = n := by
lean 3 declaration is
forall (m : ZNum) (n : ZNum), Iff (Dvd.Dvd.{0} Int (semigroupDvd.{0} Int Int.semigroup) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) m) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n)) (Dvd.Dvd.{0} ZNum (semigroupDvd.{0} ZNum (SemigroupWithZero.toSemigroup.{0} ZNum (NonUnitalSemiring.toSemigroupWithZero.{0} ZNum (NonUnitalRing.toNonUnitalSemiring.{0} ZNum (NonUnitalCommRing.toNonUnitalRing.{0} ZNum (CommRing.toNonUnitalCommRing.{0} ZNum (StrictOrderedCommRing.toCommRing.{0} ZNum (LinearOrderedCommRing.toStrictOrderedCommRing.{0} ZNum ZNum.linearOrderedCommRing)))))))) m n)
but is expected to have type
- forall (m : ZNum) (n : ZNum), Iff (Dvd.dvd.{0} Int Int.instDvdInt (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt m) (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt n)) (Dvd.dvd.{0} ZNum (semigroupDvd.{0} ZNum (SemigroupWithZero.toSemigroup.{0} ZNum (NonUnitalSemiring.toSemigroupWithZero.{0} ZNum (NonUnitalRing.toNonUnitalSemiring.{0} ZNum (NonUnitalCommRing.toNonUnitalRing.{0} ZNum (CommRing.toNonUnitalCommRing.{0} ZNum (StrictOrderedCommRing.toCommRing.{0} ZNum (LinearOrderedCommRing.toStrictOrderedCommRing.{0} ZNum ZNum.linearOrderedCommRing)))))))) m n)
+ forall (m : ZNum) (n : ZNum), Iff (Dvd.dvd.{0} Int Int.instDvdInt (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt m) (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (Semiring.toOne.{0} Int Int.instSemiringInt) Int.instAddInt Int.instNegInt n)) (Dvd.dvd.{0} ZNum (semigroupDvd.{0} ZNum (SemigroupWithZero.toSemigroup.{0} ZNum (NonUnitalSemiring.toSemigroupWithZero.{0} ZNum (NonUnitalCommSemiring.toNonUnitalSemiring.{0} ZNum (NonUnitalCommRing.toNonUnitalCommSemiring.{0} ZNum (CommRing.toNonUnitalCommRing.{0} ZNum (StrictOrderedCommRing.toCommRing.{0} ZNum (LinearOrderedCommRing.toStrictOrderedCommRing.{0} ZNum ZNum.linearOrderedCommRing)))))))) m n)
Case conversion may be inaccurate. Consider using '#align znum.dvd_to_int ZNum.dvd_to_intₓ'. -/
@[simp, norm_cast]
theorem dvd_to_int (m n : ZNum) : (m : ℤ) ∣ n ↔ m ∣ n :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/039ef89bef6e58b32b62898dd48e9d1a4312bb65
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
! This file was ported from Lean 3 source module data.num.lemmas
-! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
+! leanprover-community/mathlib commit 25a9423c6b2c8626e91c688bfd6c1d0a986a3e6e
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -16,6 +16,9 @@ import Mathbin.Data.Nat.Size
/-!
# Properties of the binary representation of integers
+
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/e05ead7993520a432bec94ac504842d90707ad63
@@ -25,26 +25,40 @@ namespace PosNum
variable {α : Type _}
+#print PosNum.cast_one /-
@[simp, norm_cast]
theorem cast_one [One α] [Add α] : ((1 : PosNum) : α) = 1 :=
rfl
#align pos_num.cast_one PosNum.cast_one
+-/
+#print PosNum.cast_one' /-
@[simp]
theorem cast_one' [One α] [Add α] : (PosNum.one : α) = 1 :=
rfl
#align pos_num.cast_one' PosNum.cast_one'
+-/
+#print PosNum.cast_bit0 /-
@[simp, norm_cast]
theorem cast_bit0 [One α] [Add α] (n : PosNum) : (n.bit0 : α) = bit0 n :=
rfl
#align pos_num.cast_bit0 PosNum.cast_bit0
+-/
+#print PosNum.cast_bit1 /-
@[simp, norm_cast]
theorem cast_bit1 [One α] [Add α] (n : PosNum) : (n.bit1 : α) = bit1 n :=
rfl
#align pos_num.cast_bit1 PosNum.cast_bit1
+-/
+/- warning: pos_num.cast_to_nat -> PosNum.cast_to_nat is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1)))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PosNum Nat (HasLiftT.mk.{1, 1} PosNum Nat (CoeTCₓ.coe.{1, 1} PosNum Nat (posNumCoe.{0} Nat Nat.hasOne Nat.hasAdd))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1) (castPosNum.{0} Nat (CanonicallyOrderedCommSemiring.toOne.{0} Nat Nat.canonicallyOrderedCommSemiring) instAddNat n)) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) n)
+Case conversion may be inaccurate. Consider using '#align pos_num.cast_to_nat PosNum.cast_to_natₓ'. -/
@[simp, norm_cast]
theorem cast_to_nat [AddMonoidWithOne α] : ∀ n : PosNum, ((n : ℕ) : α) = n
| 1 => Nat.cast_one
@@ -52,16 +66,25 @@ theorem cast_to_nat [AddMonoidWithOne α] : ∀ n : PosNum, ((n : ℕ) : α) = n
| bit1 p => (Nat.cast_bit1 _).trans <| congr_arg bit1 p.cast_to_nat
#align pos_num.cast_to_nat PosNum.cast_to_nat
+#print PosNum.to_nat_to_int /-
@[simp, norm_cast]
theorem to_nat_to_int (n : PosNum) : ((n : ℕ) : ℤ) = n :=
cast_to_nat _
#align pos_num.to_nat_to_int PosNum.to_nat_to_int
+-/
+/- warning: pos_num.cast_to_int -> PosNum.cast_to_int is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Int α (HasLiftT.mk.{1, succ u1} Int α (CoeTCₓ.coe.{1, succ u1} Int α (Int.castCoe.{u1} α (AddGroupWithOne.toHasIntCast.{u1} α _inst_1)))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) PosNum Int (HasLiftT.mk.{1, 1} PosNum Int (CoeTCₓ.coe.{1, 1} PosNum Int (posNumCoe.{0} Int Int.hasOne Int.hasAdd))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) (castPosNum.{0} Int (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt n)) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) n)
+Case conversion may be inaccurate. Consider using '#align pos_num.cast_to_int PosNum.cast_to_intₓ'. -/
@[simp, norm_cast]
theorem cast_to_int [AddGroupWithOne α] (n : PosNum) : ((n : ℤ) : α) = n := by
rw [← to_nat_to_int, Int.cast_ofNat, cast_to_nat]
#align pos_num.cast_to_int PosNum.cast_to_int
+#print PosNum.succ_to_nat /-
theorem succ_to_nat : ∀ n, (succ n : ℕ) = n + 1
| 1 => rfl
| bit0 p => rfl
@@ -69,13 +92,19 @@ theorem succ_to_nat : ∀ n, (succ n : ℕ) = n + 1
(congr_arg bit0 (succ_to_nat p)).trans <|
show ↑p + 1 + ↑p + 1 = ↑p + ↑p + 1 + 1 by simp [add_left_comm]
#align pos_num.succ_to_nat PosNum.succ_to_nat
+-/
+#print PosNum.one_add /-
theorem one_add (n : PosNum) : 1 + n = succ n := by cases n <;> rfl
#align pos_num.one_add PosNum.one_add
+-/
+#print PosNum.add_one /-
theorem add_one (n : PosNum) : n + 1 = succ n := by cases n <;> rfl
#align pos_num.add_one PosNum.add_one
+-/
+#print PosNum.add_to_nat /-
@[norm_cast]
theorem add_to_nat : ∀ m n, ((m + n : PosNum) : ℕ) = m + n
| 1, b => by rw [one_add b, succ_to_nat, add_comm] <;> rfl
@@ -91,7 +120,9 @@ theorem add_to_nat : ∀ m n, ((m + n : PosNum) : ℕ) = m + n
show (succ (a + b) + succ (a + b) : ℕ) = a + a + 1 + (b + b + 1) by
rw [succ_to_nat, add_to_nat] <;> simp [add_left_comm]
#align pos_num.add_to_nat PosNum.add_to_nat
+-/
+#print PosNum.add_succ /-
theorem add_succ : ∀ m n : PosNum, m + succ n = succ (m + n)
| 1, b => by simp [one_add]
| bit0 a, 1 => congr_arg bit0 (add_one a)
@@ -101,17 +132,23 @@ theorem add_succ : ∀ m n : PosNum, m + succ n = succ (m + n)
| bit1 a, bit0 b => rfl
| bit1 a, bit1 b => congr_arg bit1 (add_succ a b)
#align pos_num.add_succ PosNum.add_succ
+-/
+#print PosNum.bit0_of_bit0 /-
theorem bit0_of_bit0 : ∀ n, bit0 n = bit0 n
| 1 => rfl
| bit0 p => congr_arg bit0 (bit0_of_bit0 p)
| bit1 p => show bit0 (succ (bit0 p)) = _ by rw [bit0_of_bit0] <;> rfl
#align pos_num.bit0_of_bit0 PosNum.bit0_of_bit0
+-/
+#print PosNum.bit1_of_bit1 /-
theorem bit1_of_bit1 (n : PosNum) : bit1 n = bit1 n :=
show bit0 n + 1 = bit1 n by rw [add_one, bit0_of_bit0] <;> rfl
#align pos_num.bit1_of_bit1 PosNum.bit1_of_bit1
+-/
+#print PosNum.mul_to_nat /-
@[norm_cast]
theorem mul_to_nat (m) : ∀ n, ((m * n : PosNum) : ℕ) = m * n
| 1 => (mul_one _).symm
@@ -120,7 +157,9 @@ theorem mul_to_nat (m) : ∀ n, ((m * n : PosNum) : ℕ) = m * n
(add_to_nat (bit0 (m * p)) m).trans <|
show (↑(m * p) + ↑(m * p) + ↑m : ℕ) = ↑m * (p + p) + m by rw [mul_to_nat, left_distrib]
#align pos_num.mul_to_nat PosNum.mul_to_nat
+-/
+#print PosNum.to_nat_pos /-
theorem to_nat_pos : ∀ n : PosNum, 0 < (n : ℕ)
| 1 => zero_lt_one
| bit0 p =>
@@ -128,19 +167,25 @@ theorem to_nat_pos : ∀ n : PosNum, 0 < (n : ℕ)
add_pos h h
| bit1 p => Nat.succ_pos _
#align pos_num.to_nat_pos PosNum.to_nat_pos
+-/
+#print PosNum.cmp_to_nat_lemma /-
theorem cmp_to_nat_lemma {m n : PosNum} : (m : ℕ) < n → (bit1 m : ℕ) < bit0 n :=
show (m : ℕ) < n → (m + m + 1 + 1 : ℕ) ≤ n + n by
intro h <;> rw [Nat.add_right_comm m m 1, add_assoc] <;> exact add_le_add h h
#align pos_num.cmp_to_nat_lemma PosNum.cmp_to_nat_lemma
+-/
+#print PosNum.cmp_swap /-
theorem cmp_swap (m) : ∀ n, (cmp m n).symm = cmp n m := by
induction' m with m IH m IH <;> intro n <;> cases' n with n n <;> try unfold cmp <;> try rfl <;>
rw [← IH] <;>
cases cmp m n <;>
rfl
#align pos_num.cmp_swap PosNum.cmp_swap
+-/
+#print PosNum.cmp_to_nat /-
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
| 1, 1 => rfl
| bit0 a, 1 =>
@@ -176,7 +221,9 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
· rw [this]
· exact Nat.succ_lt_succ (add_lt_add this this)
#align pos_num.cmp_to_nat PosNum.cmp_to_nat
+-/
+#print PosNum.lt_to_nat /-
@[norm_cast]
theorem lt_to_nat {m n : PosNum} : (m : ℕ) < n ↔ m < n :=
show (m : ℕ) < n ↔ cmp m n = Ordering.lt from
@@ -185,11 +232,14 @@ theorem lt_to_nat {m n : PosNum} : (m : ℕ) < n ↔ m < n :=
| Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
| Ordering.gt, h => by simp [not_lt_of_gt h] <;> exact by decide
#align pos_num.lt_to_nat PosNum.lt_to_nat
+-/
+#print PosNum.le_to_nat /-
@[norm_cast]
theorem le_to_nat {m n : PosNum} : (m : ℕ) ≤ n ↔ m ≤ n := by
rw [← not_lt] <;> exact not_congr lt_to_nat
#align pos_num.le_to_nat PosNum.le_to_nat
+-/
end PosNum
@@ -199,50 +249,71 @@ variable {α : Type _}
open PosNum
+#print Num.add_zero /-
theorem add_zero (n : Num) : n + 0 = n := by cases n <;> rfl
#align num.add_zero Num.add_zero
+-/
+#print Num.zero_add /-
theorem zero_add (n : Num) : 0 + n = n := by cases n <;> rfl
#align num.zero_add Num.zero_add
+-/
+#print Num.add_one /-
theorem add_one : ∀ n : Num, n + 1 = succ n
| 0 => rfl
| Pos p => by cases p <;> rfl
#align num.add_one Num.add_one
+-/
+#print Num.add_succ /-
theorem add_succ : ∀ m n : Num, m + succ n = succ (m + n)
| 0, n => by simp [zero_add]
| Pos p, 0 => show pos (p + 1) = succ (pos p + 0) by rw [PosNum.add_one, add_zero] <;> rfl
| Pos p, Pos q => congr_arg pos (PosNum.add_succ _ _)
#align num.add_succ Num.add_succ
+-/
+#print Num.bit0_of_bit0 /-
theorem bit0_of_bit0 : ∀ n : Num, bit0 n = n.bit0
| 0 => rfl
| Pos p => congr_arg pos p.bit0_of_bit0
#align num.bit0_of_bit0 Num.bit0_of_bit0
+-/
+#print Num.bit1_of_bit1 /-
theorem bit1_of_bit1 : ∀ n : Num, bit1 n = n.bit1
| 0 => rfl
| Pos p => congr_arg pos p.bit1_of_bit1
#align num.bit1_of_bit1 Num.bit1_of_bit1
+-/
+#print Num.ofNat'_zero /-
@[simp]
theorem ofNat'_zero : Num.ofNat' 0 = 0 := by simp [Num.ofNat']
#align num.of_nat'_zero Num.ofNat'_zero
+-/
+#print Num.ofNat'_bit /-
theorem ofNat'_bit (b n) : ofNat' (Nat.bit b n) = cond b Num.bit1 Num.bit0 (ofNat' n) :=
Nat.binaryRec_eq rfl _ _
#align num.of_nat'_bit Num.ofNat'_bit
+-/
+#print Num.ofNat'_one /-
@[simp]
theorem ofNat'_one : Num.ofNat' 1 = 1 := by erw [of_nat'_bit tt 0, cond, of_nat'_zero] <;> rfl
#align num.of_nat'_one Num.ofNat'_one
+-/
+#print Num.bit1_succ /-
theorem bit1_succ : ∀ n : Num, n.bit1.succ = n.succ.bit0
| 0 => rfl
| Pos n => rfl
#align num.bit1_succ Num.bit1_succ
+-/
+#print Num.ofNat'_succ /-
theorem ofNat'_succ : ∀ {n}, ofNat' (n + 1) = ofNat' n + 1 :=
Nat.binaryRec (by simp <;> rfl) fun b n ih =>
by
@@ -253,47 +324,69 @@ theorem ofNat'_succ : ∀ {n}, ofNat' (n + 1) = ofNat' n + 1 :=
of_nat'_bit, of_nat'_bit, ih]
simp only [cond, add_one, bit1_succ]
#align num.of_nat'_succ Num.ofNat'_succ
+-/
+#print Num.add_ofNat' /-
@[simp]
theorem add_ofNat' (m n) : Num.ofNat' (m + n) = Num.ofNat' m + Num.ofNat' n := by
induction n <;> simp [Nat.add_zero, of_nat'_succ, add_zero, Nat.add_succ, add_one, add_succ, *]
#align num.add_of_nat' Num.add_ofNat'
+-/
+#print Num.cast_zero /-
@[simp, norm_cast]
theorem cast_zero [Zero α] [One α] [Add α] : ((0 : Num) : α) = 0 :=
rfl
#align num.cast_zero Num.cast_zero
+-/
+#print Num.cast_zero' /-
@[simp]
theorem cast_zero' [Zero α] [One α] [Add α] : (Num.zero : α) = 0 :=
rfl
#align num.cast_zero' Num.cast_zero'
+-/
+#print Num.cast_one /-
@[simp, norm_cast]
theorem cast_one [Zero α] [One α] [Add α] : ((1 : Num) : α) = 1 :=
rfl
#align num.cast_one Num.cast_one
+-/
+#print Num.cast_pos /-
@[simp]
theorem cast_pos [Zero α] [One α] [Add α] (n : PosNum) : (Num.pos n : α) = n :=
rfl
#align num.cast_pos Num.cast_pos
+-/
+#print Num.succ'_to_nat /-
theorem succ'_to_nat : ∀ n, (succ' n : ℕ) = n + 1
| 0 => (zero_add _).symm
| Pos p => PosNum.succ_to_nat _
#align num.succ'_to_nat Num.succ'_to_nat
+-/
+#print Num.succ_to_nat /-
theorem succ_to_nat (n) : (succ n : ℕ) = n + 1 :=
succ'_to_nat n
#align num.succ_to_nat Num.succ_to_nat
+-/
+/- warning: num.cast_to_nat -> Num.cast_to_nat is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1)))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Num Nat (HasLiftT.mk.{1, 1} Num Nat (CoeTCₓ.coe.{1, 1} Num Nat (numNatCoe.{0} Nat Nat.hasOne Nat.hasAdd Nat.hasZero))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Num), Eq.{succ u1} α (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1) (castNum.{0} Nat (CanonicallyOrderedCommSemiring.toOne.{0} Nat Nat.canonicallyOrderedCommSemiring) instAddNat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero) n)) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddMonoid.toZero.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)) n)
+Case conversion may be inaccurate. Consider using '#align num.cast_to_nat Num.cast_to_natₓ'. -/
@[simp, norm_cast]
theorem cast_to_nat [AddMonoidWithOne α] : ∀ n : Num, ((n : ℕ) : α) = n
| 0 => Nat.cast_zero
| Pos p => p.cast_to_nat
#align num.cast_to_nat Num.cast_to_nat
+#print Num.add_to_nat /-
@[norm_cast]
theorem add_to_nat : ∀ m n, ((m + n : Num) : ℕ) = m + n
| 0, 0 => rfl
@@ -301,7 +394,9 @@ theorem add_to_nat : ∀ m n, ((m + n : Num) : ℕ) = m + n
| Pos p, 0 => rfl
| Pos p, Pos q => PosNum.add_to_nat _ _
#align num.add_to_nat Num.add_to_nat
+-/
+#print Num.mul_to_nat /-
@[norm_cast]
theorem mul_to_nat : ∀ m n, ((m * n : Num) : ℕ) = m * n
| 0, 0 => rfl
@@ -309,7 +404,9 @@ theorem mul_to_nat : ∀ m n, ((m * n : Num) : ℕ) = m * n
| Pos p, 0 => rfl
| Pos p, Pos q => PosNum.mul_to_nat _ _
#align num.mul_to_nat Num.mul_to_nat
+-/
+#print Num.cmp_to_nat /-
theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n) ((n : ℕ) < m) : Prop)
| 0, 0 => rfl
| 0, Pos b => to_nat_pos _
@@ -319,7 +416,9 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
have := PosNum.cmp_to_nat a b <;> revert this <;> dsimp [cmp] <;> cases PosNum.cmp a b
exacts[id, congr_arg Pos, id]
#align num.cmp_to_nat Num.cmp_to_nat
+-/
+#print Num.lt_to_nat /-
@[norm_cast]
theorem lt_to_nat {m n : Num} : (m : ℕ) < n ↔ m < n :=
show (m : ℕ) < n ↔ cmp m n = Ordering.lt from
@@ -328,37 +427,46 @@ theorem lt_to_nat {m n : Num} : (m : ℕ) < n ↔ m < n :=
| Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
| Ordering.gt, h => by simp [not_lt_of_gt h] <;> exact by decide
#align num.lt_to_nat Num.lt_to_nat
+-/
+#print Num.le_to_nat /-
@[norm_cast]
theorem le_to_nat {m n : Num} : (m : ℕ) ≤ n ↔ m ≤ n := by
rw [← not_lt] <;> exact not_congr lt_to_nat
#align num.le_to_nat Num.le_to_nat
+-/
end Num
namespace PosNum
+#print PosNum.of_to_nat' /-
@[simp]
theorem of_to_nat' : ∀ n : PosNum, Num.ofNat' (n : ℕ) = Num.pos n
| 1 => by erw [@Num.ofNat'_bit tt 0, Num.ofNat'_zero] <;> rfl
| bit0 p => by erw [@Num.ofNat'_bit ff, of_to_nat'] <;> rfl
| bit1 p => by erw [@Num.ofNat'_bit tt, of_to_nat'] <;> rfl
#align pos_num.of_to_nat' PosNum.of_to_nat'
+-/
end PosNum
namespace Num
+#print Num.of_to_nat' /-
@[simp, norm_cast]
theorem of_to_nat' : ∀ n : Num, Num.ofNat' (n : ℕ) = n
| 0 => ofNat'_zero
| Pos p => p.of_to_nat'
#align num.of_to_nat' Num.of_to_nat'
+-/
+#print Num.to_nat_inj /-
@[norm_cast]
theorem to_nat_inj {m n : Num} : (m : ℕ) = n ↔ m = n :=
⟨fun h => Function.LeftInverse.injective of_to_nat' h, congr_arg _⟩
#align num.to_nat_inj Num.to_nat_inj
+-/
/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
/-- This tactic tries to turn an (in)equality about `num`s to one about `nat`s by rewriting.
@@ -486,45 +594,69 @@ instance : LinearOrderedSemiring Num :=
DecidableEq := Num.decidableEq
exists_pair_ne := ⟨0, 1, by decide⟩ }
+#print Num.add_of_nat /-
@[simp, norm_cast]
theorem add_of_nat (m n) : ((m + n : ℕ) : Num) = m + n :=
add_ofNat' _ _
#align num.add_of_nat Num.add_of_nat
+-/
+#print Num.to_nat_to_int /-
@[simp, norm_cast]
theorem to_nat_to_int (n : Num) : ((n : ℕ) : ℤ) = n :=
cast_to_nat _
#align num.to_nat_to_int Num.to_nat_to_int
+-/
+/- warning: num.cast_to_int -> Num.cast_to_int is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Int α (HasLiftT.mk.{1, succ u1} Int α (CoeTCₓ.coe.{1, succ u1} Int α (Int.castCoe.{u1} α (AddGroupWithOne.toHasIntCast.{u1} α _inst_1)))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Num Int (HasLiftT.mk.{1, 1} Num Int (CoeTCₓ.coe.{1, 1} Num Int (numNatCoe.{0} Int Int.hasOne Int.hasAdd Int.hasZero))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Num), Eq.{succ u1} α (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) (castNum.{0} Int (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) n)) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) n)
+Case conversion may be inaccurate. Consider using '#align num.cast_to_int Num.cast_to_intₓ'. -/
@[simp, norm_cast]
theorem cast_to_int {α} [AddGroupWithOne α] (n : Num) : ((n : ℤ) : α) = n := by
rw [← to_nat_to_int, Int.cast_ofNat, cast_to_nat]
#align num.cast_to_int Num.cast_to_int
+#print Num.to_of_nat /-
theorem to_of_nat : ∀ n : ℕ, ((n : Num) : ℕ) = n
| 0 => by rw [Nat.cast_zero, cast_zero]
| n + 1 => by rw [Nat.cast_succ, add_one, succ_to_nat, to_of_nat]
#align num.to_of_nat Num.to_of_nat
+-/
+/- warning: num.of_nat_cast -> Num.of_nat_cast is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Nat), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Num (HasLiftT.mk.{1, 1} Nat Num (CoeTCₓ.coe.{1, 1} Nat Num (Nat.castCoe.{0} Num (AddMonoidWithOne.toNatCast.{0} Num Num.addMonoidWithOne)))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1)))) n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Nat), Eq.{succ u1} α (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddMonoid.toZero.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)) (Nat.cast.{0} Num (Semiring.toNatCast.{0} Num (StrictOrderedSemiring.toSemiring.{0} Num (LinearOrderedSemiring.toStrictOrderedSemiring.{0} Num Num.linearOrderedSemiring))) n)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α _inst_1) n)
+Case conversion may be inaccurate. Consider using '#align num.of_nat_cast Num.of_nat_castₓ'. -/
@[simp, norm_cast]
theorem of_nat_cast {α} [AddMonoidWithOne α] (n : ℕ) : ((n : Num) : α) = n := by
rw [← cast_to_nat, to_of_nat]
#align num.of_nat_cast Num.of_nat_cast
+#print Num.of_nat_inj /-
@[simp, norm_cast]
theorem of_nat_inj {m n : ℕ} : (m : Num) = n ↔ m = n :=
⟨fun h => Function.LeftInverse.injective to_of_nat h, congr_arg _⟩
#align num.of_nat_inj Num.of_nat_inj
+-/
+#print Num.of_to_nat /-
@[simp, norm_cast]
theorem of_to_nat : ∀ n : Num, ((n : ℕ) : Num) = n :=
of_to_nat'
#align num.of_to_nat Num.of_to_nat
+-/
+#print Num.dvd_to_nat /-
@[norm_cast]
theorem dvd_to_nat (m n : Num) : (m : ℕ) ∣ n ↔ m ∣ n :=
⟨fun ⟨k, e⟩ => ⟨k, by rw [← of_to_nat n, e] <;> simp⟩, fun ⟨k, e⟩ => ⟨k, by simp [e, mul_to_nat]⟩⟩
#align num.dvd_to_nat Num.dvd_to_nat
+-/
end Num
@@ -534,16 +666,21 @@ variable {α : Type _}
open Num
+#print PosNum.of_to_nat /-
@[simp, norm_cast]
theorem of_to_nat : ∀ n : PosNum, ((n : ℕ) : Num) = Num.pos n :=
of_to_nat'
#align pos_num.of_to_nat PosNum.of_to_nat
+-/
+#print PosNum.to_nat_inj /-
@[norm_cast]
theorem to_nat_inj {m n : PosNum} : (m : ℕ) = n ↔ m = n :=
⟨fun h => Num.pos.inj <| by rw [← PosNum.of_to_nat, ← PosNum.of_to_nat, h], congr_arg _⟩
#align pos_num.to_nat_inj PosNum.to_nat_inj
+-/
+#print PosNum.pred'_to_nat /-
theorem pred'_to_nat : ∀ n, (pred' n : ℕ) = Nat.pred n
| 1 => rfl
| bit0 n =>
@@ -556,44 +693,59 @@ theorem pred'_to_nat : ∀ n, (pred' n : ℕ) = Nat.pred n
| Num.pos p, (h : Nat.succ ↑p = n) => by rw [← h] <;> exact (Nat.succ_add p p).symm
| bit1 n => rfl
#align pos_num.pred'_to_nat PosNum.pred'_to_nat
+-/
+#print PosNum.pred'_succ' /-
@[simp]
theorem pred'_succ' (n) : pred' (succ' n) = n :=
Num.to_nat_inj.1 <| by rw [pred'_to_nat, succ'_to_nat, Nat.add_one, Nat.pred_succ]
#align pos_num.pred'_succ' PosNum.pred'_succ'
+-/
+#print PosNum.succ'_pred' /-
@[simp]
theorem succ'_pred' (n) : succ' (pred' n) = n :=
to_nat_inj.1 <| by
rw [succ'_to_nat, pred'_to_nat, Nat.add_one, Nat.succ_pred_eq_of_pos (to_nat_pos _)]
#align pos_num.succ'_pred' PosNum.succ'_pred'
+-/
instance : Dvd PosNum :=
⟨fun m n => Pos m ∣ Pos n⟩
+#print PosNum.dvd_to_nat /-
@[norm_cast]
theorem dvd_to_nat {m n : PosNum} : (m : ℕ) ∣ n ↔ m ∣ n :=
Num.dvd_to_nat (Pos m) (Pos n)
#align pos_num.dvd_to_nat PosNum.dvd_to_nat
+-/
+#print PosNum.size_to_nat /-
theorem size_to_nat : ∀ n, (size n : ℕ) = Nat.size n
| 1 => Nat.size_one.symm
| bit0 n => by
rw [size, succ_to_nat, size_to_nat, cast_bit0, Nat.size_bit0 <| ne_of_gt <| to_nat_pos n]
| bit1 n => by rw [size, succ_to_nat, size_to_nat, cast_bit1, Nat.size_bit1]
#align pos_num.size_to_nat PosNum.size_to_nat
+-/
+#print PosNum.size_eq_natSize /-
theorem size_eq_natSize : ∀ n, (size n : ℕ) = natSize n
| 1 => rfl
| bit0 n => by rw [size, succ_to_nat, nat_size, size_eq_nat_size]
| bit1 n => by rw [size, succ_to_nat, nat_size, size_eq_nat_size]
#align pos_num.size_eq_nat_size PosNum.size_eq_natSize
+-/
+#print PosNum.natSize_to_nat /-
theorem natSize_to_nat (n) : natSize n = Nat.size n := by rw [← size_eq_nat_size, size_to_nat]
#align pos_num.nat_size_to_nat PosNum.natSize_to_nat
+-/
+#print PosNum.natSize_pos /-
theorem natSize_pos (n) : 0 < natSize n := by cases n <;> apply Nat.succ_pos
#align pos_num.nat_size_pos PosNum.natSize_pos
+-/
/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
/-- This tactic tries to turn an (in)equality about `pos_num`s to one about `nat`s by rewriting.
@@ -681,44 +833,85 @@ instance : LinearOrder PosNum where
decidableLe := by infer_instance
DecidableEq := by infer_instance
+#print PosNum.cast_to_num /-
@[simp]
theorem cast_to_num (n : PosNum) : ↑n = Num.pos n := by rw [← cast_to_nat, ← of_to_nat n]
#align pos_num.cast_to_num PosNum.cast_to_num
+-/
+#print PosNum.bit_to_nat /-
@[simp, norm_cast]
theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by cases b <;> rfl
#align pos_num.bit_to_nat PosNum.bit_to_nat
+-/
+/- warning: pos_num.cast_add -> PosNum.cast_add is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (m : PosNum) (n : PosNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) (HAdd.hAdd.{0, 0, 0} PosNum PosNum PosNum (instHAdd.{0} PosNum PosNum.hasAdd) m n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (m : PosNum) (n : PosNum), Eq.{succ u1} α (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (HAdd.hAdd.{0, 0, 0} PosNum PosNum PosNum (instHAdd.{0} PosNum PosNum.instAddPosNum) m n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) m) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) n))
+Case conversion may be inaccurate. Consider using '#align pos_num.cast_add PosNum.cast_addₓ'. -/
@[simp, norm_cast]
theorem cast_add [AddMonoidWithOne α] (m n) : ((m + n : PosNum) : α) = m + n := by
rw [← cast_to_nat, add_to_nat, Nat.cast_add, cast_to_nat, cast_to_nat]
#align pos_num.cast_add PosNum.cast_add
+/- warning: pos_num.cast_succ -> PosNum.cast_succ is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) (PosNum.succ n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1)))))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : PosNum), Eq.{succ u1} α (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (PosNum.succ n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1))))
+Case conversion may be inaccurate. Consider using '#align pos_num.cast_succ PosNum.cast_succₓ'. -/
@[simp, norm_cast]
theorem cast_succ [AddMonoidWithOne α] (n : PosNum) : (succ n : α) = n + 1 := by
rw [← add_one, cast_add, cast_one]
#align pos_num.cast_succ PosNum.cast_succ
+/- warning: pos_num.cast_inj -> PosNum.cast_inj is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] [_inst_2 : CharZero.{u1} α _inst_1] {m : PosNum} {n : PosNum}, Iff (Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n)) (Eq.{1} PosNum m n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] [_inst_2 : CharZero.{u1} α _inst_1] {m : PosNum} {n : PosNum}, Iff (Eq.{succ u1} α (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) m) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) n)) (Eq.{1} PosNum m n)
+Case conversion may be inaccurate. Consider using '#align pos_num.cast_inj PosNum.cast_injₓ'. -/
@[simp, norm_cast]
theorem cast_inj [AddMonoidWithOne α] [CharZero α] {m n : PosNum} : (m : α) = n ↔ m = n := by
rw [← cast_to_nat m, ← cast_to_nat n, Nat.cast_inj, to_nat_inj]
#align pos_num.cast_inj PosNum.cast_inj
+/- warning: pos_num.one_le_cast -> PosNum.one_le_cast is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) n)
+Case conversion may be inaccurate. Consider using '#align pos_num.one_le_cast PosNum.one_le_castₓ'. -/
@[simp]
theorem one_le_cast [LinearOrderedSemiring α] (n : PosNum) : (1 : α) ≤ n := by
rw [← cast_to_nat, ← Nat.cast_one, Nat.cast_le] <;> apply to_nat_pos
#align pos_num.one_le_cast PosNum.one_le_cast
+/- warning: pos_num.cast_pos -> PosNum.cast_pos is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] (n : PosNum), LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) n)
+Case conversion may be inaccurate. Consider using '#align pos_num.cast_pos PosNum.cast_posₓ'. -/
@[simp]
theorem cast_pos [LinearOrderedSemiring α] (n : PosNum) : 0 < (n : α) :=
lt_of_lt_of_le zero_lt_one (one_le_cast n)
#align pos_num.cast_pos PosNum.cast_pos
+/- warning: pos_num.cast_mul -> PosNum.cast_mul is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (m : PosNum) (n : PosNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) (HMul.hMul.{0, 0, 0} PosNum PosNum PosNum (instHMul.{0} PosNum PosNum.hasMul) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (Distrib.toHasMul.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (m : PosNum) (n : PosNum), Eq.{succ u1} α (castPosNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (HMul.hMul.{0, 0, 0} PosNum PosNum PosNum (instHMul.{0} PosNum PosNum.instMulPosNum) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (castPosNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) m) (castPosNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) n))
+Case conversion may be inaccurate. Consider using '#align pos_num.cast_mul PosNum.cast_mulₓ'. -/
@[simp, norm_cast]
theorem cast_mul [Semiring α] (m n) : ((m * n : PosNum) : α) = m * n := by
rw [← cast_to_nat, mul_to_nat, Nat.cast_mul, cast_to_nat, cast_to_nat]
#align pos_num.cast_mul PosNum.cast_mul
+#print PosNum.cmp_eq /-
@[simp]
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n :=
by
@@ -726,12 +919,25 @@ theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n :=
cases cmp m n <;> simp at this⊢ <;> try exact this <;>
· simp [show m ≠ n from fun e => by rw [e] at this <;> exact lt_irrefl _ this]
#align pos_num.cmp_eq PosNum.cmp_eq
+-/
+/- warning: pos_num.cast_lt -> PosNum.cast_lt is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LT.lt.{0} PosNum PosNum.hasLt m n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) m) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) n)) (LT.lt.{0} PosNum PosNum.instLTPosNum m n)
+Case conversion may be inaccurate. Consider using '#align pos_num.cast_lt PosNum.cast_ltₓ'. -/
@[simp, norm_cast]
theorem cast_lt [LinearOrderedSemiring α] {m n : PosNum} : (m : α) < n ↔ m < n := by
rw [← cast_to_nat m, ← cast_to_nat n, Nat.cast_lt, lt_to_nat]
#align pos_num.cast_lt PosNum.cast_lt
+/- warning: pos_num.cast_le -> PosNum.cast_le is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LE.le.{0} PosNum PosNum.hasLe m n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : PosNum} {n : PosNum}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) m) (castPosNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) n)) (LE.le.{0} PosNum PosNum.instLEPosNum m n)
+Case conversion may be inaccurate. Consider using '#align pos_num.cast_le PosNum.cast_leₓ'. -/
@[simp, norm_cast]
theorem cast_le [LinearOrderedSemiring α] {m n : PosNum} : (m : α) ≤ n ↔ m ≤ n := by
rw [← not_lt] <;> exact not_congr cast_lt
@@ -745,32 +951,70 @@ variable {α : Type _}
open PosNum
+#print Num.bit_to_nat /-
theorem bit_to_nat (b n) : (bit b n : ℕ) = Nat.bit b n := by cases b <;> cases n <;> rfl
#align num.bit_to_nat Num.bit_to_nat
+-/
+/- warning: num.cast_succ' -> Num.cast_succ' is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) (Num.succ' n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1)))))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Num), Eq.{succ u1} α (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (Num.succ' n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddMonoid.toZero.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1))))
+Case conversion may be inaccurate. Consider using '#align num.cast_succ' Num.cast_succ'ₓ'. -/
theorem cast_succ' [AddMonoidWithOne α] (n) : (succ' n : α) = n + 1 := by
rw [← PosNum.cast_to_nat, succ'_to_nat, Nat.cast_add_one, cast_to_nat]
#align num.cast_succ' Num.cast_succ'
+/- warning: num.cast_succ -> Num.cast_succ is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) (Num.succ n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1)))))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddMonoidWithOne.{u1} α] (n : Num), Eq.{succ u1} α (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddMonoid.toZero.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)) (Num.succ n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)))) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1))) (AddMonoid.toZero.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α _inst_1)) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (AddMonoidWithOne.toOne.{u1} α _inst_1))))
+Case conversion may be inaccurate. Consider using '#align num.cast_succ Num.cast_succₓ'. -/
theorem cast_succ [AddMonoidWithOne α] (n) : (succ n : α) = n + 1 :=
cast_succ' n
#align num.cast_succ Num.cast_succ
+/- warning: num.cast_add -> Num.cast_add is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (m : Num) (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) (HAdd.hAdd.{0, 0, 0} Num Num Num (instHAdd.{0} Num Num.hasAdd) m n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (m : Num) (n : Num), Eq.{succ u1} α (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) (HAdd.hAdd.{0, 0, 0} Num Num Num (instHAdd.{0} Num Num.instAddNum) m n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))) (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) m) (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) n))
+Case conversion may be inaccurate. Consider using '#align num.cast_add Num.cast_addₓ'. -/
@[simp, norm_cast]
theorem cast_add [Semiring α] (m n) : ((m + n : Num) : α) = m + n := by
rw [← cast_to_nat, add_to_nat, Nat.cast_add, cast_to_nat, cast_to_nat]
#align num.cast_add Num.cast_add
+/- warning: num.cast_bit0 -> Num.cast_bit0 is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) (Num.bit0 n)) (bit0.{u1} α (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (n : Num), Eq.{succ u1} α (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) (Num.bit0 n)) (bit0.{u1} α (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) n))
+Case conversion may be inaccurate. Consider using '#align num.cast_bit0 Num.cast_bit0ₓ'. -/
@[simp, norm_cast]
theorem cast_bit0 [Semiring α] (n : Num) : (n.bit0 : α) = bit0 n := by
rw [← bit0_of_bit0, _root_.bit0, cast_add] <;> rfl
#align num.cast_bit0 Num.cast_bit0
+/- warning: num.cast_bit1 -> Num.cast_bit1 is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) (Num.bit1 n)) (bit1.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (n : Num), Eq.{succ u1} α (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) (Num.bit1 n)) (bit1.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) n))
+Case conversion may be inaccurate. Consider using '#align num.cast_bit1 Num.cast_bit1ₓ'. -/
@[simp, norm_cast]
theorem cast_bit1 [Semiring α] (n : Num) : (n.bit1 : α) = bit1 n := by
rw [← bit1_of_bit1, _root_.bit1, bit0_of_bit0, cast_add, cast_bit0] <;> rfl
#align num.cast_bit1 Num.cast_bit1
+/- warning: num.cast_mul -> Num.cast_mul is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (m : Num) (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) (HMul.hMul.{0, 0, 0} Num Num Num (instHMul.{0} Num Num.hasMul) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (Distrib.toHasMul.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1))))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Semiring.{u1} α] (m : Num) (n : Num), Eq.{succ u1} α (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) (HMul.hMul.{0, 0, 0} Num Num Num (instHMul.{0} Num Num.instMulNum) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (NonUnitalNonAssocSemiring.toMul.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) m) (castNum.{u1} α (Semiring.toOne.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α _inst_1)))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α _inst_1)) n))
+Case conversion may be inaccurate. Consider using '#align num.cast_mul Num.cast_mulₓ'. -/
@[simp, norm_cast]
theorem cast_mul [Semiring α] : ∀ m n, ((m * n : Num) : α) = m * n
| 0, 0 => (MulZeroClass.zero_mul _).symm
@@ -779,19 +1023,26 @@ theorem cast_mul [Semiring α] : ∀ m n, ((m * n : Num) : α) = m * n
| Pos p, Pos q => PosNum.cast_mul _ _
#align num.cast_mul Num.cast_mul
+#print Num.size_to_nat /-
theorem size_to_nat : ∀ n, (size n : ℕ) = Nat.size n
| 0 => Nat.size_zero.symm
| Pos p => p.size_to_nat
#align num.size_to_nat Num.size_to_nat
+-/
+#print Num.size_eq_natSize /-
theorem size_eq_natSize : ∀ n, (size n : ℕ) = natSize n
| 0 => rfl
| Pos p => p.size_eq_natSize
#align num.size_eq_nat_size Num.size_eq_natSize
+-/
+#print Num.natSize_to_nat /-
theorem natSize_to_nat (n) : natSize n = Nat.size n := by rw [← size_eq_nat_size, size_to_nat]
#align num.nat_size_to_nat Num.natSize_to_nat
+-/
+#print Num.ofNat'_eq /-
@[simp]
theorem ofNat'_eq : ∀ n, Num.ofNat' n = n :=
Nat.binaryRec (by simp) fun b n IH => by
@@ -800,33 +1051,50 @@ theorem ofNat'_eq : ∀ n, Num.ofNat' n = n :=
· cases b <;> simp [Nat.bit, bit0_of_bit0, bit1_of_bit1]
· rfl
#align num.of_nat'_eq Num.ofNat'_eq
+-/
+#print Num.zneg_toZNum /-
theorem zneg_toZNum (n : Num) : -n.toZNum = n.toZNumNeg := by cases n <;> rfl
#align num.zneg_to_znum Num.zneg_toZNum
+-/
+#print Num.zneg_toZNumNeg /-
theorem zneg_toZNumNeg (n : Num) : -n.toZNumNeg = n.toZNum := by cases n <;> rfl
#align num.zneg_to_znum_neg Num.zneg_toZNumNeg
+-/
+#print Num.toZNum_inj /-
theorem toZNum_inj {m n : Num} : m.toZNum = n.toZNum ↔ m = n :=
⟨fun h => by cases m <;> cases n <;> cases h <;> rfl, congr_arg _⟩
#align num.to_znum_inj Num.toZNum_inj
+-/
+#print Num.cast_toZNum /-
@[simp, norm_cast squash]
theorem cast_toZNum [Zero α] [One α] [Add α] [Neg α] : ∀ n : Num, (n.toZNum : α) = n
| 0 => rfl
| Num.pos p => rfl
#align num.cast_to_znum Num.cast_toZNum
+-/
+/- warning: num.cast_to_znum_neg -> Num.cast_toZNumNeg is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] [_inst_2 : One.{u1} α] (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) _inst_2 (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1))))) (Num.toZNumNeg n)) (Neg.neg.{u1} α (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α _inst_2 (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1))))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] [_inst_2 : One.{u1} α] (n : Num), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) _inst_2 (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (Num.toZNumNeg n)) (Neg.neg.{u1} α (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (castNum.{u1} α _inst_2 (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) n))
+Case conversion may be inaccurate. Consider using '#align num.cast_to_znum_neg Num.cast_toZNumNegₓ'. -/
@[simp]
theorem cast_toZNumNeg [AddGroup α] [One α] : ∀ n : Num, (n.toZNumNeg : α) = -n
| 0 => neg_zero.symm
| Num.pos p => rfl
#align num.cast_to_znum_neg Num.cast_toZNumNeg
+#print Num.add_toZNum /-
@[simp]
theorem add_toZNum (m n : Num) : Num.toZNum (m + n) = m.toZNum + n.toZNum := by
cases m <;> cases n <;> rfl
#align num.add_to_znum Num.add_toZNum
+-/
end Num
@@ -834,6 +1102,7 @@ namespace PosNum
open Num
+#print PosNum.pred_to_nat /-
theorem pred_to_nat {n : PosNum} (h : 1 < n) : (pred n : ℕ) = Nat.pred n :=
by
unfold pred
@@ -845,20 +1114,29 @@ theorem pred_to_nat {n : PosNum} (h : 1 < n) : (pred n : ℕ) = Nat.pred n :=
· rw [← pred'_to_nat, e]
rfl
#align pos_num.pred_to_nat PosNum.pred_to_nat
+-/
+#print PosNum.sub'_one /-
theorem sub'_one (a : PosNum) : sub' a 1 = (pred' a).toZNum := by cases a <;> rfl
#align pos_num.sub'_one PosNum.sub'_one
+-/
+#print PosNum.one_sub' /-
theorem one_sub' (a : PosNum) : sub' 1 a = (pred' a).toZNumNeg := by cases a <;> rfl
#align pos_num.one_sub' PosNum.one_sub'
+-/
+#print PosNum.lt_iff_cmp /-
theorem lt_iff_cmp {m n} : m < n ↔ cmp m n = Ordering.lt :=
Iff.rfl
#align pos_num.lt_iff_cmp PosNum.lt_iff_cmp
+-/
+#print PosNum.le_iff_cmp /-
theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap] <;> cases cmp m n <;> exact by decide
#align pos_num.le_iff_cmp PosNum.le_iff_cmp
+-/
end PosNum
@@ -868,11 +1146,19 @@ variable {α : Type _}
open PosNum
+#print Num.pred_to_nat /-
theorem pred_to_nat : ∀ n : Num, (pred n : ℕ) = Nat.pred n
| 0 => rfl
| Pos p => by rw [pred, PosNum.pred'_to_nat] <;> rfl
#align num.pred_to_nat Num.pred_to_nat
+-/
+/- warning: num.ppred_to_nat -> Num.ppred_to_nat is a dubious translation:
+lean 3 declaration is
+ forall (n : Num), Eq.{1} (Option.{0} Nat) (Functor.map.{0, 0} Option.{0} (Traversable.toFunctor.{0} Option.{0} Option.traversable.{0}) Num Nat ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Num Nat (HasLiftT.mk.{1, 1} Num Nat (CoeTCₓ.coe.{1, 1} Num Nat (numNatCoe.{0} Nat Nat.hasOne Nat.hasAdd Nat.hasZero)))) (Num.ppred n)) (Nat.ppred ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Num Nat (HasLiftT.mk.{1, 1} Num Nat (CoeTCₓ.coe.{1, 1} Num Nat (numNatCoe.{0} Nat Nat.hasOne Nat.hasAdd Nat.hasZero))) n))
+but is expected to have type
+ forall (n : Num), Eq.{1} (Option.{0} Nat) (Functor.map.{0, 0} Option.{0} instFunctorOption.{0} Num Nat (castNum.{0} Nat (CanonicallyOrderedCommSemiring.toOne.{0} Nat Nat.canonicallyOrderedCommSemiring) instAddNat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Num.ppred n)) (Nat.ppred (castNum.{0} Nat (CanonicallyOrderedCommSemiring.toOne.{0} Nat Nat.canonicallyOrderedCommSemiring) instAddNat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero) n))
+Case conversion may be inaccurate. Consider using '#align num.ppred_to_nat Num.ppred_to_natₓ'. -/
theorem ppred_to_nat : ∀ n : Num, coe <$> ppred n = Nat.ppred n
| 0 => rfl
| Pos p => by
@@ -881,40 +1167,67 @@ theorem ppred_to_nat : ∀ n : Num, coe <$> ppred n = Nat.ppred n
rfl
#align num.ppred_to_nat Num.ppred_to_nat
+#print Num.cmp_swap /-
theorem cmp_swap (m n) : (cmp m n).symm = cmp n m := by
cases m <;> cases n <;> try unfold cmp <;> try rfl <;> apply PosNum.cmp_swap
#align num.cmp_swap Num.cmp_swap
+-/
+#print Num.cmp_eq /-
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n :=
by
have := cmp_to_nat m n
cases cmp m n <;> simp at this⊢ <;> try exact this <;>
· simp [show m ≠ n from fun e => by rw [e] at this <;> exact lt_irrefl _ this]
#align num.cmp_eq Num.cmp_eq
+-/
+/- warning: num.cast_lt -> Num.cast_lt is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LT.lt.{0} Num Num.hasLt m n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) m) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) n)) (LT.lt.{0} Num Num.instLTNum m n)
+Case conversion may be inaccurate. Consider using '#align num.cast_lt Num.cast_ltₓ'. -/
@[simp, norm_cast]
theorem cast_lt [LinearOrderedSemiring α] {m n : Num} : (m : α) < n ↔ m < n := by
rw [← cast_to_nat m, ← cast_to_nat n, Nat.cast_lt, lt_to_nat]
#align num.cast_lt Num.cast_lt
+/- warning: num.cast_le -> Num.cast_le is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedCancelAddCommMonoid.toPartialOrder.{u1} α (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (LE.le.{0} Num Num.hasLe m n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedSemiring.toPartialOrder.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) m) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) n)) (LE.le.{0} Num Num.instLENum m n)
+Case conversion may be inaccurate. Consider using '#align num.cast_le Num.cast_leₓ'. -/
@[simp, norm_cast]
theorem cast_le [LinearOrderedSemiring α] {m n : Num} : (m : α) ≤ n ↔ m ≤ n := by
rw [← not_lt] <;> exact not_congr cast_lt
#align num.cast_le Num.cast_le
+/- warning: num.cast_inj -> Num.cast_inj is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} α (NonAssocSemiring.toAddCommMonoidWithOne.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))))))))) n)) (Eq.{1} Num m n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedSemiring.{u1} α] {m : Num} {n : Num}, Iff (Eq.{succ u1} α (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) m) (castNum.{u1} α (Semiring.toOne.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} α (Semiring.toNonAssocSemiring.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))))) (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α _inst_1)))) n)) (Eq.{1} Num m n)
+Case conversion may be inaccurate. Consider using '#align num.cast_inj Num.cast_injₓ'. -/
@[simp, norm_cast]
theorem cast_inj [LinearOrderedSemiring α] {m n : Num} : (m : α) = n ↔ m = n := by
rw [← cast_to_nat m, ← cast_to_nat n, Nat.cast_inj, to_nat_inj]
#align num.cast_inj Num.cast_inj
+#print Num.lt_iff_cmp /-
theorem lt_iff_cmp {m n} : m < n ↔ cmp m n = Ordering.lt :=
Iff.rfl
#align num.lt_iff_cmp Num.lt_iff_cmp
+-/
+#print Num.le_iff_cmp /-
theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap] <;> cases cmp m n <;> exact by decide
#align num.le_iff_cmp Num.le_iff_cmp
+-/
+#print Num.bitwise'_to_nat /-
theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (p : PosNum → PosNum → Num)
(gff : g false false = false) (f00 : f 0 0 = 0)
(f0n : ∀ n, f 0 (pos n) = cond (g false true) (pos n) 0)
@@ -961,29 +1274,39 @@ theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (
rw [← show ∀ n, ↑(p m n) = Nat.bitwise' g ↑m ↑n from IH]
rw [← bit_to_nat, pbb]
#align num.bitwise_to_nat Num.bitwise'_to_nat
+-/
+#print Num.lor'_to_nat /-
@[simp, norm_cast]
-theorem lor_to_nat : ∀ m n, (lor m n : ℕ) = Nat.lor' m n := by
+theorem lor'_to_nat : ∀ m n, (lor m n : ℕ) = Nat.lor' m n := by
apply bitwise_to_nat fun x y => Pos (PosNum.lor x y) <;> intros <;> try cases a <;>
try cases b <;>
rfl
-#align num.lor_to_nat Num.lor_to_nat
+#align num.lor_to_nat Num.lor'_to_nat
+-/
+#print Num.land'_to_nat /-
@[simp, norm_cast]
-theorem land_to_nat : ∀ m n, (land m n : ℕ) = Nat.land' m n := by
+theorem land'_to_nat : ∀ m n, (land m n : ℕ) = Nat.land' m n := by
apply bitwise_to_nat PosNum.land <;> intros <;> try cases a <;> try cases b <;> rfl
-#align num.land_to_nat Num.land_to_nat
+#align num.land_to_nat Num.land'_to_nat
+-/
+#print Num.ldiff'_to_nat /-
@[simp, norm_cast]
-theorem ldiff_to_nat : ∀ m n, (ldiff m n : ℕ) = Nat.ldiff' m n := by
+theorem ldiff'_to_nat : ∀ m n, (ldiff m n : ℕ) = Nat.ldiff' m n := by
apply bitwise_to_nat PosNum.ldiff <;> intros <;> try cases a <;> try cases b <;> rfl
-#align num.ldiff_to_nat Num.ldiff_to_nat
+#align num.ldiff_to_nat Num.ldiff'_to_nat
+-/
+#print Num.lxor'_to_nat /-
@[simp, norm_cast]
-theorem lxor_to_nat : ∀ m n, (lxor m n : ℕ) = Nat.lxor' m n := by
+theorem lxor'_to_nat : ∀ m n, (lxor m n : ℕ) = Nat.lxor' m n := by
apply bitwise_to_nat PosNum.lxor <;> intros <;> try cases a <;> try cases b <;> rfl
-#align num.lxor_to_nat Num.lxor_to_nat
+#align num.lxor_to_nat Num.lxor'_to_nat
+-/
+#print Num.shiftl_to_nat /-
@[simp, norm_cast]
theorem shiftl_to_nat (m n) : (shiftl m n : ℕ) = Nat.shiftl m n :=
by
@@ -993,7 +1316,9 @@ theorem shiftl_to_nat (m n) : (shiftl m n : ℕ) = Nat.shiftl m n :=
simp; induction' n with n IH; · rfl
simp [PosNum.shiftl, Nat.shiftl_succ]; rw [← IH]
#align num.shiftl_to_nat Num.shiftl_to_nat
+-/
+#print Num.shiftr_to_nat /-
@[simp, norm_cast]
theorem shiftr_to_nat (m n) : (shiftr m n : ℕ) = Nat.shiftr m n :=
by
@@ -1023,7 +1348,9 @@ theorem shiftr_to_nat (m n) : (shiftr m n : ℕ) = Nat.shiftr m n :=
change (bit0 ↑m : ℕ) with Nat.bit ff m
rw [Nat.div2_bit]
#align num.shiftr_to_nat Num.shiftr_to_nat
+-/
+#print Num.testBit_to_nat /-
@[simp]
theorem testBit_to_nat (m n) : testBit m n = Nat.testBit m n :=
by
@@ -1050,6 +1377,7 @@ theorem testBit_to_nat (m n) : testBit m n = Nat.testBit m n :=
rw [Nat.div2_bit]
apply IH
#align num.test_bit_to_nat Num.testBit_to_nat
+-/
end Num
@@ -1059,31 +1387,47 @@ variable {α : Type _}
open PosNum
+#print ZNum.cast_zero /-
@[simp, norm_cast]
theorem cast_zero [Zero α] [One α] [Add α] [Neg α] : ((0 : ZNum) : α) = 0 :=
rfl
#align znum.cast_zero ZNum.cast_zero
+-/
+#print ZNum.cast_zero' /-
@[simp]
theorem cast_zero' [Zero α] [One α] [Add α] [Neg α] : (ZNum.zero : α) = 0 :=
rfl
#align znum.cast_zero' ZNum.cast_zero'
+-/
+#print ZNum.cast_one /-
@[simp, norm_cast]
theorem cast_one [Zero α] [One α] [Add α] [Neg α] : ((1 : ZNum) : α) = 1 :=
rfl
#align znum.cast_one ZNum.cast_one
+-/
+#print ZNum.cast_pos /-
@[simp]
theorem cast_pos [Zero α] [One α] [Add α] [Neg α] (n : PosNum) : (pos n : α) = n :=
rfl
#align znum.cast_pos ZNum.cast_pos
+-/
+#print ZNum.cast_neg /-
@[simp]
theorem cast_neg [Zero α] [One α] [Add α] [Neg α] (n : PosNum) : (neg n : α) = -n :=
rfl
#align znum.cast_neg ZNum.cast_neg
+-/
+/- warning: znum.cast_zneg -> ZNum.cast_zneg is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] [_inst_2 : One.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) _inst_2 (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1))))) (Neg.neg.{0} ZNum ZNum.hasNeg n)) (Neg.neg.{u1} α (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) _inst_2 (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] [_inst_2 : One.{u1} α] (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) _inst_2 (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (Neg.neg.{0} ZNum ZNum.instNegZNum n)) (Neg.neg.{u1} α (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) _inst_2 (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) n))
+Case conversion may be inaccurate. Consider using '#align znum.cast_zneg ZNum.cast_znegₓ'. -/
@[simp, norm_cast]
theorem cast_zneg [AddGroup α] [One α] : ∀ n, ((-n : ZNum) : α) = -n
| 0 => neg_zero.symm
@@ -1091,48 +1435,74 @@ theorem cast_zneg [AddGroup α] [One α] : ∀ n, ((-n : ZNum) : α) = -n
| neg p => (neg_neg _).symm
#align znum.cast_zneg ZNum.cast_zneg
+#print ZNum.neg_zero /-
theorem neg_zero : (-0 : ZNum) = 0 :=
rfl
#align znum.neg_zero ZNum.neg_zero
+-/
+#print ZNum.zneg_pos /-
theorem zneg_pos (n : PosNum) : -pos n = neg n :=
rfl
#align znum.zneg_pos ZNum.zneg_pos
+-/
+#print ZNum.zneg_neg /-
theorem zneg_neg (n : PosNum) : -neg n = pos n :=
rfl
#align znum.zneg_neg ZNum.zneg_neg
+-/
+#print ZNum.zneg_zneg /-
theorem zneg_zneg (n : ZNum) : - -n = n := by cases n <;> rfl
#align znum.zneg_zneg ZNum.zneg_zneg
+-/
+#print ZNum.zneg_bit1 /-
theorem zneg_bit1 (n : ZNum) : -n.bit1 = (-n).bitm1 := by cases n <;> rfl
#align znum.zneg_bit1 ZNum.zneg_bit1
+-/
+#print ZNum.zneg_bitm1 /-
theorem zneg_bitm1 (n : ZNum) : -n.bitm1 = (-n).bit1 := by cases n <;> rfl
#align znum.zneg_bitm1 ZNum.zneg_bitm1
+-/
+#print ZNum.zneg_succ /-
theorem zneg_succ (n : ZNum) : -n.succ = (-n).pred := by
cases n <;> try rfl <;> rw [succ, Num.zneg_toZNumNeg] <;> rfl
#align znum.zneg_succ ZNum.zneg_succ
+-/
+#print ZNum.zneg_pred /-
theorem zneg_pred (n : ZNum) : -n.pred = (-n).succ := by
rw [← zneg_zneg (succ (-n)), zneg_succ, zneg_zneg]
#align znum.zneg_pred ZNum.zneg_pred
+-/
+#print ZNum.abs_to_nat /-
@[simp]
theorem abs_to_nat : ∀ n, (abs n : ℕ) = Int.natAbs n
| 0 => rfl
| Pos p => congr_arg Int.natAbs p.to_nat_to_int
| neg p => show Int.natAbs ((p : ℕ) : ℤ) = Int.natAbs (-p) by rw [p.to_nat_to_int, Int.natAbs_neg]
#align znum.abs_to_nat ZNum.abs_to_nat
+-/
+#print ZNum.abs_toZNum /-
@[simp]
theorem abs_toZNum : ∀ n : Num, abs n.toZNum = n
| 0 => rfl
| Num.pos p => rfl
#align znum.abs_to_znum ZNum.abs_toZNum
+-/
+/- warning: znum.cast_to_int -> ZNum.cast_to_int is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Int α (HasLiftT.mk.{1, succ u1} Int α (CoeTCₓ.coe.{1, succ u1} Int α (Int.castCoe.{u1} α (AddGroupWithOne.toHasIntCast.{u1} α _inst_1)))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt n)) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n)
+Case conversion may be inaccurate. Consider using '#align znum.cast_to_int ZNum.cast_to_intₓ'. -/
@[simp, norm_cast]
theorem cast_to_int [AddGroupWithOne α] : ∀ n : ZNum, ((n : ℤ) : α) = n
| 0 => by rw [cast_zero, cast_zero, Int.cast_zero]
@@ -1140,18 +1510,28 @@ theorem cast_to_int [AddGroupWithOne α] : ∀ n : ZNum, ((n : ℤ) : α) = n
| neg p => by rw [cast_neg, cast_neg, Int.cast_neg, PosNum.cast_to_int]
#align znum.cast_to_int ZNum.cast_to_int
+#print ZNum.bit0_of_bit0 /-
theorem bit0_of_bit0 : ∀ n : ZNum, bit0 n = n.bit0
| 0 => rfl
| Pos a => congr_arg pos a.bit0_of_bit0
| neg a => congr_arg neg a.bit0_of_bit0
#align znum.bit0_of_bit0 ZNum.bit0_of_bit0
+-/
+#print ZNum.bit1_of_bit1 /-
theorem bit1_of_bit1 : ∀ n : ZNum, bit1 n = n.bit1
| 0 => rfl
| Pos a => congr_arg pos a.bit1_of_bit1
| neg a => show PosNum.sub' 1 (bit0 a) = _ by rw [PosNum.one_sub', a.bit0_of_bit0] <;> rfl
#align znum.bit1_of_bit1 ZNum.bit1_of_bit1
+-/
+/- warning: znum.cast_bit0 -> ZNum.cast_bit0 is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (ZNum.bit0 n)) (bit0.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (ZNum.bit0 n)) (bit0.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n))
+Case conversion may be inaccurate. Consider using '#align znum.cast_bit0 ZNum.cast_bit0ₓ'. -/
@[simp, norm_cast]
theorem cast_bit0 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit0 : α) = bit0 n
| 0 => (add_zero _).symm
@@ -1160,6 +1540,12 @@ theorem cast_bit0 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit0 : α) = bit0 n
rw [ZNum.bit0, cast_neg, cast_neg, PosNum.cast_bit0, _root_.bit0, _root_.bit0, neg_add_rev]
#align znum.cast_bit0 ZNum.cast_bit0
+/- warning: znum.cast_bit1 -> ZNum.cast_bit1 is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (ZNum.bit1 n)) (bit1.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (ZNum.bit1 n)) (bit1.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n))
+Case conversion may be inaccurate. Consider using '#align znum.cast_bit1 ZNum.cast_bit1ₓ'. -/
@[simp, norm_cast]
theorem cast_bit1 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit1 : α) = bit1 n
| 0 => by simp [ZNum.bit1, _root_.bit1, _root_.bit0]
@@ -1176,6 +1562,12 @@ theorem cast_bit1 [AddGroupWithOne α] : ∀ n : ZNum, (n.bit1 : α) = bit1 n
simpa [_root_.bit1, _root_.bit0, -add_comm]
#align znum.cast_bit1 ZNum.cast_bit1
+/- warning: znum.cast_bitm1 -> ZNum.cast_bitm1 is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (ZNum.bitm1 n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))) (bit0.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) n)) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (ZNum.bitm1 n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (AddGroupWithOne.toSub.{u1} α _inst_1)) (bit0.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n)) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))))
+Case conversion may be inaccurate. Consider using '#align znum.cast_bitm1 ZNum.cast_bitm1ₓ'. -/
@[simp]
theorem cast_bitm1 [AddGroupWithOne α] (n : ZNum) : (n.bitm1 : α) = bit0 n - 1 :=
by
@@ -1187,17 +1579,23 @@ theorem cast_bitm1 [AddGroupWithOne α] (n : ZNum) : (n.bitm1 : α) = bit0 n - 1
simpa [_root_.bit1, _root_.bit0, sub_eq_add_neg, -Int.add_neg_one]
#align znum.cast_bitm1 ZNum.cast_bitm1
+#print ZNum.add_zero /-
theorem add_zero (n : ZNum) : n + 0 = n := by cases n <;> rfl
#align znum.add_zero ZNum.add_zero
+-/
+#print ZNum.zero_add /-
theorem zero_add (n : ZNum) : 0 + n = n := by cases n <;> rfl
#align znum.zero_add ZNum.zero_add
+-/
+#print ZNum.add_one /-
theorem add_one : ∀ n : ZNum, n + 1 = succ n
| 0 => rfl
| Pos p => congr_arg pos p.add_one
| neg p => by cases p <;> rfl
#align znum.add_one ZNum.add_one
+-/
end ZNum
@@ -1205,14 +1603,22 @@ namespace PosNum
variable {α : Type _}
-theorem cast_to_zNum : ∀ n : PosNum, (n : ZNum) = ZNum.pos n
+#print PosNum.cast_to_znum /-
+theorem cast_to_znum : ∀ n : PosNum, (n : ZNum) = ZNum.pos n
| 1 => rfl
| bit0 p => (ZNum.bit0_of_bit0 p).trans <| congr_arg _ (cast_to_znum p)
| bit1 p => (ZNum.bit1_of_bit1 p).trans <| congr_arg _ (cast_to_znum p)
-#align pos_num.cast_to_znum PosNum.cast_to_zNum
+#align pos_num.cast_to_znum PosNum.cast_to_znum
+-/
attribute [-simp] Int.add_neg_one
+/- warning: pos_num.cast_sub' -> PosNum.cast_sub' is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (m : PosNum) (n : PosNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (PosNum.sub' m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) PosNum α (HasLiftT.mk.{1, succ u1} PosNum α (CoeTCₓ.coe.{1, succ u1} PosNum α (posNumCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (m : PosNum) (n : PosNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (PosNum.sub' m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (AddGroupWithOne.toSub.{u1} α _inst_1)) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) m) (castPosNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) n))
+Case conversion may be inaccurate. Consider using '#align pos_num.cast_sub' PosNum.cast_sub'ₓ'. -/
theorem cast_sub' [AddGroupWithOne α] : ∀ m n : PosNum, (sub' m n : α) = m - n
| a, 1 => by
rw [sub'_one, Num.cast_toZNum, ← Num.cast_to_nat, pred'_to_nat, ← Nat.sub_one] <;>
@@ -1241,13 +1647,17 @@ theorem cast_sub' [AddGroupWithOne α] : ∀ m n : PosNum, (sub' m n : α) = m -
simpa [_root_.bit1, _root_.bit0, sub_eq_add_neg]
#align pos_num.cast_sub' PosNum.cast_sub'
+#print PosNum.to_nat_eq_succ_pred /-
theorem to_nat_eq_succ_pred (n : PosNum) : (n : ℕ) = n.pred' + 1 := by
rw [← Num.succ'_to_nat, n.succ'_pred']
#align pos_num.to_nat_eq_succ_pred PosNum.to_nat_eq_succ_pred
+-/
+#print PosNum.to_int_eq_succ_pred /-
theorem to_int_eq_succ_pred (n : PosNum) : (n : ℤ) = (n.pred' : ℕ) + 1 := by
rw [← n.to_nat_to_int, to_nat_eq_succ_pred] <;> rfl
#align pos_num.to_int_eq_succ_pred PosNum.to_int_eq_succ_pred
+-/
end PosNum
@@ -1255,6 +1665,12 @@ namespace Num
variable {α : Type _}
+/- warning: num.cast_sub' -> Num.cast_sub' is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (m : Num) (n : Num), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (Num.sub' m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (m : Num) (n : Num), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (Num.sub' m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (AddGroupWithOne.toSub.{u1} α _inst_1)) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) m) (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) n))
+Case conversion may be inaccurate. Consider using '#align num.cast_sub' Num.cast_sub'ₓ'. -/
@[simp]
theorem cast_sub' [AddGroupWithOne α] : ∀ m n : Num, (sub' m n : α) = m - n
| 0, 0 => (sub_zero _).symm
@@ -1263,23 +1679,30 @@ theorem cast_sub' [AddGroupWithOne α] : ∀ m n : Num, (sub' m n : α) = m - n
| Pos a, Pos b => PosNum.cast_sub' _ _
#align num.cast_sub' Num.cast_sub'
+#print Num.toZNum_succ /-
theorem toZNum_succ : ∀ n : Num, n.succ.toZNum = n.toZNum.succ
| 0 => rfl
| Pos n => rfl
#align num.to_znum_succ Num.toZNum_succ
+-/
+#print Num.toZNumNeg_succ /-
theorem toZNumNeg_succ : ∀ n : Num, n.succ.toZNumNeg = n.toZNumNeg.pred
| 0 => rfl
| Pos n => rfl
#align num.to_znum_neg_succ Num.toZNumNeg_succ
+-/
+#print Num.pred_succ /-
@[simp]
theorem pred_succ : ∀ n : ZNum, n.pred.succ = n
| 0 => rfl
| ZNum.neg p => show toZNumNeg (pos p).succ'.pred' = _ by rw [PosNum.pred'_succ'] <;> rfl
| ZNum.pos p => by rw [ZNum.pred, ← to_znum_succ, Num.succ, PosNum.succ'_pred', to_znum]
#align num.pred_succ Num.pred_succ
+-/
+#print Num.succ_ofInt' /-
theorem succ_ofInt' : ∀ n, ZNum.ofInt' (n + 1) = ZNum.ofInt' n + 1
| (n : ℕ) => by
erw [ZNum.ofInt', ZNum.ofInt', Num.ofNat'_succ, Num.add_one, to_znum_succ, ZNum.add_one]
@@ -1288,14 +1711,18 @@ theorem succ_ofInt' : ∀ n, ZNum.ofInt' (n + 1) = ZNum.ofInt' n + 1
erw [ZNum.ofInt', ZNum.ofInt', @Num.ofNat'_succ (n + 1), Num.add_one, to_znum_neg_succ,
@of_nat'_succ n, Num.add_one, ZNum.add_one, pred_succ]
#align num.succ_of_int' Num.succ_ofInt'
+-/
+#print Num.ofInt'_toZNum /-
theorem ofInt'_toZNum : ∀ n : ℕ, toZNum n = ZNum.ofInt' n
| 0 => rfl
| n + 1 => by
rw [Nat.cast_succ, Num.add_one, to_znum_succ, of_int'_to_znum, Nat.cast_succ, succ_of_int',
ZNum.add_one]
#align num.of_int'_to_znum Num.ofInt'_toZNum
+-/
+#print Num.mem_ofZNum' /-
theorem mem_ofZNum' : ∀ {m : Num} {n : ZNum}, m ∈ ofZNum' n ↔ n = toZNum m
| 0, 0 => ⟨fun _ => rfl, fun _ => rfl⟩
| Pos m, 0 => ⟨fun h => by cases h, fun h => by cases h⟩
@@ -1303,15 +1730,23 @@ theorem mem_ofZNum' : ∀ {m : Num} {n : ZNum}, m ∈ ofZNum' n ↔ n = toZNum m
Option.some_inj.trans <| by cases m <;> constructor <;> intro h <;> try cases h <;> rfl
| m, ZNum.neg p => ⟨fun h => by cases h, fun h => by cases m <;> cases h⟩
#align num.mem_of_znum' Num.mem_ofZNum'
+-/
-theorem ofZNum'_to_nat : ∀ n : ZNum, coe <$> ofZNum' n = Int.toNat' n
+/- warning: num.of_znum'_to_nat -> Num.ofZNum'_toNat is a dubious translation:
+lean 3 declaration is
+ forall (n : ZNum), Eq.{1} (Option.{0} Nat) (Functor.map.{0, 0} Option.{0} (Traversable.toFunctor.{0} Option.{0} Option.traversable.{0}) Num Nat ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Num Nat (HasLiftT.mk.{1, 1} Num Nat (CoeTCₓ.coe.{1, 1} Num Nat (numNatCoe.{0} Nat Nat.hasOne Nat.hasAdd Nat.hasZero)))) (Num.ofZNum' n)) (Int.toNat' ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n))
+but is expected to have type
+ forall (n : ZNum), Eq.{1} (Option.{0} Nat) (Functor.map.{0, 0} Option.{0} instFunctorOption.{0} Num Nat (castNum.{0} Nat (CanonicallyOrderedCommSemiring.toOne.{0} Nat Nat.canonicallyOrderedCommSemiring) instAddNat (LinearOrderedCommMonoidWithZero.toZero.{0} Nat Nat.linearOrderedCommMonoidWithZero)) (Num.ofZNum' n)) (Int.toNat' (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt n))
+Case conversion may be inaccurate. Consider using '#align num.of_znum'_to_nat Num.ofZNum'_toNatₓ'. -/
+theorem ofZNum'_toNat : ∀ n : ZNum, coe <$> ofZNum' n = Int.toNat' n
| 0 => rfl
| ZNum.pos p => show _ = Int.toNat' p by rw [← PosNum.to_nat_to_int p] <;> rfl
| ZNum.neg p =>
(congr_arg fun x => Int.toNat' (-x)) <|
show ((p.pred' + 1 : ℕ) : ℤ) = p by rw [← succ'_to_nat] <;> simp
-#align num.of_znum'_to_nat Num.ofZNum'_to_nat
+#align num.of_znum'_to_nat Num.ofZNum'_toNat
+#print Num.ofZNum_toNat /-
@[simp]
theorem ofZNum_toNat : ∀ n : ZNum, (ofZNum n : ℕ) = Int.toNat n
| 0 => rfl
@@ -1320,17 +1755,26 @@ theorem ofZNum_toNat : ∀ n : ZNum, (ofZNum n : ℕ) = Int.toNat n
(congr_arg fun x => Int.toNat (-x)) <|
show ((p.pred' + 1 : ℕ) : ℤ) = p by rw [← succ'_to_nat] <;> simp
#align num.of_znum_to_nat Num.ofZNum_toNat
+-/
+/- warning: num.cast_of_znum -> Num.cast_ofZNum is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Num α (HasLiftT.mk.{1, succ u1} Num α (CoeTCₓ.coe.{1, succ u1} Num α (numNatCoe.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))) (Num.ofZNum n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) (Int.toNat ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n)))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (castNum.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (Num.ofZNum n)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (Int.toNat (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt n)))
+Case conversion may be inaccurate. Consider using '#align num.cast_of_znum Num.cast_ofZNumₓ'. -/
@[simp]
theorem cast_ofZNum [AddGroupWithOne α] (n : ZNum) : (ofZNum n : α) = Int.toNat n := by
rw [← cast_to_nat, of_znum_to_nat]
#align num.cast_of_znum Num.cast_ofZNum
+#print Num.sub_to_nat /-
@[simp, norm_cast]
theorem sub_to_nat (m n) : ((m - n : Num) : ℕ) = m - n :=
show (ofZNum _ : ℕ) = _ by
rw [of_znum_to_nat, cast_sub', ← to_nat_to_int, ← to_nat_to_int, Int.toNat_sub]
#align num.sub_to_nat Num.sub_to_nat
+-/
end Num
@@ -1338,6 +1782,12 @@ namespace ZNum
variable {α : Type _}
+/- warning: znum.cast_add -> ZNum.cast_add is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (HAdd.hAdd.{0, 0, 0} ZNum ZNum ZNum (instHAdd.{0} ZNum ZNum.hasAdd) m n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (HAdd.hAdd.{0, 0, 0} ZNum ZNum ZNum (instHAdd.{0} ZNum ZNum.instAddZNum) m n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) m) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n))
+Case conversion may be inaccurate. Consider using '#align znum.cast_add ZNum.cast_addₓ'. -/
@[simp, norm_cast]
theorem cast_add [AddGroupWithOne α] : ∀ m n, ((m + n : ZNum) : α) = m + n
| 0, a => by cases a <;> exact (_root_.zero_add _).symm
@@ -1355,11 +1805,18 @@ theorem cast_add [AddGroupWithOne α] : ∀ m n, ((m + n : ZNum) : α) = m + n
← PosNum.cast_to_int b, ← Int.cast_add, ← Int.cast_add, add_comm]
#align znum.cast_add ZNum.cast_add
+/- warning: znum.cast_succ -> ZNum.cast_succ is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) (ZNum.succ n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) n) (OfNat.ofNat.{u1} α 1 (OfNat.mk.{u1} α 1 (One.one.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (ZNum.succ n)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) n) (OfNat.ofNat.{u1} α 1 (One.toOfNat1.{u1} α (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))))
+Case conversion may be inaccurate. Consider using '#align znum.cast_succ ZNum.cast_succₓ'. -/
@[simp]
theorem cast_succ [AddGroupWithOne α] (n) : ((succ n : ZNum) : α) = n + 1 := by
rw [← add_one, cast_add, cast_one]
#align znum.cast_succ ZNum.cast_succ
+#print ZNum.mul_to_int /-
@[simp, norm_cast]
theorem mul_to_int : ∀ m n, ((m * n : ZNum) : ℤ) = m * n
| 0, a => by cases a <;> exact (_root_.zero_mul _).symm
@@ -1369,28 +1826,42 @@ theorem mul_to_int : ∀ m n, ((m * n : ZNum) : ℤ) = m * n
| neg a, Pos b => show -↑(a * b) = -↑a * ↑b by rw [PosNum.cast_mul, neg_mul_eq_neg_mul]
| neg a, neg b => show ↑(a * b) = -↑a * -↑b by rw [PosNum.cast_mul, neg_mul_neg]
#align znum.mul_to_int ZNum.mul_to_int
+-/
+/- warning: znum.cast_mul -> ZNum.cast_mul is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) (HMul.hMul.{0, 0, 0} ZNum ZNum ZNum (instHMul.{0} ZNum ZNum.hasMul) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (Distrib.toHasMul.{u1} α (Ring.toDistrib.{u1} α _inst_1))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) (HMul.hMul.{0, 0, 0} ZNum ZNum ZNum (instHMul.{0} ZNum ZNum.instMulZNum) m n)) (HMul.hMul.{u1, u1, u1} α α α (instHMul.{u1} α (NonUnitalNonAssocRing.toMul.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) n))
+Case conversion may be inaccurate. Consider using '#align znum.cast_mul ZNum.cast_mulₓ'. -/
theorem cast_mul [Ring α] (m n) : ((m * n : ZNum) : α) = m * n := by
rw [← cast_to_int, mul_to_int, Int.cast_mul, cast_to_int, cast_to_int]
#align znum.cast_mul ZNum.cast_mul
+#print ZNum.ofInt'_neg /-
theorem ofInt'_neg : ∀ n : ℤ, ofInt' (-n) = -ofInt' n
| -[n+1] => show ofInt' (n + 1 : ℕ) = _ by simp only [of_int', Num.zneg_toZNumNeg]
| 0 => show Num.toZNum _ = -Num.toZNum _ by rw [Num.ofNat'_zero] <;> rfl
| (n + 1 : ℕ) => show Num.toZNumNeg _ = -Num.toZNum _ by rw [Num.zneg_toZNum] <;> rfl
#align znum.of_int'_neg ZNum.ofInt'_neg
+-/
+#print ZNum.of_to_int' /-
theorem of_to_int' : ∀ n : ZNum, ZNum.ofInt' n = n
| 0 => by erw [of_int', Num.ofNat'_zero, Num.toZNum]
| Pos a => by rw [cast_pos, ← PosNum.cast_to_nat, ← Num.ofInt'_toZNum, PosNum.of_to_nat] <;> rfl
| neg a => by
rw [cast_neg, of_int'_neg, ← PosNum.cast_to_nat, ← Num.ofInt'_toZNum, PosNum.of_to_nat] <;> rfl
#align znum.of_to_int' ZNum.of_to_int'
+-/
+#print ZNum.to_int_inj /-
theorem to_int_inj {m n : ZNum} : (m : ℤ) = n ↔ m = n :=
⟨fun h => Function.LeftInverse.injective of_to_int' h, congr_arg _⟩
#align znum.to_int_inj ZNum.to_int_inj
+-/
+#print ZNum.cmp_to_int /-
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
| 0, 0 => rfl
| Pos a, Pos b => by
@@ -1408,7 +1879,9 @@ theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n
| neg a, Pos b => lt_trans (neg_lt_zero.2 <| PosNum.cast_pos _) (PosNum.cast_pos _)
| 0, Pos b => PosNum.cast_pos _
#align znum.cmp_to_int ZNum.cmp_to_int
+-/
+#print ZNum.lt_to_int /-
@[norm_cast]
theorem lt_to_int {m n : ZNum} : (m : ℤ) < n ↔ m < n :=
show (m : ℤ) < n ↔ cmp m n = Ordering.lt from
@@ -1417,21 +1890,42 @@ theorem lt_to_int {m n : ZNum} : (m : ℤ) < n ↔ m < n :=
| Ordering.eq, h => by simp at h <;> simp [h, lt_irrefl] <;> exact by decide
| Ordering.gt, h => by simp [not_lt_of_gt h] <;> exact by decide
#align znum.lt_to_int ZNum.lt_to_int
+-/
+#print ZNum.le_to_int /-
theorem le_to_int {m n : ZNum} : (m : ℤ) ≤ n ↔ m ≤ n := by
rw [← not_lt] <;> exact not_congr lt_to_int
#align znum.le_to_int ZNum.le_to_int
+-/
+/- warning: znum.cast_lt -> ZNum.cast_lt is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommGroup.toPartialOrder.{u1} α (StrictOrderedRing.toOrderedAddCommGroup.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) n)) (LT.lt.{0} ZNum ZNum.hasLt m n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedRing.toPartialOrder.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (LT.lt.{0} ZNum ZNum.instLTZNum m n)
+Case conversion may be inaccurate. Consider using '#align znum.cast_lt ZNum.cast_ltₓ'. -/
@[simp, norm_cast]
theorem cast_lt [LinearOrderedRing α] {m n : ZNum} : (m : α) < n ↔ m < n := by
rw [← cast_to_int m, ← cast_to_int n, Int.cast_lt, lt_to_int]
#align znum.cast_lt ZNum.cast_lt
+/- warning: znum.cast_le -> ZNum.cast_le is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (OrderedAddCommGroup.toPartialOrder.{u1} α (StrictOrderedRing.toOrderedAddCommGroup.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) n)) (LE.le.{0} ZNum ZNum.hasLe m n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (StrictOrderedRing.toPartialOrder.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (LE.le.{0} ZNum ZNum.instLEZNum m n)
+Case conversion may be inaccurate. Consider using '#align znum.cast_le ZNum.cast_leₓ'. -/
@[simp, norm_cast]
theorem cast_le [LinearOrderedRing α] {m n : ZNum} : (m : α) ≤ n ↔ m ≤ n := by
rw [← not_lt] <;> exact not_congr cast_lt
#align znum.cast_le ZNum.cast_le
+/- warning: znum.cast_inj -> ZNum.cast_inj is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))))))))) n)) (Eq.{1} ZNum m n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : LinearOrderedRing.{u1} α] {m : ZNum} {n : ZNum}, Iff (Eq.{succ u1} α (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (StrictOrderedSemiring.toSemiring.{u1} α (LinearOrderedSemiring.toStrictOrderedSemiring.{u1} α (LinearOrderedRing.toLinearOrderedSemiring.{u1} α _inst_1))))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1)))) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))))))) (Ring.toNeg.{u1} α (StrictOrderedRing.toRing.{u1} α (LinearOrderedRing.toStrictOrderedRing.{u1} α _inst_1))) n)) (Eq.{1} ZNum m n)
+Case conversion may be inaccurate. Consider using '#align znum.cast_inj ZNum.cast_injₓ'. -/
@[simp, norm_cast]
theorem cast_inj [LinearOrderedRing α] {m n : ZNum} : (m : α) = n ↔ m = n := by
rw [← cast_to_int m, ← cast_to_int n, Int.cast_inj, to_int_inj]
@@ -1580,10 +2074,22 @@ instance : LinearOrderedCommRing ZNum :=
apply mul_pos
zero_le_one := by decide }
+/- warning: znum.cast_sub -> ZNum.cast_sub is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) (HSub.hSub.{0, 0, 0} ZNum ZNum ZNum (instHSub.{0} ZNum (SubNegMonoid.toHasSub.{0} ZNum (AddGroup.toSubNegMonoid.{0} ZNum (AddGroupWithOne.toAddGroup.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) m) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))) (Distrib.toHasAdd.{u1} α (Ring.toDistrib.{u1} α _inst_1)) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α (AddCommGroupWithOne.toAddGroupWithOne.{u1} α (Ring.toAddCommGroupWithOne.{u1} α _inst_1)))))))) n))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Ring.{u1} α] (m : ZNum) (n : ZNum), Eq.{succ u1} α (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) (HSub.hSub.{0, 0, 0} ZNum ZNum ZNum (instHSub.{0} ZNum (Ring.toSub.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))) m n)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (Ring.toSub.{u1} α _inst_1)) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) m) (castZNum.{u1} α (MonoidWithZero.toZero.{u1} α (Semiring.toMonoidWithZero.{u1} α (Ring.toSemiring.{u1} α _inst_1))) (NonAssocRing.toOne.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1)) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} α (NonAssocRing.toNonUnitalNonAssocRing.{u1} α (Ring.toNonAssocRing.{u1} α _inst_1))))) (Ring.toNeg.{u1} α _inst_1) n))
+Case conversion may be inaccurate. Consider using '#align znum.cast_sub ZNum.cast_subₓ'. -/
@[simp, norm_cast]
theorem cast_sub [Ring α] (m n) : ((m - n : ZNum) : α) = m - n := by simp [sub_eq_neg_add]
#align znum.cast_sub ZNum.cast_sub
+/- warning: znum.neg_of_int -> ZNum.neg_of_int is a dubious translation:
+lean 3 declaration is
+ forall (n : Int), Eq.{1} ZNum ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) (Neg.neg.{0} Int Int.hasNeg n)) (Neg.neg.{0} ZNum ZNum.hasNeg ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) n))
+but is expected to have type
+ forall (n : Int), Eq.{1} ZNum (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) (Neg.neg.{0} Int Int.instNegInt n)) (Neg.neg.{0} ZNum ZNum.instNegZNum (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) n))
+Case conversion may be inaccurate. Consider using '#align znum.neg_of_int ZNum.neg_of_intₓ'. -/
@[simp, norm_cast]
theorem neg_of_int : ∀ n, ((-n : ℤ) : ZNum) = -n
| (n + 1 : ℕ) => rfl
@@ -1591,6 +2097,12 @@ theorem neg_of_int : ∀ n, ((-n : ℤ) : ZNum) = -n
| -[n+1] => (zneg_zneg _).symm
#align znum.neg_of_int ZNum.neg_of_int
+/- warning: znum.of_int'_eq -> ZNum.ofInt'_eq is a dubious translation:
+lean 3 declaration is
+ forall (n : Int), Eq.{1} ZNum (ZNum.ofInt' n) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) n)
+but is expected to have type
+ forall (n : Int), Eq.{1} ZNum (ZNum.ofInt' n) (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) n)
+Case conversion may be inaccurate. Consider using '#align znum.of_int'_eq ZNum.ofInt'_eqₓ'. -/
@[simp]
theorem ofInt'_eq : ∀ n : ℤ, ZNum.ofInt' n = n
| (n : ℕ) => rfl
@@ -1601,33 +2113,67 @@ theorem ofInt'_eq : ∀ n : ℤ, ZNum.ofInt' n = n
rfl
#align znum.of_int'_eq ZNum.ofInt'_eq
+#print ZNum.of_nat_toZNum /-
@[simp]
theorem of_nat_toZNum (n : ℕ) : Num.toZNum n = n :=
rfl
#align znum.of_nat_to_znum ZNum.of_nat_toZNum
+-/
+/- warning: znum.of_to_int -> ZNum.of_to_int is a dubious translation:
+lean 3 declaration is
+ forall (n : ZNum), Eq.{1} ZNum ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n)) n
+but is expected to have type
+ forall (n : ZNum), Eq.{1} ZNum (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt n)) n
+Case conversion may be inaccurate. Consider using '#align znum.of_to_int ZNum.of_to_intₓ'. -/
@[simp, norm_cast]
theorem of_to_int (n : ZNum) : ((n : ℤ) : ZNum) = n := by rw [← of_int'_eq, of_to_int']
#align znum.of_to_int ZNum.of_to_int
+/- warning: znum.to_of_int -> ZNum.to_of_int is a dubious translation:
+lean 3 declaration is
+ forall (n : Int), Eq.{1} Int ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) n)) n
+but is expected to have type
+ forall (n : Int), Eq.{1} Int (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) n)) n
+Case conversion may be inaccurate. Consider using '#align znum.to_of_int ZNum.to_of_intₓ'. -/
theorem to_of_int (n : ℤ) : ((n : ZNum) : ℤ) = n :=
Int.inductionOn' n 0 (by simp) (by simp) (by simp)
#align znum.to_of_int ZNum.to_of_int
+#print ZNum.of_nat_toZNumNeg /-
@[simp]
theorem of_nat_toZNumNeg (n : ℕ) : Num.toZNumNeg n = -n := by rw [← of_nat_to_znum, Num.zneg_toZNum]
#align znum.of_nat_to_znum_neg ZNum.of_nat_toZNumNeg
+-/
+/- warning: znum.of_int_cast -> ZNum.of_int_cast is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Int), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Int ZNum (HasLiftT.mk.{1, 1} Int ZNum (CoeTCₓ.coe.{1, 1} Int ZNum (Int.castCoe.{0} ZNum (AddGroupWithOne.toHasIntCast.{0} ZNum (AddCommGroupWithOne.toAddGroupWithOne.{0} ZNum (Ring.toAddCommGroupWithOne.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))))))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Int α (HasLiftT.mk.{1, succ u1} Int α (CoeTCₓ.coe.{1, succ u1} Int α (Int.castCoe.{u1} α (AddGroupWithOne.toHasIntCast.{u1} α _inst_1)))) n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Int), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (Int.cast.{0} ZNum (Ring.toIntCast.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing)))) n)) (Int.cast.{u1} α (AddGroupWithOne.toIntCast.{u1} α _inst_1) n)
+Case conversion may be inaccurate. Consider using '#align znum.of_int_cast ZNum.of_int_castₓ'. -/
@[simp, norm_cast]
theorem of_int_cast [AddGroupWithOne α] (n : ℤ) : ((n : ZNum) : α) = n := by
rw [← cast_to_int, to_of_int]
#align znum.of_int_cast ZNum.of_int_cast
+/- warning: znum.of_nat_cast -> ZNum.of_nat_cast is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Nat), Eq.{succ u1} α ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) ZNum α (HasLiftT.mk.{1, succ u1} ZNum α (CoeTCₓ.coe.{1, succ u1} ZNum α (znumCoe.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1)))))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat ZNum (HasLiftT.mk.{1, 1} Nat ZNum (CoeTCₓ.coe.{1, 1} Nat ZNum (Nat.castCoe.{0} ZNum (AddMonoidWithOne.toNatCast.{0} ZNum ZNum.addMonoidWithOne)))) n)) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat α (HasLiftT.mk.{1, succ u1} Nat α (CoeTCₓ.coe.{1, succ u1} Nat α (Nat.castCoe.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1))))) n)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : AddGroupWithOne.{u1} α] (n : Nat), Eq.{succ u1} α (castZNum.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α (AddGroupWithOne.toAddGroup.{u1} α _inst_1))))) (AddMonoidWithOne.toOne.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddMonoidWithOne.toAddMonoid.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)))) (AddGroupWithOne.toNeg.{u1} α _inst_1) (Nat.cast.{0} ZNum (NonAssocRing.toNatCast.{0} ZNum (Ring.toNonAssocRing.{0} ZNum (StrictOrderedRing.toRing.{0} ZNum (LinearOrderedRing.toStrictOrderedRing.{0} ZNum (LinearOrderedCommRing.toLinearOrderedRing.{0} ZNum ZNum.linearOrderedCommRing))))) n)) (Nat.cast.{u1} α (AddMonoidWithOne.toNatCast.{u1} α (AddGroupWithOne.toAddMonoidWithOne.{u1} α _inst_1)) n)
+Case conversion may be inaccurate. Consider using '#align znum.of_nat_cast ZNum.of_nat_castₓ'. -/
@[simp, norm_cast]
theorem of_nat_cast [AddGroupWithOne α] (n : ℕ) : ((n : ZNum) : α) = n := by
rw [← Int.cast_ofNat, of_int_cast, Int.cast_ofNat]
#align znum.of_nat_cast ZNum.of_nat_cast
+/- warning: znum.dvd_to_int -> ZNum.dvd_to_int is a dubious translation:
+lean 3 declaration is
+ forall (m : ZNum) (n : ZNum), Iff (Dvd.Dvd.{0} Int (semigroupDvd.{0} Int Int.semigroup) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) m) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) ZNum Int (HasLiftT.mk.{1, 1} ZNum Int (CoeTCₓ.coe.{1, 1} ZNum Int (znumCoe.{0} Int Int.hasZero Int.hasOne Int.hasAdd Int.hasNeg))) n)) (Dvd.Dvd.{0} ZNum (semigroupDvd.{0} ZNum (SemigroupWithZero.toSemigroup.{0} ZNum (NonUnitalSemiring.toSemigroupWithZero.{0} ZNum (NonUnitalRing.toNonUnitalSemiring.{0} ZNum (NonUnitalCommRing.toNonUnitalRing.{0} ZNum (CommRing.toNonUnitalCommRing.{0} ZNum (StrictOrderedCommRing.toCommRing.{0} ZNum (LinearOrderedCommRing.toStrictOrderedCommRing.{0} ZNum ZNum.linearOrderedCommRing)))))))) m n)
+but is expected to have type
+ forall (m : ZNum) (n : ZNum), Iff (Dvd.dvd.{0} Int Int.instDvdInt (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt m) (castZNum.{0} Int (CommMonoidWithZero.toZero.{0} Int (CommSemiring.toCommMonoidWithZero.{0} Int Int.instCommSemiringInt)) (NonAssocRing.toOne.{0} Int (Ring.toNonAssocRing.{0} Int Int.instRingInt)) Int.instAddInt Int.instNegInt n)) (Dvd.dvd.{0} ZNum (semigroupDvd.{0} ZNum (SemigroupWithZero.toSemigroup.{0} ZNum (NonUnitalSemiring.toSemigroupWithZero.{0} ZNum (NonUnitalRing.toNonUnitalSemiring.{0} ZNum (NonUnitalCommRing.toNonUnitalRing.{0} ZNum (CommRing.toNonUnitalCommRing.{0} ZNum (StrictOrderedCommRing.toCommRing.{0} ZNum (LinearOrderedCommRing.toStrictOrderedCommRing.{0} ZNum ZNum.linearOrderedCommRing)))))))) m n)
+Case conversion may be inaccurate. Consider using '#align znum.dvd_to_int ZNum.dvd_to_intₓ'. -/
@[simp, norm_cast]
theorem dvd_to_int (m n : ZNum) : (m : ℤ) ∣ n ↔ m ∣ n :=
⟨fun ⟨k, e⟩ => ⟨k, by rw [← of_to_int n, e] <;> simp⟩, fun ⟨k, e⟩ => ⟨k, by simp [e]⟩⟩
@@ -1637,7 +2183,8 @@ end ZNum
namespace PosNum
-theorem divmod_to_nat_aux {n d : PosNum} {q r : Num} (h₁ : (r : ℕ) + d * bit0 q = n)
+#print PosNum.divMod_to_nat_aux /-
+theorem divMod_to_nat_aux {n d : PosNum} {q r : Num} (h₁ : (r : ℕ) + d * bit0 q = n)
(h₂ : (r : ℕ) < 2 * d) :
((divModAux d q r).2 + d * (divModAux d q r).1 : ℕ) = ↑n ∧ ((divModAux d q r).2 : ℕ) < d :=
by
@@ -1657,8 +2204,10 @@ theorem divmod_to_nat_aux {n d : PosNum} {q r : Num} (h₁ : (r : ℕ) + d * bit
constructor
· rwa [_root_.bit1, add_comm _ 1, mul_add, mul_one, ← add_assoc, ← this]
· rwa [this, two_mul, add_lt_add_iff_right] at h₂
-#align pos_num.divmod_to_nat_aux PosNum.divmod_to_nat_aux
+#align pos_num.divmod_to_nat_aux PosNum.divMod_to_nat_aux
+-/
+#print PosNum.divMod_to_nat /-
theorem divMod_to_nat (d n : PosNum) :
(n / d : ℕ) = (divMod d n).1 ∧ (n % d : ℕ) = (divMod d n).2 :=
by
@@ -1686,21 +2235,27 @@ theorem divMod_to_nat (d n : PosNum) :
· rw [← bit0_eq_two_mul]
exact Nat.bit0_lt IH.2
#align pos_num.divmod_to_nat PosNum.divMod_to_nat
+-/
+#print PosNum.div'_to_nat /-
@[simp]
theorem div'_to_nat (n d) : (div' n d : ℕ) = n / d :=
(divMod_to_nat _ _).1.symm
#align pos_num.div'_to_nat PosNum.div'_to_nat
+-/
+#print PosNum.mod'_to_nat /-
@[simp]
theorem mod'_to_nat (n d) : (mod' n d : ℕ) = n % d :=
(divMod_to_nat _ _).2.symm
#align pos_num.mod'_to_nat PosNum.mod'_to_nat
+-/
end PosNum
namespace Num
+#print Num.div_zero /-
@[simp]
protected theorem div_zero (n : Num) : n / 0 = 0 :=
show n.div 0 = 0 by
@@ -1708,7 +2263,9 @@ protected theorem div_zero (n : Num) : n / 0 = 0 :=
rfl
simp [Num.div]
#align num.div_zero Num.div_zero
+-/
+#print Num.div_to_nat /-
@[simp, norm_cast]
theorem div_to_nat : ∀ n d, ((n / d : Num) : ℕ) = n / d
| 0, 0 => by simp
@@ -1716,7 +2273,9 @@ theorem div_to_nat : ∀ n d, ((n / d : Num) : ℕ) = n / d
| Pos n, 0 => (Nat.div_zero _).symm
| Pos n, Pos d => PosNum.div'_to_nat _ _
#align num.div_to_nat Num.div_to_nat
+-/
+#print Num.mod_zero /-
@[simp]
protected theorem mod_zero (n : Num) : n % 0 = n :=
show n.mod 0 = n by
@@ -1724,7 +2283,9 @@ protected theorem mod_zero (n : Num) : n % 0 = n :=
rfl
simp [Num.mod]
#align num.mod_zero Num.mod_zero
+-/
+#print Num.mod_to_nat /-
@[simp, norm_cast]
theorem mod_to_nat : ∀ n d, ((n % d : Num) : ℕ) = n % d
| 0, 0 => by simp
@@ -1732,7 +2293,9 @@ theorem mod_to_nat : ∀ n d, ((n % d : Num) : ℕ) = n % d
| Pos n, 0 => (Nat.mod_zero _).symm
| Pos n, Pos d => PosNum.mod'_to_nat _ _
#align num.mod_to_nat Num.mod_to_nat
+-/
+#print Num.gcd_to_nat_aux /-
theorem gcd_to_nat_aux :
∀ {n} {a b : Num}, a ≤ b → (a * b).natSize ≤ n → (gcdAux n a b : ℕ) = Nat.gcd a b
| 0, 0, b, ab, h => (Nat.gcd_zero_left _).symm
@@ -1756,7 +2319,9 @@ theorem gcd_to_nat_aux :
rw [Nat.le_div_iff_mul_le a.cast_pos, one_mul]
exact le_to_nat.2 ab
#align num.gcd_to_nat_aux Num.gcd_to_nat_aux
+-/
+#print Num.gcd_to_nat /-
@[simp]
theorem gcd_to_nat : ∀ a b, (gcd a b : ℕ) = Nat.gcd a b :=
by
@@ -1773,28 +2338,38 @@ theorem gcd_to_nat : ∀ a b, (gcd a b : ℕ) = Nat.gcd a b :=
· rw [Nat.gcd_comm]
exact gcd_to_nat_aux (le_of_not_le h) (this _ _)
#align num.gcd_to_nat Num.gcd_to_nat
+-/
+#print Num.dvd_iff_mod_eq_zero /-
theorem dvd_iff_mod_eq_zero {m n : Num} : m ∣ n ↔ n % m = 0 := by
rw [← dvd_to_nat, Nat.dvd_iff_mod_eq_zero, ← to_nat_inj, mod_to_nat] <;> rfl
#align num.dvd_iff_mod_eq_zero Num.dvd_iff_mod_eq_zero
+-/
+#print Num.decidableDvd /-
instance decidableDvd : DecidableRel ((· ∣ ·) : Num → Num → Prop)
| a, b => decidable_of_iff' _ dvd_iff_mod_eq_zero
#align num.decidable_dvd Num.decidableDvd
+-/
end Num
+#print PosNum.decidableDvd /-
instance PosNum.decidableDvd : DecidableRel ((· ∣ ·) : PosNum → PosNum → Prop)
| a, b => Num.decidableDvd _ _
#align pos_num.decidable_dvd PosNum.decidableDvd
+-/
namespace ZNum
+#print ZNum.div_zero /-
@[simp]
protected theorem div_zero (n : ZNum) : n / 0 = 0 :=
show n.div 0 = 0 by cases n <;> first |rfl|simp [ZNum.div]
#align znum.div_zero ZNum.div_zero
+-/
+#print ZNum.div_to_int /-
@[simp, norm_cast]
theorem div_to_int : ∀ n d, ((n / d : ZNum) : ℤ) = n / d
| 0, 0 => by simp [Int.div_zero]
@@ -1819,7 +2394,9 @@ theorem div_to_int : ∀ n d, ((n / d : ZNum) : ℤ) = n / d
change (Nat.succ (_ / d) : ℤ) = Nat.succ (n.pred' / (d.pred' + 1))
rw [d.to_nat_eq_succ_pred]
#align znum.div_to_int ZNum.div_to_int
+-/
+#print ZNum.mod_to_int /-
@[simp, norm_cast]
theorem mod_to_int : ∀ n d, ((n % d : ZNum) : ℤ) = n % d
| 0, d => (Int.zero_mod _).symm
@@ -1832,15 +2409,20 @@ theorem mod_to_int : ∀ n d, ((n % d : ZNum) : ℤ) = n % d
abs_to_nat, ← Int.subNatNat_eq_coe, n.to_int_eq_succ_pred] <;>
rfl
#align znum.mod_to_int ZNum.mod_to_int
+-/
+#print ZNum.gcd_to_nat /-
@[simp]
theorem gcd_to_nat (a b) : (gcd a b : ℕ) = Int.gcd a b :=
(Num.gcd_to_nat _ _).trans <| by simpa
#align znum.gcd_to_nat ZNum.gcd_to_nat
+-/
+#print ZNum.dvd_iff_mod_eq_zero /-
theorem dvd_iff_mod_eq_zero {m n : ZNum} : m ∣ n ↔ n % m = 0 := by
rw [← dvd_to_int, Int.dvd_iff_emod_eq_zero, ← to_int_inj, mod_to_int] <;> rfl
#align znum.dvd_iff_mod_eq_zero ZNum.dvd_iff_mod_eq_zero
+-/
instance : DecidableRel ((· ∣ ·) : ZNum → ZNum → Prop)
| a, b => decidable_of_iff' _ dvd_iff_mod_eq_zero
@@ -1849,14 +2431,18 @@ end ZNum
namespace Int
+#print Int.ofSnum /-
/-- Cast a `snum` to the corresponding integer. -/
def ofSnum : SNum → ℤ :=
SNum.rec' (fun a => cond a (-1) 0) fun a p IH => cond a (bit1 IH) (bit0 IH)
#align int.of_snum Int.ofSnum
+-/
+#print Int.snumCoe /-
instance snumCoe : Coe SNum ℤ :=
⟨ofSnum⟩
#align int.snum_coe Int.snumCoe
+-/
end Int
mathlib commit https://github.com/leanprover-community/mathlib/commit/2196ab363eb097c008d4497125e0dde23fb36db2
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
! This file was ported from Lean 3 source module data.num.lemmas
-! leanprover-community/mathlib commit 7ac96dea0572f31067e9e35bebbecef7fa3fa91a
+! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -1351,9 +1351,8 @@ theorem cast_add [AddGroupWithOne α] : ∀ m n, ((m + n : ZNum) : α) = m + n
(PosNum.cast_sub' _ _).trans <| (sub_eq_add_neg _ _).trans this
| neg a, neg b =>
show -(↑(a + b) : α) = -a + -b by
- rw [PosNum.cast_add, neg_eq_iff_neg_eq, neg_add_rev, neg_neg, neg_neg, ← PosNum.cast_to_int a,
- ← PosNum.cast_to_int b, ← Int.cast_add] <;>
- simp [add_comm]
+ rw [PosNum.cast_add, neg_eq_iff_eq_neg, neg_add_rev, neg_neg, neg_neg, ← PosNum.cast_to_int a,
+ ← PosNum.cast_to_int b, ← Int.cast_add, ← Int.cast_add, add_comm]
#align znum.cast_add ZNum.cast_add
@[simp]
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -305,7 +305,7 @@ theorem add_to_nat : ∀ m n, ((m + n : Num) : ℕ) = m + n
@[norm_cast]
theorem mul_to_nat : ∀ m n, ((m * n : Num) : ℕ) = m * n
| 0, 0 => rfl
- | 0, Pos q => (zero_mul _).symm
+ | 0, Pos q => (MulZeroClass.zero_mul _).symm
| Pos p, 0 => rfl
| Pos p, Pos q => PosNum.mul_to_nat _ _
#align num.mul_to_nat Num.mul_to_nat
@@ -773,9 +773,9 @@ theorem cast_bit1 [Semiring α] (n : Num) : (n.bit1 : α) = bit1 n := by
@[simp, norm_cast]
theorem cast_mul [Semiring α] : ∀ m n, ((m * n : Num) : α) = m * n
- | 0, 0 => (zero_mul _).symm
- | 0, Pos q => (zero_mul _).symm
- | Pos p, 0 => (mul_zero _).symm
+ | 0, 0 => (MulZeroClass.zero_mul _).symm
+ | 0, Pos q => (MulZeroClass.zero_mul _).symm
+ | Pos p, 0 => (MulZeroClass.mul_zero _).symm
| Pos p, Pos q => PosNum.cast_mul _ _
#align num.cast_mul Num.cast_mul
@@ -915,7 +915,7 @@ theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap] <;> cases cmp m n <;> exact by decide
#align num.le_iff_cmp Num.le_iff_cmp
-theorem bitwise_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (p : PosNum → PosNum → Num)
+theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (p : PosNum → PosNum → Num)
(gff : g false false = false) (f00 : f 0 0 = 0)
(f0n : ∀ n, f 0 (pos n) = cond (g false true) (pos n) 0)
(fn0 : ∀ n, f (pos n) 0 = cond (g true false) (pos n) 0)
@@ -923,16 +923,16 @@ theorem bitwise_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (p
(p1b : ∀ b n, p 1 (PosNum.bit b n) = bit (g true b) (cond (g false true) (pos n) 0))
(pb1 : ∀ a m, p (PosNum.bit a m) 1 = bit (g a true) (cond (g true false) (pos m) 0))
(pbb : ∀ a b m n, p (PosNum.bit a m) (PosNum.bit b n) = bit (g a b) (p m n)) :
- ∀ m n : Num, (f m n : ℕ) = Nat.bitwise g m n :=
+ ∀ m n : Num, (f m n : ℕ) = Nat.bitwise' g m n :=
by
intros ;
cases' m with m <;> cases' n with n <;> try change zero with 0 <;>
try change ((0 : Num) : ℕ) with 0
· rw [f00, Nat.bitwise'_zero] <;> rfl
- · unfold Nat.bitwise
+ · unfold Nat.bitwise'
rw [f0n, Nat.binaryRec_zero]
cases g ff tt <;> rfl
- · unfold Nat.bitwise
+ · unfold Nat.bitwise'
generalize h : (Pos m : ℕ) = m'
revert h
apply Nat.bitCasesOn m' _
@@ -958,19 +958,19 @@ theorem bitwise_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (p
any_goals rw [Nat.bitwise'_zero_left, this, ← bit_to_nat, p1b]
any_goals rw [Nat.bitwise'_zero_right _ gff, this, ← bit_to_nat, pb1]
all_goals
- rw [← show ∀ n, ↑(p m n) = Nat.bitwise g ↑m ↑n from IH]
+ rw [← show ∀ n, ↑(p m n) = Nat.bitwise' g ↑m ↑n from IH]
rw [← bit_to_nat, pbb]
-#align num.bitwise_to_nat Num.bitwise_to_nat
+#align num.bitwise_to_nat Num.bitwise'_to_nat
@[simp, norm_cast]
-theorem lor_to_nat : ∀ m n, (lor m n : ℕ) = Nat.lor m n := by
+theorem lor_to_nat : ∀ m n, (lor m n : ℕ) = Nat.lor' m n := by
apply bitwise_to_nat fun x y => Pos (PosNum.lor x y) <;> intros <;> try cases a <;>
try cases b <;>
rfl
#align num.lor_to_nat Num.lor_to_nat
@[simp, norm_cast]
-theorem land_to_nat : ∀ m n, (land m n : ℕ) = Nat.land m n := by
+theorem land_to_nat : ∀ m n, (land m n : ℕ) = Nat.land' m n := by
apply bitwise_to_nat PosNum.land <;> intros <;> try cases a <;> try cases b <;> rfl
#align num.land_to_nat Num.land_to_nat
mathlib commit https://github.com/leanprover-community/mathlib/commit/4c586d291f189eecb9d00581aeb3dd998ac34442
@@ -360,7 +360,7 @@ theorem to_nat_inj {m n : Num} : (m : ℕ) = n ↔ m = n :=
⟨fun h => Function.LeftInverse.injective of_to_nat' h, congr_arg _⟩
#align num.to_nat_inj Num.to_nat_inj
-/- ./././Mathport/Syntax/Translate/Expr.lean:334:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
/-- This tactic tries to turn an (in)equality about `num`s to one about `nat`s by rewriting.
```lean
example (n : num) (m : num) : n ≤ n + m :=
@@ -374,7 +374,7 @@ unsafe def transfer_rw : tactic Unit :=
sorry
#align num.transfer_rw num.transfer_rw
-/- ./././Mathport/Syntax/Translate/Expr.lean:334:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
/--
This tactic tries to prove (in)equalities about `num`s by transfering them to the `nat` world and
then trying to call `simp`.
@@ -386,7 +386,7 @@ unsafe def transfer : tactic Unit :=
sorry
#align num.transfer num.transfer
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic num.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic num.transfer -/
instance : AddMonoid Num where
add := (· + ·)
zero := 0
@@ -403,7 +403,7 @@ instance : AddMonoidWithOne Num :=
natCast_zero := ofNat'_zero
natCast_succ := fun _ => ofNat'_succ }
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic num.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic num.transfer -/
instance : CommSemiring Num := by
refine_struct
{ Num.addMonoid,
@@ -419,12 +419,12 @@ instance : CommSemiring Num := by
transfer <;>
simp [add_comm, mul_add, add_mul, mul_assoc, mul_comm, mul_left_comm]
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic num.transfer_rw -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic num.transfer -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic num.transfer_rw -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic num.transfer_rw -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic num.transfer_rw -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic num.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic num.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic num.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic num.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic num.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic num.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic num.transfer_rw -/
instance : OrderedCancelAddCommMonoid Num :=
{ Num.commSemiring with
lt := (· < ·)
@@ -459,9 +459,9 @@ instance : OrderedCancelAddCommMonoid Num :=
transfer_rw
apply le_of_add_le_add_left }
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic num.transfer_rw -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic num.transfer_rw -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic num.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic num.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic num.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic num.transfer_rw -/
instance : LinearOrderedSemiring Num :=
{ Num.commSemiring,
Num.orderedCancelAddCommMonoid with
@@ -595,7 +595,7 @@ theorem natSize_to_nat (n) : natSize n = Nat.size n := by rw [← size_eq_nat_si
theorem natSize_pos (n) : 0 < natSize n := by cases n <;> apply Nat.succ_pos
#align pos_num.nat_size_pos PosNum.natSize_pos
-/- ./././Mathport/Syntax/Translate/Expr.lean:334:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
/-- This tactic tries to turn an (in)equality about `pos_num`s to one about `nat`s by rewriting.
```lean
example (n : pos_num) (m : pos_num) : n ≤ n + m :=
@@ -609,7 +609,7 @@ unsafe def transfer_rw : tactic Unit :=
sorry
#align pos_num.transfer_rw pos_num.transfer_rw
-/- ./././Mathport/Syntax/Translate/Expr.lean:334:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
/--
This tactic tries to prove (in)equalities about `pos_num`s by transferring them to the `nat` world
and then trying to call `simp`.
@@ -621,13 +621,13 @@ unsafe def transfer : tactic Unit :=
sorry
#align pos_num.transfer pos_num.transfer
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic pos_num.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic pos_num.transfer -/
instance : AddCommSemigroup PosNum := by
refine' { add := (· + ·).. } <;>
run_tac
transfer
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic pos_num.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic pos_num.transfer -/
instance : CommMonoid PosNum := by
refine_struct
{ mul := (· * ·)
@@ -637,7 +637,7 @@ instance : CommMonoid PosNum := by
run_tac
transfer
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic pos_num.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic pos_num.transfer -/
instance : Distrib PosNum := by
refine'
{ add := (· + ·)
@@ -646,11 +646,11 @@ instance : Distrib PosNum := by
transfer
simp [mul_add, mul_comm]
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic pos_num.transfer_rw -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic pos_num.transfer -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic pos_num.transfer_rw -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic pos_num.transfer_rw -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic pos_num.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic pos_num.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic pos_num.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic pos_num.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic pos_num.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic pos_num.transfer_rw -/
instance : LinearOrder PosNum where
lt := (· < ·)
lt_iff_le_not_le := by
@@ -1438,7 +1438,7 @@ theorem cast_inj [LinearOrderedRing α] {m n : ZNum} : (m : α) = n ↔ m = n :=
rw [← cast_to_int m, ← cast_to_int n, Int.cast_inj, to_int_inj]
#align znum.cast_inj ZNum.cast_inj
-/- ./././Mathport/Syntax/Translate/Expr.lean:334:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
/-- This tactic tries to turn an (in)equality about `znum`s to one about `int`s by rewriting.
```lean
example (n : znum) (m : znum) : n ≤ n + m * m :=
@@ -1452,7 +1452,7 @@ unsafe def transfer_rw : tactic Unit :=
sorry
#align znum.transfer_rw znum.transfer_rw
-/- ./././Mathport/Syntax/Translate/Expr.lean:334:4: warning: unsupported (TODO): `[tacs] -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:330:4: warning: unsupported (TODO): `[tacs] -/
/--
This tactic tries to prove (in)equalities about `znum`s by transfering them to the `int` world and
then trying to call `simp`.
@@ -1468,11 +1468,11 @@ unsafe def transfer : tactic Unit :=
sorry
#align znum.transfer znum.transfer
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer_rw -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer_rw -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer_rw -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer_rw -/
instance : LinearOrder ZNum where
lt := (· < ·)
lt_iff_le_not_le := by
@@ -1503,9 +1503,9 @@ instance : LinearOrder ZNum where
decidableLe := ZNum.decidableLE
decidableLt := ZNum.decidableLT
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer -/
instance : AddCommGroup ZNum where
add := (· + ·)
add_assoc := by
@@ -1531,14 +1531,14 @@ instance : AddMonoidWithOne ZNum :=
show (Num.ofNat' (n + 1)).toZNum = (Num.ofNat' n).toZNum + 1 by
rw [Num.ofNat'_succ, Num.add_one, Num.toZNum_succ, ZNum.add_one] }
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer_rw -/
-/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:72:18: unsupported non-interactive tactic znum.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer_rw -/
+/- ./././Mathport/Syntax/Translate/Tactic/Builtin.lean:69:18: unsupported non-interactive tactic znum.transfer_rw -/
instance : LinearOrderedCommRing ZNum :=
{ ZNum.linearOrder, ZNum.addCommGroup,
ZNum.addMonoidWithOne with
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -894,7 +894,7 @@ theorem castNum_eq_bitwise {f : Num → Num → Num} {g : Bool → Bool → Bool
show PosNum.bit0 = PosNum.bit false from rfl, show PosNum.bit1 = PosNum.bit true from rfl,
show ((1 : Num) : ℕ) = Nat.bit true 0 from rfl]
all_goals
- repeat'
+ repeat
rw [show ∀ b n, (pos (PosNum.bit b n) : ℕ) = Nat.bit b ↑n by
intros b _; cases b <;> rfl]
rw [Nat.bitwise_bit gff]
@@ -956,13 +956,13 @@ theorem castNum_shiftRight (m : Num) (n : Nat) : ↑(m >>> n) = (m : ℕ) >>> (n
apply Nat.div_eq_of_lt
simp
· trans
- apply IH
+ · apply IH
change Nat.shiftRight m n = Nat.shiftRight (_root_.bit1 m) (n + 1)
rw [add_comm n 1, @Nat.shiftRight_eq _ (1 + n), Nat.shiftRight_add]
apply congr_arg fun x => Nat.shiftRight x n
simp [Nat.shiftRight_succ, Nat.shiftRight_zero, ← Nat.div2_val]
· trans
- apply IH
+ · apply IH
change Nat.shiftRight m n = Nat.shiftRight (_root_.bit0 m) (n + 1)
rw [add_comm n 1, @Nat.shiftRight_eq _ (1 + n), Nat.shiftRight_add]
apply congr_arg fun x => Nat.shiftRight x n
nat_cast
/int_cast
/rat_cast
to natCast
/intCast
/ratCast
(#11486)
Now that I am defining NNRat.cast
, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast
/intCast
/ratCast
over nat_cast
/int_cast
/rat_cast
, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.
@@ -476,9 +476,9 @@ theorem to_of_nat : ∀ n : ℕ, ((n : Num) : ℕ) = n
#align num.to_of_nat Num.to_of_nat
@[simp, norm_cast]
-theorem of_nat_cast {α} [AddMonoidWithOne α] (n : ℕ) : ((n : Num) : α) = n := by
+theorem of_natCast {α} [AddMonoidWithOne α] (n : ℕ) : ((n : Num) : α) = n := by
rw [← cast_to_nat, to_of_nat]
-#align num.of_nat_cast Num.of_nat_cast
+#align num.of_nat_cast Num.of_natCast
@[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this
theorem of_nat_inj {m n : ℕ} : (m : Num) = n ↔ m = n :=
@@ -1530,14 +1530,14 @@ theorem of_nat_toZNumNeg (n : ℕ) : Num.toZNumNeg n = -n := by rw [← of_nat_t
#align znum.of_nat_to_znum_neg ZNum.of_nat_toZNumNeg
@[simp, norm_cast]
-theorem of_int_cast [AddGroupWithOne α] (n : ℤ) : ((n : ZNum) : α) = n := by
+theorem of_intCast [AddGroupWithOne α] (n : ℤ) : ((n : ZNum) : α) = n := by
rw [← cast_to_int, to_of_int]
-#align znum.of_int_cast ZNum.of_int_cast
+#align znum.of_int_cast ZNum.of_intCast
@[simp, norm_cast]
-theorem of_nat_cast [AddGroupWithOne α] (n : ℕ) : ((n : ZNum) : α) = n := by
- rw [← Int.cast_natCast, of_int_cast, Int.cast_natCast]
-#align znum.of_nat_cast ZNum.of_nat_cast
+theorem of_natCast [AddGroupWithOne α] (n : ℕ) : ((n : ZNum) : α) = n := by
+ rw [← Int.cast_natCast, of_intCast, Int.cast_natCast]
+#align znum.of_nat_cast ZNum.of_natCast
@[simp, norm_cast]
theorem dvd_to_int (m n : ZNum) : (m : ℤ) ∣ n ↔ m ∣ n :=
@@ -810,7 +810,7 @@ theorem lt_iff_cmp {m n} : m < n ↔ cmp m n = Ordering.lt :=
#align pos_num.lt_iff_cmp PosNum.lt_iff_cmp
theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
- not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap]; cases cmp m n <;> exact by decide
+ not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap]; cases cmp m n <;> decide
#align pos_num.le_iff_cmp PosNum.le_iff_cmp
end PosNum
@@ -865,7 +865,7 @@ theorem lt_iff_cmp {m n} : m < n ↔ cmp m n = Ordering.lt :=
#align num.lt_iff_cmp Num.lt_iff_cmp
theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
- not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap]; cases cmp m n <;> exact by decide
+ not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap]; cases cmp m n <;> decide
#align num.le_iff_cmp Num.le_iff_cmp
theorem castNum_eq_bitwise {f : Num → Num → Num} {g : Bool → Bool → Bool}
OfNat
and Nat.cast
lemmas (#11861)
This renames
Int.cast_ofNat
to Int.cast_natCast
Int.int_cast_ofNat
to Int.cast_ofNat
I think the history here is that this lemma was previously about Int.ofNat
, before we globally fixed the simp-normal form to be Nat.cast
.
Since the Int.cast_ofNat
name is repurposed, it can't be deprecated. Int.int_cast_ofNat
is such a wonky name that it was probably never used.
@@ -66,7 +66,7 @@ theorem to_nat_to_int (n : PosNum) : ((n : ℕ) : ℤ) = n :=
@[simp, norm_cast]
theorem cast_to_int [AddGroupWithOne α] (n : PosNum) : ((n : ℤ) : α) = n := by
- rw [← to_nat_to_int, Int.cast_ofNat, cast_to_nat]
+ rw [← to_nat_to_int, Int.cast_natCast, cast_to_nat]
#align pos_num.cast_to_int PosNum.cast_to_int
theorem succ_to_nat : ∀ n, (succ n : ℕ) = n + 1
@@ -467,7 +467,7 @@ theorem to_nat_to_int (n : Num) : ((n : ℕ) : ℤ) = n :=
@[simp, norm_cast]
theorem cast_to_int {α} [AddGroupWithOne α] (n : Num) : ((n : ℤ) : α) = n := by
- rw [← to_nat_to_int, Int.cast_ofNat, cast_to_nat]
+ rw [← to_nat_to_int, Int.cast_natCast, cast_to_nat]
#align num.cast_to_int Num.cast_to_int
theorem to_of_nat : ∀ n : ℕ, ((n : Num) : ℕ) = n
@@ -1536,7 +1536,7 @@ theorem of_int_cast [AddGroupWithOne α] (n : ℤ) : ((n : ZNum) : α) = n := by
@[simp, norm_cast]
theorem of_nat_cast [AddGroupWithOne α] (n : ℕ) : ((n : ZNum) : α) = n := by
- rw [← Int.cast_ofNat, of_int_cast, Int.cast_ofNat]
+ rw [← Int.cast_natCast, of_int_cast, Int.cast_natCast]
#align znum.of_nat_cast ZNum.of_nat_cast
@[simp, norm_cast]
coe_nat
to natCast
(#11637)
Reduce the diff of #11499
All in the Int
namespace:
ofNat_eq_cast
→ ofNat_eq_natCast
cast_eq_cast_iff_Nat
→ natCast_inj
natCast_eq_ofNat
→ ofNat_eq_natCast
coe_nat_sub
→ natCast_sub
coe_nat_nonneg
→ natCast_nonneg
sign_coe_add_one
→ sign_natCast_add_one
nat_succ_eq_int_succ
→ natCast_succ
succ_neg_nat_succ
→ succ_neg_natCast_succ
coe_pred_of_pos
→ natCast_pred_of_pos
coe_nat_div
→ natCast_div
coe_nat_ediv
→ natCast_ediv
sign_coe_nat_of_nonzero
→ sign_natCast_of_ne_zero
toNat_coe_nat
→ toNat_natCast
toNat_coe_nat_add_one
→ toNat_natCast_add_one
coe_nat_dvd
→ natCast_dvd_natCast
coe_nat_dvd_left
→ natCast_dvd
coe_nat_dvd_right
→ dvd_natCast
le_coe_nat_sub
→ le_natCast_sub
succ_coe_nat_pos
→ succ_natCast_pos
coe_nat_modEq_iff
→ natCast_modEq_iff
coe_natAbs
→ natCast_natAbs
coe_nat_eq_zero
→ natCast_eq_zero
coe_nat_ne_zero
→ natCast_ne_zero
coe_nat_ne_zero_iff_pos
→ natCast_ne_zero_iff_pos
abs_coe_nat
→ abs_natCast
coe_nat_nonpos_iff
→ natCast_nonpos_iff
Also rename Nat.coe_nat_dvd
to Nat.cast_dvd_cast
@@ -1555,7 +1555,7 @@ theorem divMod_to_nat_aux {n d : PosNum} {q r : Num} (h₁ : (r : ℕ) + d * _ro
have : ∀ {r₂}, Num.ofZNum' (Num.sub' r (Num.pos d)) = some r₂ ↔ (r : ℕ) = r₂ + d := by
intro r₂
apply Num.mem_ofZNum'.trans
- rw [← ZNum.to_int_inj, Num.cast_toZNum, Num.cast_sub', sub_eq_iff_eq_add, ← Int.coe_nat_inj']
+ rw [← ZNum.to_int_inj, Num.cast_toZNum, Num.cast_sub', sub_eq_iff_eq_add, ← Int.natCast_inj]
simp
cases' e : Num.ofZNum' (Num.sub' r (Num.pos d)) with r₂ <;> simp [divModAux]
· refine' ⟨h₁, lt_of_not_ge fun h => _⟩
We change the following field in the definition of an additive commutative monoid:
nsmul_succ : ∀ (n : ℕ) (x : G),
- AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+ AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x
where the latter is more natural
We adjust the definitions of ^
in monoids, groups, etc.
Originally there was a warning comment about why this natural order was preferred
use
x * npowRec n x
and notnpowRec n x * x
in the definition to make sure that definitional unfolding ofnpowRec
is blocked, to avoid deep recursion issues.
but it seems to no longer apply.
Remarks on the PR :
pow_succ
and pow_succ'
have switched their meanings.Ideal.IsPrime.mul_mem_pow
which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul
.@@ -1654,7 +1654,7 @@ theorem gcd_to_nat_aux :
exact le_of_lt (Nat.mod_lt _ (PosNum.cast_pos _))
rw [natSize_to_nat, mul_to_nat, Nat.size_le] at h ⊢
rw [mod_to_nat, mul_comm]
- rw [pow_succ', ← Nat.mod_add_div b (pos a)] at h
+ rw [pow_succ, ← Nat.mod_add_div b (pos a)] at h
refine' lt_of_mul_lt_mul_right (lt_of_le_of_lt _ h) (Nat.zero_le 2)
rw [mul_two, mul_add]
refine'
@@ -835,7 +835,7 @@ theorem ppred_to_nat : ∀ n : Num, (↑) <$> ppred n = Nat.ppred n
#align num.ppred_to_nat Num.ppred_to_nat
theorem cmp_swap (m n) : (cmp m n).swap = cmp n m := by
- cases m <;> cases n <;> try { unfold cmp } <;> try { rfl }; apply PosNum.cmp_swap
+ cases m <;> cases n <;> try { rfl }; apply PosNum.cmp_swap
#align num.cmp_swap Num.cmp_swap
theorem cmp_eq (m n) : cmp m n = Ordering.eq ↔ m = n := by
nsmul
and zsmul
to default automatically (#6262)
This PR removes the default values for nsmul
and zsmul
, forcing the user to populate them manually.
The previous behavior can be obtained by writing nsmul := nsmulRec
and zsmul := zsmulRec
, which is now in the docstring for these fields.
The motivation here is to make it more obvious when module diamonds are being introduced, or at least where they might be hiding; you can now simply search for nsmulRec
in the source code.
Arguably we should do the same thing for intCast
, natCast
, pow
, and zpow
too, but diamonds are less common in those fields, so I'll leave them to a subsequent PR.
Co-authored-by: Matthew Ballard <matt@mrb.email>
@@ -397,6 +397,7 @@ instance addMonoid : AddMonoid Num where
zero_add := zero_add
add_zero := add_zero
add_assoc := by transfer
+ nsmul := nsmulRec
#align num.add_monoid Num.addMonoid
instance addMonoidWithOne : AddMonoidWithOne Num :=
@@ -1435,11 +1436,13 @@ instance addMonoid : AddMonoid ZNum where
zero := 0
zero_add := zero_add
add_zero := add_zero
+ nsmul := nsmulRec
instance addCommGroup : AddCommGroup ZNum :=
{ ZNum.addMonoid with
add_comm := by transfer
neg := Neg.neg
+ zsmul := zsmulRec
add_left_neg := by transfer }
#align znum.add_comm_group ZNum.addCommGroup
@@ -188,8 +188,8 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
theorem lt_to_nat {m n : PosNum} : (m : ℕ) < n ↔ m < n :=
show (m : ℕ) < n ↔ cmp m n = Ordering.lt from
match cmp m n, cmp_to_nat m n with
- | Ordering.lt, h => by simp at h; simp [h]
- | Ordering.eq, h => by simp at h; simp [h, lt_irrefl]
+ | Ordering.lt, h => by simp only at h; simp [h]
+ | Ordering.eq, h => by simp only at h; simp [h, lt_irrefl]
| Ordering.gt, h => by simp [not_lt_of_gt h]
#align pos_num.lt_to_nat PosNum.lt_to_nat
@@ -257,7 +257,7 @@ theorem ofNat'_succ : ∀ {n}, ofNat' (n + 1) = ofNat' n + 1 :=
simp only [← bit1_of_bit1, ← bit0_of_bit0, cond, _root_.bit1]
-- Porting note: `cc` was not ported yet so `exact Nat.add_left_comm n 1 1` is used.
· erw [show n.bit true + 1 = (n + 1).bit false by
- simp [Nat.bit, _root_.bit1, _root_.bit0]; exact Nat.add_left_comm n 1 1,
+ simpa [Nat.bit, _root_.bit1, _root_.bit0] using Nat.add_left_comm n 1 1,
ofNat'_bit, ofNat'_bit, ih]
simp only [cond, add_one, bit1_succ])
#align num.of_nat'_succ Num.ofNat'_succ
@@ -333,8 +333,8 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
theorem lt_to_nat {m n : Num} : (m : ℕ) < n ↔ m < n :=
show (m : ℕ) < n ↔ cmp m n = Ordering.lt from
match cmp m n, cmp_to_nat m n with
- | Ordering.lt, h => by simp at h; simp [h]
- | Ordering.eq, h => by simp at h; simp [h, lt_irrefl]
+ | Ordering.lt, h => by simp only at h; simp [h]
+ | Ordering.eq, h => by simp only at h; simp [h, lt_irrefl]
| Ordering.gt, h => by simp [not_lt_of_gt h]
#align num.lt_to_nat Num.lt_to_nat
@@ -1355,8 +1355,8 @@ theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n
theorem lt_to_int {m n : ZNum} : (m : ℤ) < n ↔ m < n :=
show (m : ℤ) < n ↔ cmp m n = Ordering.lt from
match cmp m n, cmp_to_int m n with
- | Ordering.lt, h => by simp at h; simp [h]
- | Ordering.eq, h => by simp at h; simp [h, lt_irrefl]
+ | Ordering.lt, h => by simp only at h; simp [h]
+ | Ordering.eq, h => by simp only at h; simp [h, lt_irrefl]
| Ordering.gt, h => by simp [not_lt_of_gt h]
#align znum.lt_to_int ZNum.lt_to_int
@@ -1737,7 +1737,7 @@ theorem mod_to_int : ∀ n d, ((n % d : ZNum) : ℤ) = n % d
@[simp]
theorem gcd_to_nat (a b) : (gcd a b : ℕ) = Int.gcd a b :=
- (Num.gcd_to_nat _ _).trans <| by simp; rfl
+ (Num.gcd_to_nat _ _).trans <| by simp only [abs_to_nat]; rfl
#align znum.gcd_to_nat ZNum.gcd_to_nat
theorem dvd_iff_mod_eq_zero {m n : ZNum} : m ∣ n ↔ n % m = 0 := by
This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0
branch as we update to intermediate nightlies.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>
@@ -157,6 +157,7 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
add_le_add h h
| 1, bit1 b => Nat.succ_lt_succ <| to_nat_pos <| bit0 b
| bit0 a, bit0 b => by
+ dsimp [cmp]
have := cmp_to_nat a b; revert this; cases cmp a b <;> dsimp <;> intro this
· exact add_lt_add this this
· rw [this]
@@ -176,6 +177,7 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
apply Nat.lt_succ_self
· exact Nat.le_succ_of_le (add_lt_add this this)
| bit1 a, bit1 b => by
+ dsimp [cmp]
have := cmp_to_nat a b; revert this; cases cmp a b <;> dsimp <;> intro this
· exact Nat.succ_lt_succ (add_lt_add this this)
· rw [this]
@@ -1239,10 +1241,10 @@ theorem ofInt'_toZNum : ∀ n : ℕ, toZNum n = ZNum.ofInt' n
theorem mem_ofZNum' : ∀ {m : Num} {n : ZNum}, m ∈ ofZNum' n ↔ n = toZNum m
| 0, 0 => ⟨fun _ => rfl, fun _ => rfl⟩
- | pos m, 0 => ⟨fun., fun.⟩
+ | pos m, 0 => ⟨nofun, nofun⟩
| m, ZNum.pos p =>
Option.some_inj.trans <| by cases m <;> constructor <;> intro h <;> try cases h <;> rfl
- | m, ZNum.neg p => ⟨fun., fun h => by cases m <;> cases h⟩
+ | m, ZNum.neg p => ⟨nofun, fun h => by cases m <;> cases h⟩
#align num.mem_of_znum' Num.mem_ofZNum'
theorem ofZNum'_toNat : ∀ n : ZNum, (↑) <$> ofZNum' n = Int.toNat' n
@@ -59,7 +59,7 @@ theorem cast_to_nat [AddMonoidWithOne α] : ∀ n : PosNum, ((n : ℕ) : α) = n
| bit1 p => (Nat.cast_bit1 _).trans <| congr_arg _root_.bit1 p.cast_to_nat
#align pos_num.cast_to_nat PosNum.cast_to_nat
-@[norm_cast] -- @[simp] -- Porting note: simp can prove this
+@[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this
theorem to_nat_to_int (n : PosNum) : ((n : ℕ) : ℤ) = n :=
cast_to_nat _
#align pos_num.to_nat_to_int PosNum.to_nat_to_int
@@ -452,12 +452,12 @@ instance linearOrderedSemiring : LinearOrderedSemiring Num :=
exists_pair_ne := ⟨0, 1, by decide⟩ }
#align num.linear_ordered_semiring Num.linearOrderedSemiring
-@[norm_cast] -- @[simp] -- Porting note: simp can prove this
+@[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this
theorem add_of_nat (m n) : ((m + n : ℕ) : Num) = m + n :=
add_ofNat' _ _
#align num.add_of_nat Num.add_of_nat
-@[norm_cast] -- @[simp] -- Porting note: simp can prove this
+@[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this
theorem to_nat_to_int (n : Num) : ((n : ℕ) : ℤ) = n :=
cast_to_nat _
#align num.to_nat_to_int Num.to_nat_to_int
@@ -477,7 +477,7 @@ theorem of_nat_cast {α} [AddMonoidWithOne α] (n : ℕ) : ((n : Num) : α) = n
rw [← cast_to_nat, to_of_nat]
#align num.of_nat_cast Num.of_nat_cast
-@[norm_cast] -- @[simp] -- Porting note: simp can prove this
+@[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this
theorem of_nat_inj {m n : ℕ} : (m : Num) = n ↔ m = n :=
⟨fun h => Function.LeftInverse.injective to_of_nat h, congr_arg _⟩
#align num.of_nat_inj Num.of_nat_inj
@@ -1489,7 +1489,7 @@ instance linearOrderedCommRing : LinearOrderedCommRing ZNum :=
theorem cast_sub [Ring α] (m n) : ((m - n : ZNum) : α) = m - n := by simp [sub_eq_neg_add]
#align znum.cast_sub ZNum.cast_sub
-@[norm_cast] -- @[simp] -- Porting note: simp can prove this
+@[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this
theorem neg_of_int : ∀ n, ((-n : ℤ) : ZNum) = -n
| (n + 1 : ℕ) => rfl
| 0 => by rw [Int.cast_neg]
@@ -1492,7 +1492,7 @@ theorem cast_sub [Ring α] (m n) : ((m - n : ZNum) : α) = m - n := by simp [sub
@[norm_cast] -- @[simp] -- Porting note: simp can prove this
theorem neg_of_int : ∀ n, ((-n : ℤ) : ZNum) = -n
| (n + 1 : ℕ) => rfl
- | 0 => by rw [Int.cast_neg, Int.cast_zero]
+ | 0 => by rw [Int.cast_neg]
| -[n+1] => (zneg_zneg _).symm
#align znum.neg_of_int ZNum.neg_of_int
@@ -977,11 +977,11 @@ theorem castNum_testBit (m n) : testBit m n = Nat.testBit m n := by
induction' n with n IH generalizing m <;> cases' m with m m
<;> dsimp only [PosNum.testBit, Nat.zero_eq]
· rfl
- · rw [PosNum.cast_bit1, ← Nat.bit_true, Nat.testBit_zero]
- · rw [PosNum.cast_bit0, ← Nat.bit_false, Nat.testBit_zero]
- · rw [PosNum.cast_one', ← bit1_zero, ← Nat.bit_true, Nat.testBit_succ, Nat.zero_testBit]
- · rw [PosNum.cast_bit1, ← Nat.bit_true, Nat.testBit_succ, IH]
- · rw [PosNum.cast_bit0, ← Nat.bit_false, Nat.testBit_succ, IH]
+ · rw [PosNum.cast_bit1, ← Nat.bit_true, Nat.testBit_bit_zero]
+ · rw [PosNum.cast_bit0, ← Nat.bit_false, Nat.testBit_bit_zero]
+ · rw [PosNum.cast_one', ← bit1_zero, ← Nat.bit_true, Nat.testBit_bit_succ, Nat.zero_testBit]
+ · rw [PosNum.cast_bit1, ← Nat.bit_true, Nat.testBit_bit_succ, IH]
+ · rw [PosNum.cast_bit0, ← Nat.bit_false, Nat.testBit_bit_succ, IH]
#align num.test_bit_to_nat Num.castNum_testBit
end Num
@@ -6,7 +6,6 @@ Authors: Mario Carneiro
import Mathlib.Data.Num.Bitwise
import Mathlib.Data.Int.CharZero
import Mathlib.Data.Nat.Bitwise
-import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Data.Nat.PSub
import Mathlib.Data.Nat.Size
cases x with | ...
instead of cases x; case => ...
(#9321)
This converts usages of the pattern
cases h
case inl h' => ...
case inr h' => ...
which derive from mathported code, to the "structured cases
" syntax:
cases h with
| inl h' => ...
| inr h' => ...
The case where the subgoals are handled with ·
instead of case
is more contentious (and much more numerous) so I left those alone. This pattern also appears with cases'
, induction
, induction'
, and rcases
. Furthermore, there is a similar transformation for by_cases
:
by_cases h : cond
case pos => ...
case neg => ...
is replaced by:
if h : cond then
...
else
...
Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@@ -970,10 +970,10 @@ theorem castNum_shiftRight (m : Num) (n : Nat) : ↑(m >>> n) = (m : ℕ) >>> (n
@[simp]
theorem castNum_testBit (m n) : testBit m n = Nat.testBit m n := by
-- Porting note: `unfold` → `dsimp only`
- cases m <;> dsimp only [testBit]
- case zero =>
+ cases m with dsimp only [testBit]
+ | zero =>
rw [show (Num.zero : Nat) = 0 from rfl, Nat.zero_testBit]
- case pos m =>
+ | pos m =>
rw [cast_pos]
induction' n with n IH generalizing m <;> cases' m with m m
<;> dsimp only [PosNum.testBit, Nat.zero_eq]
The names for lemmas about monotonicity of (a ^ ·)
and (· ^ n)
were a mess. This PR tidies up everything related by following the naming convention for (a * ·)
and (· * b)
. Namely, (a ^ ·)
is pow_right
and (· ^ n)
is pow_left
in lemma names. All lemma renames follow the corresponding multiplication lemma names closely.
Algebra.GroupPower.Order
pow_mono
→ pow_right_mono
pow_le_pow
→ pow_le_pow_right
pow_le_pow_of_le_left
→ pow_le_pow_left
pow_lt_pow_of_lt_left
→ pow_lt_pow_left
strictMonoOn_pow
→ pow_left_strictMonoOn
pow_strictMono_right
→ pow_right_strictMono
pow_lt_pow
→ pow_lt_pow_right
pow_lt_pow_iff
→ pow_lt_pow_iff_right
pow_le_pow_iff
→ pow_le_pow_iff_right
self_lt_pow
→ lt_self_pow
strictAnti_pow
→ pow_right_strictAnti
pow_lt_pow_iff_of_lt_one
→ pow_lt_pow_iff_right_of_lt_one
pow_lt_pow_of_lt_one
→ pow_lt_pow_right_of_lt_one
lt_of_pow_lt_pow
→ lt_of_pow_lt_pow_left
le_of_pow_le_pow
→ le_of_pow_le_pow_left
pow_lt_pow₀
→ pow_lt_pow_right₀
Algebra.GroupPower.CovariantClass
pow_le_pow_of_le_left'
→ pow_le_pow_left'
nsmul_le_nsmul_of_le_right
→ nsmul_le_nsmul_right
pow_lt_pow'
→ pow_lt_pow_right'
nsmul_lt_nsmul
→ nsmul_lt_nsmul_left
pow_strictMono_left
→ pow_right_strictMono'
nsmul_strictMono_right
→ nsmul_left_strictMono
StrictMono.pow_right'
→ StrictMono.pow_const
StrictMono.nsmul_left
→ StrictMono.const_nsmul
pow_strictMono_right'
→ pow_left_strictMono
nsmul_strictMono_left
→ nsmul_right_strictMono
Monotone.pow_right
→ Monotone.pow_const
Monotone.nsmul_left
→ Monotone.const_nsmul
lt_of_pow_lt_pow'
→ lt_of_pow_lt_pow_left'
lt_of_nsmul_lt_nsmul
→ lt_of_nsmul_lt_nsmul_right
pow_le_pow'
→ pow_le_pow_right'
nsmul_le_nsmul
→ nsmul_le_nsmul_left
pow_le_pow_of_le_one'
→ pow_le_pow_right_of_le_one'
nsmul_le_nsmul_of_nonpos
→ nsmul_le_nsmul_left_of_nonpos
le_of_pow_le_pow'
→ le_of_pow_le_pow_left'
le_of_nsmul_le_nsmul'
→ le_of_nsmul_le_nsmul_right'
pow_le_pow_iff'
→ pow_le_pow_iff_right'
nsmul_le_nsmul_iff
→ nsmul_le_nsmul_iff_left
pow_lt_pow_iff'
→ pow_lt_pow_iff_right'
nsmul_lt_nsmul_iff
→ nsmul_lt_nsmul_iff_left
Data.Nat.Pow
Nat.pow_lt_pow_of_lt_left
→ Nat.pow_lt_pow_left
Nat.pow_le_iff_le_left
→ Nat.pow_le_pow_iff_left
Nat.pow_lt_iff_lt_left
→ Nat.pow_lt_pow_iff_left
pow_le_pow_iff_left
pow_lt_pow_iff_left
pow_right_injective
pow_right_inj
Nat.pow_le_pow_left
to have the correct name since Nat.pow_le_pow_of_le_left
is in Std.Nat.pow_le_pow_right
to have the correct name since Nat.pow_le_pow_of_le_right
is in Std.self_le_pow
was a duplicate of le_self_pow
.Nat.pow_lt_pow_of_lt_right
is defeq to pow_lt_pow_right
.Nat.pow_right_strictMono
is defeq to pow_right_strictMono
.Nat.pow_le_iff_le_right
is defeq to pow_le_pow_iff_right
.Nat.pow_lt_iff_lt_right
is defeq to pow_lt_pow_iff_right
.0 < n
or 1 ≤ n
to n ≠ 0
.Nat
lemmas have been protected
.@@ -952,7 +952,7 @@ theorem castNum_shiftRight (m : Num) (n : Nat) : ↑(m >>> n) = (m : ℕ) >>> (n
· rw [Nat.shiftRight_eq_div_pow]
symm
apply Nat.div_eq_of_lt
- simp [@Nat.pow_lt_pow_of_lt_right 2 (by decide) 0 (n + 1) (Nat.succ_pos _)]
+ simp
· trans
apply IH
change Nat.shiftRight m n = Nat.shiftRight (_root_.bit1 m) (n + 1)
@@ -1428,19 +1428,22 @@ instance linearOrder : LinearOrder ZNum where
decidableLT := ZNum.decidableLT
#align znum.linear_order ZNum.linearOrder
-instance addCommGroup : AddCommGroup ZNum where
+instance addMonoid : AddMonoid ZNum where
add := (· + ·)
add_assoc := by transfer
zero := 0
zero_add := zero_add
add_zero := add_zero
- add_comm := by transfer
- neg := Neg.neg
- add_left_neg := by transfer
+
+instance addCommGroup : AddCommGroup ZNum :=
+ { ZNum.addMonoid with
+ add_comm := by transfer
+ neg := Neg.neg
+ add_left_neg := by transfer }
#align znum.add_comm_group ZNum.addCommGroup
instance addMonoidWithOne : AddMonoidWithOne ZNum :=
- { ZNum.addCommGroup with
+ { ZNum.addMonoid with
one := 1
natCast := fun n => ZNum.ofInt' n
natCast_zero := show (Num.ofNat' 0).toZNum = 0 by rw [Num.ofNat'_zero]; rfl
@@ -86,8 +86,8 @@ theorem add_one (n : PosNum) : n + 1 = succ n := by cases n <;> rfl
@[norm_cast]
theorem add_to_nat : ∀ m n, ((m + n : PosNum) : ℕ) = m + n
- | 1, b => by rw [one_add b, succ_to_nat, add_comm]; rfl
- | a, 1 => by rw [add_one a, succ_to_nat]; rfl
+ | 1, b => by rw [one_add b, succ_to_nat, add_comm, cast_one]
+ | a, 1 => by rw [add_one a, succ_to_nat, cast_one]
| bit0 a, bit0 b => (congr_arg _root_.bit0 (add_to_nat a b)).trans <| add_add_add_comm _ _ _ _
| bit0 a, bit1 b =>
(congr_arg _root_.bit1 (add_to_nat a b)).trans <|
@@ -113,11 +113,11 @@ theorem add_succ : ∀ m n : PosNum, m + succ n = succ (m + n)
theorem bit0_of_bit0 : ∀ n, _root_.bit0 n = bit0 n
| 1 => rfl
| bit0 p => congr_arg bit0 (bit0_of_bit0 p)
- | bit1 p => show bit0 (succ (_root_.bit0 p)) = _ by rw [bit0_of_bit0 p]; rfl
+ | bit1 p => show bit0 (succ (_root_.bit0 p)) = _ by rw [bit0_of_bit0 p, succ]
#align pos_num.bit0_of_bit0 PosNum.bit0_of_bit0
theorem bit1_of_bit1 (n : PosNum) : _root_.bit1 n = bit1 n :=
- show _root_.bit0 n + 1 = bit1 n by rw [add_one, bit0_of_bit0]; rfl
+ show _root_.bit0 n + 1 = bit1 n by rw [add_one, bit0_of_bit0, succ]
#align pos_num.bit1_of_bit1 PosNum.bit1_of_bit1
@[norm_cast]
@@ -218,7 +218,7 @@ theorem add_one : ∀ n : Num, n + 1 = succ n
theorem add_succ : ∀ m n : Num, m + succ n = succ (m + n)
| 0, n => by simp [zero_add]
- | pos p, 0 => show pos (p + 1) = succ (pos p + 0) by rw [PosNum.add_one, add_zero]; rfl
+ | pos p, 0 => show pos (p + 1) = succ (pos p + 0) by rw [PosNum.add_one, add_zero, succ, succ']
| pos p, pos q => congr_arg pos (PosNum.add_succ _ _)
#align num.add_succ Num.add_succ
@@ -250,7 +250,7 @@ theorem bit1_succ : ∀ n : Num, n.bit1.succ = n.succ.bit0
#align num.bit1_succ Num.bit1_succ
theorem ofNat'_succ : ∀ {n}, ofNat' (n + 1) = ofNat' n + 1 :=
- @(Nat.binaryRec (by simp; rfl) fun b n ih => by
+ @(Nat.binaryRec (by simp [zero_add]) fun b n ih => by
cases b
· erw [ofNat'_bit true n, ofNat'_bit]
simp only [← bit1_of_bit1, ← bit0_of_bit0, cond, _root_.bit1]
@@ -420,7 +420,7 @@ instance commSemiring : CommSemiring Num := by
instance orderedCancelAddCommMonoid : OrderedCancelAddCommMonoid Num where
le := (· ≤ ·)
lt := (· < ·)
- lt_iff_le_not_le a b := by simp only [←lt_to_nat, ←le_to_nat, lt_iff_le_not_le]
+ lt_iff_le_not_le a b := by simp only [← lt_to_nat, ← le_to_nat, lt_iff_le_not_le]
le_refl := by transfer
le_trans a b c := by transfer_rw; apply le_trans
le_antisymm a b := by transfer_rw; apply le_antisymm
@@ -897,8 +897,8 @@ theorem castNum_eq_bitwise {f : Num → Num → Num} {g : Bool → Bool → Bool
intros b _; cases b <;> rfl]
rw [Nat.bitwise_bit gff]
any_goals rw [Nat.bitwise_zero, p11]; cases g true true <;> rfl
- any_goals rw [Nat.bitwise_zero_left, ←Bool.cond_eq_ite, this, ← bit_to_nat, p1b]
- any_goals rw [Nat.bitwise_zero_right, ←Bool.cond_eq_ite, this, ← bit_to_nat, pb1]
+ any_goals rw [Nat.bitwise_zero_left, ← Bool.cond_eq_ite, this, ← bit_to_nat, p1b]
+ any_goals rw [Nat.bitwise_zero_right, ← Bool.cond_eq_ite, this, ← bit_to_nat, pb1]
all_goals
rw [← show ∀ n : PosNum, ↑(p m n) = Nat.bitwise g ↑m ↑n from IH]
rw [← bit_to_nat, pbb]
@@ -929,7 +929,7 @@ theorem castNum_xor : ∀ m n : Num, ↑(m ^^^ n) = (↑m ^^^ ↑n : ℕ) := by
@[simp, norm_cast]
theorem castNum_shiftLeft (m : Num) (n : Nat) : ↑(m <<< n) = (m : ℕ) <<< (n : ℕ) := by
- cases m <;> dsimp only [←shiftl_eq_shiftLeft, shiftl]
+ cases m <;> dsimp only [← shiftl_eq_shiftLeft, shiftl]
· symm
apply Nat.zero_shiftLeft
simp only [cast_pos]
@@ -943,12 +943,12 @@ theorem castNum_shiftLeft (m : Num) (n : Nat) : ↑(m <<< n) = (m : ℕ) <<< (n
@[simp, norm_cast]
theorem castNum_shiftRight (m : Num) (n : Nat) : ↑(m >>> n) = (m : ℕ) >>> (n : ℕ) := by
- cases' m with m <;> dsimp only [←shiftr_eq_shiftRight, shiftr];
+ cases' m with m <;> dsimp only [← shiftr_eq_shiftRight, shiftr];
· symm
apply Nat.zero_shiftRight
induction' n with n IH generalizing m
· cases m <;> rfl
- cases' m with m m <;> dsimp only [PosNum.shiftr, ←PosNum.shiftr_eq_shiftRight]
+ cases' m with m m <;> dsimp only [PosNum.shiftr, ← PosNum.shiftr_eq_shiftRight]
· rw [Nat.shiftRight_eq_div_pow]
symm
apply Nat.div_eq_of_lt
Notably leanprover/std4#366 changed the definition of testBit
(to something equivalent) when upstreaming it, which broke a handful of proofs.
Other conflicting changes in Std, resolved for now by priming the mathlib name:
Std.BitVec.adc
: the type was changed from BitVec (n + 1)
to Bool × BitVec w
Nat.mul_add_mod
: the type was changed from (a * b + c) % b = c % b
to (b * a + c) % b = c % b
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Alex Keizer <alex@keizer.dev> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -970,28 +970,19 @@ theorem castNum_shiftRight (m : Num) (n : Nat) : ↑(m >>> n) = (m : ℕ) >>> (n
@[simp]
theorem castNum_testBit (m n) : testBit m n = Nat.testBit m n := by
-- Porting note: `unfold` → `dsimp only`
- cases m <;> dsimp only [testBit, Nat.testBit]
+ cases m <;> dsimp only [testBit]
case zero =>
- change false = Nat.bodd (0 >>> n)
- rw [Nat.zero_shiftRight]
- rfl
+ rw [show (Num.zero : Nat) = 0 from rfl, Nat.zero_testBit]
case pos m =>
- induction' n with n IH generalizing m <;> cases' m with m m <;> dsimp only [PosNum.testBit]
+ rw [cast_pos]
+ induction' n with n IH generalizing m <;> cases' m with m m
+ <;> dsimp only [PosNum.testBit, Nat.zero_eq]
· rfl
- · exact (Nat.bodd_bit _ _).symm
- · exact (Nat.bodd_bit _ _).symm
- · change false = Nat.bodd (1 >>> (n + 1))
- rw [add_comm, Nat.shiftRight_add]
- change false = Nat.bodd (0 >>> n)
- rw [Nat.zero_shiftRight]; rfl
- · change PosNum.testBit m n = Nat.bodd ((Nat.bit true m) >>> (n + 1))
- rw [add_comm, Nat.shiftRight_add]
- simp only [Nat.shiftRight_succ, Nat.shiftRight_zero, ← Nat.div2_val, Nat.div2_bit]
- apply IH
- · change PosNum.testBit m n = Nat.bodd ((Nat.bit false m) >>> (n + 1))
- rw [add_comm, Nat.shiftRight_add]
- simp only [Nat.shiftRight_succ, Nat.shiftRight_zero, ← Nat.div2_val, Nat.div2_bit]
- apply IH
+ · rw [PosNum.cast_bit1, ← Nat.bit_true, Nat.testBit_zero]
+ · rw [PosNum.cast_bit0, ← Nat.bit_false, Nat.testBit_zero]
+ · rw [PosNum.cast_one', ← bit1_zero, ← Nat.bit_true, Nat.testBit_succ, Nat.zero_testBit]
+ · rw [PosNum.cast_bit1, ← Nat.bit_true, Nat.testBit_succ, IH]
+ · rw [PosNum.cast_bit0, ← Nat.bit_false, Nat.testBit_succ, IH]
#align num.test_bit_to_nat Num.castNum_testBit
end Num
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -250,7 +250,7 @@ theorem bit1_succ : ∀ n : Num, n.bit1.succ = n.succ.bit0
#align num.bit1_succ Num.bit1_succ
theorem ofNat'_succ : ∀ {n}, ofNat' (n + 1) = ofNat' n + 1 :=
- @(Nat.binaryRec (by simp) fun b n ih => by
+ @(Nat.binaryRec (by simp; rfl) fun b n ih => by
cases b
· erw [ofNat'_bit true n, ofNat'_bit]
simp only [← bit1_of_bit1, ← bit0_of_bit0, cond, _root_.bit1]
There really is no reason (mathematically nor import graphically) to have OrderedCancelCommMonoid
be defined in a separate file from OrderedCommMonoid
.
Also take the opportunity to:
OrderedCancelCommMonoid
extend OrderedCommMonoid
to_additive
can be called directly on the multiplicative version@@ -25,7 +25,7 @@ unnecessary.
set_option linter.deprecated false
-- Porting note: Required for the notation `-[n+1]`.
-open Int
+open Int Function
attribute [local simp] add_assoc
@@ -363,9 +363,10 @@ theorem of_to_nat' : ∀ n : Num, Num.ofNat' (n : ℕ) = n
| pos p => p.of_to_nat'
#align num.of_to_nat' Num.of_to_nat'
+lemma toNat_injective : Injective (castNum : Num → ℕ) := LeftInverse.injective of_to_nat'
+
@[norm_cast]
-theorem to_nat_inj {m n : Num} : (m : ℕ) = n ↔ m = n :=
- ⟨fun h => Function.LeftInverse.injective of_to_nat' h, congr_arg _⟩
+theorem to_nat_inj {m n : Num} : (m : ℕ) = n ↔ m = n := toNat_injective.eq_iff
#align num.to_nat_inj Num.to_nat_inj
/-- This tactic tries to turn an (in)equality about `Num`s to one about `Nat`s by rewriting.
@@ -416,33 +417,15 @@ instance commSemiring : CommSemiring Num := by
simp [add_comm, mul_add, add_mul, mul_assoc, mul_comm, mul_left_comm]
#align num.comm_semiring Num.commSemiring
-instance orderedCancelAddCommMonoid : OrderedCancelAddCommMonoid Num :=
- { Num.commSemiring with
- lt := (· < ·)
- lt_iff_le_not_le := by
- intro a b
- transfer_rw
- apply lt_iff_le_not_le
- le := (· ≤ ·)
- le_refl := by
- transfer
- le_trans := by
- intro a b c
- transfer_rw
- apply le_trans
- le_antisymm := by
- intro a b
- transfer_rw
- apply le_antisymm
- add_le_add_left := by
- intro a b h c
- revert h
- transfer_rw
- exact fun h => add_le_add_left h c
- le_of_add_le_add_left := by
- intro a b c
- transfer_rw
- apply le_of_add_le_add_left }
+instance orderedCancelAddCommMonoid : OrderedCancelAddCommMonoid Num where
+ le := (· ≤ ·)
+ lt := (· < ·)
+ lt_iff_le_not_le a b := by simp only [←lt_to_nat, ←le_to_nat, lt_iff_le_not_le]
+ le_refl := by transfer
+ le_trans a b c := by transfer_rw; apply le_trans
+ le_antisymm a b := by transfer_rw; apply le_antisymm
+ add_le_add_left a b h c := by revert h; transfer_rw; exact fun h => add_le_add_left h c
+ le_of_add_le_add_left a b c := by transfer_rw; apply le_of_add_le_add_left
#align num.ordered_cancel_add_comm_monoid Num.orderedCancelAddCommMonoid
instance linearOrderedSemiring : LinearOrderedSemiring Num :=
Removes nonterminal simps on lines looking like simp [...]
@@ -1666,7 +1666,7 @@ theorem gcd_to_nat_aux :
| 0, pos a, pos b, _ab, h => (not_lt_of_le h).elim <| PosNum.natSize_pos _
| Nat.succ n, 0, b, _ab, _h => (Nat.gcd_zero_left _).symm
| Nat.succ n, pos a, b, ab, h => by
- simp [gcdAux]
+ simp only [gcdAux, cast_pos]
rw [Nat.gcd_rec, gcd_to_nat_aux, mod_to_nat]
· rfl
· rw [← le_to_nat, mod_to_nat]
@@ -1688,7 +1688,7 @@ theorem gcd_to_nat_aux :
theorem gcd_to_nat : ∀ a b, (gcd a b : ℕ) = Nat.gcd a b := by
have : ∀ a b : Num, (a * b).natSize ≤ a.natSize + b.natSize := by
intros
- simp [natSize_to_nat]
+ simp only [natSize_to_nat, cast_mul]
rw [Nat.size_le, pow_add]
exact mul_lt_mul'' (Nat.lt_size_self _) (Nat.lt_size_self _) (Nat.zero_le _) (Nat.zero_le _)
intros
@@ -883,7 +883,8 @@ theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap]; cases cmp m n <;> exact by decide
#align num.le_iff_cmp Num.le_iff_cmp
-theorem bitwise_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (p : PosNum → PosNum → Num)
+theorem castNum_eq_bitwise {f : Num → Num → Num} {g : Bool → Bool → Bool}
+ (p : PosNum → PosNum → Num)
(gff : g false false = false) (f00 : f 0 0 = 0)
(f0n : ∀ n, f 0 (pos n) = cond (g false true) (pos n) 0)
(fn0 : ∀ n, f (pos n) 0 = cond (g true false) (pos n) 0)
@@ -918,33 +919,33 @@ theorem bitwise_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (p
all_goals
rw [← show ∀ n : PosNum, ↑(p m n) = Nat.bitwise g ↑m ↑n from IH]
rw [← bit_to_nat, pbb]
-#align num.bitwise_to_nat Num.bitwise_to_nat
+#align num.bitwise_to_nat Num.castNum_eq_bitwise
@[simp, norm_cast]
-theorem lor_to_nat : ∀ m n : Num, ↑(m ||| n) = Nat.lor m n := by
+theorem castNum_or : ∀ m n : Num, ↑(m ||| n) = (↑m ||| ↑n : ℕ) := by
-- Porting note: A name of an implicit local hypothesis is not available so
-- `cases_type*` is used.
- apply bitwise_to_nat fun x y => pos (PosNum.lor x y) <;>
+ apply castNum_eq_bitwise fun x y => pos (PosNum.lor x y) <;>
intros <;> (try cases_type* Bool) <;> rfl
-#align num.lor_to_nat Num.lor_to_nat
+#align num.lor_to_nat Num.castNum_or
@[simp, norm_cast]
-theorem land_to_nat : ∀ m n : Num, ↑(m &&& n) = Nat.land m n := by
- apply bitwise_to_nat PosNum.land <;> intros <;> (try cases_type* Bool) <;> rfl
-#align num.land_to_nat Num.land_to_nat
+theorem castNum_and : ∀ m n : Num, ↑(m &&& n) = (↑m &&& ↑n : ℕ) := by
+ apply castNum_eq_bitwise PosNum.land <;> intros <;> (try cases_type* Bool) <;> rfl
+#align num.land_to_nat Num.castNum_and
@[simp, norm_cast]
-theorem ldiff_to_nat : ∀ m n : Num, (ldiff m n : ℕ) = Nat.ldiff m n := by
- apply bitwise_to_nat PosNum.ldiff <;> intros <;> (try cases_type* Bool) <;> rfl
-#align num.ldiff_to_nat Num.ldiff_to_nat
+theorem castNum_ldiff : ∀ m n : Num, (ldiff m n : ℕ) = Nat.ldiff m n := by
+ apply castNum_eq_bitwise PosNum.ldiff <;> intros <;> (try cases_type* Bool) <;> rfl
+#align num.ldiff_to_nat Num.castNum_ldiff
@[simp, norm_cast]
-theorem lxor_to_nat : ∀ m n : Num, ↑(m ^^^ n) = Nat.xor m n := by
- apply bitwise_to_nat PosNum.lxor <;> intros <;> (try cases_type* Bool) <;> rfl
-#align num.lxor_to_nat Num.lxor_to_nat
+theorem castNum_xor : ∀ m n : Num, ↑(m ^^^ n) = (↑m ^^^ ↑n : ℕ) := by
+ apply castNum_eq_bitwise PosNum.lxor <;> intros <;> (try cases_type* Bool) <;> rfl
+#align num.lxor_to_nat Num.castNum_ldiff
@[simp, norm_cast]
-theorem shiftl_to_nat (m : Num) (n : Nat) : ↑(m <<< n) = (m : ℕ) <<< (n : ℕ) := by
+theorem castNum_shiftLeft (m : Num) (n : Nat) : ↑(m <<< n) = (m : ℕ) <<< (n : ℕ) := by
cases m <;> dsimp only [←shiftl_eq_shiftLeft, shiftl]
· symm
apply Nat.zero_shiftLeft
@@ -954,11 +955,11 @@ theorem shiftl_to_nat (m : Num) (n : Nat) : ↑(m <<< n) = (m : ℕ) <<< (n :
simp [PosNum.shiftl_succ_eq_bit0_shiftl, Nat.shiftLeft_succ, IH,
Nat.bit0_val, pow_succ, ← mul_assoc, mul_comm,
-shiftl_eq_shiftLeft, -PosNum.shiftl_eq_shiftLeft, shiftl]
-#align num.shiftl_to_nat Num.shiftl_to_nat
+#align num.shiftl_to_nat Num.castNum_shiftLeft
@[simp, norm_cast]
-theorem shiftr_to_nat (m : Num) (n : Nat) : ↑(m >>> n) = (m : ℕ) >>> (n : ℕ) := by
+theorem castNum_shiftRight (m : Num) (n : Nat) : ↑(m >>> n) = (m : ℕ) >>> (n : ℕ) := by
cases' m with m <;> dsimp only [←shiftr_eq_shiftRight, shiftr];
· symm
apply Nat.zero_shiftRight
@@ -981,10 +982,10 @@ theorem shiftr_to_nat (m : Num) (n : Nat) : ↑(m >>> n) = (m : ℕ) >>> (n :
rw [add_comm n 1, @Nat.shiftRight_eq _ (1 + n), Nat.shiftRight_add]
apply congr_arg fun x => Nat.shiftRight x n
simp [Nat.shiftRight_succ, Nat.shiftRight_zero, ← Nat.div2_val]
-#align num.shiftr_to_nat Num.shiftr_to_nat
+#align num.shiftr_to_nat Num.castNum_shiftRight
@[simp]
-theorem testBit_to_nat (m n) : testBit m n = Nat.testBit m n := by
+theorem castNum_testBit (m n) : testBit m n = Nat.testBit m n := by
-- Porting note: `unfold` → `dsimp only`
cases m <;> dsimp only [testBit, Nat.testBit]
case zero =>
@@ -1008,7 +1009,7 @@ theorem testBit_to_nat (m n) : testBit m n = Nat.testBit m n := by
rw [add_comm, Nat.shiftRight_add]
simp only [Nat.shiftRight_succ, Nat.shiftRight_zero, ← Nat.div2_val, Nat.div2_bit]
apply IH
-#align num.test_bit_to_nat Num.testBit_to_nat
+#align num.test_bit_to_nat Num.castNum_testBit
end Num
Nat.bitwise'
(#7451)
Building upon the proof that Nat.bitwise
and Nat.bitwise'
are equal (from #7410), this PR completely removes bitwise'
and changes all uses to bitwise
instead.
In particular, land'/lor'/lxor'
are replaced with the bitwise
-based equivalent operations in core, which have overriden optimized implementations in the compiler.
Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Alex Keizer <alex@keizer.dev> Co-authored-by: Chris Hughes <chrishughes24@gmail.com>
@@ -883,7 +883,7 @@ theorem le_iff_cmp {m n} : m ≤ n ↔ cmp m n ≠ Ordering.gt :=
not_congr <| lt_iff_cmp.trans <| by rw [← cmp_swap]; cases cmp m n <;> exact by decide
#align num.le_iff_cmp Num.le_iff_cmp
-theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (p : PosNum → PosNum → Num)
+theorem bitwise_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (p : PosNum → PosNum → Num)
(gff : g false false = false) (f00 : f 0 0 = 0)
(f0n : ∀ n, f 0 (pos n) = cond (g false true) (pos n) 0)
(fn0 : ∀ n, f (pos n) 0 = cond (g true false) (pos n) 0)
@@ -891,23 +891,15 @@ theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (
(p1b : ∀ b n, p 1 (PosNum.bit b n) = bit (g true b) (cond (g false true) (pos n) 0))
(pb1 : ∀ a m, p (PosNum.bit a m) 1 = bit (g a true) (cond (g true false) (pos m) 0))
(pbb : ∀ a b m n, p (PosNum.bit a m) (PosNum.bit b n) = bit (g a b) (p m n)) :
- ∀ m n : Num, (f m n : ℕ) = Nat.bitwise' g m n := by
- -- Porting note: `change .. with ..` is now `simp only [show .. = .. from rfl]`.
+ ∀ m n : Num, (f m n : ℕ) = Nat.bitwise g m n := by
intros m n
cases' m with m <;> cases' n with n <;>
try simp only [show zero = 0 from rfl, show ((0 : Num) : ℕ) = 0 from rfl]
- · rw [f00, Nat.bitwise'_zero]; rfl
- · unfold Nat.bitwise'
- rw [f0n, Nat.binaryRec_zero]
+ · rw [f00, Nat.bitwise_zero]; rfl
+ · rw [f0n, Nat.bitwise_zero_left]
cases g false true <;> rfl
- · unfold Nat.bitwise'
- generalize h : (pos m : ℕ) = m'
- revert h
- apply Nat.bitCasesOn m' _
- intro b m' h
- rw [fn0, Nat.binaryRec_eq, Nat.binaryRec_zero, ← h]
+ · rw [fn0, Nat.bitwise_zero_right]
cases g true false <;> rfl
- apply Nat.bitwise'_bit_aux gff
· rw [fnn]
have : ∀ (b) (n : PosNum), (cond b (↑n) 0 : ℕ) = ↑(cond b (pos n) 0 : Num) := by
intros b _; cases b <;> rfl
@@ -919,38 +911,37 @@ theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (
repeat'
rw [show ∀ b n, (pos (PosNum.bit b n) : ℕ) = Nat.bit b ↑n by
intros b _; cases b <;> rfl]
- rw [Nat.bitwise'_bit]
- any_goals assumption
- any_goals rw [Nat.bitwise'_zero, p11]; cases g true true <;> rfl
- any_goals rw [Nat.bitwise'_zero_left, this, ← bit_to_nat, p1b]
- any_goals rw [Nat.bitwise'_zero_right, this, ← bit_to_nat, pb1]
+ rw [Nat.bitwise_bit gff]
+ any_goals rw [Nat.bitwise_zero, p11]; cases g true true <;> rfl
+ any_goals rw [Nat.bitwise_zero_left, ←Bool.cond_eq_ite, this, ← bit_to_nat, p1b]
+ any_goals rw [Nat.bitwise_zero_right, ←Bool.cond_eq_ite, this, ← bit_to_nat, pb1]
all_goals
- rw [← show ∀ n : PosNum, ↑(p m n) = Nat.bitwise' g ↑m ↑n from IH]
+ rw [← show ∀ n : PosNum, ↑(p m n) = Nat.bitwise g ↑m ↑n from IH]
rw [← bit_to_nat, pbb]
-#align num.bitwise_to_nat Num.bitwise'_to_nat
+#align num.bitwise_to_nat Num.bitwise_to_nat
@[simp, norm_cast]
-theorem lor'_to_nat : ∀ m n : Num, ↑(m ||| n) = Nat.lor' m n := by
+theorem lor_to_nat : ∀ m n : Num, ↑(m ||| n) = Nat.lor m n := by
-- Porting note: A name of an implicit local hypothesis is not available so
-- `cases_type*` is used.
- apply bitwise'_to_nat fun x y => pos (PosNum.lor x y) <;>
+ apply bitwise_to_nat fun x y => pos (PosNum.lor x y) <;>
intros <;> (try cases_type* Bool) <;> rfl
-#align num.lor_to_nat Num.lor'_to_nat
+#align num.lor_to_nat Num.lor_to_nat
@[simp, norm_cast]
-theorem land'_to_nat : ∀ m n : Num, ↑(m &&& n) = Nat.land' m n := by
- apply bitwise'_to_nat PosNum.land <;> intros <;> (try cases_type* Bool) <;> rfl
-#align num.land_to_nat Num.land'_to_nat
+theorem land_to_nat : ∀ m n : Num, ↑(m &&& n) = Nat.land m n := by
+ apply bitwise_to_nat PosNum.land <;> intros <;> (try cases_type* Bool) <;> rfl
+#align num.land_to_nat Num.land_to_nat
@[simp, norm_cast]
-theorem ldiff'_to_nat : ∀ m n : Num, (ldiff m n : ℕ) = Nat.ldiff' m n := by
- apply bitwise'_to_nat PosNum.ldiff <;> intros <;> (try cases_type* Bool) <;> rfl
-#align num.ldiff_to_nat Num.ldiff'_to_nat
+theorem ldiff_to_nat : ∀ m n : Num, (ldiff m n : ℕ) = Nat.ldiff m n := by
+ apply bitwise_to_nat PosNum.ldiff <;> intros <;> (try cases_type* Bool) <;> rfl
+#align num.ldiff_to_nat Num.ldiff_to_nat
@[simp, norm_cast]
-theorem lxor'_to_nat : ∀ m n : Num, ↑(m ^^^ n) = Nat.lxor' m n := by
- apply bitwise'_to_nat PosNum.lxor <;> intros <;> (try cases_type* Bool) <;> rfl
-#align num.lxor_to_nat Num.lxor'_to_nat
+theorem lxor_to_nat : ∀ m n : Num, ↑(m ^^^ n) = Nat.xor m n := by
+ apply bitwise_to_nat PosNum.lxor <;> intros <;> (try cases_type* Bool) <;> rfl
+#align num.lxor_to_nat Num.lxor_to_nat
@[simp, norm_cast]
theorem shiftl_to_nat (m : Num) (n : Nat) : ↑(m <<< n) = (m : ℕ) <<< (n : ℕ) := by
This enables the existing |||
, &&&
, <<<
, >>>
, and ^^^
notation for Num
and PosNum
, and makes them simp-normal form.
@@ -930,7 +930,7 @@ theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (
#align num.bitwise_to_nat Num.bitwise'_to_nat
@[simp, norm_cast]
-theorem lor'_to_nat : ∀ m n, (lor m n : ℕ) = Nat.lor' m n := by
+theorem lor'_to_nat : ∀ m n : Num, ↑(m ||| n) = Nat.lor' m n := by
-- Porting note: A name of an implicit local hypothesis is not available so
-- `cases_type*` is used.
apply bitwise'_to_nat fun x y => pos (PosNum.lor x y) <;>
@@ -938,41 +938,42 @@ theorem lor'_to_nat : ∀ m n, (lor m n : ℕ) = Nat.lor' m n := by
#align num.lor_to_nat Num.lor'_to_nat
@[simp, norm_cast]
-theorem land'_to_nat : ∀ m n, (land m n : ℕ) = Nat.land' m n := by
+theorem land'_to_nat : ∀ m n : Num, ↑(m &&& n) = Nat.land' m n := by
apply bitwise'_to_nat PosNum.land <;> intros <;> (try cases_type* Bool) <;> rfl
#align num.land_to_nat Num.land'_to_nat
@[simp, norm_cast]
-theorem ldiff'_to_nat : ∀ m n, (ldiff m n : ℕ) = Nat.ldiff' m n := by
+theorem ldiff'_to_nat : ∀ m n : Num, (ldiff m n : ℕ) = Nat.ldiff' m n := by
apply bitwise'_to_nat PosNum.ldiff <;> intros <;> (try cases_type* Bool) <;> rfl
#align num.ldiff_to_nat Num.ldiff'_to_nat
@[simp, norm_cast]
-theorem lxor'_to_nat : ∀ m n, (lxor m n : ℕ) = Nat.lxor' m n := by
+theorem lxor'_to_nat : ∀ m n : Num, ↑(m ^^^ n) = Nat.lxor' m n := by
apply bitwise'_to_nat PosNum.lxor <;> intros <;> (try cases_type* Bool) <;> rfl
#align num.lxor_to_nat Num.lxor'_to_nat
@[simp, norm_cast]
-theorem shiftl_to_nat (m n) : (shiftl m n : ℕ) = (m : ℕ) <<< (n : ℕ) := by
- cases m <;> dsimp only [shiftl]
+theorem shiftl_to_nat (m : Num) (n : Nat) : ↑(m <<< n) = (m : ℕ) <<< (n : ℕ) := by
+ cases m <;> dsimp only [←shiftl_eq_shiftLeft, shiftl]
· symm
apply Nat.zero_shiftLeft
simp only [cast_pos]
induction' n with n IH
· rfl
simp [PosNum.shiftl_succ_eq_bit0_shiftl, Nat.shiftLeft_succ, IH,
- Nat.bit0_val, pow_succ, ← mul_assoc, mul_comm]
+ Nat.bit0_val, pow_succ, ← mul_assoc, mul_comm,
+ -shiftl_eq_shiftLeft, -PosNum.shiftl_eq_shiftLeft, shiftl]
#align num.shiftl_to_nat Num.shiftl_to_nat
@[simp, norm_cast]
-theorem shiftr_to_nat (m n) : (shiftr m n : ℕ) = (m : ℕ) >>> (n : ℕ) := by
- cases' m with m <;> dsimp only [shiftr];
+theorem shiftr_to_nat (m : Num) (n : Nat) : ↑(m >>> n) = (m : ℕ) >>> (n : ℕ) := by
+ cases' m with m <;> dsimp only [←shiftr_eq_shiftRight, shiftr];
· symm
apply Nat.zero_shiftRight
induction' n with n IH generalizing m
· cases m <;> rfl
- cases' m with m m <;> dsimp only [PosNum.shiftr]
+ cases' m with m m <;> dsimp only [PosNum.shiftr, ←PosNum.shiftr_eq_shiftRight]
· rw [Nat.shiftRight_eq_div_pow]
symm
apply Nat.div_eq_of_lt
@@ -5,6 +5,7 @@ Authors: Mario Carneiro
-/
import Mathlib.Data.Num.Bitwise
import Mathlib.Data.Int.CharZero
+import Mathlib.Data.Nat.Bitwise
import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Data.Nat.PSub
import Mathlib.Data.Nat.Size
@@ -922,7 +923,7 @@ theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (
any_goals assumption
any_goals rw [Nat.bitwise'_zero, p11]; cases g true true <;> rfl
any_goals rw [Nat.bitwise'_zero_left, this, ← bit_to_nat, p1b]
- any_goals rw [Nat.bitwise'_zero_right _ gff, this, ← bit_to_nat, pb1]
+ any_goals rw [Nat.bitwise'_zero_right, this, ← bit_to_nat, pb1]
all_goals
rw [← show ∀ n : PosNum, ↑(p m n) = Nat.bitwise' g ↑m ↑n from IH]
rw [← bit_to_nat, pbb]
This removes redundant field values of the form add := add
for smaller terms and less unfolding during unification.
A list of all files containing a structure instance of the form { a1, ... with x1 := val, ... }
where some xi
is a field of some aj
was generated by modifying the structure instance elaboration algorithm to print such overlaps to stdout in a custom toolchain.
Using that toolchain, I went through each file on the list and attempted to remove algebraic fields that overlapped and were redundant, eg add := add
and not toFun
(though some other ones did creep in). If things broke (which was the case in a couple of cases), I did not push further and reverted.
It is possible that pushing harder and trying to remove all redundant overlaps will yield further improvements.
@@ -409,9 +409,6 @@ instance commSemiring : CommSemiring Num := by
{ Num.addMonoid,
Num.addMonoidWithOne with
mul := (· * ·)
- one := 1
- add := (· + ·)
- zero := 0
npow := @npowRec Num ⟨1⟩ ⟨(· * ·)⟩, .. } <;>
try { intros; rfl } <;>
transfer <;>
@@ -1500,7 +1497,6 @@ instance linearOrderedCommRing : LinearOrderedCommRing ZNum :=
mul_assoc := by transfer
zero_mul := by transfer
mul_zero := by transfer
- one := 1
one_mul := by transfer
mul_one := by transfer
left_distrib := by
Many proofs use the "stream of consciousness" style from Lean 3, rather than have ... :=
or suffices ... from/by
.
This PR updates a fraction of these to the preferred Lean 4 style.
I think a good goal would be to delete the "deferred" versions of have
, suffices
, and let
at the bottom of Mathlib.Tactic.Have
(Anyone who would like to contribute more cleanup is welcome to push directly to this branch.)
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -1689,7 +1689,7 @@ theorem gcd_to_nat_aux :
refine'
add_le_add_left
(Nat.mul_le_mul_left _ (le_trans (le_of_lt (Nat.mod_lt _ (PosNum.cast_pos _))) _)) _
- suffices : 1 ≤ _; simpa using Nat.mul_le_mul_left (pos a) this
+ suffices 1 ≤ _ by simpa using Nat.mul_le_mul_left (pos a) this
rw [Nat.le_div_iff_mul_le a.cast_pos, one_mul]
exact le_to_nat.2 ab
#align num.gcd_to_nat_aux Num.gcd_to_nat_aux
@@ -955,45 +955,42 @@ theorem lxor'_to_nat : ∀ m n, (lxor m n : ℕ) = Nat.lxor' m n := by
#align num.lxor_to_nat Num.lxor'_to_nat
@[simp, norm_cast]
-theorem shiftl_to_nat (m n) : (shiftl m n : ℕ) = Nat.shiftl m n := by
+theorem shiftl_to_nat (m n) : (shiftl m n : ℕ) = (m : ℕ) <<< (n : ℕ) := by
cases m <;> dsimp only [shiftl]
· symm
- apply Nat.zero_shiftl
+ apply Nat.zero_shiftLeft
simp only [cast_pos]
induction' n with n IH
· rfl
- simp [PosNum.shiftl_succ_eq_bit0_shiftl, Nat.shiftl_succ, IH]
+ simp [PosNum.shiftl_succ_eq_bit0_shiftl, Nat.shiftLeft_succ, IH,
+ Nat.bit0_val, pow_succ, ← mul_assoc, mul_comm]
#align num.shiftl_to_nat Num.shiftl_to_nat
@[simp, norm_cast]
-theorem shiftr_to_nat (m n) : (shiftr m n : ℕ) = Nat.shiftr m n := by
- cases' m with m <;> dsimp only [shiftr]
+
+theorem shiftr_to_nat (m n) : (shiftr m n : ℕ) = (m : ℕ) >>> (n : ℕ) := by
+ cases' m with m <;> dsimp only [shiftr];
· symm
- apply Nat.zero_shiftr
+ apply Nat.zero_shiftRight
induction' n with n IH generalizing m
· cases m <;> rfl
cases' m with m m <;> dsimp only [PosNum.shiftr]
- · rw [Nat.shiftr_eq_div_pow]
+ · rw [Nat.shiftRight_eq_div_pow]
symm
apply Nat.div_eq_of_lt
- exact @Nat.pow_lt_pow_of_lt_right 2 (by decide) 0 (n + 1) (Nat.succ_pos _)
+ simp [@Nat.pow_lt_pow_of_lt_right 2 (by decide) 0 (n + 1) (Nat.succ_pos _)]
· trans
apply IH
- change Nat.shiftr m n = Nat.shiftr (_root_.bit1 m) (n + 1)
- rw [add_comm n 1, Nat.shiftr_add]
- apply congr_arg fun x => Nat.shiftr x n
- -- Porting note: `unfold` is not repeated in Lean4.
- repeat unfold Nat.shiftr
- change (m : ℕ) = Nat.div2 (Nat.bit true m)
- rw [Nat.div2_bit]
+ change Nat.shiftRight m n = Nat.shiftRight (_root_.bit1 m) (n + 1)
+ rw [add_comm n 1, @Nat.shiftRight_eq _ (1 + n), Nat.shiftRight_add]
+ apply congr_arg fun x => Nat.shiftRight x n
+ simp [Nat.shiftRight_succ, Nat.shiftRight_zero, ← Nat.div2_val]
· trans
apply IH
- change Nat.shiftr m n = Nat.shiftr (_root_.bit0 m) (n + 1)
- rw [add_comm n 1, Nat.shiftr_add]
- apply congr_arg fun x => Nat.shiftr x n
- repeat unfold Nat.shiftr
- change (m : ℕ) = Nat.div2 (Nat.bit false m)
- rw [Nat.div2_bit]
+ change Nat.shiftRight m n = Nat.shiftRight (_root_.bit0 m) (n + 1)
+ rw [add_comm n 1, @Nat.shiftRight_eq _ (1 + n), Nat.shiftRight_add]
+ apply congr_arg fun x => Nat.shiftRight x n
+ simp [Nat.shiftRight_succ, Nat.shiftRight_zero, ← Nat.div2_val]
#align num.shiftr_to_nat Num.shiftr_to_nat
@[simp]
@@ -1001,27 +998,25 @@ theorem testBit_to_nat (m n) : testBit m n = Nat.testBit m n := by
-- Porting note: `unfold` → `dsimp only`
cases m <;> dsimp only [testBit, Nat.testBit]
case zero =>
- change false = Nat.bodd (Nat.shiftr 0 n)
- rw [Nat.zero_shiftr]
+ change false = Nat.bodd (0 >>> n)
+ rw [Nat.zero_shiftRight]
rfl
case pos m =>
induction' n with n IH generalizing m <;> cases' m with m m <;> dsimp only [PosNum.testBit]
· rfl
· exact (Nat.bodd_bit _ _).symm
· exact (Nat.bodd_bit _ _).symm
- · change false = Nat.bodd (Nat.shiftr 1 (n + 1))
- rw [add_comm, Nat.shiftr_add]
- change false = Nat.bodd (Nat.shiftr 0 n)
- rw [Nat.zero_shiftr]; rfl
- · change PosNum.testBit m n = Nat.bodd (Nat.shiftr (Nat.bit true m) (n + 1))
- rw [add_comm, Nat.shiftr_add]
- dsimp only [Nat.shiftr]
- rw [Nat.div2_bit]
+ · change false = Nat.bodd (1 >>> (n + 1))
+ rw [add_comm, Nat.shiftRight_add]
+ change false = Nat.bodd (0 >>> n)
+ rw [Nat.zero_shiftRight]; rfl
+ · change PosNum.testBit m n = Nat.bodd ((Nat.bit true m) >>> (n + 1))
+ rw [add_comm, Nat.shiftRight_add]
+ simp only [Nat.shiftRight_succ, Nat.shiftRight_zero, ← Nat.div2_val, Nat.div2_bit]
apply IH
- · change PosNum.testBit m n = Nat.bodd (Nat.shiftr (Nat.bit false m) (n + 1))
- rw [add_comm, Nat.shiftr_add]
- dsimp only [Nat.shiftr]
- rw [Nat.div2_bit]
+ · change PosNum.testBit m n = Nat.bodd ((Nat.bit false m) >>> (n + 1))
+ rw [add_comm, Nat.shiftRight_add]
+ simp only [Nat.shiftRight_succ, Nat.shiftRight_zero, ← Nat.div2_val, Nat.div2_bit]
apply IH
#align num.test_bit_to_nat Num.testBit_to_nat
MulZeroClass.
in mul_zero
/zero_mul
(#6682)
Search&replace MulZeroClass.mul_zero
-> mul_zero
, MulZeroClass.zero_mul
-> zero_mul
.
These were introduced by Mathport, as the full name of mul_zero
is actually MulZeroClass.mul_zero
(it's exported with the short name).
@@ -1344,8 +1344,8 @@ theorem cast_succ [AddGroupWithOne α] (n) : ((succ n : ZNum) : α) = n + 1 := b
@[simp, norm_cast]
theorem mul_to_int : ∀ m n, ((m * n : ZNum) : ℤ) = m * n
- | 0, a => by cases a <;> exact (MulZeroClass.zero_mul _).symm
- | b, 0 => by cases b <;> exact (MulZeroClass.mul_zero _).symm
+ | 0, a => by cases a <;> exact (zero_mul _).symm
+ | b, 0 => by cases b <;> exact (mul_zero _).symm
| pos a, pos b => PosNum.cast_mul a b
| pos a, neg b => show -↑(a * b) = ↑a * -↑b by rw [PosNum.cast_mul, neg_mul_eq_mul_neg]
| neg a, pos b => show -↑(a * b) = -↑a * ↑b by rw [PosNum.cast_mul, neg_mul_eq_neg_mul]
The major change here is adapting to simp
failing if it makes no progress.
The vast majority of the redundant simp
s found due to this change were extracted to #6632.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -897,7 +897,7 @@ theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (
-- Porting note: `change .. with ..` is now `simp only [show .. = .. from rfl]`.
intros m n
cases' m with m <;> cases' n with n <;>
- simp only [show zero = 0 from rfl, show ((0 : Num) : ℕ) = 0 from rfl]
+ try simp only [show zero = 0 from rfl, show ((0 : Num) : ℕ) = 0 from rfl]
· rw [f00, Nat.bitwise'_zero]; rfl
· unfold Nat.bitwise'
rw [f0n, Nat.binaryRec_zero]
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -30,7 +30,7 @@ attribute [local simp] add_assoc
namespace PosNum
-variable {α : Type _}
+variable {α : Type*}
@[simp, norm_cast]
theorem cast_one [One α] [Add α] : ((1 : PosNum) : α) = 1 :=
@@ -200,7 +200,7 @@ end PosNum
namespace Num
-variable {α : Type _}
+variable {α : Type*}
open PosNum
@@ -517,7 +517,7 @@ end Num
namespace PosNum
-variable {α : Type _}
+variable {α : Type*}
open Num
@@ -711,7 +711,7 @@ end PosNum
namespace Num
-variable {α : Type _}
+variable {α : Type*}
open PosNum
@@ -834,7 +834,7 @@ end PosNum
namespace Num
-variable {α : Type _}
+variable {α : Type*}
open PosNum
@@ -1029,7 +1029,7 @@ end Num
namespace ZNum
-variable {α : Type _}
+variable {α : Type*}
open PosNum
@@ -1178,7 +1178,7 @@ end ZNum
namespace PosNum
-variable {α : Type _}
+variable {α : Type*}
theorem cast_to_znum : ∀ n : PosNum, (n : ZNum) = ZNum.pos n
| 1 => rfl
@@ -1226,7 +1226,7 @@ end PosNum
namespace Num
-variable {α : Type _}
+variable {α : Type*}
@[simp]
theorem cast_sub' [AddGroupWithOne α] : ∀ m n : Num, (sub' m n : α) = m - n
@@ -1318,7 +1318,7 @@ end Num
namespace ZNum
-variable {α : Type _}
+variable {α : Type*}
@[simp, norm_cast]
theorem cast_add [AddGroupWithOne α] : ∀ m n, ((m + n : ZNum) : α) = m + n
Per https://github.com/leanprover/lean4/issues/2343, we are going to need to change the automatic generation of instance names, as they become too long.
This PR ensures that everywhere in Mathlib that refers to an instance by name, that name is given explicitly, rather than being automatically generated.
There are four exceptions, which are now commented, with links to https://github.com/leanprover/lean4/issues/2343.
This was implemented by running Mathlib against a modified Lean that appended _ᾰ
to all automatically generated names, and fixing everything.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -465,6 +465,9 @@ instance linearOrderedSemiring : LinearOrderedSemiring Num :=
apply mul_lt_mul_of_pos_right
decidableLT := Num.decidableLT
decidableLE := Num.decidableLE
+ -- This is relying on an automatically generated instance name,
+ -- generated in a `deriving` handler.
+ -- See https://github.com/leanprover/lean4/issues/2343
decidableEq := instDecidableEqNum
exists_pair_ne := ⟨0, 1, by decide⟩ }
#align num.linear_ordered_semiring Num.linearOrderedSemiring
@@ -1458,6 +1461,8 @@ instance linearOrder : LinearOrder ZNum where
intro a b
transfer_rw
apply le_total
+ -- This is relying on an automatically generated instance name, generated in a `deriving` handler.
+ -- See https://github.com/leanprover/lean4/issues/2343
decidableEq := instDecidableEqZNum
decidableLE := ZNum.decidableLE
decidableLT := ZNum.decidableLT
@@ -2,11 +2,6 @@
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module data.num.lemmas
-! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Num.Bitwise
import Mathlib.Data.Int.CharZero
@@ -14,6 +9,8 @@ import Mathlib.Data.Nat.GCD.Basic
import Mathlib.Data.Nat.PSub
import Mathlib.Data.Nat.Size
+#align_import data.num.lemmas from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
+
/-!
# Properties of the binary representation of integers
-/
Alongside any necessary spacing/flow changes to accommodate their removal.
@@ -967,7 +967,7 @@ theorem shiftl_to_nat (m n) : (shiftl m n : ℕ) = Nat.shiftl m n := by
@[simp, norm_cast]
theorem shiftr_to_nat (m n) : (shiftr m n : ℕ) = Nat.shiftr m n := by
- cases' m with m <;> dsimp only [shiftr];
+ cases' m with m <;> dsimp only [shiftr]
· symm
apply Nat.zero_shiftr
induction' n with n IH generalizing m
This is the second half of the changes originally in #5699, removing all occurrences of ;
after a space and implementing a linter rule to enforce it.
In most cases this 2-character substring has a space after it, so the following command was run first:
find . -type f -name "*.lean" -exec sed -i -E 's/ ; /; /g' {} \;
The remaining cases were few enough in number that they were done manually.
@@ -614,7 +614,7 @@ instance commMonoid : CommMonoid PosNum := by
{ mul := (· * ·)
one := (1 : PosNum)
npow := @npowRec PosNum ⟨1⟩ ⟨(· * ·)⟩,.. } <;>
- try { intros ; rfl } <;>
+ try { intros; rfl } <;>
transfer
#align pos_num.comm_monoid PosNum.commMonoid
at
and goals (#5387)
Changes are of the form
some_tactic at h⊢
-> some_tactic at h ⊢
some_tactic at h
-> some_tactic at h
@@ -1684,7 +1684,7 @@ theorem gcd_to_nat_aux :
· rfl
· rw [← le_to_nat, mod_to_nat]
exact le_of_lt (Nat.mod_lt _ (PosNum.cast_pos _))
- rw [natSize_to_nat, mul_to_nat, Nat.size_le] at h⊢
+ rw [natSize_to_nat, mul_to_nat, Nat.size_le] at h ⊢
rw [mod_to_nat, mul_comm]
rw [pow_succ', ← Nat.mod_add_div b (pos a)] at h
refine' lt_of_mul_lt_mul_right (lt_of_le_of_lt _ h) (Nat.zero_le 2)
@@ -935,22 +935,23 @@ theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (
theorem lor'_to_nat : ∀ m n, (lor m n : ℕ) = Nat.lor' m n := by
-- Porting note: A name of an implicit local hypothesis is not available so
-- `cases_type*` is used.
- apply bitwise'_to_nat fun x y => pos (PosNum.lor x y) <;> intros <;> cases_type* Bool <;> rfl
+ apply bitwise'_to_nat fun x y => pos (PosNum.lor x y) <;>
+ intros <;> (try cases_type* Bool) <;> rfl
#align num.lor_to_nat Num.lor'_to_nat
@[simp, norm_cast]
theorem land'_to_nat : ∀ m n, (land m n : ℕ) = Nat.land' m n := by
- apply bitwise'_to_nat PosNum.land <;> intros <;> cases_type* Bool <;> rfl
+ apply bitwise'_to_nat PosNum.land <;> intros <;> (try cases_type* Bool) <;> rfl
#align num.land_to_nat Num.land'_to_nat
@[simp, norm_cast]
theorem ldiff'_to_nat : ∀ m n, (ldiff m n : ℕ) = Nat.ldiff' m n := by
- apply bitwise'_to_nat PosNum.ldiff <;> intros <;> cases_type* Bool <;> rfl
+ apply bitwise'_to_nat PosNum.ldiff <;> intros <;> (try cases_type* Bool) <;> rfl
#align num.ldiff_to_nat Num.ldiff'_to_nat
@[simp, norm_cast]
theorem lxor'_to_nat : ∀ m n, (lxor m n : ℕ) = Nat.lxor' m n := by
- apply bitwise'_to_nat PosNum.lxor <;> intros <;> cases_type* Bool <;> rfl
+ apply bitwise'_to_nat PosNum.lxor <;> intros <;> (try cases_type* Bool) <;> rfl
#align num.lxor_to_nat Num.lxor'_to_nat
@[simp, norm_cast]
@@ -933,7 +933,7 @@ theorem bitwise'_to_nat {f : Num → Num → Num} {g : Bool → Bool → Bool} (
@[simp, norm_cast]
theorem lor'_to_nat : ∀ m n, (lor m n : ℕ) = Nat.lor' m n := by
- -- Porting note: An name of an implicit local hypothesis is not available so
+ -- Porting note: A name of an implicit local hypothesis is not available so
-- `cases_type*` is used.
apply bitwise'_to_nat fun x y => pos (PosNum.lor x y) <;> intros <;> cases_type* Bool <;> rfl
#align num.lor_to_nat Num.lor'_to_nat
@@ -327,7 +327,7 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
| pos a, 0 => to_nat_pos _
| pos a, pos b => by
have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]; cases PosNum.cmp a b
- exacts[id, congr_arg pos, id]
+ exacts [id, congr_arg pos, id]
#align num.cmp_to_nat Num.cmp_to_nat
@[norm_cast]
@@ -596,8 +596,8 @@ scoped macro (name := transfer_rw) "transfer_rw" : tactic => `(tactic|
repeat first | rw [add_to_nat] | rw [mul_to_nat] | rw [cast_one] | rw [cast_zero]))
/--
-This tactic tries to prove (in)equalities about `PosNum`s by transfering them to the `Nat` world and
-then trying to call `simp`.
+This tactic tries to prove (in)equalities about `PosNum`s by transferring them to the `Nat` world
+and then trying to call `simp`.
```lean
example (n : PosNum) (m : PosNum) : n ≤ n + m := by transfer
```
I ran codespell Mathlib
and got tired halfway through the suggestions.
@@ -382,7 +382,7 @@ scoped macro (name := transfer_rw) "transfer_rw" : tactic => `(tactic|
repeat first | rw [add_to_nat] | rw [mul_to_nat] | rw [cast_one] | rw [cast_zero]))
/--
-This tactic tries to prove (in)equalities about `Num`s by transfering them to the `Nat` world and
+This tactic tries to prove (in)equalities about `Num`s by transferring them to the `Nat` world and
then trying to call `simp`.
```lean
example (n : Num) (m : Num) : n ≤ n + m := by transfer
@@ -1429,7 +1429,7 @@ scoped macro (name := transfer_rw) "transfer_rw" : tactic => `(tactic|
repeat first | rw [cast_add] | rw [mul_to_int] | rw [cast_one] | rw [cast_zero]))
/--
-This tactic tries to prove (in)equalities about `ZNum`s by transfering them to the `Int` world and
+This tactic tries to prove (in)equalities about `ZNum`s by transferring them to the `Int` world and
then trying to call `simp`.
```lean
example (n : ZNum) (m : ZNum) : n ≤ n + m * m := by
The main breaking change is that tac <;> [t1, t2]
is now written tac <;> [t1; t2]
, to avoid clashing with tactics like cases
and use
that take comma-separated lists.
@@ -1376,13 +1376,11 @@ theorem to_int_inj {m n : ZNum} : (m : ℤ) = n ↔ m = n :=
theorem cmp_to_int : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℤ) < n) (m = n) ((n : ℤ) < m) : Prop)
| 0, 0 => rfl
| pos a, pos b => by
- have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]; cases PosNum.cmp a b <;>
- dsimp <;>
- [simp, exact congr_arg pos, simp [GT.gt]]
+ have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]
+ cases PosNum.cmp a b <;> dsimp <;> [simp; exact congr_arg pos; simp [GT.gt]]
| neg a, neg b => by
- have := PosNum.cmp_to_nat b a; revert this; dsimp [cmp]; cases PosNum.cmp b a <;>
- dsimp <;>
- [simp, simp (config := { contextual := true }), simp [GT.gt]]
+ have := PosNum.cmp_to_nat b a; revert this; dsimp [cmp]
+ cases PosNum.cmp b a <;> dsimp <;> [simp; simp (config := { contextual := true }); simp [GT.gt]]
| pos a, 0 => PosNum.cast_pos _
| pos a, neg b => lt_trans (neg_lt_zero.2 <| PosNum.cast_pos _) (PosNum.cast_pos _)
| 0, neg b => neg_lt_zero.2 <| PosNum.cast_pos _
LinearOrder
decidable fields (#4006)
This renames
decidable_eq
to decidableEq
decidable_lt
to decidableLT
decidable_le
to decidableLE
decidableLT_of_decidableLE
to decidableLTOfDecidableLE
decidableEq_of_decidableLE
to decidableEqOfDecidableLE
These fields are data not proofs, so they should be lowerCamelCased
.
@@ -466,9 +466,9 @@ instance linearOrderedSemiring : LinearOrderedSemiring Num :=
intro a b c
transfer_rw
apply mul_lt_mul_of_pos_right
- decidable_lt := Num.decidableLT
- decidable_le := Num.decidableLE
- decidable_eq := instDecidableEqNum
+ decidableLT := Num.decidableLT
+ decidableLE := Num.decidableLE
+ decidableEq := instDecidableEqNum
exists_pair_ne := ⟨0, 1, by decide⟩ }
#align num.linear_ordered_semiring Num.linearOrderedSemiring
@@ -646,9 +646,9 @@ instance linearOrder : LinearOrder PosNum where
intro a b
transfer_rw
apply le_total
- decidable_lt := by infer_instance
- decidable_le := by infer_instance
- decidable_eq := by infer_instance
+ decidableLT := by infer_instance
+ decidableLE := by infer_instance
+ decidableEq := by infer_instance
#align pos_num.linear_order PosNum.linearOrder
@[simp]
@@ -1462,9 +1462,9 @@ instance linearOrder : LinearOrder ZNum where
intro a b
transfer_rw
apply le_total
- decidable_eq := instDecidableEqZNum
- decidable_le := ZNum.decidableLE
- decidable_lt := ZNum.decidableLT
+ decidableEq := instDecidableEqZNum
+ decidableLE := ZNum.decidableLE
+ decidableLT := ZNum.decidableLT
#align znum.linear_order ZNum.linearOrder
instance addCommGroup : AddCommGroup ZNum where
@@ -955,11 +955,13 @@ theorem lxor'_to_nat : ∀ m n, (lxor m n : ℕ) = Nat.lxor' m n := by
@[simp, norm_cast]
theorem shiftl_to_nat (m n) : (shiftl m n : ℕ) = Nat.shiftl m n := by
- cases m <;> dsimp only [shiftl];
+ cases m <;> dsimp only [shiftl]
· symm
apply Nat.zero_shiftl
- simp; induction' n with n IH; · rfl
- simp [PosNum.shiftl_succ_eq_bit0_shiftl, Nat.shiftl_succ]; rw [← IH]
+ simp only [cast_pos]
+ induction' n with n IH
+ · rfl
+ simp [PosNum.shiftl_succ_eq_bit0_shiftl, Nat.shiftl_succ, IH]
#align num.shiftl_to_nat Num.shiftl_to_nat
@[simp, norm_cast]
@@ -967,7 +969,8 @@ theorem shiftr_to_nat (m n) : (shiftr m n : ℕ) = Nat.shiftr m n := by
cases' m with m <;> dsimp only [shiftr];
· symm
apply Nat.zero_shiftr
- induction' n with n IH generalizing m; · cases m <;> rfl
+ induction' n with n IH generalizing m
+ · cases m <;> rfl
cases' m with m m <;> dsimp only [PosNum.shiftr]
· rw [Nat.shiftr_eq_div_pow]
symm
@@ -1642,8 +1645,8 @@ namespace Num
protected theorem div_zero (n : Num) : n / 0 = 0 :=
show n.div 0 = 0 by
cases n
- rfl
- simp [Num.div]
+ · rfl
+ · simp [Num.div]
#align num.div_zero Num.div_zero
@[simp, norm_cast]
@@ -1658,8 +1661,8 @@ theorem div_to_nat : ∀ n d, ((n / d : Num) : ℕ) = n / d
protected theorem mod_zero (n : Num) : n % 0 = n :=
show n.mod 0 = n by
cases n
- rfl
- simp [Num.mod]
+ · rfl
+ · simp [Num.mod]
#align num.mod_zero Num.mod_zero
@[simp, norm_cast]
@@ -1678,7 +1681,8 @@ theorem gcd_to_nat_aux :
| Nat.succ n, 0, b, _ab, _h => (Nat.gcd_zero_left _).symm
| Nat.succ n, pos a, b, ab, h => by
simp [gcdAux]
- rw [Nat.gcd_rec, gcd_to_nat_aux, mod_to_nat]; · rfl
+ rw [Nat.gcd_rec, gcd_to_nat_aux, mod_to_nat]
+ · rfl
· rw [← le_to_nat, mod_to_nat]
exact le_of_lt (Nat.mod_lt _ (PosNum.cast_pos _))
rw [natSize_to_nat, mul_to_nat, Nat.size_le] at h⊢
by
s! (#3825)
This PR puts, with one exception, every single remaining by
that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh
. The exception is when the by
begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.
Essentially this is s/\n *by$/ by/g
, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated by
s".
@@ -325,8 +325,7 @@ theorem cmp_to_nat : ∀ m n, (Ordering.casesOn (cmp m n) ((m : ℕ) < n) (m = n
| 0, 0 => rfl
| 0, pos b => to_nat_pos _
| pos a, 0 => to_nat_pos _
- | pos a, pos b =>
- by
+ | pos a, pos b => by
have := PosNum.cmp_to_nat a b; revert this; dsimp [cmp]; cases PosNum.cmp a b
exacts[id, congr_arg pos, id]
#align num.cmp_to_nat Num.cmp_to_nat
@@ -1583,8 +1582,7 @@ theorem divMod_to_nat_aux {n d : PosNum} {q r : Num} (h₁ : (r : ℕ) + d * _ro
(h₂ : (r : ℕ) < 2 * d) :
((divModAux d q r).2 + d * (divModAux d q r).1 : ℕ) = ↑n ∧ ((divModAux d q r).2 : ℕ) < d := by
unfold divModAux
- have : ∀ {r₂}, Num.ofZNum' (Num.sub' r (Num.pos d)) = some r₂ ↔ (r : ℕ) = r₂ + d :=
- by
+ have : ∀ {r₂}, Num.ofZNum' (Num.sub' r (Num.pos d)) = some r₂ ↔ (r : ℕ) = r₂ + d := by
intro r₂
apply Num.mem_ofZNum'.trans
rw [← ZNum.to_int_inj, Num.cast_toZNum, Num.cast_sub', sub_eq_iff_eq_add, ← Int.coe_nat_inj']
@@ -1698,8 +1696,7 @@ theorem gcd_to_nat_aux :
@[simp]
theorem gcd_to_nat : ∀ a b, (gcd a b : ℕ) = Nat.gcd a b := by
- have : ∀ a b : Num, (a * b).natSize ≤ a.natSize + b.natSize :=
- by
+ have : ∀ a b : Num, (a * b).natSize ≤ a.natSize + b.natSize := by
intros
simp [natSize_to_nat]
rw [Nat.size_le, pow_add]
@@ -1743,15 +1740,13 @@ theorem div_to_int : ∀ n d, ((n / d : ZNum) : ℤ) = n / d
| pos n, pos d => (Num.cast_toZNum _).trans <| by rw [← Num.to_nat_to_int]; simp
| pos n, neg d => (Num.cast_toZNumNeg _).trans <| by rw [← Num.to_nat_to_int]; simp
| neg n, pos d =>
- show -_ = -_ / ↑d
- by
+ show -_ = -_ / ↑d by
rw [n.to_int_eq_succ_pred, d.to_int_eq_succ_pred, ← PosNum.to_nat_to_int, Num.succ'_to_nat,
Num.div_to_nat]
change -[n.pred' / ↑d+1] = -[n.pred' / (d.pred' + 1)+1]
rw [d.to_nat_eq_succ_pred]
| neg n, neg d =>
- show ↑(PosNum.pred' n / Num.pos d).succ' = -_ / -↑d
- by
+ show ↑(PosNum.pred' n / Num.pos d).succ' = -_ / -↑d by
rw [n.to_int_eq_succ_pred, d.to_int_eq_succ_pred, ← PosNum.to_nat_to_int, Num.succ'_to_nat,
Num.div_to_nat]
change (Nat.succ (_ / d) : ℤ) = Nat.succ (n.pred' / (d.pred' + 1))
The unported dependencies are