Section MemoFunction.
Variable A: Type.
Variable f: nat -> A.
CoFixpoint memo_make (n:nat) : Stream A := Cons (f n) (memo_make (S n)).
Definition memo_list := memo_make 0.
Fixpoint memo_get (n:nat) (l:Stream A) : A :=
match n with
| O => hd l
| S n1 => memo_get n1 (tl l)
end.

Theorem memo_get_correct: forall n, memo_get n memo_list = f n.