(*****************************************************************************)
(*                    Case where E is an identifier                          *)
(* This case is special in the sens that we cannot use the predicate         *)
(*compilation because the variables of the formulation must be introduced    *)
(* in a very precise order.                                                  *)
(* Of course we could avoid a new definition using a the Cut tactic          *)
(* The point is that in this case only we must first do an induction on the  *)
(* ML environment in which we evaluate our expression (an identifier!)       *)
(*****************************************************************************)


Inductive compilation_id (E : MLexp) : Prop :=
    preuve_compilation_id :
      (forall (e : MLenv) (s : Squelette),
       Habite e s ->
       forall V : MLval,
       ML_DS e E V ->
       forall C : Commande,
       Traduction s E C ->
       forall CV : CSem_val,
       Equiv_env e CV ->
       exists CV1 : CSem_val,
         Equiv_val V CV1 /\
         (forall s : Etat, CAM_DS (ETcons CV s) C (ETcons CV1 s))) ->
      compilation_id E.(*****************************************************************************)
(*                    Case where E is an identifier                          *)
(* This case is special in the sens that we cannot use the predicate         *)
(*compilation because the variables of the formulation must be introduced    *)
(* in a very precise order.                                                  *)
(* Of course we could avoid a new definition using a the Cut tactic          *)
(* The point is that in this case only we must first do an induction on the  *)
(* ML environment in which we evaluate our expression (an identifier!)       *)
(*****************************************************************************)


Inductive compilation_id (E : MLexp) : Prop :=
    preuve_compilation_id :
      (forall (e : MLenv) (s : Squelette),
       Habite e s ->
       forall V : MLval,
       ML_DS e E V ->
       forall C : Commande,
       Traduction s E C ->
       forall CV : CSem_val,
       Equiv_env e CV ->
       exists CV1 : CSem_val,
         Equiv_val V CV1 /\
         (forall s : Etat, CAM_DS (ETcons CV s) C (ETcons CV1 s))) ->
      compilation_id E.

(* Specifications: *)
Lemma Proof_ident : forall x : Pat, compilation_id (id x).
Lemma Proof_abstraction : forall (E : MLexp) (p : Pat), compilation (lambda p E).
Lemma final_proof : forall (E : MLexp) (e : MLenv) (V : MLval), ML_DS e E V -> forall (s : Squelette) (C : Commande), Traduction s E C -> Habite e s -> forall V : MLval, ML_DS e E V -> forall CV : CSem_val, Equiv_env e CV -> exists CV1 : CSem_val, Equiv_val V CV1 /\ (forall s : Etat, CAM_DS (ETcons CV s) C (ETcons CV1 s)).