The Fibonacci Sequence
Summary
Definition of the Fibonacci sequence F₀ = 0, F₁ = 1, Fₙ₊₂ = Fₙ + Fₙ₊₁
.
Main Definitions
fib
returns the stream of Fibonacci numbers.
Main Statements
fib_succ_succ
shows thatfib
indeed satisfies the Fibonacci recurrenceFₙ₊₂ = Fₙ + Fₙ₊₁.
.
Implementation Notes
For efficiency purposes, the sequence is defined using stream.iterate
.
Tags
fib, fibonacci