Inductive iostream :=
  | Empty : iostream
  | WriteByte : byte -> iostream
  | Seq : iostream -> (unit -> iostream) -> iostream.Inductive iostream :=
  | Empty : iostream
  | WriteByte : byte -> iostream
  | Seq : iostream -> (unit -> iostream) -> iostream.Inductive iostream :=
  | Empty : iostream
  | WriteByte : byte -> iostream
  | Seq : iostream -> (unit -> iostream) -> iostream.Inductive iostream :=
  | Empty : iostream
  | WriteByte : byte -> iostream
  | Seq : iostream -> (unit -> iostream) -> iostream.Definition t := iostream.Fixpoint iostreamDenote (i : iostream) : list byte :=
    match i with
    | Empty => []
    | WriteByte b => [b]
    | Seq i1 i2 => iostreamDenote i1 ++ iostreamDenote (i2 tt)
    end.Definition unwrap := iostreamDenote.(* serializers *)
  Definition empty : iostream := Empty.Definition putByte : byte -> iostream :=
    WriteByte.Definition append : (unit -> iostream) -> (unit -> iostream) -> iostream :=
    fun t1 t2 => Seq (t1 tt) t2.

Lemma append_unwrap : forall x y : unit -> t, unwrap (append x y) = unwrap (x tt) ++ unwrap (y tt).