Skip to content

Commit 1fd32e2

Browse files
feat(Algebra/Field/Power): weaken assumptions of Odd.neg_zpow (#37319)
The lemmas `Even.neg_zpow` and `Even.neg_one_zpow` are stated assuming `[DivisionMonoid α] [HasDistribNeg α]`. However, `Odd.neg_zpow` and `Odd.neg_one_zpow` currently assume the stronger `[DivisionRing α]`. This PR weakens the assumption of the `Odd` lemmas to match their `Even` counterparts. The lemmas are currently the only content of Mathlib.Algebra.Field.Power. That files exists in order to "define Field with minimal imports". But after this PR, Power.lean does not rely on Mathlib.Algebra.Field.Defs any more. We hence deprecate "Field.Power" and move the two statements to Mathlib.Algebra.Ring.Int.Parity. --- Examples: ``` -- these all work: example (z : ℤ) (h : Even z) : (-1 : ℂ)^z = 1 := Even.neg_one_zpow h example (z : ℤ) (h : Even z) : (-1 : unitary ℂ)^z = 1 := Even.neg_one_zpow h example (z : ℤ) (h : Odd z) : (-1 : ℂ)^z = -1 := Odd.neg_one_zpow h -- but this fails without the PR: example (z : ℤ) (h : Odd z) : (-1 : unitary ℂ)^z = -1 := Odd.neg_one_zpow h ``` [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/) Co-authored-by: DHTT <prparadoxes@gmail.com> Co-authored-by: David Gross <david.gross@thp.uni-koeln.de>
1 parent 04e84bf commit 1fd32e2

3 files changed

Lines changed: 24 additions & 29 deletions

File tree

Mathlib/Algebra/Field/Power.lean

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,8 @@ Copyright (c) 2014 Robert Y. Lewis. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Robert Y. Lewis, Leonardo de Moura, Johannes Hölzl, Mario Carneiro
55
-/
6-
module
6+
module -- shake: keep-all
77

8-
public import Mathlib.Algebra.Field.Defs
98
public import Mathlib.Algebra.Ring.Int.Parity
109

11-
/-!
12-
# Results about powers in fields or division rings.
13-
14-
This file exists to ensure we can define `Field` with minimal imports,
15-
so it contains some lemmas about powers of elements which need imports
16-
beyond those needed for the basic definition.
17-
-/
18-
19-
public section
20-
21-
22-
variable {α : Type*}
23-
24-
section DivisionRing
25-
26-
variable [DivisionRing α] {n : ℤ}
27-
28-
theorem Odd.neg_zpow (h : Odd n) (a : α) : (-a) ^ n = -a ^ n := by
29-
have hn : n ≠ 0 := by rintro rfl; exact Int.not_even_iff_odd.2 h .zero
30-
obtain ⟨k, rfl⟩ := h
31-
simp_rw [zpow_add' (.inr (.inl hn)), zpow_one, zpow_mul, zpow_two, neg_mul_neg,
32-
neg_mul_eq_mul_neg]
33-
34-
theorem Odd.neg_one_zpow (h : Odd n) : (-1 : α) ^ n = -1 := by rw [h.neg_zpow, one_zpow]
35-
36-
end DivisionRing
10+
deprecated_module (since := "2026-04-17")

Mathlib/Algebra/Ring/Int/Parity.lean

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,23 @@ theorem coe_nat_two_pow_pred (p : ℕ) : ((2 ^ p - 1 : ℕ) : ℤ) = (2 ^ p - 1
136136
natCast_pow_pred 2 p (by decide)
137137

138138
end Int
139+
140+
section DivisionMonoid
141+
142+
variable {α : Type*} [DivisionMonoid α] [HasDistribNeg α] {n : ℤ}
143+
144+
theorem Odd.neg_zpow (h : Odd n) (a : α) : (-a) ^ n = -a ^ n := by
145+
obtain ⟨k, rfl⟩ := h
146+
cases k with
147+
| ofNat k =>
148+
rw [Int.ofNat_eq_natCast]
149+
norm_cast
150+
simp [pow_add]
151+
| negSucc k =>
152+
simp_rw [Int.negSucc_eq, show 2 * -(↑k + 1) + (1 : ℤ) = - (1 + k*2) by grind, _root_.zpow_neg]
153+
norm_cast
154+
simp [pow_add]
155+
156+
theorem Odd.neg_one_zpow (h : Odd n) : (-1 : α) ^ n = -1 := by rw [h.neg_zpow, one_zpow]
157+
158+
end DivisionMonoid

Mathlib/Tactic/FieldSimp/Lemmas.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Authors: Heather Macbeth, Arend Mellendijk, Michael Rothgang
66
module
77

88
public import Mathlib.Algebra.BigOperators.Group.List.Basic
9-
public import Mathlib.Algebra.Field.Power -- shake: keep (Qq dependency)
9+
public import Mathlib.Algebra.Field.Defs -- shake: keep (Qq dependency)
10+
public import Mathlib.Algebra.Ring.Int.Parity -- shake: keep (Qq dependency)
1011
public import Mathlib.Algebra.Order.GroupWithZero.Unbundled.Basic
1112
public import Mathlib.Util.Qq
1213

0 commit comments

Comments
 (0)