Mathlib theorem · Existing formal mathematics

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.

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 d

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

For 0 < d, a nontrivial integer solution of x² − d y² = 1 exists exactly when d is not a square. Explanatory diagram.
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

Statement map for Pell Equation SolvabilityFor positive d, the Pell equation has a nontrivial integer solution if and only if d is not a square. The pinned upstream declaration is Pell.exists_iff_not_isSquare. The exact checked statement is theorem Pell.exists_iff_not_isSquare {d : ℤ} (h₀ : 0 < d) : (∃ x y : ℤ, x ^ 2 - d * y ^ 2 = 1 ∧ y ≠ 0) ↔ ¬IsSquare d.Mathematical readingFor positive d, the Pellequation has anontrivial integersolution if and only ifd is not a square.Pinned declarationmathlib ·Pell.exists_iff_not_isSquareExact checked formtheoremPell.exists_iff_not_isSquare{d : ℤ} (h₀ : 0 < d) :(∃ x y : ℤ, x ^ 2 - d *y ^ 2 = 1 ∧ y ≠ 0) ↔¬IsSquare dStatement map for Pell Equation SolvabilityFor positive d, the Pell equation has a nontrivial integer solution if and only if d is not a square. The pinned upstream declaration is Pell.exists_iff_not_isSquare. The exact checked statement is theorem Pell.exists_iff_not_isSquare {d : ℤ} (h₀ : 0 < d) : (∃ x y : ℤ, x ^ 2 - d * y ^ 2 = 1 ∧ y ≠ 0) ↔ ¬IsSquare d.Mathematical readingFor positive d, the Pellequation has anontrivial integersolution if and only ifd is not a square.Pinned declarationmathlib ·Pell.exists_iff_not_isSquareExact checked formtheoremPell.exists_iff_not_isSquare{d : ℤ} (h₀ : 0 < d) :(∃ x y : ℤ, x ^ 2 - d *y ^ 2 = 1 ∧ y ≠ 0) ↔¬IsSquare d

This map summarizes the statement's structure; the exact Mathlib declaration remains authoritative.

A positive nonsquare tile count corresponds to an off-axis integer point, while the square-case contrast remains confined to the axis. Explanatory scientific diagram.
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

Upstream indexedPinned source bytes verified locally
Locally reproducedExact upstream declaration replayed
Reviewed pageCurrent public presentation reviewed
Accepted Atlas resultNot recorded for the preferred artifact

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.

Source and local evidence

Where the theorem comes from

Existing declaration
Pell.exists_iff_not_isSquare in mathlib
Relationship
The checked artifact is the upstream declaration itself
Local Lean evidence
artifact.library.mathlib.pell-equation-solvability.v001
Source
Open the pinned upstream reference