Definition of the Fibonacci sequence F₀ = 0, F₁ = 1, Fₙ₊₂ = Fₙ + Fₙ₊₁.
For efficiency purposes, the sequence is defined using stream.iterate.
fib, fibonacci
Auxiliary stream creating Fibonacci pairs ⟨Fₙ, Fₙ₊₁⟩.
Implementation of the fibonacci sequence satisfying fib 0 = 0, fib 1 = 1, fib (n + 2) = fib n + fib (n + 1).
Note: We use a stream iterator for better performance when compared to the naive recursive implementation.
Shows that fib indeed satisfies the Fibonacci recurrence Fₙ₊₂ = Fₙ + Fₙ₊₁.