-lemma JS_trans_narrow : \forall Q.
- (\forall G,T,U.
- (JSubtype G T Q) \to (JSubtype G Q U) \to
- (JSubtype G T U)) \land
- (\forall G,H,X,P,M,N.
- (JSubtype (H @ ((mk_bound true X Q) :: G)) M N) \to
- (JSubtype G P Q) \to
- (JSubtype (H @ ((mk_bound true X P) :: G)) M N)).
-apply Typ_len_ind;intros 2;
-cut (\forall G,T,P.
- (JSubtype G T U) \to
- (JSubtype G U P) \to
- (JSubtype G T P))
- [split
- [assumption
- |cut (\forall G,M,N.(JSubtype G M N) \to
- \forall G1,X,G2,P.
- (G = G2 @ ((mk_bound true X U) :: G1)) \to
- (JSubtype G1 P U) \to
- (JSubtype (G2 @ ((mk_bound true X P) :: G1)) M N))
- [intros;apply (Hcut1 ? ? ? H2 ? ? ? ? ? H3);reflexivity
- |intros;cut (incl ? (fv_env (G2 @ ((mk_bound true X U)::G1)))
- (fv_env (G2 @ ((mk_bound true X P)::G1))))
- [intros;generalize in match H2;generalize in match Hcut1;
- generalize in match Hcut;generalize in match G2;elim H1
- [apply SA_Top
- [rewrite > H8 in H4;lapply (JS_to_WFT1 ? ? ? H3);
- apply (WFE_Typ_subst ? ? ? ? ? ? ? H4 Hletin)
- |rewrite > H8 in H5;apply (WFT_env_incl ? ? H5 ? H7)]
- |apply SA_Refl_TVar
- [rewrite > H8 in H4;apply (WFE_Typ_subst ? ? ? ? ? ? ? H4);
- apply (JS_to_WFT1 ? ? ? H3)
- |rewrite > H8 in H5;apply (H7 ? H5)]
- |elim (decidable_eq_nat X n)
- [apply (SA_Trans_TVar ? ? ? P)
- [rewrite < H10;elim l
- [simplify;constructor 1
- |simplify;constructor 2;assumption]
- |apply H7
- [lapply (H6 ? H7 H8 H9);lapply (JS_to_WFE ? ? ? Hletin);
- apply (JS_weakening ? ? ? H3 ? Hletin1);unfold;intros;
- elim l;simplify;constructor 2;assumption
- |lapply (WFE_bound_bound true n t1 U ? ? H4)
- [apply (JS_to_WFE ? ? ? H5)
- |rewrite < Hletin;apply (H6 ? H7 H8 H9)
- |rewrite > H9;rewrite > H10;elim l;simplify
- [constructor 1
- |constructor 2;assumption]]]]
- |apply (SA_Trans_TVar ? ? ? t1)
- [rewrite > H9 in H4;
- apply (lookup_env_extends ? ? ? ? ? ? ? ? ? ? H4);
- unfold;intro;apply H10;symmetry;assumption
- |apply (H6 ? H7 H8 H9)]]
- |apply SA_Arrow
- [apply (H5 ? H8 H9 H10)
- |apply (H7 ? H8 H9 H10)]
- |apply SA_All
- [apply (H5 ? H8 H9 H10)
- |intros;apply (H7 ? ? (mk_bound true X1 t2::l) H8)
- [rewrite > H10;cut ((fv_env (l@(mk_bound true X P::G1))) =
- (fv_env (l@(mk_bound true X U::G1))))
- [unfold;intro;apply H11;unfold;rewrite > Hcut2;assumption
- |elim l
- [simplify;reflexivity
- |elim t4;simplify;rewrite > H12;reflexivity]]
- |simplify;apply (incl_nat_cons ? ? ? H9)
- |simplify;rewrite < H10;reflexivity]]]
- |cut ((fv_env (G2@(mk_bound true X U::G1))) =
- (fv_env (G2@(mk_bound true X P::G1))))
- [rewrite > Hcut1;unfold;intros;assumption
- |elim G2
- [simplify;reflexivity
- |elim t;simplify;rewrite > H4;reflexivity]]]]]
- |intros 4;generalize in match H;elim H1
- [inversion H5
- [intros;rewrite < H8;apply (SA_Top ? ? H2 H3)
- |intros;destruct H9
- |intros;destruct H10
- |*:intros;destruct H11]
- |assumption
- |apply (SA_Trans_TVar ? ? ? ? H2);apply (H4 H5 H6)
- |inversion H7
- [intros;apply (SA_Top ? ? H8);rewrite < H10;apply WFT_Arrow
- [apply (JS_to_WFT2 ? ? ? H2)
- |apply (JS_to_WFT1 ? ? ? H4)]
- |intros;destruct H11
- |intros;destruct H12
- |intros;destruct H13;apply SA_Arrow
- [rewrite > H12 in H2;rewrite < Hcut in H8;
- lapply (H6 t2)
- [elim Hletin;apply (H15 ? ? ? H8 H2)
- |apply (t_len_arrow1 t2 t3)]
- |rewrite > H12 in H4;rewrite < Hcut1 in H10;
- lapply (H6 t3)
- [elim Hletin;apply (H15 ? ? ? H4 H10)
- |apply (t_len_arrow2 t2 t3)]]
- |intros;destruct H13]
- |inversion H7
- [intros;apply (SA_Top ? ? H8);rewrite < H10;apply WFT_Forall
- [apply (JS_to_WFT2 ? ? ? H2)
- |intros;lapply (H4 ? H13);lapply (JS_to_WFT1 ? ? ? Hletin);
- apply (WFT_env_incl ? ? Hletin1);simplify;unfold;intros;
- assumption]
- |intros;destruct H11
- |intros;destruct H12
- |intros;destruct H13
- |intros;destruct H13;subst;apply SA_All
- [lapply (H6 t4)
- [elim Hletin;apply (H12 ? ? ? H8 H2)
- |apply t_len_forall1]
- |intros;(*destruct H12;*)subst;
- lapply (H6 (subst_type_O t5 (TFree X)))
- [elim Hletin;apply H13
- [lapply (H6 t4)
- [elim Hletin1;apply (H16 e1 [] X t6);
- [simplify;apply H4;assumption
+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
+ |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 ? (Arrow t t1));
+ elim H6 in ⊢ (? ? ? %→%); clear H6; intros; destruct;
+ [apply (SA_Trans_TVar ? ? ? ? H);apply (H4 ? ? H8 H9);autobatch
+ |inversion H11;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);
+ assumption
+ |simplify;autobatch
+ |apply (narrowing X (mk_bound true X t::l1)
+ ? ? ? ? ? H7 ? ? [])
+ [intros;apply H9
+ [unfold;intros;lapply (H8 ? H17);rewrite > fv_append;
+ autobatch
+ |apply (JS_weakening ? ? ? H7)
+ [autobatch
+ |unfold;intros;autobatch]