Lucas sequences
StructureParameters of a Lucas sequence#✓fully proved
Lucas sequence parameters are a pair of integers \((P, Q)\) with \(Q \ne 0\).
The condition \(Q \ne 0\) follows the convention of the sources.
structure LucasSequenceParams where
p : ℤ
q : ℤ
q_ne_zero : q ≠ 0
q : ℤ
MathlibExt/NumberTheory/LucasSequence.lean:41
Used by 198
DefinitionCoprime Lucas sequence parameters#✓fully proved
Lucas sequence parameters \((P, Q)\) are coprime when there exist integers \(x\) and \(y\) with \(xP + yQ = 1\).
This additional condition is imposed in some applications of Lucas sequences.
def LucasSequenceParams.IsCoprime (params : LucasSequenceParams) : Prop :=
∃ x y : ℤ, x * params.p + y * params.q = 1
structure LucasSequenceParams where
p : ℤ
q : ℤ
q_ne_zero : q ≠ 0
MathlibExt/NumberTheory/LucasSequence.lean:39
Uses 1 · Used by 3
DefinitionLucas sequence \(U(P, Q)\)#✓fully proved
For Lucas sequence parameters \((P, Q)\), the Lucas sequence \(U(P, Q)\) is the integer sequence \((U_n)_{n \ge 0}\) with \(U_0 = 0\), \(U_1 = 1\) and \(U_{n+2} = P U_{n+1} - Q U_n\) for every natural number \(n\).
def lucasU (params : LucasSequenceParams) : ℕ → ℤ
| 0 => 0
| 1 => 1
| n + 2 => params.p * lucasU params (n + 1) - params.q * lucasU params n
structure LucasSequenceParams where
p : ℤ
q : ℤ
q_ne_zero : q ≠ 0
MathlibExt/NumberTheory/LucasSequence.lean:39
Uses 1 · Used by 154
DefinitionCompanion Lucas sequence \(V(P, Q)\)#✓fully proved
For Lucas sequence parameters \((P, Q)\), the companion Lucas sequence \(V(P, Q)\) is the integer sequence \((V_n)_{n \ge 0}\) with \(V_0 = 2\), \(V_1 = P\) and \(V_{n+2} = P V_{n+1} - Q V_n\) for every natural number \(n\).
def lucasV (params : LucasSequenceParams) : ℕ → ℤ
| 0 => 2
| 1 => params.p
| n + 2 => params.p * lucasV params (n + 1) - params.q * lucasV params n
structure LucasSequenceParams where
p : ℤ
q : ℤ
q_ne_zero : q ≠ 0
MathlibExt/NumberTheory/LucasSequence.lean:39
Uses 1 · Used by 55
DefinitionFibonacci parameters for Lucas sequences#✓fully proved
The Fibonacci parameters are the Lucas sequence parameters \(P = 1\) and \(Q = -1\); they satisfy the required condition \(Q \ne 0\).
These parameters give the Fibonacci and classical Lucas-number sequences.
def fibonacciLucasParams : LucasSequenceParams where
p := 1
q := -1
q_ne_zero := by decide
structure LucasSequenceParams where
p : ℤ
q : ℤ
q_ne_zero : q ≠ 0
MathlibExt/NumberTheory/LucasSequence.lean:39
Uses 1 · Used by 5
DefinitionLucas numbers#✓fully proved
The Lucas numbers are the natural numbers \(L_n\) defined by \(L_0 = 2\), \(L_1 = 1\) and \(L_{n+2} = L_{n+1} + L_n\) for every natural number \(n\). They begin \(2, 1, 3, 4, 7, \dots\).
def lucasNumber : ℕ → ℕ
| 0 => 2
| 1 => 1
| n + 2 => lucasNumber (n + 1) + lucasNumber n
Used by 77
TheoremThe Lucas sequence \(U(1, -1)\) is the Fibonacci sequence#✓fully proved
For every natural number \(n\), the \(n\)-th term of the Lucas sequence \(U(1, -1)\) equals the Fibonacci number \(F_n\), where \(F_0 = 0\), \(F_1 = 1\) and \(F_{n+2} = F_{n+1} + F_n\).
theorem lucasU_fibonacciLucasParams (n : ℕ) :
lucasU fibonacciLucasParams n = (Nat.fib n : ℤ)
def lucasU (params : LucasSequenceParams) : ℕ → ℤ
| 0 => 0
| 1 => 1
| n + 2 => params.p * lucasU params (n + 1) - params.q * lucasU params n
MathlibExt/NumberTheory/LucasSequence.lean:50
def fibonacciLucasParams : LucasSequenceParams where
p := 1
q := -1
q_ne_zero := by decide
MathlibExt/NumberTheory/LucasSequence.lean:63
Uses 3 · Used by 2
TheoremRecurrence for the Lucas sequence \(U(P, Q)\)#✓fully proved
For Lucas sequence parameters \((P, Q)\) and every natural number \(n\), the Lucas sequence \(U = U(P, Q)\) satisfies \(U_{n+2} = P U_{n+1} - Q U_n\).
theorem lucasU_add_two (params : LucasSequenceParams) (n : ℕ) :
lucasU params (n + 2) =
params.p * lucasU params (n + 1) - params.q * lucasU params n
structure LucasSequenceParams where
p : ℤ
q : ℤ
q_ne_zero : q ≠ 0
MathlibExt/NumberTheory/LucasSequence.lean:39
def lucasU (params : LucasSequenceParams) : ℕ → ℤ
| 0 => 0
| 1 => 1
| n + 2 => params.p * lucasU params (n + 1) - params.q * lucasU params n
MathlibExt/NumberTheory/LucasSequence.lean:50
Uses 2 · Used by 2
TheoremCassini's identity for Lucas sequences#✓fully proved
For Lucas sequence parameters \((P, Q)\) and every natural number \(n\), the Lucas sequence \(U = U(P, Q)\) satisfies \(U_{n+1}^2 - U_n U_{n+2} = Q^n\).
theorem lucasU_cassini (params : LucasSequenceParams) (n : ℕ) :
lucasU params (n + 1) ^ 2 - lucasU params n * lucasU params (n + 2) =
params.q ^ n
structure LucasSequenceParams where
p : ℤ
q : ℤ
q_ne_zero : q ≠ 0
MathlibExt/NumberTheory/LucasSequence.lean:39
def lucasU (params : LucasSequenceParams) : ℕ → ℤ
| 0 => 0
| 1 => 1
| n + 2 => params.p * lucasU params (n + 1) - params.q * lucasU params n
MathlibExt/NumberTheory/LucasSequence.lean:50
Uses 3
TheoremThe Lucas sequence \(V(1, -1)\) gives the Lucas numbers#✓fully proved
For every natural number \(n\), the \(n\)-th term of the companion Lucas sequence \(V(1, -1)\) equals the \(n\)-th Lucas number \(L_n\).
theorem lucasV_fibonacciLucasParams (n : ℕ) :
lucasV fibonacciLucasParams n = (lucasNumber n : ℤ)
def lucasV (params : LucasSequenceParams) : ℕ → ℤ
| 0 => 2
| 1 => params.p
| n + 2 => params.p * lucasV params (n + 1) - params.q * lucasV params n
MathlibExt/NumberTheory/LucasSequence.lean:56
def fibonacciLucasParams : LucasSequenceParams where
p := 1
q := -1
q_ne_zero := by decide
MathlibExt/NumberTheory/LucasSequence.lean:63
def lucasNumber : ℕ → ℕ
| 0 => 2
| 1 => 1
| n + 2 => lucasNumber (n + 1) + lucasNumber n
MathlibExt/NumberTheory/LucasSequence.lean:69
Uses 4
DefinitionSpecial primes of a Lucas pair#✓fully proved
For integers \(P\) and \(Q\), a natural number \(p\) is a special prime for the Lucas parameters \((P, Q)\) if \(p\) is prime and \(p\) divides \(\gcd(P, Q)\).
Used by 1
TheoremSpecial primes are the common prime divisors of the parameters#✓fully proved
For integers \(P\) and \(Q\) and a natural number \(p\), \(p\) is a special prime for the Lucas parameters \((P, Q)\) if and only if \(p\) is prime and \(p\) divides both \(P\) and \(Q\) in \(\mathbb{Z}\).
theorem isLucasSpecialPrime_iff (P Q : Int) (p : Nat) :
IsLucasSpecialPrime P Q p ↔ Nat.Prime p ∧ (p : Int) ∣ P ∧ (p : Int) ∣ Q
def IsLucasSpecialPrime (P Q : Int) (p : Nat) : Prop :=
Nat.Prime p ∧ p ∣ Int.gcd P Q
MathlibExt/NumberTheory/LucasSpecialPrime.lean:22
Uses 1
TheoremBinet formulas for Lucas sequences over any field#✓fully proved
Let \(P\) and \(Q\) be integers with \(Q \ne 0\), let \(U_n = U_n(P, Q)\) and \(V_n = V_n(P, Q)\) be the associated Lucas sequences, and let \(\alpha\) and \(\beta\) be elements of a field \(K\) with \(\alpha + \beta = P\) and \(\alpha \beta = Q\) in \(K\). If \(\alpha \ne \beta\), then for every natural number \(n\), \(U_n = (\alpha^n - \beta^n) / (\alpha - \beta)\) and \(V_n = \alpha^n + \beta^n\) in \(K\). If \(\beta = \alpha\), then for every natural number \(n\), \(U_n = n \alpha^{n-1}\) and \(V_n = 2 \alpha^n\) in \(K\), where \(\alpha^{n-1}\) is read as \(1\) when \(n = 0\). Here the integers \(U_n\), \(V_n\), \(P\), \(Q\) and \(n\) are mapped into \(K\).
No assumption on the characteristic of \(K\) is made; for example \(K\) may be \(\mathbb{Z}/p\mathbb{Z}\) for a prime \(p\), where the coefficient \(n\) of the double-root formula is read modulo \(p\).
theorem lucas_binet_formulas_of_field
{K : Type*} [Field K]
(params : LucasSequenceParams) (alpha beta : K)
(hsum : alpha + beta = (params.p : K))
(hprod : alpha * beta = (params.q : K)) :
(alpha ≠ beta → ∀ n : ℕ,
(lucasU params n : K) = (alpha ^ n - beta ^ n) / (alpha - beta) ∧
(lucasV params n : K) = alpha ^ n + beta ^ n) ∧
(beta = alpha → ∀ n : ℕ,
(lucasU params n : K) = (n : K) * alpha ^ (n - 1) ∧
(lucasV params n : K) = 2 * alpha ^ n)
structure LucasSequenceParams where
p : ℤ
q : ℤ
q_ne_zero : q ≠ 0
MathlibExt/NumberTheory/LucasSequence.lean:39
def lucasU (params : LucasSequenceParams) : ℕ → ℤ
| 0 => 0
| 1 => 1
| n + 2 => params.p * lucasU params (n + 1) - params.q * lucasU params n
MathlibExt/NumberTheory/LucasSequence.lean:50
def lucasV (params : LucasSequenceParams) : ℕ → ℤ
| 0 => 2
| 1 => params.p
| n + 2 => params.p * lucasV params (n + 1) - params.q * lucasV params n
MathlibExt/NumberTheory/LucasSequence.lean:56
Uses 3 · Used by 1
TheoremBinet formulas for Lucas sequences#✓fully proved
Let \(P\) and \(Q\) be integers with \(Q \ne 0\), let \(U_n = U_n(P, Q)\) and \(V_n = V_n(P, Q)\) be the associated Lucas sequences, and let \(\alpha\) and \(\beta\) be elements of a field \(K\) of characteristic zero with \(\alpha + \beta = P\) and \(\alpha \beta = Q\) in \(K\). If \(\alpha \ne \beta\), then for every natural number \(n\), \(U_n = (\alpha^n - \beta^n) / (\alpha - \beta)\) and \(V_n = \alpha^n + \beta^n\) in \(K\). If \(\beta = \alpha\), then for every natural number \(n\), \(U_n = n \alpha^{n-1}\) and \(V_n = 2 \alpha^n\) in \(K\), where \(\alpha^{n-1}\) is read as \(1\) when \(n = 0\). Here the integers \(U_n\), \(V_n\), \(P\), \(Q\) and \(n\) are mapped into \(K\).
In the double-root case the hypotheses give \(P = 2 \alpha\) and \(Q = \alpha^2\).
theorem lucas_binet_formulas
{K : Type*} [Field K] [CharZero K]
(params : LucasSequenceParams) (alpha beta : K)
(hsum : alpha + beta = (params.p : K))
(hprod : alpha * beta = (params.q : K)) :
(alpha ≠ beta → ∀ n : ℕ,
(lucasU params n : K) = (alpha ^ n - beta ^ n) / (alpha - beta) ∧
(lucasV params n : K) = alpha ^ n + beta ^ n) ∧
(beta = alpha → ∀ n : ℕ,
(lucasU params n : K) = (n : K) * alpha ^ (n - 1) ∧
(lucasV params n : K) = 2 * alpha ^ n)
structure LucasSequenceParams where
p : ℤ
q : ℤ
q_ne_zero : q ≠ 0
MathlibExt/NumberTheory/LucasSequence.lean:39
def lucasU (params : LucasSequenceParams) : ℕ → ℤ
| 0 => 0
| 1 => 1
| n + 2 => params.p * lucasU params (n + 1) - params.q * lucasU params n
MathlibExt/NumberTheory/LucasSequence.lean:50
def lucasV (params : LucasSequenceParams) : ℕ → ℤ
| 0 => 2
| 1 => params.p
| n + 2 => params.p * lucasV params (n + 1) - params.q * lucasV params n
MathlibExt/NumberTheory/LucasSequence.lean:56
Sources
- Christian Ballot, "A Further Generalization of a Congruence of Wolstenholme", Journal of Integer Sequences 15 (2012), Article 12.8.6, sequence definitions and formulas at lines 274–289, https://cs.uwaterloo.ca/journals/JIS/VOL15/Ballot/ballot4.tex
Uses 4
DefinitionLucas sequence of the first kind#✓fully proved
For integers \(P\) and \(Q\), a sequence of integers \((u_n)_{n \ge 0}\) is the Lucas sequence of the first kind with parameters \(P\) and \(Q\) when \(u_0 = 0\), \(u_1 = 1\), and \(u_{n+2} = P u_{n+1} - Q u_n\) for every natural number \(n\).
public def IsLucasSequenceFirstKind (P Q : ℤ) (u : ℕ → ℤ) : Prop :=
u 0 = 0 ∧ u 1 = 1 ∧ ∀ n : ℕ, u (n + 2) = P * u (n + 1) - Q * u n
TheoremLucas sequence of the first kind: value at zero#✓fully proved
If \((u_n)_{n \ge 0}\) is the Lucas sequence of the first kind with integer parameters \(P\) and \(Q\), then \(u_0 = 0\).
public theorem IsLucasSequenceFirstKind.initialZero {P Q : ℤ} {u : ℕ → ℤ}
(h : IsLucasSequenceFirstKind P Q u) : u 0 = 0
public def IsLucasSequenceFirstKind (P Q : ℤ) (u : ℕ → ℤ) : Prop :=
u 0 = 0 ∧ u 1 = 1 ∧ ∀ n : ℕ, u (n + 2) = P * u (n + 1) - Q * u n
MathlibExt/NumberTheory/Recurrences/LucasSequenceFirstKind.lean:44
Uses 1 · Used by 1
TheoremLucas sequence of the first kind: value at one#✓fully proved
If \((u_n)_{n \ge 0}\) is the Lucas sequence of the first kind with integer parameters \(P\) and \(Q\), then \(u_1 = 1\).
public theorem IsLucasSequenceFirstKind.initialOne {P Q : ℤ} {u : ℕ → ℤ}
(h : IsLucasSequenceFirstKind P Q u) : u 1 = 1
public def IsLucasSequenceFirstKind (P Q : ℤ) (u : ℕ → ℤ) : Prop :=
u 0 = 0 ∧ u 1 = 1 ∧ ∀ n : ℕ, u (n + 2) = P * u (n + 1) - Q * u n
MathlibExt/NumberTheory/Recurrences/LucasSequenceFirstKind.lean:44
Uses 1 · Used by 1
TheoremLucas sequence of the first kind: the recurrence#✓fully proved
If \((u_n)_{n \ge 0}\) is the Lucas sequence of the first kind with integer parameters \(P\) and \(Q\), then \(u_{n+2} = P u_{n+1} - Q u_n\) for every natural number \(n\).
public theorem IsLucasSequenceFirstKind.recurrenceStep {P Q : ℤ} {u : ℕ → ℤ}
(h : IsLucasSequenceFirstKind P Q u) (n : ℕ) :
u (n + 2) = P * u (n + 1) - Q * u n
public def IsLucasSequenceFirstKind (P Q : ℤ) (u : ℕ → ℤ) : Prop :=
u 0 = 0 ∧ u 1 = 1 ∧ ∀ n : ℕ, u (n + 2) = P * u (n + 1) - Q * u n
MathlibExt/NumberTheory/Recurrences/LucasSequenceFirstKind.lean:44
Uses 1 · Used by 1
DefinitionNondegenerate Lucas pair#✓fully proved
A pair of integers \((P, Q)\) is nondegenerate when \(Q \ne 0\) and, for all complex numbers \(\alpha\) and \(\beta\) with \(\alpha + \beta = P\) and \(\alpha \beta = Q\), the quotient \(\alpha / \beta\) is not a root of unity. Such \(\alpha\) and \(\beta\) are the two roots of \(x^2 - P x + Q\), in either order.
public def IsNondegenerateLucasPair (P Q : ℤ) : Prop :=
Q ≠ 0 ∧ ∀ α β : ℂ, α + β = (P : ℂ) → α * β = (Q : ℂ) → ¬ IsOfFinOrder (α / β)
Sources
- https://cs.uwaterloo.ca/journals/JIS/VOL13/Smyth/smyth2.tex: lines 621-622 say a Lucas sequence is degenerate iff
Q = 0orα / βis a root of unity, whereαandβare the two roots ofx² - P x + Q. Lines 114-122 establishα + β = Pandα * β = Q.
Used by 50
TheoremAddition formula \(2U_{m+n} = U_m V_n + V_m U_n\) for Lucas sequences#●ready to prove
For all integers \(P\) and \(Q\) with \(Q \neq 0\) and all natural numbers \(m\) and \(n\), the Lucas sequences \(U_n = U_n(P, Q)\) and \(V_n = V_n(P, Q)\) satisfy \(2U_{m+n} = U_m V_n + V_m U_n\).
This is the integer specialization of the paper's Proposition 1: its generalized Fibonacci numbers \(F_n\) and Lucas numbers \(L_n\), with recurrence \(x_{n+2} = a x_{n+1} + b x_n\), are \(U_n(a, -b)\) and \(V_n(a, -b)\), and the paper allows real \(a\) and \(b\).
theorem_wanted two_mul_lucasU_add
(params : MetaMathlibExt.LucasSequenceParams) (m n : ℕ) :
2 * MetaMathlibExt.lucasU params (m + n) =
MetaMathlibExt.lucasU params m * MetaMathlibExt.lucasV params n +
MetaMathlibExt.lucasV params m * MetaMathlibExt.lucasU params n
structure LucasSequenceParams where
p : ℤ
q : ℤ
q_ne_zero : q ≠ 0
MathlibExt/NumberTheory/LucasSequence.lean:39
def lucasU (params : LucasSequenceParams) : ℕ → ℤ
| 0 => 0
| 1 => 1
| n + 2 => params.p * lucasU params (n + 1) - params.q * lucasU params n
MathlibExt/NumberTheory/LucasSequence.lean:50
def lucasV (params : LucasSequenceParams) : ℕ → ℤ
| 0 => 2
| 1 => params.p
| n + 2 => params.p * lucasV params (n + 1) - params.q * lucasV params n
MathlibExt/NumberTheory/LucasSequence.lean:56
Sources
- Vladimir V. Kruchinin and Maria Y. Perminova, "Identities and Hadamard Product of the Generalized Fibonacci, Lucas, Catalan, and Harmonic Numbers", Proposition 1.
Uses 3
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.