Skip to content

Conversation

SnirBroshi
Copy link
Contributor

Add a Decidable instance for the already proven theorem of being the sum of two squares.

Try #eval Finset.range 50 |>.filter (∃ x y, · = x ^ 2 + y ^ 2)


Open in Gitpod

@github-actions github-actions bot added new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-number-theory Number theory (also use t-algebra or t-analysis to specialize) labels Oct 6, 2025
Copy link

github-actions bot commented Oct 6, 2025

PR summary a2df56f501

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ Nat.mod_four_ne_three_of_mem_primeFactors_of_isSquare_neg_one
+ ZMod.isSquare_neg_one_iff_forall_mem_primeFactors_mod_four_ne_three
+ instance {n : ℕ} : Decidable (∃ x y, n = x ^ 2 + y ^ 2)

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

… the sum of two squares

Try `#eval Finset.range 50 |>.filter (∃ x y, · = x ^ 2 + y ^ 2)`
…sSquare_neg_one` to `Nat.mod_four_ne_three_of_mem_primeFactors_of_isSquare_neg_one`
@riccardobrasca
Copy link
Member

Thanks!

bors d+

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Oct 15, 2025

✌️ SnirBroshi can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@riccardobrasca
Copy link
Member

Sorry, Can you also add a deprecation (maybe with a warning that the statement slightly changed)?

@SnirBroshi
Copy link
Contributor Author

Sorry, Can you also add a deprecation (maybe with a warning that the statement slightly changed)?

Added back the original statements of the theorems I changed, with deprecations. Is this okay? (I didn't do it for the main theorem because it feels wrong to find a new name for it)

@riccardobrasca
Copy link
Member

Sorry, Can you also add a deprecation (maybe with a warning that the statement slightly changed)?

Added back the original statements of the theorems I changed, with deprecations. Is this okay? (I didn't do it for the main theorem because it feels wrong to find a new name for it)

I mean to use an alias, explaining that the statement slightly changed, something like

@[deprecated "Note that the statement now uses ...." (since := "2025-10-15")]
alias Nat.Prime.mod_four_ne_three_of_dvd_isSquare_neg_one := Nat.mod_four_ne_three_of_mem_primeFactors_of_isSquare_neg_one

And similarly for the other declarations.

@riccardobrasca
Copy link
Member

Thanks!

bors merge

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the ready-to-merge This PR has been sent to bors. label Oct 15, 2025
mathlib-bors bot pushed a commit that referenced this pull request Oct 15, 2025
… the sum of two squares (#30273)

Add a `Decidable` instance for the already proven theorem of being the sum of two squares.

Try `#eval Finset.range 50 |>.filter (∃ x y, · = x ^ 2 + y ^ 2)`
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Oct 15, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(NumberTheory/SumTwoSquares): it is decidable whether a number is the sum of two squares [Merged by Bors] - feat(NumberTheory/SumTwoSquares): it is decidable whether a number is the sum of two squares Oct 15, 2025
@mathlib-bors mathlib-bors bot closed this Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! 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.

4 participants