Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Unit rank of quadratic fields

Proved
DirichletUnitTheorem.quadratic_unit_rank

by Lucas · Oct 9, 2026 · Mathlib 0df444a (Lean v4.33.1)

algebraic-number-theorynumber-theory

Let KKK be a quadratic number field, [K:Q]=2[K:\mathbb Q]=2[K:Q]=2. Then

  1. the unit rank of KKK is 111 if and only if KKK is a real quadratic field (both embeddings are real), and
  2. the unit rank of KKK is 000 if and only if KKK is an imaginary quadratic field (no embedding is real).

For real quadratic fields this is the theory of Pell's equation.

Formalization Note "Real quadratic" is encoded as Mathlib's IsTotallyReal and "imaginary quadratic" as IsTotallyComplex; for degree 222 these agree with the usual notions.

Preamble
import Mathlib
open NumberField
Formal statement
namespace DirichletUnitTheorem

theorem quadratic_unit_rank (K : Type*) [Field K] [NumberField K]
    (hK : Module.finrank ℚ K = 2) :
    (Module.rank ℤ (Additive (𝓞 K)ˣ) = 1 ↔ IsTotallyReal K) ∧
      (Module.rank ℤ (Additive (𝓞 K)ˣ) = 0 ↔ IsTotallyComplex K) := by sorry

end DirichletUnitTheorem
Source
Wikipedia, "Dirichlet's unit theorem" (article supplied by the account owner as a PDF), lead section ("if K is a quadratic field, the rank is 1 if it is a real quadratic field, and 0 if an imaginary quadratic field").
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic) — same agent as the drafter; non-blind

Non-blind read-back — not independent testimony. This read-back was written by the same agent (Aristotle, by Harmonic) that drafted this Lean statement, at the explicit request of the account owner. Its author knew the intended meaning while writing it, so it must not be mistaken for a blind audit by an independent reviewer. Please compare it against the Lean code itself.

Throughout, KKK is a number field (a field of characteristic zero that is finite-dimensional over Q\mathbb QQ), OK\mathcal O_KOK​ is its ring of integers and OK×\mathcal O_K^\timesOK×​ the unit group. r1r_1r1​ denotes the number of real infinite places of KKK and r2r_2r2​ the number of complex infinite places (each complex place corresponds to a pair of complex-conjugate embeddings K→CK\to\mathbb CK→C). The rank of an abelian group AAA is its rank as a Z\mathbb ZZ-module: the supremum of the cardinalities of Z\mathbb ZZ-linearly independent families (for the multiplicative group OK×\mathcal O_K^\timesOK×​: multiplicatively independent families). Torsion elements never belong to such a family. Statement. Let KKK be a number field with [K:Q]=2[K:\mathbb Q]=2[K:Q]=2. Then both of the following hold:

  1. the rank of OK×\mathcal O_K^\timesOK×​ (a cardinal) equals 111 if and only if KKK is totally real (every infinite place of KKK is real);
  2. the rank of OK×\mathcal O_K^\timesOK×​ equals 000 if and only if KKK is totally complex (every infinite place of KKK is complex).
Human review
  • Endorsed by Shuze Chen · Oct 10, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Lucas · Oct 10, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me