(** The simulation diagram. *)

Fixpoint seq_left_depth (s: Csharpminor.stmt) : nat :=
  match s with
  | Csharpminor.Sseq s1 s2 => S (seq_left_depth s1)
  | _ => O
  end.Definition measure (S: Csharpminor.state) : nat :=
  match S with
  | Csharpminor.State fn s k e le m => seq_left_depth s
  | _ => O
  end.

(* Specifications: *)
Lemma transl_step_correct: forall S1 t S2, Csharpminor.step ge S1 t S2 -> forall T1, match_states S1 T1 -> (exists T2, plus step tge T1 t T2 /\ match_states S2 T2) \/ (measure S2 < measure S1 /\ t = E0 /\ match_states S2 T1)%nat.
Lemma match_globalenvs_init: forall m, Genv.init_mem prog = Some m -> match_globalenvs (Mem.flat_inj (Mem.nextblock m)) (Mem.nextblock m).
Lemma transl_initial_states: forall S, Csharpminor.initial_state prog S -> exists R, Cminor.initial_state tprog R /\ match_states S R.
Lemma transl_final_states: forall S R r, match_states S R -> Csharpminor.final_state S r -> Cminor.final_state R r.
Theorem transl_program_correct: forward_simulation (Csharpminor.semantics prog) (Cminor.semantics tprog).