Commit c2a17c01 authored by Pierre Letouzey's avatar Pierre Letouzey
Browse files

Equiv: direct proofs on subst instead of using partialsubst

parent fb32a921
...@@ -300,16 +300,18 @@ Lemma nam2mix_subst_fsubst stk x u f : ...@@ -300,16 +300,18 @@ Lemma nam2mix_subst_fsubst stk x u f :
nam2mix stk (subst x u f) = nam2mix stk (subst x u f) =
Mix.fsubst x (nam2mix_term [] u) (nam2mix stk f). Mix.fsubst x (nam2mix_term [] u) (nam2mix stk f).
Proof. Proof.
intros X U. set (h := S (height f)).
destruct (subst_carac x u f) as (f' & EQ & SI & ->). assert (LT : height f < h) by (unfold h; auto with *).
apply (nam2mix_canonical_gen1 stk) in EQ. rewrite EQ. clear f EQ. clearbody h. revert stk f LT.
revert stk X U SI. induction h as [|h IH]; [inversion 1|].
induction f'; cbn; intros stk X U IS; f_equal; auto. intros stk f LT X U; rewrite subst_eqn; destruct f; simpl in LT;
simpl_height; cbn - [subst]; f_equal; try easy.
- rewrite <- (nam2mix_term_nostack stk); auto. - rewrite <- (nam2mix_term_nostack stk); auto.
injection (nam2mix_term_subst stk x u (Fun "" l)); easy. injection (nam2mix_term_subst stk x u (Fun "" l)); easy.
- intuition. - intuition.
- intuition. - intuition.
- case eqbspec; cbn. - intuition.
- case eqbspec.
+ intros ->. + intros ->.
unfold Mix.fsubst. unfold Mix.fsubst.
rewrite form_vmap_id; auto. rewrite form_vmap_id; auto.
...@@ -318,8 +320,15 @@ Proof. ...@@ -318,8 +320,15 @@ Proof.
intros IN. intros IN.
case eqbspec; auto. intros <-. namedec. case eqbspec; auto. intros <-. namedec.
+ intros NE. + intros NE.
destruct IS as [-> | (NI,IS)]; [easy|]. destruct (Names.mem v (Term.vars u)) eqn:IN; simpl.
apply IHf'; simpl; intuition; subst; eauto. * f_equal.
setfresh vars z Hz.
rewrite IH; auto.
f_equal. apply (nam2mix_rename []); auto with set.
simpl; intuition.
simpl. intros y [<-|Hy]. namedec. auto.
* f_equal. rewrite <- NamesF.not_mem_iff in IN.
apply IH; simpl; intuition; subst; eauto.
Qed. Qed.
Lemma nam2mix0_subst_fsubst x u f : Lemma nam2mix0_subst_fsubst x u f :
...@@ -347,26 +356,34 @@ Lemma nam2mix_subst_bsubst stk x u f : ...@@ -347,26 +356,34 @@ Lemma nam2mix_subst_bsubst stk x u f :
Mix.bsubst (length stk) (nam2mix_term [] u) Mix.bsubst (length stk) (nam2mix_term [] u)
(nam2mix (stk++[x]) f). (nam2mix (stk++[x]) f).
Proof. Proof.
intros NI H. set (h := S (height f)).
destruct (subst_carac x u f) as (f' & EQ & SI & ->). assert (LT : height f < h) by (unfold h; auto with *).
apply (nam2mix_canonical_gen1 (stk++[x])) in EQ. rewrite EQ. clear f EQ. clearbody h. revert stk f LT.
revert stk NI H SI. induction h as [|h IH]; [inversion 1|].
induction f'; cbn; intros stk X U IS; f_equal; auto. intros stk f LT X U; rewrite subst_eqn; destruct f; simpl in LT;
simpl_height; cbn - [subst]; f_equal; try easy.
- injection (term_subst_bsubst stk x u (Fun "" l)); auto. - injection (term_subst_bsubst stk x u (Fun "" l)); auto.
- destruct IS as (IS1,IS2); auto. - intuition.
- destruct IS as (IS1,IS2); auto. - intuition.
- case eqbspec; cbn. - intuition.
- case eqbspec; simpl.
+ intros <-. + intros <-.
f_equal.
change (x::stk++[x]) with ((x::stk)++[x]). change (x::stk++[x]) with ((x::stk)++[x]).
rewrite nam2mix_shadowstack by (simpl; auto). rewrite nam2mix_shadowstack by (simpl; auto).
symmetry. symmetry.
apply form_level_bsubst_id. apply form_level_bsubst_id.
now rewrite nam2mix_level. now rewrite nam2mix_level.
+ intros NE. + intros NE.
destruct IS as [->|(NI,IS)]; [easy|]. destruct (Names.mem v (Term.vars u)) eqn:IN; simpl.
apply IHf'; simpl; auto. * f_equal.
intuition. setfresh vars z Hz.
intros y [<-|Hy]; auto. rewrite IH; auto.
f_equal. simpl. apply (nam2mix_rename []); auto with set.
simpl; intuition.
simpl. intros y [<-|Hy]. namedec. auto.
* f_equal. rewrite <- NamesF.not_mem_iff in IN.
apply IH; simpl; intuition; subst; eauto.
Qed. Qed.
Lemma nam2mix_subst_bsubst0 x u f : Lemma nam2mix_subst_bsubst0 x u f :
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment