Definition sequential_trace {state: Type} (tr: trace state) : Prop :=
  forall k s ms s' ms',
    tr k = Some (s, ms) ->
    tr (S k) = Some (s' , ms') ->
    ms = Terminating s'.Definition sound_trace {state: Type} (R: state -> MetaState state -> Prop) (tr: trace state) : Prop :=
  forall k s ms,
    tr k = Some (s, ms) ->
    R s ms.

Lemma trace_app_sound1 {state: Type}: forall R (tr1 tr2: trace state), sound_trace R (stream_app tr1 tr2) -> sound_trace R tr1.