Skip to content

Commit 9b07aee

Browse files
committed
chore: Rename nonzero_of_invertible to Invertible.ne_zero (#15860)
From LeanAPAP
1 parent 4ecf882 commit 9b07aee

File tree

7 files changed

+22
-20
lines changed

7 files changed

+22
-20
lines changed

Archive/Wiedijk100Theorems/SolutionOfCubic.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ theorem cubic_monic_eq_zero_iff (hω : IsPrimitiveRoot ω 3) (hp : p = (3 * c -
7373
x ^ 3 + b * x ^ 2 + c * x + d = 0
7474
x = s - t - b / 3 ∨ x = s * ω - t * ω ^ 2 - b / 3 ∨ x = s * ω ^ 2 - t * ω - b / 3 := by
7575
let y := x + b / 3
76-
have hi2 : (2 : K) ≠ 0 := nonzero_of_invertible _
77-
have hi3 : (3 : K) ≠ 0 := nonzero_of_invertible _
76+
have hi2 : (2 : K) ≠ 0 := Invertible.ne_zero _
77+
have hi3 : (3 : K) ≠ 0 := Invertible.ne_zero _
7878
have h9 : (9 : K) = 3 ^ 2 := by norm_num
7979
have h54 : (54 : K) = 2 * 3 ^ 3 := by norm_num
8080
have h₁ : x ^ 3 + b * x ^ 2 + c * x + d = y ^ 3 + 3 * p * y - 2 * q := by
@@ -92,7 +92,7 @@ theorem cubic_eq_zero_iff (ha : a ≠ 0) (hω : IsPrimitiveRoot ω 3)
9292
a * x ^ 3 + b * x ^ 2 + c * x + d = 0
9393
x = s - t - b / (3 * a) ∨
9494
x = s * ω - t * ω ^ 2 - b / (3 * a) ∨ x = s * ω ^ 2 - t * ω - b / (3 * a) := by
95-
have hi3 : (3 : K) ≠ 0 := nonzero_of_invertible _
95+
have hi3 : (3 : K) ≠ 0 := Invertible.ne_zero _
9696
have h9 : (9 : K) = 3 ^ 2 := by norm_num
9797
have h54 : (54 : K) = 2 * 3 ^ 3 := by norm_num
9898
have h₁ : a * x ^ 3 + b * x ^ 2 + c * x + d
@@ -119,8 +119,8 @@ theorem cubic_eq_zero_iff_of_p_eq_zero (ha : a ≠ 0) (hω : IsPrimitiveRoot ω
119119
x = s - b / (3 * a) ∨ x = s * ω - b / (3 * a) ∨ x = s * ω ^ 2 - b / (3 * a) := by
120120
have h₁ : ∀ x a₁ a₂ a₃ : K, x = a₁ ∨ x = a₂ ∨ x = a₃ ↔ (x - a₁) * (x - a₂) * (x - a₃) = 0 := by
121121
intros; simp only [mul_eq_zero, sub_eq_zero, or_assoc]
122-
have hi2 : (2 : K) ≠ 0 := nonzero_of_invertible _
123-
have hi3 : (3 : K) ≠ 0 := nonzero_of_invertible _
122+
have hi2 : (2 : K) ≠ 0 := Invertible.ne_zero _
123+
have hi3 : (3 : K) ≠ 0 := Invertible.ne_zero _
124124
have h54 : (54 : K) = 2 * 3 ^ 3 := by norm_num
125125
have hb2 : b ^ 2 = 3 * a * c := by rw [sub_eq_zero] at hpz; rw [hpz]
126126
have hb3 : b ^ 3 = 3 * a * b * c := by rw [pow_succ, hb2]; ring

Mathlib/Algebra/CharP/Invertible.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def invertibleOfRingCharNotDvd {t : ℕ} (not_dvd : ¬ringChar K ∣ t) : Invert
2828

2929
theorem not_ringChar_dvd_of_invertible {t : ℕ} [Invertible (t : K)] : ¬ringChar K ∣ t := by
3030
rw [← ringChar.spec, ← Ne]
31-
exact nonzero_of_invertible (t : K)
31+
exact Invertible.ne_zero (t : K)
3232

3333
/-- A natural number `t` is invertible in a field `K` of characteristic `p` if `p` does not divide
3434
`t`. -/

Mathlib/Algebra/GroupWithZero/Invertible.lean

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@ universe u
1818

1919
variable {α : Type u}
2020

21-
theorem nonzero_of_invertible [MulZeroOneClass α] (a : α) [Nontrivial α] [Invertible a] : a ≠ 0 :=
21+
theorem Invertible.ne_zero [MulZeroOneClass α] (a : α) [Nontrivial α] [Invertible a] : a ≠ 0 :=
2222
fun ha =>
2323
zero_ne_one <|
2424
calc
2525
0 = ⅟ a * a := by simp [ha]
26-
_ = 1 := invOf_mul_self a
26+
_ = 1 := invOf_mul_self
2727

28-
instance (priority := 100) Invertible.ne_zero [MulZeroOneClass α] [Nontrivial α] (a : α)
28+
@[deprecated (since := "2024-08-15")] alias nonzero_of_invertible := Invertible.ne_zero
29+
30+
instance (priority := 100) Invertible.toNeZero [MulZeroOneClass α] [Nontrivial α] (a : α)
2931
[Invertible a] : NeZero a :=
30-
nonzero_of_invertible a⟩
32+
Invertible.ne_zero a⟩
3133

3234
section MonoidWithZero
3335
variable [MonoidWithZero α]
@@ -48,31 +50,31 @@ def invertibleOfNonzero {a : α} (h : a ≠ 0) : Invertible a :=
4850

4951
@[simp]
5052
theorem invOf_eq_inv (a : α) [Invertible a] : ⅟ a = a⁻¹ :=
51-
invOf_eq_right_inv (mul_inv_cancel₀ (nonzero_of_invertible a))
53+
invOf_eq_right_inv (mul_inv_cancel₀ (Invertible.ne_zero a))
5254

5355
@[simp]
5456
theorem inv_mul_cancel_of_invertible (a : α) [Invertible a] : a⁻¹ * a = 1 :=
55-
inv_mul_cancel₀ (nonzero_of_invertible a)
57+
inv_mul_cancel₀ (Invertible.ne_zero a)
5658

5759
@[simp]
5860
theorem mul_inv_cancel_of_invertible (a : α) [Invertible a] : a * a⁻¹ = 1 :=
59-
mul_inv_cancel₀ (nonzero_of_invertible a)
61+
mul_inv_cancel₀ (Invertible.ne_zero a)
6062

6163
/-- `a` is the inverse of `a⁻¹` -/
6264
def invertibleInv {a : α} [Invertible a] : Invertible a⁻¹ :=
6365
⟨a, by simp, by simp⟩
6466

6567
@[simp]
6668
theorem div_mul_cancel_of_invertible (a b : α) [Invertible b] : a / b * b = a :=
67-
div_mul_cancel₀ a (nonzero_of_invertible b)
69+
div_mul_cancel₀ a (Invertible.ne_zero b)
6870

6971
@[simp]
7072
theorem mul_div_cancel_of_invertible (a b : α) [Invertible b] : a * b / b = a :=
71-
mul_div_cancel_right₀ a (nonzero_of_invertible b)
73+
mul_div_cancel_right₀ a (Invertible.ne_zero b)
7274

7375
@[simp]
7476
theorem div_self_of_invertible (a : α) [Invertible a] : a / a = 1 :=
75-
div_self (nonzero_of_invertible a)
77+
div_self (Invertible.ne_zero a)
7678

7779
/-- `b / a` is the inverse of `a / b` -/
7880
def invertibleDiv (a b : α) [Invertible a] [Invertible b] : Invertible (a / b) :=

Mathlib/Algebra/Ring/Invertible.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ theorem invOf_two_add_invOf_two [NonAssocSemiring α] [Invertible (2 : α)] :
3333
(⅟ 2 : α) + (⅟ 2 : α) = 1 := by rw [← two_mul, mul_invOf_self]
3434

3535
theorem pos_of_invertible_cast [Semiring α] [Nontrivial α] (n : ℕ) [Invertible (n : α)] : 0 < n :=
36-
Nat.zero_lt_of_ne_zero fun h => nonzero_of_invertible (n : α) (h ▸ Nat.cast_zero)
36+
Nat.zero_lt_of_ne_zero fun h => Invertible.ne_zero (n : α) (h ▸ Nat.cast_zero)
3737

3838
theorem invOf_add_invOf [Semiring α] (a b : α) [Invertible a] [Invertible b] :
3939
⅟a + ⅟b = ⅟a * (a + b) * ⅟b := by

Mathlib/LinearAlgebra/AffineSpace/Combination.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ theorem centroid_pair [DecidableEq ι] [Invertible (2 : k)] (p : ι → P) (i₁
783783
· have hc : (card ({i₁, i₂} : Finset ι) : k) ≠ 0 := by
784784
rw [card_insert_of_not_mem (not_mem_singleton.2 h), card_singleton]
785785
norm_num
786-
exact nonzero_of_invertible _
786+
exact Invertible.ne_zero _
787787
rw [centroid_def,
788788
affineCombination_eq_weightedVSubOfPoint_vadd_of_sum_eq_one _ _ _
789789
(sum_centroidWeights_eq_one_of_cast_card_ne_zero _ hc) (p i₁)]

Mathlib/RingTheory/WittVector/WittPolynomial.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ theorem xInTermsOfW_vars_aux (n : ℕ) :
229229
n ∈ (xInTermsOfW p ℚ n).vars ∧ (xInTermsOfW p ℚ n).vars ⊆ range (n + 1) := by
230230
apply Nat.strongInductionOn n; clear n
231231
intro n ih
232-
rw [xInTermsOfW_eq, mul_comm, vars_C_mul _ (nonzero_of_invertible _),
232+
rw [xInTermsOfW_eq, mul_comm, vars_C_mul _ (Invertible.ne_zero _),
233233
vars_sub_of_disjoint, vars_X, range_succ, insert_eq]
234234
on_goal 1 =>
235235
simp only [true_and_iff, true_or_iff, eq_self_iff_true, mem_union, mem_singleton]

Mathlib/Tactic/NormNum/Result.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ theorem IsRat.of_raw (α) [DivisionRing α] (n : ℤ) (d : ℕ)
238238
⟨this, by simp [div_eq_mul_inv]⟩
239239

240240
theorem IsRat.den_nz {α} [DivisionRing α] {a n d} : IsRat (a : α) n d → (d : α) ≠ 0
241-
| ⟨_, _⟩ => nonzero_of_invertible (d : α)
241+
| ⟨_, _⟩ => Invertible.ne_zero (d : α)
242242

243243
/-- The result of `norm_num` running on an expression `x` of type `α`.
244244
Untyped version of `Result`. -/

0 commit comments

Comments
 (0)