1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 set "baseuri" "cic:/matita/Fsub/defn".
16 include "Fsub/util.ma".
18 (*** representation of Fsub types ***)
19 inductive Typ : Set \def
20 | TVar : nat \to Typ (* type var *)
21 | TFree: nat \to Typ (* free type name *)
22 | Top : Typ (* maximum type *)
23 | Arrow : Typ \to Typ \to Typ (* functions *)
24 | Forall : Typ \to Typ \to Typ. (* universal type *)
26 (* representation of bounds *)
28 record bound : Set \def {
29 istype : bool; (* is subtyping bound? *)
30 name : nat ; (* name *)
31 btype : Typ (* type to which the name is bound *)
34 (*** Various kinds of substitution, not all will be used probably ***)
36 (* substitutes i-th dangling index in type T with type U *)
37 let rec subst_type_nat T U i \def
39 [ (TVar n) \Rightarrow match (eqb n i) with
41 | false \Rightarrow T]
42 | (TFree X) \Rightarrow T
44 | (Arrow T1 T2) \Rightarrow (Arrow (subst_type_nat T1 U i) (subst_type_nat T2 U i))
45 | (Forall T1 T2) \Rightarrow (Forall (subst_type_nat T1 U i) (subst_type_nat T2 U (S i))) ].
47 (*** height of T's syntactic tree ***)
51 [(TVar n) \Rightarrow (S O)
52 |(TFree X) \Rightarrow (S O)
53 |Top \Rightarrow (S O)
54 |(Arrow T1 T2) \Rightarrow (S (max (t_len T1) (t_len T2)))
55 |(Forall T1 T2) \Rightarrow (S (max (t_len T1) (t_len T2)))].
57 (*** definitions about lists ***)
59 definition fv_env : (list bound) \to (list nat) \def
60 \lambda G.(map ? ? (\lambda b.match b with
61 [(mk_bound B X T) \Rightarrow X]) G).
63 let rec fv_type T \def
65 [(TVar n) \Rightarrow []
66 |(TFree x) \Rightarrow [x]
68 |(Arrow U V) \Rightarrow ((fv_type U) @ (fv_type V))
69 |(Forall U V) \Rightarrow ((fv_type U) @ (fv_type V))].
71 (*** Type Well-Formedness judgement ***)
73 inductive WFType : (list bound) \to Typ \to Prop \def
74 | WFT_TFree : \forall X,G.(in_list ? X (fv_env G))
75 \to (WFType G (TFree X))
76 | WFT_Top : \forall G.(WFType G Top)
77 | WFT_Arrow : \forall G,T,U.(WFType G T) \to (WFType G U) \to
78 (WFType G (Arrow T U))
79 | WFT_Forall : \forall G,T,U.(WFType G T) \to
81 (\lnot (in_list ? X (fv_env G))) \to
82 (\lnot (in_list ? X (fv_type U))) \to
83 (WFType ((mk_bound true X T) :: G)
84 (subst_type_nat U (TFree X) O))) \to
85 (WFType G (Forall T U)).
87 (*** Environment Well-Formedness judgement ***)
89 inductive WFEnv : (list bound) \to Prop \def
90 | WFE_Empty : (WFEnv (nil ?))
91 | WFE_cons : \forall B,X,T,G.(WFEnv G) \to
92 \lnot (in_list ? X (fv_env G)) \to
93 (WFType G T) \to (WFEnv ((mk_bound B X T) :: G)).
95 (*** Subtyping judgement ***)
96 inductive JSubtype : (list bound) \to Typ \to Typ \to Prop \def
97 | SA_Top : \forall G.\forall T:Typ.(WFEnv G) \to
98 (WFType G T) \to (JSubtype G T Top)
99 | SA_Refl_TVar : \forall G.\forall X:nat.(WFEnv G)
100 \to (in_list ? X (fv_env G))
101 \to (JSubtype G (TFree X) (TFree X))
102 | SA_Trans_TVar : \forall G.\forall X:nat.\forall T:Typ.
104 (in_list ? (mk_bound true X U) G) \to
105 (JSubtype G U T) \to (JSubtype G (TFree X) T)
106 | SA_Arrow : \forall G.\forall S1,S2,T1,T2:Typ.
107 (JSubtype G T1 S1) \to (JSubtype G S2 T2) \to
108 (JSubtype G (Arrow S1 S2) (Arrow T1 T2))
109 | SA_All : \forall G.\forall S1,S2,T1,T2:Typ.
110 (JSubtype G T1 S1) \to
111 (\forall X:nat.\lnot (in_list ? X (fv_env G)) \to
112 (JSubtype ((mk_bound true X T1) :: G)
113 (subst_type_nat S2 (TFree X) O) (subst_type_nat T2 (TFree X) O))) \to
114 (JSubtype G (Forall S1 S2) (Forall T1 T2)).
116 notation "hvbox(e ⊢ break ta ⊴ break tb)"
117 non associative with precedence 30 for @{ 'subjudg $e $ta $tb }.
118 interpretation "Fsub subtype judgement" 'subjudg e ta tb =
119 (cic:/matita/Fsub/defn/JSubtype.ind#xpointer(1/1) e ta tb).
121 notation > "hvbox(\Forall S.T)"
122 non associative with precedence 60 for @{ 'forall $S $T}.
123 notation < "hvbox('All' \sub S. break T)"
124 non associative with precedence 60 for @{ 'forall $S $T}.
125 interpretation "universal type" 'forall S T =
126 (cic:/matita/Fsub/defn/Typ.ind#xpointer(1/1/5) S T).
128 notation "#x" with precedence 79 for @{'tvar $x}.
129 interpretation "bound tvar" 'tvar x =
130 (cic:/matita/Fsub/defn/Typ.ind#xpointer(1/1/1) x).
132 notation "!x" with precedence 79 for @{'tname $x}.
133 interpretation "bound tname" 'tname x =
134 (cic:/matita/Fsub/defn/Typ.ind#xpointer(1/1/2) x).
136 notation "⊤" with precedence 90 for @{'toptype}.
137 interpretation "toptype" 'toptype =
138 (cic:/matita/Fsub/defn/Typ.ind#xpointer(1/1/3)).
140 notation "hvbox(s break ⇛ t)"
141 right associative with precedence 55 for @{ 'arrow $s $t }.
142 interpretation "arrow type" 'arrow S T =
143 (cic:/matita/Fsub/defn/Typ.ind#xpointer(1/1/4) S T).
145 notation "hvbox(S [# n ↦ T])"
146 non associative with precedence 80 for @{ 'substvar $S $T $n }.
147 interpretation "subst bound var" 'substvar S T n =
148 (cic:/matita/Fsub/defn/subst_type_nat.con S T n).
150 notation "hvbox(|T|)"
151 non associative with precedence 30 for @{ 'tlen $T }.
152 interpretation "type length" 'tlen T =
153 (cic:/matita/Fsub/defn/t_len.con T).
155 notation "hvbox(!X ⊴ T)"
156 non associative with precedence 60 for @{ 'subtypebound $X $T }.
157 interpretation "subtyping bound" 'subtypebound X T =
158 (cic:/matita/Fsub/defn/bound.ind#xpointer(1/1/1) true X T).
160 (****** PROOFS ********)
162 (*** theorems about lists ***)
164 lemma boundinenv_natinfv : \forall x,G.
165 (\exists B,T.(in_list ? (mk_bound B x T) G)) \to
166 (in_list ? x (fv_env G)).
168 [elim H;elim H1;lapply (in_list_nil ? ? H2);elim Hletin
169 |elim H1;elim H2;elim (in_cons_case ? ? ? ? H3)
170 [rewrite < H4;simplify;apply in_Base
171 |elim H4;elim t;simplify;apply in_Skip2;apply H;apply (ex_intro ? ? a);
172 apply (ex_intro ? ? a1);assumption]]
175 lemma nat_in_list_case : \forall G,H,n.(in_list nat n (H @ G)) \to
176 (in_list nat n G) \lor (in_list nat n H).
178 [simplify in H1;left;assumption
179 |simplify in H2;elim (in_cons_case ? ? ? ? H2)
180 [right;rewrite > H3;apply in_Base
181 |elim H3;elim (H1 H5) [left;assumption|right;apply in_Skip2;assumption]]]
184 lemma natinG_or_inH_to_natinGH : \forall G,H,n.
185 (in_list nat n G) \lor (in_list nat n H) \to
186 (in_list nat n (H @ G)).
190 |simplify;apply in_Skip2;assumption]
191 |generalize in match H2;elim H2
192 [simplify;apply in_Base
193 |lapply (H4 H3);simplify;apply in_Skip;assumption]]
196 lemma natinfv_boundinenv : \forall x,G.(in_list ? x (fv_env G)) \to
197 \exists B,T.(in_list ? (mk_bound B x T) G).
199 [simplify;intro;lapply (in_list_nil ? ? H);elim Hletin
200 |intros 3;elim t;simplify in H1;elim (in_cons_case ? ? ? ? H1)
201 [rewrite < H2;apply (ex_intro ? ? b);apply (ex_intro ? ? t1);apply in_Base
202 |elim H2;elim (H H4);elim H5;apply (ex_intro ? ? a);
203 apply (ex_intro ? ? a1);apply in_Skip
205 |intro;destruct H7;elim (H3 Hcut1)]]]
208 theorem varinT_varinT_subst : \forall X,Y,T.
209 (in_list ? X (fv_type T)) \to \forall n.
210 (in_list ? X (fv_type (subst_type_nat T (TFree Y) n))).
212 [simplify in H;elim (in_list_nil ? ? H)
213 |simplify in H;simplify;assumption
214 |simplify in H;elim (in_list_nil ? ? H)
215 |simplify in H2;simplify;elim (nat_in_list_case ? ? ? H2);
216 apply natinG_or_inH_to_natinGH;
219 |simplify in H2;simplify;elim (nat_in_list_case ? ? ? H2);
220 apply natinG_or_inH_to_natinGH;
222 |right;apply (H H3)]]
225 lemma incl_bound_fv : \forall l1,l2.(incl ? l1 l2) \to
226 (incl ? (fv_env l1) (fv_env l2)).
227 intros.unfold in H.unfold.intros.apply boundinenv_natinfv.
228 lapply (natinfv_boundinenv ? ? H1).elim Hletin.elim H2.apply ex_intro
235 lemma incl_nat_cons : \forall x,l1,l2.
236 (incl nat l1 l2) \to (incl nat (x :: l1) (x :: l2)).
237 intros.unfold in H.unfold.intros.elim (in_cons_case ? ? ? ? H1)
238 [rewrite > H2;apply in_Base|elim H2;apply in_Skip2;apply (H ? H4)]
241 lemma WFT_env_incl : \forall G,T.(WFType G T) \to
242 \forall H.(incl ? (fv_env G) (fv_env H)) \to (WFType H T).
244 [apply WFT_TFree;unfold in H3;apply (H3 ? H1)
246 |apply WFT_Arrow [apply (H2 ? H6)|apply (H4 ? H6)]
249 |intros;apply (H4 ? ? H8)
250 [unfold;intro;apply H7;apply(H6 ? H9)
251 |simplify;apply (incl_nat_cons ? ? ? H6)]]]
254 lemma fv_env_extends : \forall H,x,B,C,T,U,G.
255 (fv_env (H @ ((mk_bound B x T) :: G))) =
256 (fv_env (H @ ((mk_bound C x U) :: G))).
258 [simplify;reflexivity|elim t;simplify;rewrite > H1;reflexivity]
261 lemma lookup_env_extends : \forall G,H,B,C,D,T,U,V,x,y.
262 (in_list ? (mk_bound D y V) (H @ ((mk_bound C x U) :: G))) \to
264 (in_list ? (mk_bound D y V) (H @ ((mk_bound B x T) :: G))).
266 [simplify in H1;elim (in_cons_case ? ? ? ? H1)
267 [destruct H3;elim (H2 Hcut1)
268 |simplify;elim H3;apply (in_Skip ? ? ? ? H5);intro;destruct H6;
270 |simplify in H2;simplify;elim (in_cons_case ? ? ? ? H2)
271 [rewrite > H4;apply in_Base
272 |elim H4;apply (in_Skip ? ? ? ? (H1 H6 H3) H5)]]
275 lemma in_FV_subst : \forall x,T,U,n.(in_list ? x (fv_type T)) \to
276 (in_list ? x (fv_type (subst_type_nat T U n))).
278 [simplify in H;elim (in_list_nil ? ? H)
279 |2,3:simplify;simplify in H;assumption
280 |*:simplify in H2;simplify;apply natinG_or_inH_to_natinGH;
281 lapply (nat_in_list_case ? ? ? H2);elim Hletin
282 [1,3:left;apply (H1 ? H3)
283 |*:right;apply (H ? H3)]]
286 (*** lemma on fresh names ***)
288 lemma fresh_name : \forall l:(list nat).\exists n.\lnot (in_list ? n l).
289 cut (\forall l:(list nat).\exists n.\forall m.
290 (n \leq m) \to \lnot (in_list ? m l))
291 [intros;lapply (Hcut l);elim Hletin;apply ex_intro
293 |apply H;constructor 1]
295 [apply (ex_intro ? ? O);intros;unfold;intro;elim (in_list_nil ? ? H1)
296 |elim H;elim (decidable_eq_nat a t)
297 [apply (ex_intro ? ? (S a));intros;intro;elim (in_cons_case ? ? ? ? H4)
298 [rewrite < H5 in H2;rewrite < H2 in H3;apply (not_le_Sn_n ? H3)
299 |elim H5;elim (H1 m ? H7);apply (le_S_S_to_le ? ? (le_S ? ? H3))]
300 |cut ((leb a t) = true \lor (leb a t) = false)
302 [apply (ex_intro ? ? (S t));intros;intro;
303 elim (in_cons_case ? ? ? ? H5)
304 [rewrite > H6 in H4;apply (not_le_Sn_n ? H4)
305 |elim H6;elim (H1 m ? H8);apply (trans_le a t m)
306 [lapply (leb_to_Prop a t);rewrite > H3 in Hletin;assumption
307 |apply (le_S_S_to_le t m (le_S (S t) m H4))]]
308 |apply (ex_intro ? ? a);intros;intro;elim (in_cons_case ? ? ? ? H5)
309 [lapply (leb_to_Prop a t);rewrite > H3 in Hletin;
310 simplify in Hletin;lapply (not_le_to_lt ? ? Hletin);
311 unfold in Hletin1;rewrite < H6 in Hletin;apply (Hletin H4)
312 |elim H6;elim (H1 ? H4 H8)]]
313 |elim (leb a t);autobatch]]]]
316 (*** lemmata on well-formedness ***)
318 lemma fv_WFT : \forall T,x,G.(WFType G T) \to (in_list ? x (fv_type T)) \to
319 (in_list ? x (fv_env G)).
321 [simplify in H2;elim (in_cons_case ? ? ? ? H2)
322 [rewrite > H3;assumption|elim H3;elim (in_list_nil ? ? H5)]
323 |simplify in H1;elim (in_list_nil ? x H1)
324 |simplify in H5;elim (nat_in_list_case ? ? ? H5);autobatch
325 |simplify in H5;elim (nat_in_list_case ? ? ? H5)
326 [elim (fresh_name ((fv_type t1) @ (fv_env l)));
327 cut ((¬ (in_list ? a (fv_type t1))) ∧
328 (¬ (in_list ? a (fv_env l))))
329 [elim Hcut;lapply (H4 ? H9 H8)
331 [simplify in Hletin;elim (in_cons_case ? ? ? ? Hletin)
332 [elim (Hcut1 H10)|elim H10;assumption]
333 |intro;apply H8;rewrite < H10;assumption]
334 |apply in_FV_subst;assumption]
336 [intro;apply H7;apply natinG_or_inH_to_natinGH;right;assumption
337 |intro;apply H7;apply natinG_or_inH_to_natinGH;left;assumption]]
341 (*** some exotic inductions and related lemmas ***)
343 lemma not_t_len_lt_SO : \forall T.\lnot (t_len T) < (S O).
345 [1,2,3:simplify;unfold;intro;unfold in H;elim (not_le_Sn_n ? H)
346 |*:simplify;unfold;rewrite > max_case;elim (leb (t_len t) (t_len t1))
347 [1,3:simplify in H2;apply H1;apply (trans_lt ? ? ? ? H2);unfold;constructor 1
348 |*:simplify in H2;apply H;apply (trans_lt ? ? ? ? H2);unfold;constructor 1]]
351 lemma Typ_len_ind : \forall P:Typ \to Prop.
352 (\forall U.(\forall V.((t_len V) < (t_len U)) \to (P V))
355 cut (\forall P:Typ \to Prop.
356 (\forall U.(\forall V.((t_len V) < (t_len U)) \to (P V))
358 \to \forall T,n.(n = (t_len T)) \to (P T))
359 [intros;apply (Hcut ? H ? (t_len T));reflexivity
360 |intros 4;generalize in match T;apply (nat_elim1 n);intros;
361 generalize in match H2;elim t
362 [1,2,3:apply H;intros;simplify in H4;elim (not_t_len_lt_SO ? H4)
363 |*:apply H;intros;apply (H1 (t_len V))
364 [1,3:rewrite > H5;assumption
368 lemma t_len_arrow1 : \forall T1,T2.(t_len T1) < (t_len (Arrow T1 T2)).
370 (* FIXME!!! BUG?!?! *)
371 cut ((max (t_len T1) (t_len T2)) = match (leb (t_len T1) (t_len T2)) with
373 | true ⇒ (t_len T1) ])
374 [rewrite > Hcut;cut ((leb (t_len T1) (t_len T2)) = false \lor
375 (leb (t_len T1) (t_len T2)) = true)
376 [lapply (leb_to_Prop (t_len T1) (t_len T2));elim Hcut1
377 [rewrite > H;rewrite > H in Hletin;simplify;constructor 1
378 |rewrite > H;rewrite > H in Hletin;simplify;simplify in Hletin;
379 unfold;apply le_S_S;assumption]
380 |elim (leb (t_len T1) (t_len T2));autobatch]
381 |elim T1;simplify;reflexivity]
384 lemma t_len_arrow2 : \forall T1,T2.(t_len T2) < (t_len (Arrow T1 T2)).
386 (* FIXME!!! BUG?!?! *)
387 cut ((max (t_len T1) (t_len T2)) = match (leb (t_len T1) (t_len T2)) with
388 [ false \Rightarrow (t_len T2)
389 | true \Rightarrow (t_len T1) ])
390 [rewrite > Hcut;cut ((leb (t_len T1) (t_len T2)) = false \lor
391 (leb (t_len T1) (t_len T2)) = true)
392 [lapply (leb_to_Prop (t_len T1) (t_len T2));elim Hcut1
393 [rewrite > H;rewrite > H in Hletin;simplify;simplify in Hletin;
394 lapply (not_le_to_lt ? ? Hletin);unfold in Hletin1;unfold;
395 constructor 2;assumption
396 |rewrite > H;simplify;unfold;constructor 1]
397 |elim (leb (t_len T1) (t_len T2));autobatch]
398 |elim T1;simplify;reflexivity]
401 lemma t_len_forall1 : \forall T1,T2.(t_len T1) < (t_len (Forall T1 T2)).
403 (* FIXME!!! BUG?!?! *)
404 cut ((max (t_len T1) (t_len T2)) = match (leb (t_len T1) (t_len T2)) with
405 [ false \Rightarrow (t_len T2)
406 | true \Rightarrow (t_len T1) ])
407 [rewrite > Hcut;cut ((leb (t_len T1) (t_len T2)) = false \lor
408 (leb (t_len T1) (t_len T2)) = true)
409 [lapply (leb_to_Prop (t_len T1) (t_len T2));elim Hcut1
410 [rewrite > H;rewrite > H in Hletin;simplify;constructor 1
411 |rewrite > H;rewrite > H in Hletin;simplify;simplify in Hletin;
412 unfold;apply le_S_S;assumption]
413 |elim (leb (t_len T1) (t_len T2));autobatch]
414 |elim T1;simplify;reflexivity]
417 lemma t_len_forall2 : \forall T1,T2.(t_len T2) < (t_len (Forall T1 T2)).
419 (* FIXME!!! BUG?!?! *)
420 cut ((max (t_len T1) (t_len T2)) = match (leb (t_len T1) (t_len T2)) with
421 [ false \Rightarrow (t_len T2)
422 | true \Rightarrow (t_len T1) ])
423 [rewrite > Hcut;cut ((leb (t_len T1) (t_len T2)) = false \lor
424 (leb (t_len T1) (t_len T2)) = true)
425 [lapply (leb_to_Prop (t_len T1) (t_len T2));elim Hcut1
426 [rewrite > H;rewrite > H in Hletin;simplify;simplify in Hletin;
427 lapply (not_le_to_lt ? ? Hletin);unfold in Hletin1;unfold;
428 constructor 2;assumption
429 |rewrite > H;simplify;unfold;constructor 1]
430 |elim (leb (t_len T1) (t_len T2));autobatch]
431 |elim T1;simplify;reflexivity]
434 lemma eq_t_len_TFree_subst : \forall T,n,X.(t_len T) =
435 (t_len (subst_type_nat T (TFree X) n)).
437 [simplify;elim (eqb n n1);simplify;reflexivity
438 |2,3:simplify;reflexivity
439 |simplify;lapply (H n X);lapply (H1 n X);rewrite < Hletin;rewrite < Hletin1;
441 |simplify;lapply (H n X);lapply (H1 (S n) X);rewrite < Hletin;
442 rewrite < Hletin1;reflexivity]
445 (*** lemmata relating subtyping and well-formedness ***)
447 lemma JS_to_WFE : \forall G,T,U.(G \vdash T ⊴ U) \to (WFEnv G).
448 intros;elim H;assumption.
451 lemma JS_to_WFT : \forall G,T,U.(JSubtype G T U) \to ((WFType G T) \land
454 [split [assumption|apply WFT_Top]
455 |split;apply WFT_TFree;assumption
457 [apply WFT_TFree;apply boundinenv_natinfv;apply ex_intro
458 [apply true | apply ex_intro [apply t1 |assumption]]
460 |elim H2;elim H4;split;apply WFT_Arrow;assumption
462 [apply (WFT_Forall ? ? ? H6);intros;elim (H4 X H7);
463 apply (WFT_env_incl ? ? H9);simplify;unfold;intros;assumption
464 |apply (WFT_Forall ? ? ? H5);intros;elim (H4 X H7);
465 apply (WFT_env_incl ? ? H10);simplify;unfold;intros;assumption]]
468 lemma JS_to_WFT1 : \forall G,T,U.(JSubtype G T U) \to (WFType G T).
469 intros;lapply (JS_to_WFT ? ? ? H);elim Hletin;assumption.
472 lemma JS_to_WFT2 : \forall G,T,U.(JSubtype G T U) \to (WFType G U).
473 intros;lapply (JS_to_WFT ? ? ? H);elim Hletin;assumption.
476 lemma WFE_Typ_subst : \forall H,x,B,C,T,U,G.
477 (WFEnv (H @ ((mk_bound B x T) :: G))) \to (WFType G U) \to
478 (WFEnv (H @ ((mk_bound C x U) :: G))).
480 [simplify;intros;(*FIXME*)generalize in match H1;intro;inversion H1;intros
481 [lapply (nil_cons ? G (mk_bound B x T));elim (Hletin H4)
482 |destruct H8;rewrite < Hcut2 in H6;rewrite < Hcut in H4;
483 rewrite < Hcut in H6;apply (WFE_cons ? ? ? ? H4 H6 H2)]
484 |intros;simplify;generalize in match H2;elim t;simplify in H4;
487 |destruct H9;apply WFE_cons
488 [rewrite < Hcut in H5;apply (H1 H5 H3)
489 |rewrite < (fv_env_extends ? x B C T U);rewrite > Hcut;rewrite > Hcut2;
491 |rewrite < Hcut3 in H8;rewrite > Hcut1;apply (WFT_env_incl ? ? H8);
492 rewrite < (fv_env_extends ? x B C T U);unfold;intros;
493 rewrite > Hcut;assumption]]]
496 lemma WFE_bound_bound : \forall B,x,T,U,G. (WFEnv G) \to
497 (in_list ? (mk_bound B x T) G) \to
498 (in_list ? (mk_bound B x U) G) \to T = U.
500 [lapply (in_list_nil ? ? H1);elim Hletin
501 |elim (in_cons_case ? ? ? ? H6)
502 [destruct H7;subst;elim (in_cons_case ? ? ? ? H5)
503 [destruct H7;assumption
504 |elim H7;elim H3;apply boundinenv_natinfv;apply (ex_intro ? ? b);
505 apply (ex_intro ? ? T);assumption]
506 |elim H7;elim (in_cons_case ? ? ? ? H5)
507 [destruct H10;elim H3;apply boundinenv_natinfv;apply (ex_intro ? ? B);
508 apply (ex_intro ? ? U);rewrite < Hcut1;assumption
509 |elim H10;apply (H2 H12 H9)]]]