Program Definition stream_map {A B: Type} (f: A -> B) (h: stream A): stream B :=
  fun n => match h n return option B with
           | Some a => Some (f a)
           | None => None
           end.

Lemma stream_map_spec {A B: Type}: forall (f: A -> B) (h: stream A) (n: nat), stream_map f h n = match h n return option B with | Some a => Some (f a) | None => None end.