Skip to content

[Merged by Bors] - feat(NumberTheory/NumberField): quadratic fields and their discriminant - #43490

Closed
xroblot wants to merge 58 commits into
leanprover-community:masterfrom
xroblot:quadratic-field-basic
Closed

xroblot wants to merge 58 commits into
leanprover-community:masterfrom
xroblot:quadratic-field-basic

Conversation

@xroblot

@xroblot xroblot commented Sep 6, 2026 •

Copy link
Copy Markdown
Collaborator

This PR introduces quadratic fields, that is number fields of degree 2 over ℚ and relates them to the quadratic algebras.

There is no new definition: a quadratic field is a field K of characteristic zero such that Algebra.IsQuadraticExtension ℚ K holds. The instance NumberField K is then automatic.

The main results are:

  • the discriminant of K is a fundamental discriminant;
  • the ring of integers of K is isomorphic to QuadraticAlgebra ℤ (discr K / 4) (discr K % 4);
  • K is isomorphic to ℚ(√(discr K));
  • two quadratic fields are isomorphic if and only if they have the same discriminant.

Along the way it also proves that discr K is not a square and that √(discr K) lies in K.

Further results on the fields ℚ(√d) and on the real and complex embeddings will follow in later PRs.

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


xroblot and others added 30 commits July 27, 2026 20:07
…-map

# Conflicts:
#	Mathlib/Algebra/QuadraticAlgebra/Basic.lean
…ratic-algebra-discr

# Conflicts:
#	Mathlib/Algebra/QuadraticAlgebra/Basic.lean
…-discr

# Conflicts:
#	Mathlib/Algebra/QuadraticAlgebra/Basic.lean
…-disc2

# Conflicts:
#	Mathlib/Algebra/QuadraticAlgebra/Discr.lean
…tic-algebra-fraction-ring

# Conflicts:
#	Mathlib.lean
#	Mathlib/Algebra/QuadraticAlgebra/Discr.lean
@riccardobrasca riccardobrasca self-assigned this Nov 12, 2026
@tb65536 tb65536 added the LLM-generated PRs with substantial input from LLMs - review accordingly label Nov 12, 2026
@xroblot xroblot removed the LLM-generated PRs with substantial input from LLMs - review accordingly label Nov 12, 2026
@riccardobrasca

Copy link
Copy Markdown
Member

The description says "Along the way it also proves that discr K is not 1 and not a square, and that √(discr K) lies in K." but I don't see this fact (we have it in general, right?).

@xroblot

xroblot commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator Author

The description says "Along the way it also proves that discr K is not 1 and not a square, and that √(discr K) lies in K." but I don't see this fact (we have it in general, right?).

Yes, that was a leftover. I fixed that. Thanks.

@riccardobrasca

Copy link
Copy Markdown
Member

Thanks!

bors d+

@mathlib-bors mathlib-bors Bot added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Nov 30, 2026
@mathlib-bors

mathlib-bors Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

✌️ xroblot can now approve this pull request until 2026-12-14 16:49 UTC (in 2 weeks). To approve and merge, reply with bors r+. More detailed instructions are available here.

⚠️ This delegation only covers changes within Archive/**, Counterexamples/**, docs/**, DownstreamTest/**, Mathlib/**, MathlibTest/**, Wanted/**, widget/**, Archive.lean, Counterexamples.lean, docs.lean, Mathlib.lean, Wanted.lean; an author commit touching anything else will revoke it. Bors also revokes it if a later push changes too many files for it to check the full list — even if it stays within scope.

@xroblot

xroblot commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator Author

bors r+

@mathlib-bors mathlib-bors Bot added the ready-to-merge This PR has been sent to bors. label Nov 30, 2026
mathlib-bors Bot pushed a commit that referenced this pull request Nov 30, 2026
…nt (#43490)

This PR introduces quadratic fields, that is number fields of degree `2` over `ℚ` and relates them to the quadratic algebras.

There is no new definition: a quadratic field is a field `K` of characteristic zero such that `Algebra.IsQuadraticExtension ℚ K` holds. The instance `NumberField K` is then automatic.

The main results are:
* the discriminant of `K` is a fundamental discriminant;
* the ring of integers of `K` is isomorphic to `QuadraticAlgebra ℤ (discr K / 4) (discr K % 4)`;
* `K` is isomorphic to `ℚ(√(discr K))`;
* two quadratic fields are isomorphic if and only if they have the same discriminant.

Along the way it also proves that `discr K` is not a square and that `√(discr K)` lies in `K`.

Further results on the fields `ℚ(√d)` and on the real and complex embeddings will follow in later PRs.

The mathematics and design are mine. Claude Code was used as a coding assistant and for the housekeeping around this PR. 🤖
@mathlib-bors mathlib-bors Bot added the bors-staging This PR is currently being built by bors on the staging branch. label Nov 30, 2026
@mathlib-bors

mathlib-bors Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

@mathlib-bors mathlib-bors Bot changed the title feat(NumberTheory/NumberField): quadratic fields and their discriminant [Merged by Bors] - feat(NumberTheory/NumberField): quadratic fields and their discriminant Nov 30, 2026
@mathlib-bors mathlib-bors Bot closed this Nov 30, 2026
@mathlib-bors mathlib-bors Bot removed the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Nov 30, 2026
TJHeeringa pushed a commit to TJHeeringa/mathlib4 that referenced this pull request Dec 2, 2026
…nt (leanprover-community#43490)

This PR introduces quadratic fields, that is number fields of degree `2` over `ℚ` and relates them to the quadratic algebras.

There is no new definition: a quadratic field is a field `K` of characteristic zero such that `Algebra.IsQuadraticExtension ℚ K` holds. The instance `NumberField K` is then automatic.

The main results are:
* the discriminant of `K` is a fundamental discriminant;
* the ring of integers of `K` is isomorphic to `QuadraticAlgebra ℤ (discr K / 4) (discr K % 4)`;
* `K` is isomorphic to `ℚ(√(discr K))`;
* two quadratic fields are isomorphic if and only if they have the same discriminant.

Along the way it also proves that `discr K` is not a square and that `√(discr K)` lies in `K`.

Further results on the fields `ℚ(√d)` and on the real and complex embeddings will follow in later PRs.

The mathematics and design are mine. Claude Code was used as a coding assistant and for the housekeeping around this PR. 🤖
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bors-staging This PR is currently being built by bors on the staging branch. ready-to-merge This PR has been sent to bors. t-algebra Algebra (groups, rings, fields, etc) 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.

5 participants