(*(Param: list_norepet (fn_params_names f ++ fn_vars_names f))*)

(* Specifications: *)
Lemma transl_step_case_ExternalCall:
forall ef vargs m t vres m' cenv cs tm j k tk targs
(ExtCall : external_call ef ge vargs m t vres m')
(MINJ : Mem.inject j m tm)
(MCS : match_callstack j m tm cs (Mem.nextblock m) (Mem.nextblock tm))
(MK : match_cont k tk cenv nil cs)
(ISCC : Csharpminor.is_call_cont k)
(ARGSINJ : val_list_inject j vargs targs),
exists T2 : state,
plus step tge (Callstate (External ef) targs tk tm) t T2 /\
exists j', inject_incr j j' /\
match_statesInj j' (Csharpminor.Returnstate vres k m') T2.
Lemma transl_step_case_Return:
forall j m tm cs f e le k tk cenv v tv optid
(MINJ : Mem.inject j m tm)
(MCS : match_callstack j m tm cs (Mem.nextblock m) (Mem.nextblock tm))
(MK :  match_cont (Csharpminor.Kcall optid f e le k) tk cenv nil cs)
(RESINJ : val_inject j v tv),
exists T2 : state,
@plus genv state step tge (Returnstate tv tk tm) E0 T2 /\
match_statesInj j
(Csharpminor.State f Csharpminor.Sskip k e (set_optvar optid v le) m) T2.
Lemma transl_step_correct_MATCH:
forall S1 t S2, Csharpminor.step ge S1 t S2 ->
forall T1, match_states S1 T1 ->
match S1 with
Csharpminor.State f (Csharpminor.Sseq s1 s2) k e le m
=> (exists T2, plus step tge T1 t T2 /\ match_states S2 T2)
\/ (measure S2 < measure S1 /\ t = E0 /\ match_states S2 T1)%nat
| _ => (exists T2, plus step tge T1 t T2 /\ match_states S2 T2)
end.
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).