From: Claudio Sacerdoti Coen Date: Fri, 18 Apr 2008 18:27:43 +0000 (+0000) Subject: Inversion lemma for Forall. X-Git-Tag: make_still_working~5319 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=fa50dfd7a837067b5694c46e8b34663a71312056;p=helm.git Inversion lemma for Forall. --- diff --git a/helm/software/matita/contribs/POPLmark/Fsub/part1a_inversion.ma b/helm/software/matita/contribs/POPLmark/Fsub/part1a_inversion.ma index decaf1b74..b538f4d3a 100644 --- a/helm/software/matita/contribs/POPLmark/Fsub/part1a_inversion.ma +++ b/helm/software/matita/contribs/POPLmark/Fsub/part1a_inversion.ma @@ -89,9 +89,7 @@ lemma JSubtype_Arrow_inv: G ⊢ T1 ⊴ (Arrow T2 T3) → P G T1. intros; generalize in match (refl_eq ? (Arrow T2 T3)); - change in ⊢ (% → ?) with (Arrow T2 T3 = Arrow T2 T3); generalize in match (refl_eq ? G); - change in ⊢ (% → ?) with (G = G); elim H2 in ⊢ (? ? ? % → ? ? ? % → %); [1,2: destruct H6 |5: destruct H8 @@ -105,37 +103,59 @@ lemma JSubtype_Arrow_inv: ] qed. +lemma JSubtype_Forall_inv: + ∀G:list bound.∀T1,T2,T3:Typ. + ∀P:list bound → Typ → Prop. + (∀n,t1. + (mk_bound true n t1) ∈ G → G ⊢ t1 ⊴ (Forall T2 T3) → P G t1 → P G (TFree n)) → + (∀t,t1. G ⊢ T2 ⊴ t → (∀X. ¬(X ∈ fv_env G) → (mk_bound true X T2)::G ⊢ subst_type_nat t1 (TFree X) O ⊴ subst_type_nat T3 (TFree X) O) + → P G (Forall t t1)) → + G ⊢ T1 ⊴ (Forall T2 T3) → P G T1. + intros; + generalize in match (refl_eq ? (Forall T2 T3)); + generalize in match (refl_eq ? G); + elim H2 in ⊢ (? ? ? % → ? ? ? % → %); + [1,2: destruct H6 + |4: destruct H8 + | lapply (H5 H6 H7); destruct; clear H5; + apply H; + assumption + | destruct; + clear H4 H6; + apply H1; + assumption + ] +qed. + + lemma JS_trans_prova: ∀T,G1.WFType G1 T → ∀G,R,U.incl ? (fv_env G1) (fv_env G) → G ⊢ R ⊴ T → G ⊢ T ⊴ U → G ⊢ R ⊴ U. intros 3;elim H;clear H; try autobatch; [rewrite > (JSubtype_Top ? ? H3);autobatch |apply (JSubtype_Arrow_inv ? ? ? ? ? ? ? H6); intros; [ autobatch - | inversion H7;intros; destruct; autobatch depth=4 width=4 size=9 - ] - |generalize in match H7;generalize in match H4;generalize in match H2; - generalize in match H5;clear H7 H4 H2 H5; - generalize in match (refl_eq ? (Forall t t1));elim H6 in ⊢ (? ? ? %→%);destruct; - [apply (SA_Trans_TVar ? ? ? ? H);apply (H4 ? H7 H8 H9 H10);reflexivity - |inversion H11;intros;destruct; - [apply SA_Top - [autobatch - |apply WFT_Forall - [autobatch - |intros;lapply (H4 ? H13);autobatch]] - |apply SA_All - [autobatch paramodulation - |intros;apply (H10 X) - [intro;apply H15;apply H8;assumption - |intro;apply H15;apply H8;apply (WFT_to_incl ? ? ? H3); + | inversion H7;intros; destruct; autobatch depth=4 width=4 size=9] + |apply (JSubtype_Forall_inv ? ? ? ? ? ? ? H6); intros; + [ autobatch + | inversion H7;intros; destruct; + [ apply SA_Top + [ assumption + | apply WFT_Forall; + [ autobatch + | intros;lapply (H8 ? H11); + autobatch]] + | apply SA_All + [ autobatch + | intros;apply (H4 X); + [intro;apply H13;apply H5;assumption + |intro;apply H13;apply H5;apply (WFT_to_incl ? ? ? H3); assumption |simplify;autobatch - |apply (narrowing X (mk_bound true X t::l1) - ? ? ? ? ? H7 ? ? []) - [intros;apply H9 - [unfold;intros;lapply (H8 ? H17);rewrite > fv_append; + |apply (narrowing X (mk_bound true X t::G) ? ? ? ? ? H9 ? ? []) + [intros;apply H2 + [unfold;intros;lapply (H5 ? H15);rewrite > fv_append; autobatch - |apply (JS_weakening ? ? ? H7) + |apply (JS_weakening ? ? ? H9) [autobatch |unfold;intros;autobatch] |assumption]