(* *********************************************************************)
(*                                                                     *)
(*              The Compcert verified compiler                         *)
(*                                                                     *)
(*          Xavier Leroy, INRIA Paris-Rocquencourt                     *)
(*                                                                     *)
(*  Copyright Institut National de Recherche en Informatique et en     *)
(*  Automatique.  All rights reserved.  This file is distributed       *)
(*  under the terms of the INRIA Non-Commercial License Agreement.     *)
(*                                                                     *)
(* *********************************************************************)
(** * Correctness of the translation from Clight to C#minor. *)
(** * Relational specification of the transformation *)
Inductive match_fundef (p: Clight.program) : Clight.fundef -> Csharpminor.fundef -> Prop :=
| match_fundef_internal: forall f tf,
transl_function p.(prog_comp_env) f = OK tf ->
match_fundef p (Ctypes.Internal f) (AST.Internal tf)
| match_fundef_external: forall ef args res cc,
ef_sig ef = signature_of_type args res cc ->
match_fundef p (Ctypes.External ef args res cc) (AST.External ef).
Definition match_varinfo (v: type) (tv: unit) := True.
Definition match_prog (p: Clight.program) (tp: Csharpminor.program) : Prop :=
match_program_gen match_fundef match_varinfo p p tp.
(** * Properties of operations over types *)
Remark transl_params_types:
forall params,
map typ_of_type (map snd params) = typlist_of_typelist (type_of_params params).
(** * Properties of the translation functions *)
(** Transformation of expressions and statements. *)

Lemma transl_expr_lvalue:
forall ge e le m a loc ofs ce ta,
Clight.eval_lvalue ge e le m a loc ofs ->
transl_expr ce a = OK ta ->
(exists tb, transl_lvalue ce a = OK tb /\ make_load tb (typeof a) = OK ta).