(** Safety-enforcing specifications are not the only good properties of source programs that are preserved by compilation.  Another example of a property that is preserved is the ``initial trace'' property: all executions of the program start by producing an expected trace of I/O actions, representing the good behavior expected from the program. After that, the program may terminate, or continue running, or go wrong on an undefined behavior.  What matters is that the program produced the expected trace at the beginning of its execution.  This is a typical liveness property, and it is preserved by compilation. *)
Definition c_program_has_initial_trace (p: Csyntax.program) (t: trace): Prop :=
forall beh, program_behaves (Csem.semantics p) beh -> behavior_prefix t beh.
Definition asm_program_has_initial_trace (p: Asm.program) (t: trace): Prop :=
forall beh, program_behaves (Asm.semantics p) beh -> behavior_prefix t beh.

(* Specifications: *)
Theorem transf_c_program_preserves_initial_trace:
forall p tp t,
transf_c_program p = OK tp ->
c_program_has_initial_trace p t ->
asm_program_has_initial_trace tp t.