Solutions to Pell's equation
ProvedFamousTheorems.pell_eq_pellPell's equation.
Fix and set . Every natural-number solution of
is for some , where is the sequence generated by the fundamental solution via
equivalently .
The content is that the solutions are exactly the powers of the fundamental unit — there are infinitely many, but they form a single cyclic chain with no sporadic extras. For the fundamental solution is visible by inspection, which is what makes this family the clean case; for general non-square the fundamental solution can be enormous (for the smallest is ), and finding it requires continued fractions.
Brahmagupta gave a composition law for solutions in 628, and Bhaskara II's chakravala method solved the general case in the 12th century. Euler misattributed the equation to Pell; Lagrange gave the first proof in 1768 that a nontrivial solution always exists for non-square . The equation is the computational heart of the negative solution to Hilbert's tenth problem: Matiyasevich used the exponential growth of to show exponentiation is Diophantine.
Formalization note. Subtraction is truncated natural subtraction, so is stated as
written. The result is Mathlib's Pell.eq_pell.
import Mathlib
namespace FamousTheorems
theorem pell_eq_pell : ∀ {a : ℕ} (a1 : 1 < a) {x y : ℕ}, x * x - (a * a - 1) * y * y = 1 →
∃ n, x = Pell.xn a1 n ∧ y = Pell.yn a1 n := by sorry
end FamousTheorems