@@ -13,46 +13,38 @@ import Mathlib.Data.Nat.Choose.Basic
1313import Mathlib.Algebra.BigOperators.Group.Finset.Basic
1414
1515/-!
16- # Fibonacci Numbers
16+ # Fibonacci numbers
1717
18- This file defines the fibonacci series, proves results about it and introduces
19- methods to compute it quickly.
20- -/
21-
22- /-!
23- # The Fibonacci Sequence
24-
25- ## Summary
26-
27- Definition of the Fibonacci sequence `F₀ = 0, F₁ = 1, Fₙ₊₂ = Fₙ + Fₙ₊₁`.
18+ This file defines the Fibonacci sequence as `F₀ = 0, F₁ = 1, Fₙ₊₂ = Fₙ + Fₙ₊₁`. Furthermore, it
19+ proves results about the sequence and introduces methods to compute it quickly.
2820
29- ## Main Definitions
21+ ## Main definitions
3022
3123- `Nat.fib` returns the stream of Fibonacci numbers.
3224
33- ## Main Statements
25+ ## Main statements
3426
35- - `Nat.fib_add_two`: shows that `fib` indeed satisfies the Fibonacci recurrence `Fₙ₊₂ = Fₙ + Fₙ₊₁. `.
27+ - `Nat.fib_add_two`: shows that `fib` indeed satisfies the Fibonacci recurrence `Fₙ₊₂ = Fₙ + Fₙ₊₁`.
3628- `Nat.fib_gcd`: `fib n` is a strong divisibility sequence.
3729- `Nat.fib_succ_eq_sum_choose`: `fib` is given by the sum of `Nat.choose` along an antidiagonal.
3830- `Nat.fib_succ_eq_succ_sum`: shows that `F₀ + F₁ + ⋯ + Fₙ = Fₙ₊₂ - 1`.
3931- `Nat.fib_two_mul` and `Nat.fib_two_mul_add_one` are the basis for an efficient algorithm to
4032 compute `fib` (see `Nat.fastFib`).
4133
42- ## Implementation Notes
34+ ## Implementation notes
4335
4436For efficiency purposes, the sequence is defined using `Stream.iterate`.
4537
4638## Tags
4739
48- fib, fibonacci
40+ Fibonacci numbers, Fibonacci sequence
4941-/
5042
5143namespace Nat
5244
5345
5446
55- /-- Implementation of the fibonacci sequence satisfying
47+ /-- Implementation of the Fibonacci sequence satisfying
5648`fib 0 = 0, fib 1 = 1, fib (n + 2) = fib n + fib (n + 1)`.
5749
5850*Note:* We use a stream iterator for better performance when compared to the naive recursive
@@ -74,7 +66,7 @@ theorem fib_one : fib 1 = 1 :=
7466theorem fib_two : fib 2 = 1 :=
7567 rfl
7668
77- /-- Shows that `fib` indeed satisfies the Fibonacci recurrence `Fₙ₊₂ = Fₙ + Fₙ₊₁.` -/
69+ /-- Shows that `fib` indeed satisfies the Fibonacci recurrence `Fₙ₊₂ = Fₙ + Fₙ₊₁`. -/
7870theorem fib_add_two {n : ℕ} : fib (n + 2 ) = fib n + fib (n + 1 ) := by
7971 simp [fib, Function.iterate_succ_apply']
8072
0 commit comments