Definition traces (state: Type): Type := Ensemble (trace state).Definition traces_app {state: Type} (d1 d2: traces state): traces state :=
  fun tr =>
    (exists tr1 tr2, d1 tr1 /\ d2 tr2 /\ tr = stream_app tr1 tr2) \/
  (exists tr1, d1 tr1 /\ (end_state tr1 NonTerminating \/ end_state tr1 Error) /\ tr = tr1).Fixpoint traces_power {state: Type} (d: traces state) (n: nat): traces state :=
  match n with
  | 0 => is_empty_stream
  | S n => traces_app (traces_power d n) d
  end.Definition traces_pstar {state: Type} (d: traces state): traces state :=
  fun tr => exists n, traces_power d n tr.Definition traces_pomega {state: Type} (d: traces state): traces state :=
  fun tr => exists f, tr = stream_capp f /\ forall n, d (f n).

Lemma traces_power_mono {state: Type}: forall (d1 d2: traces state) (n: nat), Included _ d1 d2 -> Included _ (traces_power d1 n) (traces_power d2 n).