Existing in Mathlib · Number Theory
Pell Equation Solvability
For a positive integer d, the Pell equation has an integer solution with y nonzero exactly when d is not a square.
- Pell equation
- Diophantine equations
- integer squares
- irrational square roots
- Diophantine approximation
- modular pigeonhole argument
Exact theorem
Exact Mathlib statement
theorem Pell.exists_iff_not_isSquare {d : ℤ} (h₀ : 0 < d) : (∃ x y : ℤ, x ^ 2 - d * y ^ 2 = 1 ∧ y ≠ 0) ↔ ¬IsSquare dThe theorem at a glance
Pell equation solvability at a glance
A visual guide to the theorem's hypotheses, structure, and conclusion; the exact statement gives the formal detail.
Pell equation solvability at a glance

Detailed visual description
The poster states the exact iff for d : ℤ under 0 < d. Its checked-route section moves from irrationality of √d through rational approximation, a repeated nonzero value m and congruent numerator-denominator pairs, to a nontrivial Pell solution; the reverse direction factors the equation when d = a². The exact-scope footer excludes classification, infinitude, and minimal-solution claims.
Statement structure
From hypotheses to conclusion
This map summarizes the statement's structure; the exact Mathlib declaration remains authoritative.
Nonsquare tiles and an off-axis Pell lattice point

Detailed visual description
Nine cobalt-edged unit tiles form a square block and one gold tile extends beyond it, making a ten-tile nonsquare motif. Opposing gold arcs connect that motif to a gold-rimmed integer lattice point lying on one branch of a symmetric emerald hyperbola away from the horizontal axis. Below, a perfect three-by-three tile block pairs with a reduced hyperbola whose emphasized contacts lie only on the axis.
Why it matters
A mathematical landmark
Pell's equation is a central Diophantine equation, and this declaration captures its basic solvability boundary as an exact equivalence. Mathlib's source is especially instructive because it constructs the nonsquare direction from irrational approximation and a finite congruence collision, then proves the converse by factorization when d is a square.
ProofAtlas record
What has been checked
Mathlib is the source of the theorem; the local Lean replay and page review are separate.
Claim boundary
No new theorem is claimed
This page indexes Mathlib's exact solvability equivalence for Pell's equation. With d : ℤ and 0 < d, it states that an integer pair (x, y) with x ^ 2 - d * y ^ 2 = 1 and y ≠ 0 exists if and only if ¬IsSquare d. The positivity hypothesis and the nontriviality condition y ≠ 0 are essential parts of the selected declaration. It does not classify solutions, assert infinitude, identify a fundamental or least solution, supply an algorithm, or cover nonpositive d.
- The theorem assumes 0 < d; it is not a statement for every integer d.
- The conclusion is the existence of at least one integer solution with y ≠ 0, not a classification or enumeration of all solutions.
- The declaration does not prove infinitude of the solution set or identify a fundamental, unique, canonical, or minimal solution.
- The checked proof uses irrational approximation and a finite congruence collision; Mathlib's source explicitly leaves a connection to continued fractions as future work.
- ProofAtlas is indexing an existing Mathlib theorem, and generated explanations and visuals are not proof evidence.
Source and local evidence
Where the theorem comes from
- Existing declaration
Pell.exists_iff_not_isSquarein mathlib- Relationship
- The checked artifact is the upstream declaration itself
- Local Lean evidence
artifact.library.mathlib.pell-equation-solvability.v001