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_fin_stream {A B: Type}: forall (f: A -> B) (h: stream A), is_fin_stream h <-> is_fin_stream (stream_map f h).