Section ext_trace.
Context {event : Type -> Type} {J : juicy_ext_spec (itree event unit)} {OS_state : Type}.
Variable prog : Clight.program.
Variable ext_sem : external_function -> list val -> OS_state -> option (OS_state * option val * @trace event unit).
Variable inj_mem : external_function -> list val -> mem -> @trace event unit -> OS_state -> Prop.
Variable extr_mem : external_function -> list val -> mem -> OS_state -> mem.
Variable OS_valid : OS_state -> Prop.
Notation ge := (globalenv prog).
Instance Espec : OracleKind := Build_OracleKind (itree event unit) J.
(* For any trace that the new itree (z) allows, that trace prefixed with the OS-generated trace (t) is allowed by the old itree (z0). *)
Definition consume_trace (z z' : itree event unit) (t : @trace event unit) :=
forall t', is_trace z' t' -> is_trace z (app_trace t t').

Lemma consume_trace_nil : forall z, consume_trace z z TEnd.