Pell's equation and Matiyasevic's theorem #
This file solves Pell's equation, i.e. integer solutions to x ^ 2 - d * y ^ 2 = 1
in the special
case that d = a ^ 2 - 1
. This is then applied to prove Matiyasevic's theorem that the power
function is Diophantine, which is the last key ingredient in the solution to Hilbert's tenth
problem. For the definition of Diophantine function, see dioph.lean
.
Main definition #
pell
is a function assigning to a natural numbern
then
-th solution to Pell's equation constructed recursively from the initial solution(0, 1)
.
Main statements #
eq_pell
shows that every solution to Pell's equation is recursively obtained usingpell
matiyasevic
shows that a certain system of Diophantine equations has a solution if and only if the first variable is thex
-component in a solution to Pell's equation - the key step towards Hilbert's tenth problem in Davis' version of Matiyasevic's theorem.eq_pow_of_pell
shows that the power function is Diophantine.
Implementation notes #
The proof of Matiyasevic's theorem doesn't follow Matiyasevic's original account of using Fibonacci numbers but instead Davis' variant of using solutions to Pell's equation.
References #
- M. Carneiro, A Lean formalization of Matiyasevič's theorem
- M. Davis, Hilbert's tenth problem is unsolvable
Tags #
Pell's equation, Matiyasevic's theorem, Hilbert's tenth problem
TODO #
- Provide solutions to Pell's equation for the case of arbitrary
d
(not justd = a ^ 2 - 1
like in the current version) and furthermore also forx ^ 2 - d * y ^ 2 = -1
. - Connect solutions to the continued fraction expansion of
√d
.
@[nolint]
The Pell sequences, i.e. the sequence of integer solutions to x ^ 2 - d * y ^ 2 = 1
, where
d = a ^ 2 - 1
, defined together in mutual recursion.
@[simp]
@[simp]
theorem
pell.is_pell_mul
{a : ℕ}
(a1 : 1 < a)
{b c : ℤ√↑(d a1)}
(hb : pell.is_pell a1 b)
(hc : pell.is_pell a1 c) :
pell.is_pell a1 (b * c)
theorem
pell.is_pell_conj
{a : ℕ}
(a1 : 1 < a)
{b : ℤ√↑(d a1)} :
pell.is_pell a1 b ↔ pell.is_pell a1 b.conj
@[simp]
theorem
pell.pell_zd_succ
{a : ℕ}
(a1 : 1 < a)
(n : ℕ) :
pell.pell_zd a1 (n + 1) = pell.pell_zd a1 n * {re := ↑a, im := 1}
theorem
pell.eq_pell_lem
{a : ℕ}
(a1 : 1 < a)
(n : ℕ)
(b : ℤ√↑(d a1)) :
1 ≤ b → pell.is_pell a1 b → b ≤ pell.pell_zd a1 n → (∃ (n : ℕ), b = pell.pell_zd a1 n)
theorem
pell.eq_pell_zd
{a : ℕ}
(a1 : 1 < a)
(b : ℤ√↑(d a1))
(b1 : 1 ≤ b)
(hp : pell.is_pell a1 b) :
∃ (n : ℕ), b = pell.pell_zd a1 n
theorem
pell.pell_zd_add
{a : ℕ}
(a1 : 1 < a)
(m n : ℕ) :
pell.pell_zd a1 (m + n) = pell.pell_zd a1 m * pell.pell_zd a1 n
theorem
pell.pell_zd_sub
{a : ℕ}
(a1 : 1 < a)
{m n : ℕ}
(h : n ≤ m) :
pell.pell_zd a1 (m - n) = pell.pell_zd a1 m * (pell.pell_zd a1 n).conj
theorem
pell.pell_zd_succ_succ
{a : ℕ}
(a1 : 1 < a)
(n : ℕ) :
pell.pell_zd a1 (n + 2) + pell.pell_zd a1 n = ↑(2 * a) * pell.pell_zd a1 (n + 1)
theorem
pell.matiyasevic
{a k x y : ℕ} :
(∃ (a1 : 1 < a), pell.xn a1 k = x ∧ pell.yn a1 k = y) ↔ 1 < a ∧ k ≤ y ∧ (x = 1 ∧ y = 0 ∨ ∃ (u v s t b : ℕ), x * x - (a * a - 1) * y * y = 1 ∧ u * u - (a * a - 1) * v * v = 1 ∧ s * s - (b * b - 1) * t * t = 1 ∧ 1 < b ∧ b ≡ 1 [MOD 4 * y] ∧ b ≡ a [MOD u] ∧ 0 < v ∧ y * y ∣ v ∧ s ≡ x [MOD u] ∧ t ≡ k [MOD 4 * y])