Skip to content

feat(Algebra/Field/Power): weaken assumptions of Odd.neg_zpow#37319

Open
PrParadoxy wants to merge 9 commits intoleanprover-community:masterfrom
PrParadoxy:odd_neg
Open

feat(Algebra/Field/Power): weaken assumptions of Odd.neg_zpow#37319
PrParadoxy wants to merge 9 commits intoleanprover-community:masterfrom
PrParadoxy:odd_neg

Conversation

@PrParadoxy
Copy link
Copy Markdown
Contributor

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.


According to the docstring, the purpose of Mathlib.Algebra.Field.Power
is to define Field with minimal imports. But after this PR, Power.lean
does not rely on Mathlib.Algebra.Field.Defs any more. Arguably, it
could be deprecated. The two results in the file could be stated in
Mathlib.Algebra.Ring.Int.Parity without any extra imports. Should we implement
this in the current or an additional PR?

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

PrParadoxy and others added 6 commits March 27, 2026 21:23
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.

---

According to the docstring, the purpose of `Mathlib.Algebra.Field.Power`
is to define `Field` with minimal imports. But after this PR, Power.lean
does not rely on `Mathlib.Algebra.Field.Defs` any more. Arguably, it
could be deprecated. The two results in the file could be stated in
`Algebra.Ring.Int.Parity` without any extra imports. Should we implement
this in the current or an additional PR?

Note:
```
-- 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

-- this fails without the PR:
example (z : ℤ) (h : Odd z) : (-1 : unitary ℂ)^z = -1 := Odd.neg_one_zpow h
```
@github-actions github-actions bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Mar 28, 2026
@github-actions
Copy link
Copy Markdown

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR.

Thank you again for joining our community.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 28, 2026

PR summary 34f85c5f24

Import changes for modified files

Dependency changes

File Base Count Head Count Change
Mathlib.Algebra.Field.Power 376 372 -4 (-1.06%)
Mathlib.Tactic.FieldSimp.Lemmas 384 385 +1 (+0.26%)
Import changes for all files
Files Import difference
There are 2807 files with changed transitive imports taking up over 130896 characters: this is too many to display!
You can run ci-tools/scripts/pr_summary/import_trans_difference.sh all locally to see the whole output.

Declarations diff

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

goliath-klein and others added 2 commits March 28, 2026 19:30
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@grunweg grunweg changed the title feat(Algebra/Field/Power): Weaken assumptions of Odd.neg_zpow feat(Algebra/Field/Power): weaken assumptions of Odd.neg_zpow Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants