Skip to content

[Merged by Bors] - feat(NumberTheory): Niven's theorem - #26371

Closed
Timeroot wants to merge 20 commits into
leanprover-community:masterfrom
Timeroot:niven
Closed

Timeroot wants to merge 20 commits into
leanprover-community:masterfrom
Timeroot:niven

Conversation

@Timeroot

@Timeroot Timeroot commented Jun 24, 2025 •

Copy link
Copy Markdown
Collaborator

This file proves Niven's theorem, that the only rational cosines of angles that are rational multiples of pi, are [-1, -1/2, 0, 1/2, 1]. This is one of the theorems missing from 1000.yaml.

Co-authored-by: @Aristotle-Harmonic


Open in Gitpod

@github-actions github-actions Bot added the t-number-theory Number theory (also use t-algebra or t-analysis to specialize) label Jun 24, 2025
@github-actions

github-actions Bot commented Jun 24, 2025 •

Copy link
Copy Markdown

PR summary c73c039bf8

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.NumberTheory.Niven (new file) 2002

Declarations diff

+ exists_int_iff_exists_rat
+ isIntegral_two_mul_cos_rat_mul_pi
+ niven
+ niven_angle_eq
+ niven_sin
+ ratCast_iff

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

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

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


No changes to technical debt.

You can run this locally as

./scripts/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).

@grunweg grunweg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm always happy about 1000 theorems being crossed off. I have a few style comments (and don't know this part of the library well enough to comment on the very fine pints here).

Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
@plp127

plp127 commented Jun 25, 2025 •

Copy link
Copy Markdown
Contributor

I proved Niven's theorem once, it didn't use quite this much number theory. I didn't get around to PRing it though.

@loefflerd loefflerd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here are some stylistic comments on the main proof (and the fact that I'm critiquing the style means I think the general approach is fine). Please merge master and apply these changes; once the main theorem is in a good state I can take a look at the corollraies at the end.

Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
@loefflerd loefflerd added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Sep 22, 2025
@Timeroot

Copy link
Copy Markdown
Collaborator Author

Good tips, thanks!

@Timeroot Timeroot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Sep 22, 2025

@loefflerd loefflerd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is good now. I've suggested a few more minor changes (nothing major, just a few shortcuts and minor syntax cleanup). Thanks for this nice contribution!

maintainer delegate

Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
@github-actions

Copy link
Copy Markdown

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

@ghost ghost added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Sep 23, 2025
Comment thread Mathlib/NumberTheory/Niven.lean Resolved
@riccardobrasca

Copy link
Copy Markdown
Member

Thanks!

bors merge

@ghost ghost added ready-to-merge This PR has been sent to bors. and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Sep 27, 2025
mathlib-bors Bot pushed a commit that referenced this pull request Sep 27, 2025
This file proves Niven's theorem, that the only rational cosines of angles that are rational multiples of pi, are [-1, -1/2, 0, 1/2, 1]. This is one of the theorems missing from 1000.yaml.

Co-authored-by: @Aristotle-Harmonic
@mathlib-bors

mathlib-bors Bot commented Sep 27, 2025

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title feat(NumberTheory): Niven's theorem [Merged by Bors] - feat(NumberTheory): Niven's theorem Sep 27, 2025
@mathlib-bors mathlib-bors Bot closed this Sep 27, 2025
joelriou pushed a commit to joelriou/mathlib4 that referenced this pull request Oct 2, 2025
This file proves Niven's theorem, that the only rational cosines of angles that are rational multiples of pi, are [-1, -1/2, 0, 1/2, 1]. This is one of the theorems missing from 1000.yaml.

Co-authored-by: @Aristotle-Harmonic
BeibeiX0 pushed a commit to BeibeiX0/mathlib4 that referenced this pull request Nov 7, 2025
This file proves Niven's theorem, that the only rational cosines of angles that are rational multiples of pi, are [-1, -1/2, 0, 1/2, 1]. This is one of the theorems missing from 1000.yaml.

Co-authored-by: @Aristotle-Harmonic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors. t-number-theory Number theory (also use t-algebra or t-analysis to specialize)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants