Skip to content

feat(Algebra/QuadraticAlgebra/Int): the units of a complex quadratic order of discriminant < -4 are ±1 - #46636

Open
xroblot wants to merge 4 commits into
leanprover-community:masterfrom
xroblot:quadratic-int-units
Open

xroblot wants to merge 4 commits into
leanprover-community:masterfrom
xroblot:quadratic-int-units

Conversation

@xroblot

@xroblot xroblot commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

We prove that if discr a b < -4, then the only units of QuadraticAlgebra ℤ a b are 1 and -1. The cases of discriminant -3 and -4 will be treated in a future PR.

The mathematics and design are mine. Claude Code was used as a coding assistant and for the housekeeping around this PR. 🤖


@xroblot xroblot changed the title feat(Algebra/QuadraticAlgebra/Int): units of imaginary quadratic orders feat(Algebra/QuadraticAlgebra/Int): units of complex quadratic orders Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

PR summary a6f077d974

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ isUnit_iff_eq_one_or_neg_one

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

  • +1 new declarations
  • −0 removed declarations
+QuadraticAlgebra.Int.isUnit_iff_eq_one_or_neg_one

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

Current commit a6f077d974
Reference commit f1070cd4d9

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 Nov 27, 2026
@xroblot xroblot changed the title feat(Algebra/QuadraticAlgebra/Int): units of complex quadratic orders feat(Algebra/QuadraticAlgebra/Int): the units of a complex quadratic order of discriminant < -4 are ±1 Nov 27, 2026
@wwylele

wwylele commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

How about adding the following public lemma first?

theorem isUnit_iff_eq_one_or_neg_one (h : discr a b < -4) {x : QuadraticAlgebra ℤ a b} :
    IsUnit x ↔ x = 1 ∨ x = -1 := by

(Claude managed to generate a proof within 10 lines for this without auxiliary lemma. I can post it if you want)

Then if I read it correctly, the proposed one in the PR should be a quick corollary

@xroblot

xroblot commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator Author

How about adding the following public lemma first?

theorem isUnit_iff_eq_one_or_neg_one (h : discr a b < -4) {x : QuadraticAlgebra ℤ a b} :
    IsUnit x ↔ x = 1 ∨ x = -1 := by

Well, I was in fact going to refactor the proof along these lines. I changed the PR description but forgot to push last night 😅 It's now done.

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

modulo Monica's review comments

maintainer delegate?

@github-actions

github-actions Bot commented Dec 1, 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 1, 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.

5 participants