The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V12. Number theory

Mathlib.NumberTheory.Real.GoldenRatio

36 declarations. Mathlib docs · Source

The golden ratio and its conjugate

This file defines the golden ratio φ := (1 + √5)/2 and its conjugate ψ := (1 - √5)/2, which are the two real roots of X² - X - 1.

Along with various computational facts about them, we prove their irrationality, and we link them to the Fibonacci sequence by proving Binet's formula.

Irrationality

Links with Fibonacci sequence

abbrev Real.goldenRatio E1 #

ℝ

The golden ratio φ := (1 + √5)/2.

abbrev Real.goldenConj E1 #

ℝ

The conjugate of the golden ratio ψ := (1 - √5)/2.

def goldenRatio.termφ E1 #

Lean.ParserDescr

The golden ratio φ := (1 + √5)/2.

def goldenRatio.termψ E1 #

Lean.ParserDescr

The conjugate of the golden ratio ψ := (1 - √5)/2.

theorem Real.inv_goldenRatio E1 #

Real.goldenRatio⁻¹ = -Real.goldenConj

The inverse of the golden ratio is the opposite of its conjugate.

theorem Real.inv_goldenConj E1 #

Real.goldenConj⁻¹ = -Real.goldenRatio

The opposite of the golden ratio is the inverse of its conjugate.

theorem Real.goldenRatio_mul_goldenConj E0 #

Real.goldenRatio * Real.goldenConj = -1

theorem Real.goldenConj_mul_goldenRatio E0 #

Real.goldenConj * Real.goldenRatio = -1

theorem Real.goldenRatio_add_goldenConj E0 #

Real.goldenRatio + Real.goldenConj = 1

theorem Real.one_sub_goldenConj E1 #

1 - Real.goldenRatio = Real.goldenConj

theorem Real.one_sub_goldenRatio E1 #

1 - Real.goldenConj = Real.goldenRatio

theorem Real.goldenRatio_sub_goldenConj E0 #

Real.goldenRatio - Real.goldenConj = √5

theorem Real.goldenRatio_pow_sub_goldenRatio_pow E1 #

∀ (n : ℕ), Real.goldenRatio ^ (n + 2) - Real.goldenRatio ^ (n + 1) = Real.goldenRatio ^ n

theorem Real.goldenRatio_sq E0 #

Real.goldenRatio ^ 2 = Real.goldenRatio + 1

theorem Real.goldenConj_sq E0 #

Real.goldenConj ^ 2 = Real.goldenConj + 1

theorem Real.goldenRatio_pos E1 #

0 < Real.goldenRatio

theorem Real.goldenRatio_ne_zero E1 #

Real.goldenRatio ≠ 0

theorem Real.one_lt_goldenRatio E1 #

1 < Real.goldenRatio

theorem Real.goldenRatio_lt_two E1 #

Real.goldenRatio < 2

theorem Real.goldenConj_neg E1 #

Real.goldenConj < 0

theorem Real.goldenConj_ne_zero E1 #

Real.goldenConj ≠ 0

theorem Real.neg_one_lt_goldenConj E1 #

-1 < Real.goldenConj

theorem Real.goldenRatio_irrational E1 #

Irrational Real.goldenRatio

The golden ratio is irrational.

theorem Real.goldenConj_irrational E1 #

Irrational Real.goldenConj

The conjugate of the golden ratio is irrational.

def Real.fibRec E1 #

{α : Type u_1} → [inst : CommSemiring α] → LinearRecurrence α

The recurrence relation satisfied by the Fibonacci sequence.

theorem Real.fibRec_charPoly_eq E0 #

∀ {β : Type u_2} [inst : CommRing β], Real.fibRec.charPoly = Polynomial.X ^ 2 - (Polynomial.X + 1)

The characteristic polynomial of fibRec is X² - (X + 1).

theorem Real.fib_isSol_fibRec E1 #

∀ {α : Type u_1} [inst : CommSemiring α], Real.fibRec.IsSolution fun x ↦ ↑(Nat.fib x)

As expected, the Fibonacci sequence is a solution of fibRec.

theorem Real.geom_goldenRatio_isSol_fibRec E1 #

Real.fibRec.IsSolution fun x ↦ Real.goldenRatio ^ x

The geometric sequence fun n ↦ φ^n is a solution of fibRec.

theorem Real.geom_goldenConj_isSol_fibRec E1 #

Real.fibRec.IsSolution fun x ↦ Real.goldenConj ^ x

The geometric sequence fun n ↦ ψ^n is a solution of fibRec.

theorem Real.coe_fib_eq' E0 #

(fun n ↦ ↑(Nat.fib n)) = fun n ↦ (Real.goldenRatio ^ n - Real.goldenConj ^ n) / √5

Binet's formula as a function equality.

theorem Real.coe_fib_eq E0 #

∀ (n : ℕ), ↑(Nat.fib n) = (Real.goldenRatio ^ n - Real.goldenConj ^ n) / √5

Binet's formula as a dependent equality.

theorem Real.coe_intFib_eq E0 #

∀ (n : ℤ), ↑(Int.fib n) = (Real.goldenRatio ^ n - Real.goldenConj ^ n) / √5

Binet's formula for integer values.

theorem Real.fib_succ_sub_goldenRatio_mul_fib E1 #

∀ (n : ℕ), ↑(Nat.fib (n + 1)) - Real.goldenRatio * ↑(Nat.fib n) = Real.goldenConj ^ n

Relationship between the Fibonacci Sequence, the golden ratio, and its conjugate's exponents.

theorem Real.goldenConj_mul_fib_succ_add_fib E1 #

∀ (n : ℕ), Real.goldenConj * ↑(Nat.fib (n + 1)) + ↑(Nat.fib n) = Real.goldenConj ^ (n + 1)

Relationship between the Fibonacci Sequence, the conjugate of the golden ratio, and its exponents.

theorem Real.goldenRatio_mul_fib_succ_add_fib E1 #

∀ (n : ℕ), Real.goldenRatio * ↑(Nat.fib (n + 1)) + ↑(Nat.fib n) = Real.goldenRatio ^ (n + 1)

Relationship between the Fibonacci Sequence, the golden ratio, and its exponents.

theorem Real.fib_succ_sub_goldenConj_mul_fib E1 #

∀ (n : ℕ), ↑(Nat.fib (n + 1)) - Real.goldenConj * ↑(Nat.fib n) = Real.goldenRatio ^ n

Relationship between the Fibonacci Sequence, exponents of the golden ratio, and its conjugate.