Program Definition stream_app {A: Type} (h1 h2: stream A): stream A :=
  fun n: nat =>
    match partial_stream_len h1 n return option A with
    | None => h1 n
    | Some m => h2 (n - m)
    end.

Lemma stream_app_spec1 {A: Type}: forall (h1 h2: stream A) (m: nat), is_at_least_n_stream (S m) h1 -> stream_app h1 h2 m = h1 m.