Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit cbbaef5

Browse files
committed
chore(algebra/field_power): generalisation linter (#13107)
@alexjbest, this one is slightly more interesting, as the generalisation linter detected that two lemmas were stated incorrectly! Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent 225d1ce commit cbbaef5

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/algebra/field_power.lean

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,6 @@ open int
3737

3838
variables {K : Type u} [linear_ordered_field K] {a : K} {n : ℤ}
3939

40-
lemma zpow_eq_zero_iff (hn : 0 < n) :
41-
a ^ n = 0 ↔ a = 0 :=
42-
begin
43-
refine ⟨zpow_eq_zero, _⟩,
44-
rintros rfl,
45-
exact zero_zpow _ hn.ne'
46-
end
47-
4840
lemma zpow_nonneg {a : K} (ha : 0 ≤ a) : ∀ (z : ℤ), 0 ≤ a ^ z
4941
| (n : ℕ) := by { rw zpow_coe_nat, exact pow_nonneg ha _ }
5042
| -[1+n] := by { rw zpow_neg_succ_of_nat, exact inv_nonneg.2 (pow_nonneg ha _) }
@@ -96,14 +88,14 @@ calc p ^ z ≥ p ^ 0 : zpow_le_of_le hp hz
9688
theorem zpow_bit0_nonneg (a : K) (n : ℤ) : 0 ≤ a ^ bit0 n :=
9789
by { rw zpow_bit0₀, exact mul_self_nonneg _ }
9890

99-
theorem zpow_two_nonneg (a : K) : 0 ≤ a ^ 2 :=
100-
pow_bit0_nonneg a 1
91+
theorem zpow_two_nonneg (a : K) : 0 ≤ a ^ (2 : ℤ) :=
92+
zpow_bit0_nonneg a 1
10193

10294
theorem zpow_bit0_pos {a : K} (h : a ≠ 0) (n : ℤ) : 0 < a ^ bit0 n :=
10395
(zpow_bit0_nonneg a n).lt_of_ne (zpow_ne_zero _ h).symm
10496

105-
theorem zpow_two_pos_of_ne_zero (a : K) (h : a ≠ 0) : 0 < a ^ 2 :=
106-
pow_bit0_pos h 1
97+
theorem zpow_two_pos_of_ne_zero (a : K) (h : a ≠ 0) : 0 < a ^ (2 : ℤ) :=
98+
zpow_bit0_pos h 1
10799

108100
@[simp] theorem zpow_bit1_neg_iff : a ^ bit1 n < 0 ↔ a < 0 :=
109101
⟨λ h, not_le.1 $ λ h', not_le.2 h $ zpow_nonneg h' _,
@@ -200,7 +192,7 @@ end
200192
end ordered
201193

202194
section
203-
variables {K : Type*} [field K]
195+
variables {K : Type*} [division_ring K]
204196

205197
@[simp, norm_cast] theorem rat.cast_zpow [char_zero K] (q : ℚ) (n : ℤ) :
206198
((q ^ n : ℚ) : K) = q ^ n :=

src/algebra/group_with_zero/power.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,14 @@ by rw [zpow_bit1₀, (commute.refl a).mul_zpow₀]
217217
lemma zpow_eq_zero {x : G₀} {n : ℤ} (h : x ^ n = 0) : x = 0 :=
218218
classical.by_contradiction $ λ hx, zpow_ne_zero_of_ne_zero hx n h
219219

220+
lemma zpow_eq_zero_iff {a : G₀} {n : ℤ} (hn : 0 < n) :
221+
a ^ n = 0 ↔ a = 0 :=
222+
begin
223+
refine ⟨zpow_eq_zero, _⟩,
224+
rintros rfl,
225+
exact zero_zpow _ hn.ne'
226+
end
227+
220228
lemma zpow_ne_zero {x : G₀} (n : ℤ) : x ≠ 0 → x ^ n ≠ 0 :=
221229
mt zpow_eq_zero
222230

0 commit comments

Comments
 (0)