Program Definition stream_capp {A: Type} (h: nat -> stream A): stream A :=
  fun n: nat =>
    match partial_stream_clen' h n return option A with
    | Some (k, m) => h k m
    | None => None
    end.

Lemma stream_map_stream_capp {A B: Type}: forall (f: A -> B) (h: nat -> stream A), stream_map f (stream_capp h) = stream_capp (fun n => stream_map f (h n)).