(** * Proof of semantic preservation *)

Definition match_prog (p tp: RTL.program) :=
  match_program (fun cu f tf => tf = transf_fundef f) eq p tp.

(* Specifications: *)
Lemma transf_program_match: forall p, match_prog p (transf_program p).
Lemma symbols_preserved: forall (s: ident), Genv.find_symbol tge s = Genv.find_symbol ge s.
Lemma functions_translated: forall (v: val) (f: RTL.fundef), Genv.find_funct ge v = Some f -> Genv.find_funct tge v = Some (transf_fundef f).
Lemma funct_ptr_translated: forall (b: block) (f: RTL.fundef), Genv.find_funct_ptr ge b = Some f -> Genv.find_funct_ptr tge b = Some (transf_fundef f).
Lemma senv_preserved: Senv.equiv ge tge.
Lemma sig_preserved: forall f, funsig (transf_fundef f) = funsig f.
Lemma stacksize_preserved: forall f, fn_stacksize (transf_function f) = fn_stacksize f.
Lemma find_function_translated: forall ros rs rs' f, find_function ge ros rs = Some f -> regs_lessdef rs rs' -> find_function tge ros rs' = Some (transf_fundef f).