Skip to content

feat(FieldTheory/Finite): sum of the powers of the elements of a finite field - #45465

Open
xroblot wants to merge 5 commits into
leanprover-community:masterfrom
xroblot:finitefield-sum-pow
Open

xroblot wants to merge 5 commits into
leanprover-community:masterfrom
xroblot:finitefield-sum-pow

Conversation

@xroblot

@xroblot xroblot commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

For i ≠ 0, the sum of x ^ i over all the elements x of a finite field with q elements is -1 if q - 1 divides i, and 0 otherwise. As a special case, the sum of all the elements of a finite field is 1 if it has two elements and 0 otherwise.

The PR also adds, for a finite group with zero, the identification of a product (or a sum) over the nonzero elements with a product over the units, and clarifies the docstring of sum_pow_units and the module docstring, which gave the value q - 1 instead of -1. Finally, it deprecates FiniteField.cast_card_eq_zero, which duplicates Nat.cast_card_eq_zero.

🤖 Claude extracted this PR from my SKW project.

@xroblot xroblot added the WIP Work in progress label Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

PR summary 2cb258243c

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ Fintype.prod_compl_zero
+ sum_pow_of_ne_zero
+ sum_univ_id_eq_ite

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

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

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 2cb2582).

  • +4 new declarations
  • −0 removed declarations
+FiniteField.sum_pow_of_ne_zero
+FiniteField.sum_univ_id_eq_ite
+Fintype.prod_compl_zero
+Fintype.sum_compl_zero

No changes to strong technical debt.
No changes to weak technical debt.

Current commit 2cb258243c
Reference commit c47f9ad906

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py 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).

@github-actions github-actions Bot added the t-algebra Algebra (groups, rings, fields, etc) label Oct 29, 2026
Comment thread Mathlib/FieldTheory/Finite/Basic.lean Resolved
@xroblot xroblot removed the WIP Work in progress label Oct 29, 2026
@artie2000

artie2000 commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

and fixes ... the module docstring, which gave the value q - 1 instead of -1.

this is strictly speaking a clarification not a fix, right?
(checking my understanding of what you wrote)

@xroblot

xroblot commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator Author

and fixes ... the module docstring, which gave the value q - 1 instead of -1.

this is strictly speaking a clarification not a fix, right? (checking my understanding of what you wrote)

Indeed. I fix that. Thanks!

@artie2000 artie2000 self-assigned this Dec 1, 2026

@artie2000 artie2000 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, thanks

a few small things

Comment thread Mathlib/FieldTheory/Finite/Basic.lean Resolved
Comment thread Mathlib/FieldTheory/Finite/Basic.lean Resolved
Comment thread Mathlib/FieldTheory/Finite/Basic.lean Resolved
Comment thread Mathlib/FieldTheory/Finite/Basic.lean Resolved
@artie2000 artie2000 added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Dec 1, 2026
@xroblot xroblot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Dec 2, 2026
@artie2000

Copy link
Copy Markdown
Collaborator

thanks!

maintainer merge

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by artie2000.

@mathlib-triage mathlib-triage Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Dec 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants