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 (* This file was automatically generated: do not edit *********************)
17 include "subst0/defs.ma".
19 include "lift/props.ma".
21 theorem subst0_inv_coq:
22 \forall (i: nat).(\forall (v: T).(\forall (t1: T).(\forall (t2: T).(\forall
23 (P: ((nat \to (T \to (T \to (T \to Prop)))))).((((subst0 i v t1 t2) \to
24 (\forall (v0: T).(\forall (i0: nat).((eq nat i0 i) \to ((eq T v0 v) \to ((eq
25 T (TLRef i0) t1) \to ((eq T (lift (S i0) O v0) t2) \to (P i v t1 t2)))))))))
26 \to ((((subst0 i v t1 t2) \to (\forall (v0: T).(\forall (u2: T).(\forall (u1:
27 T).(\forall (i0: nat).(\forall (t: T).(\forall (k: K).((eq nat i0 i) \to ((eq
28 T v0 v) \to ((eq T (THead k u1 t) t1) \to ((eq T (THead k u2 t) t2) \to
29 ((subst0 i0 v0 u1 u2) \to (P i v t1 t2)))))))))))))) \to ((((subst0 i v t1
30 t2) \to (\forall (k: K).(\forall (v0: T).(\forall (t0: T).(\forall (t3:
31 T).(\forall (i0: nat).(\forall (u: T).((eq nat i0 i) \to ((eq T v0 v) \to
32 ((eq T (THead k u t3) t1) \to ((eq T (THead k u t0) t2) \to ((subst0 (s k i0)
33 v0 t3 t0) \to (P i v t1 t2)))))))))))))) \to ((((subst0 i v t1 t2) \to
34 (\forall (v0: T).(\forall (u1: T).(\forall (u2: T).(\forall (i0:
35 nat).(\forall (k: K).(\forall (t0: T).(\forall (t3: T).((eq nat i0 i) \to
36 ((eq T v0 v) \to ((eq T (THead k u1 t0) t1) \to ((eq T (THead k u2 t3) t2)
37 \to ((subst0 i0 v0 u1 u2) \to ((subst0 (s k i0) v0 t0 t3) \to (P i v t1
38 t2)))))))))))))))) \to ((subst0 i v t1 t2) \to (P i v t1 t2))))))))))
40 \lambda (i: nat).(\lambda (v: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda
41 (P: ((nat \to (T \to (T \to (T \to Prop)))))).(\lambda (H: (((subst0 i v t1
42 t2) \to (\forall (v0: T).(\forall (i0: nat).((eq nat i0 i) \to ((eq T v0 v)
43 \to ((eq T (TLRef i0) t1) \to ((eq T (lift (S i0) O v0) t2) \to (P i v t1
44 t2)))))))))).(\lambda (H0: (((subst0 i v t1 t2) \to (\forall (v0: T).(\forall
45 (u2: T).(\forall (u1: T).(\forall (i0: nat).(\forall (t: T).(\forall (k:
46 K).((eq nat i0 i) \to ((eq T v0 v) \to ((eq T (THead k u1 t) t1) \to ((eq T
47 (THead k u2 t) t2) \to ((subst0 i0 v0 u1 u2) \to (P i v t1
48 t2))))))))))))))).(\lambda (H1: (((subst0 i v t1 t2) \to (\forall (k:
49 K).(\forall (v0: T).(\forall (t0: T).(\forall (t3: T).(\forall (i0:
50 nat).(\forall (u: T).((eq nat i0 i) \to ((eq T v0 v) \to ((eq T (THead k u
51 t3) t1) \to ((eq T (THead k u t0) t2) \to ((subst0 (s k i0) v0 t3 t0) \to (P
52 i v t1 t2))))))))))))))).(\lambda (H2: (((subst0 i v t1 t2) \to (\forall (v0:
53 T).(\forall (u1: T).(\forall (u2: T).(\forall (i0: nat).(\forall (k:
54 K).(\forall (t0: T).(\forall (t3: T).((eq nat i0 i) \to ((eq T v0 v) \to ((eq
55 T (THead k u1 t0) t1) \to ((eq T (THead k u2 t3) t2) \to ((subst0 i0 v0 u1
56 u2) \to ((subst0 (s k i0) v0 t0 t3) \to (P i v t1
57 t2))))))))))))))))).(\lambda (H3: (subst0 i v t1 t2)).(let H4 \def (match H3
58 in subst0 return (\lambda (n: nat).(\lambda (t: T).(\lambda (t0: T).(\lambda
59 (t3: T).(\lambda (_: (subst0 n t t0 t3)).((eq nat n i) \to ((eq T t v) \to
60 ((eq T t0 t1) \to ((eq T t3 t2) \to (P i v t1 t2)))))))))) with [(subst0_lref
61 v0 i0) \Rightarrow (\lambda (H4: (eq nat i0 i)).(\lambda (H5: (eq T v0
62 v)).(\lambda (H6: (eq T (TLRef i0) t1)).(\lambda (H7: (eq T (lift (S i0) O
63 v0) t2)).(H H3 v0 i0 H4 H5 H6 H7))))) | (subst0_fst v0 u2 u1 i0 H4 t k)
64 \Rightarrow (\lambda (H5: (eq nat i0 i)).(\lambda (H6: (eq T v0 v)).(\lambda
65 (H7: (eq T (THead k u1 t) t1)).(\lambda (H8: (eq T (THead k u2 t) t2)).(H0 H3
66 v0 u2 u1 i0 t k H5 H6 H7 H8 H4))))) | (subst0_snd k v0 t0 t3 i0 H4 u)
67 \Rightarrow (\lambda (H5: (eq nat i0 i)).(\lambda (H6: (eq T v0 v)).(\lambda
68 (H7: (eq T (THead k u t3) t1)).(\lambda (H8: (eq T (THead k u t0) t2)).(H1 H3
69 k v0 t0 t3 i0 u H5 H6 H7 H8 H4))))) | (subst0_both v0 u1 u2 i0 H4 k t0 t3 H5)
70 \Rightarrow (\lambda (H6: (eq nat i0 i)).(\lambda (H7: (eq T v0 v)).(\lambda
71 (H8: (eq T (THead k u1 t0) t1)).(\lambda (H9: (eq T (THead k u2 t3) t2)).(H2
72 H3 v0 u1 u2 i0 k t0 t3 H6 H7 H8 H9 H4 H5)))))]) in (H4 (refl_equal nat i)
73 (refl_equal T v) (refl_equal T t1) (refl_equal T t2)))))))))))).
75 theorem subst0_gen_sort:
76 \forall (v: T).(\forall (x: T).(\forall (i: nat).(\forall (n: nat).((subst0
77 i v (TSort n) x) \to (\forall (P: Prop).P)))))
79 \lambda (v: T).(\lambda (x: T).(\lambda (i: nat).(\lambda (n: nat).(\lambda
80 (H: (subst0 i v (TSort n) x)).(\lambda (P: Prop).(subst0_inv_coq i v (TSort
81 n) x (\lambda (_: nat).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).P))))
82 (\lambda (H0: (subst0 i v (TSort n) x)).(\lambda (v0: T).(\lambda (i0:
83 nat).(\lambda (H1: (eq nat i0 i)).(\lambda (H2: (eq T v0 v)).(\lambda (H3:
84 (eq T (TLRef i0) (TSort n))).(\lambda (H4: (eq T (lift (S i0) O v0) x)).(let
85 H5 \def (eq_ind nat i0 (\lambda (n0: nat).(eq T (lift (S n0) O v0) x)) H4 i
86 H1) in (let H6 \def (eq_ind nat i0 (\lambda (n0: nat).(eq T (TLRef n0) (TSort
87 n))) H3 i H1) in (let H7 \def (eq_ind T v0 (\lambda (t: T).(eq T (lift (S i)
88 O t) x)) H5 v H2) in (let H8 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v
89 (TSort n) t)) H0 (lift (S i) O v) H7) in (let H9 \def (eq_ind_r T x (\lambda
90 (t: T).(subst0 i v (TSort n) t)) H (lift (S i) O v) H7) in (let H10 \def
91 (eq_ind T (TLRef i) (\lambda (ee: T).(match ee in T return (\lambda (_:
92 T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True |
93 (THead _ _ _) \Rightarrow False])) I (TSort n) H6) in (False_ind P
94 H10)))))))))))))) (\lambda (H0: (subst0 i v (TSort n) x)).(\lambda (v0:
95 T).(\lambda (u2: T).(\lambda (u1: T).(\lambda (i0: nat).(\lambda (t:
96 T).(\lambda (k: K).(\lambda (H1: (eq nat i0 i)).(\lambda (H2: (eq T v0
97 v)).(\lambda (H3: (eq T (THead k u1 t) (TSort n))).(\lambda (H4: (eq T (THead
98 k u2 t) x)).(\lambda (H5: (subst0 i0 v0 u1 u2)).(let H6 \def (eq_ind nat i0
99 (\lambda (n0: nat).(subst0 n0 v0 u1 u2)) H5 i H1) in (let H7 \def (eq_ind T
100 v0 (\lambda (t0: T).(subst0 i t0 u1 u2)) H6 v H2) in (let H8 \def (eq_ind_r T
101 x (\lambda (t0: T).(subst0 i v (TSort n) t0)) H0 (THead k u2 t) H4) in (let
102 H9 \def (eq_ind_r T x (\lambda (t0: T).(subst0 i v (TSort n) t0)) H (THead k
103 u2 t) H4) in (let H10 \def (eq_ind T (THead k u1 t) (\lambda (ee: T).(match
104 ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False |
105 (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TSort n)
106 H3) in (False_ind P H10)))))))))))))))))) (\lambda (H0: (subst0 i v (TSort n)
107 x)).(\lambda (k: K).(\lambda (v0: T).(\lambda (t0: T).(\lambda (t3:
108 T).(\lambda (i0: nat).(\lambda (u: T).(\lambda (H1: (eq nat i0 i)).(\lambda
109 (H2: (eq T v0 v)).(\lambda (H3: (eq T (THead k u t3) (TSort n))).(\lambda
110 (H4: (eq T (THead k u t0) x)).(\lambda (H5: (subst0 (s k i0) v0 t3 t0)).(let
111 H6 \def (eq_ind nat i0 (\lambda (n0: nat).(subst0 (s k n0) v0 t3 t0)) H5 i
112 H1) in (let H7 \def (eq_ind T v0 (\lambda (t: T).(subst0 (s k i) t t3 t0)) H6
113 v H2) in (let H8 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v (TSort n) t))
114 H0 (THead k u t0) H4) in (let H9 \def (eq_ind_r T x (\lambda (t: T).(subst0 i
115 v (TSort n) t)) H (THead k u t0) H4) in (let H10 \def (eq_ind T (THead k u
116 t3) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort
117 _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _)
118 \Rightarrow True])) I (TSort n) H3) in (False_ind P H10))))))))))))))))))
119 (\lambda (H0: (subst0 i v (TSort n) x)).(\lambda (v0: T).(\lambda (u1:
120 T).(\lambda (u2: T).(\lambda (i0: nat).(\lambda (k: K).(\lambda (t0:
121 T).(\lambda (t3: T).(\lambda (H2: (eq nat i0 i)).(\lambda (H3: (eq T v0
122 v)).(\lambda (H4: (eq T (THead k u1 t0) (TSort n))).(\lambda (H5: (eq T
123 (THead k u2 t3) x)).(\lambda (H1: (subst0 i0 v0 u1 u2)).(\lambda (H6: (subst0
124 (s k i0) v0 t0 t3)).(let H7 \def (eq_ind nat i0 (\lambda (n0: nat).(subst0 (s
125 k n0) v0 t0 t3)) H6 i H2) in (let H8 \def (eq_ind nat i0 (\lambda (n0:
126 nat).(subst0 n0 v0 u1 u2)) H1 i H2) in (let H9 \def (eq_ind T v0 (\lambda (t:
127 T).(subst0 (s k i) t t0 t3)) H7 v H3) in (let H10 \def (eq_ind T v0 (\lambda
128 (t: T).(subst0 i t u1 u2)) H8 v H3) in (let H11 \def (eq_ind_r T x (\lambda
129 (t: T).(subst0 i v (TSort n) t)) H0 (THead k u2 t3) H5) in (let H12 \def
130 (eq_ind_r T x (\lambda (t: T).(subst0 i v (TSort n) t)) H (THead k u2 t3) H5)
131 in (let H13 \def (eq_ind T (THead k u1 t0) (\lambda (ee: T).(match ee in T
132 return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _)
133 \Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TSort n) H4) in
134 (False_ind P H13)))))))))))))))))))))) H)))))).
136 theorem subst0_gen_lref:
137 \forall (v: T).(\forall (x: T).(\forall (i: nat).(\forall (n: nat).((subst0
138 i v (TLRef n) x) \to (land (eq nat n i) (eq T x (lift (S n) O v)))))))
140 \lambda (v: T).(\lambda (x: T).(\lambda (i: nat).(\lambda (n: nat).(\lambda
141 (H: (subst0 i v (TLRef n) x)).(subst0_inv_coq i v (TLRef n) x (\lambda (n0:
142 nat).(\lambda (t: T).(\lambda (_: T).(\lambda (t1: T).(land (eq nat n n0) (eq
143 T t1 (lift (S n) O t))))))) (\lambda (H0: (subst0 i v (TLRef n) x)).(\lambda
144 (v0: T).(\lambda (i0: nat).(\lambda (H1: (eq nat i0 i)).(\lambda (H2: (eq T
145 v0 v)).(\lambda (H3: (eq T (TLRef i0) (TLRef n))).(\lambda (H4: (eq T (lift
146 (S i0) O v0) x)).(let H5 \def (eq_ind nat i0 (\lambda (n0: nat).(eq T (lift
147 (S n0) O v0) x)) H4 i H1) in (let H6 \def (eq_ind nat i0 (\lambda (n0:
148 nat).(eq T (TLRef n0) (TLRef n))) H3 i H1) in (let H7 \def (eq_ind T v0
149 (\lambda (t: T).(eq T (lift (S i) O t) x)) H5 v H2) in (let H8 \def (eq_ind_r
150 T x (\lambda (t: T).(subst0 i v (TLRef n) t)) H0 (lift (S i) O v) H7) in (let
151 H9 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v (TLRef n) t)) H (lift (S i)
152 O v) H7) in (eq_ind T (lift (S i) O v) (\lambda (t: T).(land (eq nat n i) (eq
153 T t (lift (S n) O v)))) (let H10 \def (f_equal T nat (\lambda (e: T).(match e
154 in T return (\lambda (_: T).nat) with [(TSort _) \Rightarrow i | (TLRef n0)
155 \Rightarrow n0 | (THead _ _ _) \Rightarrow i])) (TLRef i) (TLRef n) H6) in
156 (let H11 \def (eq_ind_r nat n (\lambda (n0: nat).(subst0 i v (TLRef n0) (lift
157 (S i) O v))) H8 i H10) in (let H12 \def (eq_ind_r nat n (\lambda (n0:
158 nat).(subst0 i v (TLRef n0) (lift (S i) O v))) H9 i H10) in (eq_ind nat i
159 (\lambda (n0: nat).(land (eq nat n0 i) (eq T (lift (S i) O v) (lift (S n0) O
160 v)))) (conj (eq nat i i) (eq T (lift (S i) O v) (lift (S i) O v)) (refl_equal
161 nat i) (refl_equal T (lift (S i) O v))) n H10)))) x H7))))))))))))) (\lambda
162 (H0: (subst0 i v (TLRef n) x)).(\lambda (v0: T).(\lambda (u2: T).(\lambda
163 (u1: T).(\lambda (i0: nat).(\lambda (t: T).(\lambda (k: K).(\lambda (H1: (eq
164 nat i0 i)).(\lambda (H2: (eq T v0 v)).(\lambda (H3: (eq T (THead k u1 t)
165 (TLRef n))).(\lambda (H4: (eq T (THead k u2 t) x)).(\lambda (H5: (subst0 i0
166 v0 u1 u2)).(let H6 \def (eq_ind nat i0 (\lambda (n0: nat).(subst0 n0 v0 u1
167 u2)) H5 i H1) in (let H7 \def (eq_ind T v0 (\lambda (t0: T).(subst0 i t0 u1
168 u2)) H6 v H2) in (let H8 \def (eq_ind_r T x (\lambda (t0: T).(subst0 i v
169 (TLRef n) t0)) H0 (THead k u2 t) H4) in (let H9 \def (eq_ind_r T x (\lambda
170 (t0: T).(subst0 i v (TLRef n) t0)) H (THead k u2 t) H4) in (eq_ind T (THead k
171 u2 t) (\lambda (t0: T).(land (eq nat n i) (eq T t0 (lift (S n) O v)))) (let
172 H10 \def (eq_ind T (THead k u1 t) (\lambda (ee: T).(match ee in T return
173 (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _)
174 \Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TLRef n) H3) in
175 (False_ind (land (eq nat n i) (eq T (THead k u2 t) (lift (S n) O v))) H10)) x
176 H4))))))))))))))))) (\lambda (H0: (subst0 i v (TLRef n) x)).(\lambda (k:
177 K).(\lambda (v0: T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (i0:
178 nat).(\lambda (u: T).(\lambda (H1: (eq nat i0 i)).(\lambda (H2: (eq T v0
179 v)).(\lambda (H3: (eq T (THead k u t3) (TLRef n))).(\lambda (H4: (eq T (THead
180 k u t0) x)).(\lambda (H5: (subst0 (s k i0) v0 t3 t0)).(let H6 \def (eq_ind
181 nat i0 (\lambda (n0: nat).(subst0 (s k n0) v0 t3 t0)) H5 i H1) in (let H7
182 \def (eq_ind T v0 (\lambda (t: T).(subst0 (s k i) t t3 t0)) H6 v H2) in (let
183 H8 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v (TLRef n) t)) H0 (THead k u
184 t0) H4) in (let H9 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v (TLRef n)
185 t)) H (THead k u t0) H4) in (eq_ind T (THead k u t0) (\lambda (t: T).(land
186 (eq nat n i) (eq T t (lift (S n) O v)))) (let H10 \def (eq_ind T (THead k u
187 t3) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort
188 _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _)
189 \Rightarrow True])) I (TLRef n) H3) in (False_ind (land (eq nat n i) (eq T
190 (THead k u t0) (lift (S n) O v))) H10)) x H4))))))))))))))))) (\lambda (H0:
191 (subst0 i v (TLRef n) x)).(\lambda (v0: T).(\lambda (u1: T).(\lambda (u2:
192 T).(\lambda (i0: nat).(\lambda (k: K).(\lambda (t0: T).(\lambda (t3:
193 T).(\lambda (H2: (eq nat i0 i)).(\lambda (H3: (eq T v0 v)).(\lambda (H4: (eq
194 T (THead k u1 t0) (TLRef n))).(\lambda (H5: (eq T (THead k u2 t3)
195 x)).(\lambda (H1: (subst0 i0 v0 u1 u2)).(\lambda (H6: (subst0 (s k i0) v0 t0
196 t3)).(let H7 \def (eq_ind nat i0 (\lambda (n0: nat).(subst0 (s k n0) v0 t0
197 t3)) H6 i H2) in (let H8 \def (eq_ind nat i0 (\lambda (n0: nat).(subst0 n0 v0
198 u1 u2)) H1 i H2) in (let H9 \def (eq_ind T v0 (\lambda (t: T).(subst0 (s k i)
199 t t0 t3)) H7 v H3) in (let H10 \def (eq_ind T v0 (\lambda (t: T).(subst0 i t
200 u1 u2)) H8 v H3) in (let H11 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v
201 (TLRef n) t)) H0 (THead k u2 t3) H5) in (let H12 \def (eq_ind_r T x (\lambda
202 (t: T).(subst0 i v (TLRef n) t)) H (THead k u2 t3) H5) in (eq_ind T (THead k
203 u2 t3) (\lambda (t: T).(land (eq nat n i) (eq T t (lift (S n) O v)))) (let
204 H13 \def (eq_ind T (THead k u1 t0) (\lambda (ee: T).(match ee in T return
205 (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _)
206 \Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TLRef n) H4) in
207 (False_ind (land (eq nat n i) (eq T (THead k u2 t3) (lift (S n) O v))) H13))
208 x H5))))))))))))))))))))) H))))).
210 theorem subst0_gen_head:
211 \forall (k: K).(\forall (v: T).(\forall (u1: T).(\forall (t1: T).(\forall
212 (x: T).(\forall (i: nat).((subst0 i v (THead k u1 t1) x) \to (or3 (ex2 T
213 (\lambda (u2: T).(eq T x (THead k u2 t1))) (\lambda (u2: T).(subst0 i v u1
214 u2))) (ex2 T (\lambda (t2: T).(eq T x (THead k u1 t2))) (\lambda (t2:
215 T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda (u2: T).(\lambda (t2:
216 T).(eq T x (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i v u1
217 u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) v t1 t2)))))))))))
219 \lambda (k: K).(\lambda (v: T).(\lambda (u1: T).(\lambda (t1: T).(\lambda
220 (x: T).(\lambda (i: nat).(\lambda (H: (subst0 i v (THead k u1 t1)
221 x)).(subst0_inv_coq i v (THead k u1 t1) x (\lambda (n: nat).(\lambda (t:
222 T).(\lambda (_: T).(\lambda (t2: T).(or3 (ex2 T (\lambda (u2: T).(eq T t2
223 (THead k u2 t1))) (\lambda (u2: T).(subst0 n t u1 u2))) (ex2 T (\lambda (t3:
224 T).(eq T t2 (THead k u1 t3))) (\lambda (t3: T).(subst0 (s k n) t t1 t3)))
225 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead k u2 t3))))
226 (\lambda (u2: T).(\lambda (_: T).(subst0 n t u1 u2))) (\lambda (_:
227 T).(\lambda (t3: T).(subst0 (s k n) t t1 t3))))))))) (\lambda (H0: (subst0 i
228 v (THead k u1 t1) x)).(\lambda (v0: T).(\lambda (i0: nat).(\lambda (H1: (eq
229 nat i0 i)).(\lambda (H2: (eq T v0 v)).(\lambda (H3: (eq T (TLRef i0) (THead k
230 u1 t1))).(\lambda (H4: (eq T (lift (S i0) O v0) x)).(let H5 \def (eq_ind nat
231 i0 (\lambda (n: nat).(eq T (lift (S n) O v0) x)) H4 i H1) in (let H6 \def
232 (eq_ind nat i0 (\lambda (n: nat).(eq T (TLRef n) (THead k u1 t1))) H3 i H1)
233 in (let H7 \def (eq_ind T v0 (\lambda (t: T).(eq T (lift (S i) O t) x)) H5 v
234 H2) in (let H8 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v (THead k u1 t1)
235 t)) H0 (lift (S i) O v) H7) in (let H9 \def (eq_ind_r T x (\lambda (t:
236 T).(subst0 i v (THead k u1 t1) t)) H (lift (S i) O v) H7) in (eq_ind T (lift
237 (S i) O v) (\lambda (t: T).(or3 (ex2 T (\lambda (u2: T).(eq T t (THead k u2
238 t1))) (\lambda (u2: T).(subst0 i v u1 u2))) (ex2 T (\lambda (t2: T).(eq T t
239 (THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T
240 (\lambda (u2: T).(\lambda (t2: T).(eq T t (THead k u2 t2)))) (\lambda (u2:
241 T).(\lambda (_: T).(subst0 i v u1 u2))) (\lambda (_: T).(\lambda (t2:
242 T).(subst0 (s k i) v t1 t2)))))) (let H10 \def (eq_ind T (TLRef i) (\lambda
243 (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _)
244 \Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow
245 False])) I (THead k u1 t1) H6) in (False_ind (or3 (ex2 T (\lambda (u2: T).(eq
246 T (lift (S i) O v) (THead k u2 t1))) (\lambda (u2: T).(subst0 i v u1 u2)))
247 (ex2 T (\lambda (t2: T).(eq T (lift (S i) O v) (THead k u1 t2))) (\lambda
248 (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda (u2: T).(\lambda (t2:
249 T).(eq T (lift (S i) O v) (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_:
250 T).(subst0 i v u1 u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) v t1
251 t2))))) H10)) x H7))))))))))))) (\lambda (H0: (subst0 i v (THead k u1 t1)
252 x)).(\lambda (v0: T).(\lambda (u2: T).(\lambda (u0: T).(\lambda (i0:
253 nat).(\lambda (t: T).(\lambda (k0: K).(\lambda (H1: (eq nat i0 i)).(\lambda
254 (H2: (eq T v0 v)).(\lambda (H3: (eq T (THead k0 u0 t) (THead k u1
255 t1))).(\lambda (H4: (eq T (THead k0 u2 t) x)).(\lambda (H5: (subst0 i0 v0 u0
256 u2)).(let H6 \def (eq_ind nat i0 (\lambda (n: nat).(subst0 n v0 u0 u2)) H5 i
257 H1) in (let H7 \def (eq_ind T v0 (\lambda (t0: T).(subst0 i t0 u0 u2)) H6 v
258 H2) in (let H8 \def (eq_ind_r T x (\lambda (t0: T).(subst0 i v (THead k u1
259 t1) t0)) H0 (THead k0 u2 t) H4) in (let H9 \def (eq_ind_r T x (\lambda (t0:
260 T).(subst0 i v (THead k u1 t1) t0)) H (THead k0 u2 t) H4) in (eq_ind T (THead
261 k0 u2 t) (\lambda (t0: T).(or3 (ex2 T (\lambda (u3: T).(eq T t0 (THead k u3
262 t1))) (\lambda (u3: T).(subst0 i v u1 u3))) (ex2 T (\lambda (t2: T).(eq T t0
263 (THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T
264 (\lambda (u3: T).(\lambda (t2: T).(eq T t0 (THead k u3 t2)))) (\lambda (u3:
265 T).(\lambda (_: T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2:
266 T).(subst0 (s k i) v t1 t2)))))) (let H10 \def (f_equal T K (\lambda (e:
267 T).(match e in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k0 |
268 (TLRef _) \Rightarrow k0 | (THead k1 _ _) \Rightarrow k1])) (THead k0 u0 t)
269 (THead k u1 t1) H3) in ((let H11 \def (f_equal T T (\lambda (e: T).(match e
270 in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u0 | (TLRef _)
271 \Rightarrow u0 | (THead _ t0 _) \Rightarrow t0])) (THead k0 u0 t) (THead k u1
272 t1) H3) in ((let H12 \def (f_equal T T (\lambda (e: T).(match e in T return
273 (\lambda (_: T).T) with [(TSort _) \Rightarrow t | (TLRef _) \Rightarrow t |
274 (THead _ _ t0) \Rightarrow t0])) (THead k0 u0 t) (THead k u1 t1) H3) in
275 (\lambda (H13: (eq T u0 u1)).(\lambda (H14: (eq K k0 k)).(let H15 \def
276 (eq_ind K k0 (\lambda (k1: K).(subst0 i v (THead k u1 t1) (THead k1 u2 t)))
277 H9 k H14) in (let H16 \def (eq_ind K k0 (\lambda (k1: K).(subst0 i v (THead k
278 u1 t1) (THead k1 u2 t))) H8 k H14) in (eq_ind_r K k (\lambda (k1: K).(or3
279 (ex2 T (\lambda (u3: T).(eq T (THead k1 u2 t) (THead k u3 t1))) (\lambda (u3:
280 T).(subst0 i v u1 u3))) (ex2 T (\lambda (t2: T).(eq T (THead k1 u2 t) (THead
281 k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda
282 (u3: T).(\lambda (t2: T).(eq T (THead k1 u2 t) (THead k u3 t2)))) (\lambda
283 (u3: T).(\lambda (_: T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2:
284 T).(subst0 (s k i) v t1 t2)))))) (let H17 \def (eq_ind T t (\lambda (t0:
285 T).(subst0 i v (THead k u1 t1) (THead k u2 t0))) H15 t1 H12) in (let H18 \def
286 (eq_ind T t (\lambda (t0: T).(subst0 i v (THead k u1 t1) (THead k u2 t0)))
287 H16 t1 H12) in (eq_ind_r T t1 (\lambda (t0: T).(or3 (ex2 T (\lambda (u3:
288 T).(eq T (THead k u2 t0) (THead k u3 t1))) (\lambda (u3: T).(subst0 i v u1
289 u3))) (ex2 T (\lambda (t2: T).(eq T (THead k u2 t0) (THead k u1 t2)))
290 (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda (u3:
291 T).(\lambda (t2: T).(eq T (THead k u2 t0) (THead k u3 t2)))) (\lambda (u3:
292 T).(\lambda (_: T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2:
293 T).(subst0 (s k i) v t1 t2)))))) (let H19 \def (eq_ind T u0 (\lambda (t0:
294 T).(subst0 i v t0 u2)) H7 u1 H13) in (or3_intro0 (ex2 T (\lambda (u3: T).(eq
295 T (THead k u2 t1) (THead k u3 t1))) (\lambda (u3: T).(subst0 i v u1 u3)))
296 (ex2 T (\lambda (t2: T).(eq T (THead k u2 t1) (THead k u1 t2))) (\lambda (t2:
297 T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda (u3: T).(\lambda (t2:
298 T).(eq T (THead k u2 t1) (THead k u3 t2)))) (\lambda (u3: T).(\lambda (_:
299 T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) v t1
300 t2)))) (ex_intro2 T (\lambda (u3: T).(eq T (THead k u2 t1) (THead k u3 t1)))
301 (\lambda (u3: T).(subst0 i v u1 u3)) u2 (refl_equal T (THead k u2 t1)) H19)))
302 t H12))) k0 H14)))))) H11)) H10)) x H4))))))))))))))))) (\lambda (H0: (subst0
303 i v (THead k u1 t1) x)).(\lambda (k0: K).(\lambda (v0: T).(\lambda (t0:
304 T).(\lambda (t3: T).(\lambda (i0: nat).(\lambda (u: T).(\lambda (H1: (eq nat
305 i0 i)).(\lambda (H2: (eq T v0 v)).(\lambda (H3: (eq T (THead k0 u t3) (THead
306 k u1 t1))).(\lambda (H4: (eq T (THead k0 u t0) x)).(\lambda (H5: (subst0 (s
307 k0 i0) v0 t3 t0)).(let H6 \def (eq_ind nat i0 (\lambda (n: nat).(subst0 (s k0
308 n) v0 t3 t0)) H5 i H1) in (let H7 \def (eq_ind T v0 (\lambda (t: T).(subst0
309 (s k0 i) t t3 t0)) H6 v H2) in (let H8 \def (eq_ind_r T x (\lambda (t:
310 T).(subst0 i v (THead k u1 t1) t)) H0 (THead k0 u t0) H4) in (let H9 \def
311 (eq_ind_r T x (\lambda (t: T).(subst0 i v (THead k u1 t1) t)) H (THead k0 u
312 t0) H4) in (eq_ind T (THead k0 u t0) (\lambda (t: T).(or3 (ex2 T (\lambda
313 (u2: T).(eq T t (THead k u2 t1))) (\lambda (u2: T).(subst0 i v u1 u2))) (ex2
314 T (\lambda (t2: T).(eq T t (THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i)
315 v t1 t2))) (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T t (THead k u2
316 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i v u1 u2))) (\lambda (_:
317 T).(\lambda (t2: T).(subst0 (s k i) v t1 t2)))))) (let H10 \def (f_equal T K
318 (\lambda (e: T).(match e in T return (\lambda (_: T).K) with [(TSort _)
319 \Rightarrow k0 | (TLRef _) \Rightarrow k0 | (THead k1 _ _) \Rightarrow k1]))
320 (THead k0 u t3) (THead k u1 t1) H3) in ((let H11 \def (f_equal T T (\lambda
321 (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u
322 | (TLRef _) \Rightarrow u | (THead _ t _) \Rightarrow t])) (THead k0 u t3)
323 (THead k u1 t1) H3) in ((let H12 \def (f_equal T T (\lambda (e: T).(match e
324 in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _)
325 \Rightarrow t3 | (THead _ _ t) \Rightarrow t])) (THead k0 u t3) (THead k u1
326 t1) H3) in (\lambda (H13: (eq T u u1)).(\lambda (H14: (eq K k0 k)).(let H15
327 \def (eq_ind T u (\lambda (t: T).(subst0 i v (THead k u1 t1) (THead k0 t
328 t0))) H9 u1 H13) in (let H16 \def (eq_ind T u (\lambda (t: T).(subst0 i v
329 (THead k u1 t1) (THead k0 t t0))) H8 u1 H13) in (eq_ind_r T u1 (\lambda (t:
330 T).(or3 (ex2 T (\lambda (u2: T).(eq T (THead k0 t t0) (THead k u2 t1)))
331 (\lambda (u2: T).(subst0 i v u1 u2))) (ex2 T (\lambda (t2: T).(eq T (THead k0
332 t t0) (THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T
333 T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead k0 t t0) (THead k u2 t2))))
334 (\lambda (u2: T).(\lambda (_: T).(subst0 i v u1 u2))) (\lambda (_:
335 T).(\lambda (t2: T).(subst0 (s k i) v t1 t2)))))) (let H17 \def (eq_ind T t3
336 (\lambda (t: T).(subst0 (s k0 i) v t t0)) H7 t1 H12) in (let H18 \def (eq_ind
337 K k0 (\lambda (k1: K).(subst0 i v (THead k u1 t1) (THead k1 u1 t0))) H15 k
338 H14) in (let H19 \def (eq_ind K k0 (\lambda (k1: K).(subst0 i v (THead k u1
339 t1) (THead k1 u1 t0))) H16 k H14) in (let H20 \def (eq_ind K k0 (\lambda (k1:
340 K).(subst0 (s k1 i) v t1 t0)) H17 k H14) in (eq_ind_r K k (\lambda (k1:
341 K).(or3 (ex2 T (\lambda (u2: T).(eq T (THead k1 u1 t0) (THead k u2 t1)))
342 (\lambda (u2: T).(subst0 i v u1 u2))) (ex2 T (\lambda (t2: T).(eq T (THead k1
343 u1 t0) (THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T
344 T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead k1 u1 t0) (THead k u2 t2))))
345 (\lambda (u2: T).(\lambda (_: T).(subst0 i v u1 u2))) (\lambda (_:
346 T).(\lambda (t2: T).(subst0 (s k i) v t1 t2)))))) (or3_intro1 (ex2 T (\lambda
347 (u2: T).(eq T (THead k u1 t0) (THead k u2 t1))) (\lambda (u2: T).(subst0 i v
348 u1 u2))) (ex2 T (\lambda (t2: T).(eq T (THead k u1 t0) (THead k u1 t2)))
349 (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda (u2:
350 T).(\lambda (t2: T).(eq T (THead k u1 t0) (THead k u2 t2)))) (\lambda (u2:
351 T).(\lambda (_: T).(subst0 i v u1 u2))) (\lambda (_: T).(\lambda (t2:
352 T).(subst0 (s k i) v t1 t2)))) (ex_intro2 T (\lambda (t2: T).(eq T (THead k
353 u1 t0) (THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2)) t0
354 (refl_equal T (THead k u1 t0)) H20)) k0 H14))))) u H13)))))) H11)) H10)) x
355 H4))))))))))))))))) (\lambda (H0: (subst0 i v (THead k u1 t1) x)).(\lambda
356 (v0: T).(\lambda (u0: T).(\lambda (u2: T).(\lambda (i0: nat).(\lambda (k0:
357 K).(\lambda (t0: T).(\lambda (t3: T).(\lambda (H2: (eq nat i0 i)).(\lambda
358 (H3: (eq T v0 v)).(\lambda (H4: (eq T (THead k0 u0 t0) (THead k u1
359 t1))).(\lambda (H5: (eq T (THead k0 u2 t3) x)).(\lambda (H1: (subst0 i0 v0 u0
360 u2)).(\lambda (H6: (subst0 (s k0 i0) v0 t0 t3)).(let H7 \def (eq_ind nat i0
361 (\lambda (n: nat).(subst0 (s k0 n) v0 t0 t3)) H6 i H2) in (let H8 \def
362 (eq_ind nat i0 (\lambda (n: nat).(subst0 n v0 u0 u2)) H1 i H2) in (let H9
363 \def (eq_ind T v0 (\lambda (t: T).(subst0 (s k0 i) t t0 t3)) H7 v H3) in (let
364 H10 \def (eq_ind T v0 (\lambda (t: T).(subst0 i t u0 u2)) H8 v H3) in (let
365 H11 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v (THead k u1 t1) t)) H0
366 (THead k0 u2 t3) H5) in (let H12 \def (eq_ind_r T x (\lambda (t: T).(subst0 i
367 v (THead k u1 t1) t)) H (THead k0 u2 t3) H5) in (eq_ind T (THead k0 u2 t3)
368 (\lambda (t: T).(or3 (ex2 T (\lambda (u3: T).(eq T t (THead k u3 t1)))
369 (\lambda (u3: T).(subst0 i v u1 u3))) (ex2 T (\lambda (t2: T).(eq T t (THead
370 k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda
371 (u3: T).(\lambda (t2: T).(eq T t (THead k u3 t2)))) (\lambda (u3: T).(\lambda
372 (_: T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i)
373 v t1 t2)))))) (let H13 \def (f_equal T K (\lambda (e: T).(match e in T return
374 (\lambda (_: T).K) with [(TSort _) \Rightarrow k0 | (TLRef _) \Rightarrow k0
375 | (THead k1 _ _) \Rightarrow k1])) (THead k0 u0 t0) (THead k u1 t1) H4) in
376 ((let H14 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_:
377 T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) \Rightarrow u0 | (THead _ t
378 _) \Rightarrow t])) (THead k0 u0 t0) (THead k u1 t1) H4) in ((let H15 \def
379 (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with
380 [(TSort _) \Rightarrow t0 | (TLRef _) \Rightarrow t0 | (THead _ _ t)
381 \Rightarrow t])) (THead k0 u0 t0) (THead k u1 t1) H4) in (\lambda (H16: (eq T
382 u0 u1)).(\lambda (H17: (eq K k0 k)).(let H18 \def (eq_ind T t0 (\lambda (t:
383 T).(subst0 (s k0 i) v t t3)) H9 t1 H15) in (let H19 \def (eq_ind K k0
384 (\lambda (k1: K).(subst0 i v (THead k u1 t1) (THead k1 u2 t3))) H12 k H17) in
385 (let H20 \def (eq_ind K k0 (\lambda (k1: K).(subst0 i v (THead k u1 t1)
386 (THead k1 u2 t3))) H11 k H17) in (let H21 \def (eq_ind K k0 (\lambda (k1:
387 K).(subst0 (s k1 i) v t1 t3)) H18 k H17) in (eq_ind_r K k (\lambda (k1:
388 K).(or3 (ex2 T (\lambda (u3: T).(eq T (THead k1 u2 t3) (THead k u3 t1)))
389 (\lambda (u3: T).(subst0 i v u1 u3))) (ex2 T (\lambda (t2: T).(eq T (THead k1
390 u2 t3) (THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T
391 T (\lambda (u3: T).(\lambda (t2: T).(eq T (THead k1 u2 t3) (THead k u3 t2))))
392 (\lambda (u3: T).(\lambda (_: T).(subst0 i v u1 u3))) (\lambda (_:
393 T).(\lambda (t2: T).(subst0 (s k i) v t1 t2)))))) (let H22 \def (eq_ind T u0
394 (\lambda (t: T).(subst0 i v t u2)) H10 u1 H16) in (or3_intro2 (ex2 T (\lambda
395 (u3: T).(eq T (THead k u2 t3) (THead k u3 t1))) (\lambda (u3: T).(subst0 i v
396 u1 u3))) (ex2 T (\lambda (t2: T).(eq T (THead k u2 t3) (THead k u1 t2)))
397 (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda (u3:
398 T).(\lambda (t2: T).(eq T (THead k u2 t3) (THead k u3 t2)))) (\lambda (u3:
399 T).(\lambda (_: T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2:
400 T).(subst0 (s k i) v t1 t2)))) (ex3_2_intro T T (\lambda (u3: T).(\lambda
401 (t2: T).(eq T (THead k u2 t3) (THead k u3 t2)))) (\lambda (u3: T).(\lambda
402 (_: T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i)
403 v t1 t2))) u2 t3 (refl_equal T (THead k u2 t3)) H22 H21))) k0 H17))))))))
404 H14)) H13)) x H5))))))))))))))))))))) H))))))).
406 theorem subst0_gen_lift_lt:
407 \forall (u: T).(\forall (t1: T).(\forall (x: T).(\forall (i: nat).(\forall
408 (h: nat).(\forall (d: nat).((subst0 i (lift h d u) (lift h (S (plus i d)) t1)
409 x) \to (ex2 T (\lambda (t2: T).(eq T x (lift h (S (plus i d)) t2))) (\lambda
410 (t2: T).(subst0 i u t1 t2)))))))))
412 \lambda (u: T).(\lambda (t1: T).(T_ind (\lambda (t: T).(\forall (x:
413 T).(\forall (i: nat).(\forall (h: nat).(\forall (d: nat).((subst0 i (lift h d
414 u) (lift h (S (plus i d)) t) x) \to (ex2 T (\lambda (t2: T).(eq T x (lift h
415 (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u t t2))))))))) (\lambda (n:
416 nat).(\lambda (x: T).(\lambda (i: nat).(\lambda (h: nat).(\lambda (d:
417 nat).(\lambda (H: (subst0 i (lift h d u) (lift h (S (plus i d)) (TSort n))
418 x)).(let H0 \def (eq_ind T (lift h (S (plus i d)) (TSort n)) (\lambda (t:
419 T).(subst0 i (lift h d u) t x)) H (TSort n) (lift_sort n h (S (plus i d))))
420 in (subst0_gen_sort (lift h d u) x i n H0 (ex2 T (\lambda (t2: T).(eq T x
421 (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (TSort n)
422 t2))))))))))) (\lambda (n: nat).(\lambda (x: T).(\lambda (i: nat).(\lambda
423 (h: nat).(\lambda (d: nat).(\lambda (H: (subst0 i (lift h d u) (lift h (S
424 (plus i d)) (TLRef n)) x)).(lt_le_e n (S (plus i d)) (ex2 T (\lambda (t2:
425 T).(eq T x (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (TLRef
426 n) t2))) (\lambda (H0: (lt n (S (plus i d)))).(let H1 \def (eq_ind T (lift h
427 (S (plus i d)) (TLRef n)) (\lambda (t: T).(subst0 i (lift h d u) t x)) H
428 (TLRef n) (lift_lref_lt n h (S (plus i d)) H0)) in (and_ind (eq nat n i) (eq
429 T x (lift (S n) O (lift h d u))) (ex2 T (\lambda (t2: T).(eq T x (lift h (S
430 (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (TLRef n) t2))) (\lambda (H2:
431 (eq nat n i)).(\lambda (H3: (eq T x (lift (S n) O (lift h d u)))).(eq_ind_r T
432 (lift (S n) O (lift h d u)) (\lambda (t: T).(ex2 T (\lambda (t2: T).(eq T t
433 (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (TLRef n) t2))))
434 (eq_ind_r nat i (\lambda (n0: nat).(ex2 T (\lambda (t2: T).(eq T (lift (S n0)
435 O (lift h d u)) (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u
436 (TLRef n0) t2)))) (eq_ind T (lift h (plus (S i) d) (lift (S i) O u)) (\lambda
437 (t: T).(ex2 T (\lambda (t2: T).(eq T t (lift h (S (plus i d)) t2))) (\lambda
438 (t2: T).(subst0 i u (TLRef i) t2)))) (ex_intro2 T (\lambda (t2: T).(eq T
439 (lift h (S (plus i d)) (lift (S i) O u)) (lift h (S (plus i d)) t2)))
440 (\lambda (t2: T).(subst0 i u (TLRef i) t2)) (lift (S i) O u) (refl_equal T
441 (lift h (S (plus i d)) (lift (S i) O u))) (subst0_lref u i)) (lift (S i) O
442 (lift h d u)) (lift_d u h (S i) d O (le_O_n d))) n H2) x H3)))
443 (subst0_gen_lref (lift h d u) x i n H1)))) (\lambda (H0: (le (S (plus i d))
444 n)).(let H1 \def (eq_ind T (lift h (S (plus i d)) (TLRef n)) (\lambda (t:
445 T).(subst0 i (lift h d u) t x)) H (TLRef (plus n h)) (lift_lref_ge n h (S
446 (plus i d)) H0)) in (and_ind (eq nat (plus n h) i) (eq T x (lift (S (plus n
447 h)) O (lift h d u))) (ex2 T (\lambda (t2: T).(eq T x (lift h (S (plus i d))
448 t2))) (\lambda (t2: T).(subst0 i u (TLRef n) t2))) (\lambda (H2: (eq nat
449 (plus n h) i)).(\lambda (_: (eq T x (lift (S (plus n h)) O (lift h d
450 u)))).(let H4 \def (eq_ind_r nat i (\lambda (n0: nat).(le (S (plus n0 d)) n))
451 H0 (plus n h) H2) in (le_false n (plus (plus n h) d) (ex2 T (\lambda (t2:
452 T).(eq T x (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (TLRef
453 n) t2))) (le_plus_trans n (plus n h) d (le_plus_l n h)) H4))))
454 (subst0_gen_lref (lift h d u) x i (plus n h) H1))))))))))) (\lambda (k:
455 K).(\lambda (t: T).(\lambda (H: ((\forall (x: T).(\forall (i: nat).(\forall
456 (h: nat).(\forall (d: nat).((subst0 i (lift h d u) (lift h (S (plus i d)) t)
457 x) \to (ex2 T (\lambda (t2: T).(eq T x (lift h (S (plus i d)) t2))) (\lambda
458 (t2: T).(subst0 i u t t2)))))))))).(\lambda (t0: T).(\lambda (H0: ((\forall
459 (x: T).(\forall (i: nat).(\forall (h: nat).(\forall (d: nat).((subst0 i (lift
460 h d u) (lift h (S (plus i d)) t0) x) \to (ex2 T (\lambda (t2: T).(eq T x
461 (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u t0
462 t2)))))))))).(\lambda (x: T).(\lambda (i: nat).(\lambda (h: nat).(\lambda (d:
463 nat).(\lambda (H1: (subst0 i (lift h d u) (lift h (S (plus i d)) (THead k t
464 t0)) x)).(let H2 \def (eq_ind T (lift h (S (plus i d)) (THead k t t0))
465 (\lambda (t2: T).(subst0 i (lift h d u) t2 x)) H1 (THead k (lift h (S (plus i
466 d)) t) (lift h (s k (S (plus i d))) t0)) (lift_head k t t0 h (S (plus i d))))
467 in (or3_ind (ex2 T (\lambda (u2: T).(eq T x (THead k u2 (lift h (s k (S (plus
468 i d))) t0)))) (\lambda (u2: T).(subst0 i (lift h d u) (lift h (S (plus i d))
469 t) u2))) (ex2 T (\lambda (t2: T).(eq T x (THead k (lift h (S (plus i d)) t)
470 t2))) (\lambda (t2: T).(subst0 (s k i) (lift h d u) (lift h (s k (S (plus i
471 d))) t0) t2))) (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead k
472 u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i (lift h d u) (lift h (S
473 (plus i d)) t) u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) (lift h
474 d u) (lift h (s k (S (plus i d))) t0) t2)))) (ex2 T (\lambda (t2: T).(eq T x
475 (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (THead k t t0)
476 t2))) (\lambda (H3: (ex2 T (\lambda (u2: T).(eq T x (THead k u2 (lift h (s k
477 (S (plus i d))) t0)))) (\lambda (u2: T).(subst0 i (lift h d u) (lift h (S
478 (plus i d)) t) u2)))).(ex2_ind T (\lambda (u2: T).(eq T x (THead k u2 (lift h
479 (s k (S (plus i d))) t0)))) (\lambda (u2: T).(subst0 i (lift h d u) (lift h
480 (S (plus i d)) t) u2)) (ex2 T (\lambda (t2: T).(eq T x (lift h (S (plus i d))
481 t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) t2))) (\lambda (x0:
482 T).(\lambda (H4: (eq T x (THead k x0 (lift h (s k (S (plus i d)))
483 t0)))).(\lambda (H5: (subst0 i (lift h d u) (lift h (S (plus i d)) t)
484 x0)).(eq_ind_r T (THead k x0 (lift h (s k (S (plus i d))) t0)) (\lambda (t2:
485 T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h (S (plus i d)) t3))) (\lambda
486 (t3: T).(subst0 i u (THead k t t0) t3)))) (ex2_ind T (\lambda (t2: T).(eq T
487 x0 (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u t t2)) (ex2 T
488 (\lambda (t2: T).(eq T (THead k x0 (lift h (s k (S (plus i d))) t0)) (lift h
489 (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) t2)))
490 (\lambda (x1: T).(\lambda (H6: (eq T x0 (lift h (S (plus i d)) x1))).(\lambda
491 (H7: (subst0 i u t x1)).(eq_ind_r T (lift h (S (plus i d)) x1) (\lambda (t2:
492 T).(ex2 T (\lambda (t3: T).(eq T (THead k t2 (lift h (s k (S (plus i d)))
493 t0)) (lift h (S (plus i d)) t3))) (\lambda (t3: T).(subst0 i u (THead k t t0)
494 t3)))) (eq_ind T (lift h (S (plus i d)) (THead k x1 t0)) (\lambda (t2:
495 T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h (S (plus i d)) t3))) (\lambda
496 (t3: T).(subst0 i u (THead k t t0) t3)))) (ex_intro2 T (\lambda (t2: T).(eq T
497 (lift h (S (plus i d)) (THead k x1 t0)) (lift h (S (plus i d)) t2))) (\lambda
498 (t2: T).(subst0 i u (THead k t t0) t2)) (THead k x1 t0) (refl_equal T (lift h
499 (S (plus i d)) (THead k x1 t0))) (subst0_fst u x1 t i H7 t0 k)) (THead k
500 (lift h (S (plus i d)) x1) (lift h (s k (S (plus i d))) t0)) (lift_head k x1
501 t0 h (S (plus i d)))) x0 H6)))) (H x0 i h d H5)) x H4)))) H3)) (\lambda (H3:
502 (ex2 T (\lambda (t2: T).(eq T x (THead k (lift h (S (plus i d)) t) t2)))
503 (\lambda (t2: T).(subst0 (s k i) (lift h d u) (lift h (s k (S (plus i d)))
504 t0) t2)))).(ex2_ind T (\lambda (t2: T).(eq T x (THead k (lift h (S (plus i
505 d)) t) t2))) (\lambda (t2: T).(subst0 (s k i) (lift h d u) (lift h (s k (S
506 (plus i d))) t0) t2)) (ex2 T (\lambda (t2: T).(eq T x (lift h (S (plus i d))
507 t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) t2))) (\lambda (x0:
508 T).(\lambda (H4: (eq T x (THead k (lift h (S (plus i d)) t) x0))).(\lambda
509 (H5: (subst0 (s k i) (lift h d u) (lift h (s k (S (plus i d))) t0)
510 x0)).(eq_ind_r T (THead k (lift h (S (plus i d)) t) x0) (\lambda (t2: T).(ex2
511 T (\lambda (t3: T).(eq T t2 (lift h (S (plus i d)) t3))) (\lambda (t3:
512 T).(subst0 i u (THead k t t0) t3)))) (let H6 \def (eq_ind nat (s k (S (plus i
513 d))) (\lambda (n: nat).(subst0 (s k i) (lift h d u) (lift h n t0) x0)) H5 (S
514 (s k (plus i d))) (s_S k (plus i d))) in (let H7 \def (eq_ind nat (s k (plus
515 i d)) (\lambda (n: nat).(subst0 (s k i) (lift h d u) (lift h (S n) t0) x0))
516 H6 (plus (s k i) d) (s_plus k i d)) in (ex2_ind T (\lambda (t2: T).(eq T x0
517 (lift h (S (plus (s k i) d)) t2))) (\lambda (t2: T).(subst0 (s k i) u t0 t2))
518 (ex2 T (\lambda (t2: T).(eq T (THead k (lift h (S (plus i d)) t) x0) (lift h
519 (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) t2)))
520 (\lambda (x1: T).(\lambda (H8: (eq T x0 (lift h (S (plus (s k i) d))
521 x1))).(\lambda (H9: (subst0 (s k i) u t0 x1)).(eq_ind_r T (lift h (S (plus (s
522 k i) d)) x1) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T (THead k (lift h
523 (S (plus i d)) t) t2) (lift h (S (plus i d)) t3))) (\lambda (t3: T).(subst0 i
524 u (THead k t t0) t3)))) (eq_ind nat (s k (plus i d)) (\lambda (n: nat).(ex2 T
525 (\lambda (t2: T).(eq T (THead k (lift h (S (plus i d)) t) (lift h (S n) x1))
526 (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (THead k t t0)
527 t2)))) (eq_ind nat (s k (S (plus i d))) (\lambda (n: nat).(ex2 T (\lambda
528 (t2: T).(eq T (THead k (lift h (S (plus i d)) t) (lift h n x1)) (lift h (S
529 (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) t2)))) (eq_ind
530 T (lift h (S (plus i d)) (THead k t x1)) (\lambda (t2: T).(ex2 T (\lambda
531 (t3: T).(eq T t2 (lift h (S (plus i d)) t3))) (\lambda (t3: T).(subst0 i u
532 (THead k t t0) t3)))) (ex_intro2 T (\lambda (t2: T).(eq T (lift h (S (plus i
533 d)) (THead k t x1)) (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u
534 (THead k t t0) t2)) (THead k t x1) (refl_equal T (lift h (S (plus i d))
535 (THead k t x1))) (subst0_snd k u x1 t0 i H9 t)) (THead k (lift h (S (plus i
536 d)) t) (lift h (s k (S (plus i d))) x1)) (lift_head k t x1 h (S (plus i d))))
537 (S (s k (plus i d))) (s_S k (plus i d))) (plus (s k i) d) (s_plus k i d)) x0
538 H8)))) (H0 x0 (s k i) h d H7)))) x H4)))) H3)) (\lambda (H3: (ex3_2 T T
539 (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead k u2 t2)))) (\lambda (u2:
540 T).(\lambda (_: T).(subst0 i (lift h d u) (lift h (S (plus i d)) t) u2)))
541 (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) (lift h d u) (lift h (s k (S
542 (plus i d))) t0) t2))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t2: T).(eq
543 T x (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i (lift h d
544 u) (lift h (S (plus i d)) t) u2))) (\lambda (_: T).(\lambda (t2: T).(subst0
545 (s k i) (lift h d u) (lift h (s k (S (plus i d))) t0) t2))) (ex2 T (\lambda
546 (t2: T).(eq T x (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u
547 (THead k t t0) t2))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H4: (eq T x
548 (THead k x0 x1))).(\lambda (H5: (subst0 i (lift h d u) (lift h (S (plus i d))
549 t) x0)).(\lambda (H6: (subst0 (s k i) (lift h d u) (lift h (s k (S (plus i
550 d))) t0) x1)).(eq_ind_r T (THead k x0 x1) (\lambda (t2: T).(ex2 T (\lambda
551 (t3: T).(eq T t2 (lift h (S (plus i d)) t3))) (\lambda (t3: T).(subst0 i u
552 (THead k t t0) t3)))) (let H7 \def (eq_ind nat (s k (S (plus i d))) (\lambda
553 (n: nat).(subst0 (s k i) (lift h d u) (lift h n t0) x1)) H6 (S (s k (plus i
554 d))) (s_S k (plus i d))) in (let H8 \def (eq_ind nat (s k (plus i d))
555 (\lambda (n: nat).(subst0 (s k i) (lift h d u) (lift h (S n) t0) x1)) H7
556 (plus (s k i) d) (s_plus k i d)) in (ex2_ind T (\lambda (t2: T).(eq T x1
557 (lift h (S (plus (s k i) d)) t2))) (\lambda (t2: T).(subst0 (s k i) u t0 t2))
558 (ex2 T (\lambda (t2: T).(eq T (THead k x0 x1) (lift h (S (plus i d)) t2)))
559 (\lambda (t2: T).(subst0 i u (THead k t t0) t2))) (\lambda (x2: T).(\lambda
560 (H9: (eq T x1 (lift h (S (plus (s k i) d)) x2))).(\lambda (H10: (subst0 (s k
561 i) u t0 x2)).(ex2_ind T (\lambda (t2: T).(eq T x0 (lift h (S (plus i d))
562 t2))) (\lambda (t2: T).(subst0 i u t t2)) (ex2 T (\lambda (t2: T).(eq T
563 (THead k x0 x1) (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u
564 (THead k t t0) t2))) (\lambda (x3: T).(\lambda (H11: (eq T x0 (lift h (S
565 (plus i d)) x3))).(\lambda (H12: (subst0 i u t x3)).(eq_ind_r T (lift h (S
566 (plus i d)) x3) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T (THead k t2
567 x1) (lift h (S (plus i d)) t3))) (\lambda (t3: T).(subst0 i u (THead k t t0)
568 t3)))) (eq_ind_r T (lift h (S (plus (s k i) d)) x2) (\lambda (t2: T).(ex2 T
569 (\lambda (t3: T).(eq T (THead k (lift h (S (plus i d)) x3) t2) (lift h (S
570 (plus i d)) t3))) (\lambda (t3: T).(subst0 i u (THead k t t0) t3)))) (eq_ind
571 nat (s k (plus i d)) (\lambda (n: nat).(ex2 T (\lambda (t2: T).(eq T (THead k
572 (lift h (S (plus i d)) x3) (lift h (S n) x2)) (lift h (S (plus i d)) t2)))
573 (\lambda (t2: T).(subst0 i u (THead k t t0) t2)))) (eq_ind nat (s k (S (plus
574 i d))) (\lambda (n: nat).(ex2 T (\lambda (t2: T).(eq T (THead k (lift h (S
575 (plus i d)) x3) (lift h n x2)) (lift h (S (plus i d)) t2))) (\lambda (t2:
576 T).(subst0 i u (THead k t t0) t2)))) (eq_ind T (lift h (S (plus i d)) (THead
577 k x3 x2)) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h (S (plus
578 i d)) t3))) (\lambda (t3: T).(subst0 i u (THead k t t0) t3)))) (ex_intro2 T
579 (\lambda (t2: T).(eq T (lift h (S (plus i d)) (THead k x3 x2)) (lift h (S
580 (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) t2)) (THead k
581 x3 x2) (refl_equal T (lift h (S (plus i d)) (THead k x3 x2))) (subst0_both u
582 t x3 i H12 k t0 x2 H10)) (THead k (lift h (S (plus i d)) x3) (lift h (s k (S
583 (plus i d))) x2)) (lift_head k x3 x2 h (S (plus i d)))) (S (s k (plus i d)))
584 (s_S k (plus i d))) (plus (s k i) d) (s_plus k i d)) x1 H9) x0 H11)))) (H x0
585 i h d H5))))) (H0 x1 (s k i) h d H8)))) x H4)))))) H3)) (subst0_gen_head k
586 (lift h d u) (lift h (S (plus i d)) t) (lift h (s k (S (plus i d))) t0) x i
587 H2))))))))))))) t1)).
589 theorem subst0_gen_lift_false:
590 \forall (t: T).(\forall (u: T).(\forall (x: T).(\forall (h: nat).(\forall
591 (d: nat).(\forall (i: nat).((le d i) \to ((lt i (plus d h)) \to ((subst0 i u
592 (lift h d t) x) \to (\forall (P: Prop).P)))))))))
594 \lambda (t: T).(T_ind (\lambda (t0: T).(\forall (u: T).(\forall (x:
595 T).(\forall (h: nat).(\forall (d: nat).(\forall (i: nat).((le d i) \to ((lt i
596 (plus d h)) \to ((subst0 i u (lift h d t0) x) \to (\forall (P:
597 Prop).P)))))))))) (\lambda (n: nat).(\lambda (u: T).(\lambda (x: T).(\lambda
598 (h: nat).(\lambda (d: nat).(\lambda (i: nat).(\lambda (_: (le d i)).(\lambda
599 (_: (lt i (plus d h))).(\lambda (H1: (subst0 i u (lift h d (TSort n))
600 x)).(\lambda (P: Prop).(let H2 \def (eq_ind T (lift h d (TSort n)) (\lambda
601 (t0: T).(subst0 i u t0 x)) H1 (TSort n) (lift_sort n h d)) in
602 (subst0_gen_sort u x i n H2 P)))))))))))) (\lambda (n: nat).(\lambda (u:
603 T).(\lambda (x: T).(\lambda (h: nat).(\lambda (d: nat).(\lambda (i:
604 nat).(\lambda (H: (le d i)).(\lambda (H0: (lt i (plus d h))).(\lambda (H1:
605 (subst0 i u (lift h d (TLRef n)) x)).(\lambda (P: Prop).(lt_le_e n d P
606 (\lambda (H2: (lt n d)).(let H3 \def (eq_ind T (lift h d (TLRef n)) (\lambda
607 (t0: T).(subst0 i u t0 x)) H1 (TLRef n) (lift_lref_lt n h d H2)) in (and_ind
608 (eq nat n i) (eq T x (lift (S n) O u)) P (\lambda (H4: (eq nat n i)).(\lambda
609 (_: (eq T x (lift (S n) O u))).(let H6 \def (eq_ind nat n (\lambda (n0:
610 nat).(lt n0 d)) H2 i H4) in (le_false d i P H H6)))) (subst0_gen_lref u x i n
611 H3)))) (\lambda (H2: (le d n)).(let H3 \def (eq_ind T (lift h d (TLRef n))
612 (\lambda (t0: T).(subst0 i u t0 x)) H1 (TLRef (plus n h)) (lift_lref_ge n h d
613 H2)) in (and_ind (eq nat (plus n h) i) (eq T x (lift (S (plus n h)) O u)) P
614 (\lambda (H4: (eq nat (plus n h) i)).(\lambda (_: (eq T x (lift (S (plus n
615 h)) O u))).(let H6 \def (eq_ind_r nat i (\lambda (n0: nat).(lt n0 (plus d
616 h))) H0 (plus n h) H4) in (le_false d n P H2 (lt_le_S n d (simpl_lt_plus_r h
617 n d H6)))))) (subst0_gen_lref u x i (plus n h) H3))))))))))))))) (\lambda (k:
618 K).(\lambda (t0: T).(\lambda (H: ((\forall (u: T).(\forall (x: T).(\forall
619 (h: nat).(\forall (d: nat).(\forall (i: nat).((le d i) \to ((lt i (plus d h))
620 \to ((subst0 i u (lift h d t0) x) \to (\forall (P:
621 Prop).P))))))))))).(\lambda (t1: T).(\lambda (H0: ((\forall (u: T).(\forall
622 (x: T).(\forall (h: nat).(\forall (d: nat).(\forall (i: nat).((le d i) \to
623 ((lt i (plus d h)) \to ((subst0 i u (lift h d t1) x) \to (\forall (P:
624 Prop).P))))))))))).(\lambda (u: T).(\lambda (x: T).(\lambda (h: nat).(\lambda
625 (d: nat).(\lambda (i: nat).(\lambda (H1: (le d i)).(\lambda (H2: (lt i (plus
626 d h))).(\lambda (H3: (subst0 i u (lift h d (THead k t0 t1)) x)).(\lambda (P:
627 Prop).(let H4 \def (eq_ind T (lift h d (THead k t0 t1)) (\lambda (t2:
628 T).(subst0 i u t2 x)) H3 (THead k (lift h d t0) (lift h (s k d) t1))
629 (lift_head k t0 t1 h d)) in (or3_ind (ex2 T (\lambda (u2: T).(eq T x (THead k
630 u2 (lift h (s k d) t1)))) (\lambda (u2: T).(subst0 i u (lift h d t0) u2)))
631 (ex2 T (\lambda (t2: T).(eq T x (THead k (lift h d t0) t2))) (\lambda (t2:
632 T).(subst0 (s k i) u (lift h (s k d) t1) t2))) (ex3_2 T T (\lambda (u2:
633 T).(\lambda (t2: T).(eq T x (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_:
634 T).(subst0 i u (lift h d t0) u2))) (\lambda (_: T).(\lambda (t2: T).(subst0
635 (s k i) u (lift h (s k d) t1) t2)))) P (\lambda (H5: (ex2 T (\lambda (u2:
636 T).(eq T x (THead k u2 (lift h (s k d) t1)))) (\lambda (u2: T).(subst0 i u
637 (lift h d t0) u2)))).(ex2_ind T (\lambda (u2: T).(eq T x (THead k u2 (lift h
638 (s k d) t1)))) (\lambda (u2: T).(subst0 i u (lift h d t0) u2)) P (\lambda
639 (x0: T).(\lambda (_: (eq T x (THead k x0 (lift h (s k d) t1)))).(\lambda (H7:
640 (subst0 i u (lift h d t0) x0)).(H u x0 h d i H1 H2 H7 P)))) H5)) (\lambda
641 (H5: (ex2 T (\lambda (t2: T).(eq T x (THead k (lift h d t0) t2))) (\lambda
642 (t2: T).(subst0 (s k i) u (lift h (s k d) t1) t2)))).(ex2_ind T (\lambda (t2:
643 T).(eq T x (THead k (lift h d t0) t2))) (\lambda (t2: T).(subst0 (s k i) u
644 (lift h (s k d) t1) t2)) P (\lambda (x0: T).(\lambda (_: (eq T x (THead k
645 (lift h d t0) x0))).(\lambda (H7: (subst0 (s k i) u (lift h (s k d) t1)
646 x0)).(H0 u x0 h (s k d) (s k i) (s_le k d i H1) (eq_ind nat (s k (plus d h))
647 (\lambda (n: nat).(lt (s k i) n)) (lt_le_S (s k i) (s k (plus d h)) (s_lt k i
648 (plus d h) H2)) (plus (s k d) h) (s_plus k d h)) H7 P)))) H5)) (\lambda (H5:
649 (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead k u2 t2))))
650 (\lambda (u2: T).(\lambda (_: T).(subst0 i u (lift h d t0) u2))) (\lambda (_:
651 T).(\lambda (t2: T).(subst0 (s k i) u (lift h (s k d) t1) t2))))).(ex3_2_ind
652 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead k u2 t2)))) (\lambda
653 (u2: T).(\lambda (_: T).(subst0 i u (lift h d t0) u2))) (\lambda (_:
654 T).(\lambda (t2: T).(subst0 (s k i) u (lift h (s k d) t1) t2))) P (\lambda
655 (x0: T).(\lambda (x1: T).(\lambda (_: (eq T x (THead k x0 x1))).(\lambda (H7:
656 (subst0 i u (lift h d t0) x0)).(\lambda (_: (subst0 (s k i) u (lift h (s k d)
657 t1) x1)).(H u x0 h d i H1 H2 H7 P)))))) H5)) (subst0_gen_head k u (lift h d
658 t0) (lift h (s k d) t1) x i H4))))))))))))))))) t).
660 theorem subst0_gen_lift_ge:
661 \forall (u: T).(\forall (t1: T).(\forall (x: T).(\forall (i: nat).(\forall
662 (h: nat).(\forall (d: nat).((subst0 i u (lift h d t1) x) \to ((le (plus d h)
663 i) \to (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda (t2:
664 T).(subst0 (minus i h) u t1 t2))))))))))
666 \lambda (u: T).(\lambda (t1: T).(T_ind (\lambda (t: T).(\forall (x:
667 T).(\forall (i: nat).(\forall (h: nat).(\forall (d: nat).((subst0 i u (lift h
668 d t) x) \to ((le (plus d h) i) \to (ex2 T (\lambda (t2: T).(eq T x (lift h d
669 t2))) (\lambda (t2: T).(subst0 (minus i h) u t t2)))))))))) (\lambda (n:
670 nat).(\lambda (x: T).(\lambda (i: nat).(\lambda (h: nat).(\lambda (d:
671 nat).(\lambda (H: (subst0 i u (lift h d (TSort n)) x)).(\lambda (_: (le (plus
672 d h) i)).(let H1 \def (eq_ind T (lift h d (TSort n)) (\lambda (t: T).(subst0
673 i u t x)) H (TSort n) (lift_sort n h d)) in (subst0_gen_sort u x i n H1 (ex2
674 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda (t2: T).(subst0 (minus i
675 h) u (TSort n) t2)))))))))))) (\lambda (n: nat).(\lambda (x: T).(\lambda (i:
676 nat).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H: (subst0 i u (lift h d
677 (TLRef n)) x)).(\lambda (H0: (le (plus d h) i)).(lt_le_e n d (ex2 T (\lambda
678 (t2: T).(eq T x (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u (TLRef
679 n) t2))) (\lambda (H1: (lt n d)).(let H2 \def (eq_ind T (lift h d (TLRef n))
680 (\lambda (t: T).(subst0 i u t x)) H (TLRef n) (lift_lref_lt n h d H1)) in
681 (and_ind (eq nat n i) (eq T x (lift (S n) O u)) (ex2 T (\lambda (t2: T).(eq T
682 x (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u (TLRef n) t2)))
683 (\lambda (H3: (eq nat n i)).(\lambda (_: (eq T x (lift (S n) O u))).(let H5
684 \def (eq_ind nat n (\lambda (n0: nat).(lt n0 d)) H1 i H3) in (le_false (plus
685 d h) i (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda (t2:
686 T).(subst0 (minus i h) u (TLRef n) t2))) H0 (le_plus_trans (S i) d h H5)))))
687 (subst0_gen_lref u x i n H2)))) (\lambda (H1: (le d n)).(let H2 \def (eq_ind
688 T (lift h d (TLRef n)) (\lambda (t: T).(subst0 i u t x)) H (TLRef (plus n h))
689 (lift_lref_ge n h d H1)) in (and_ind (eq nat (plus n h) i) (eq T x (lift (S
690 (plus n h)) O u)) (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda
691 (t2: T).(subst0 (minus i h) u (TLRef n) t2))) (\lambda (H3: (eq nat (plus n
692 h) i)).(\lambda (H4: (eq T x (lift (S (plus n h)) O u))).(eq_ind nat (plus n
693 h) (\lambda (n0: nat).(ex2 T (\lambda (t2: T).(eq T x (lift h d t2)))
694 (\lambda (t2: T).(subst0 (minus n0 h) u (TLRef n) t2)))) (eq_ind_r T (lift (S
695 (plus n h)) O u) (\lambda (t: T).(ex2 T (\lambda (t2: T).(eq T t (lift h d
696 t2))) (\lambda (t2: T).(subst0 (minus (plus n h) h) u (TLRef n) t2))))
697 (eq_ind_r nat n (\lambda (n0: nat).(ex2 T (\lambda (t2: T).(eq T (lift (S
698 (plus n h)) O u) (lift h d t2))) (\lambda (t2: T).(subst0 n0 u (TLRef n)
699 t2)))) (ex_intro2 T (\lambda (t2: T).(eq T (lift (S (plus n h)) O u) (lift h
700 d t2))) (\lambda (t2: T).(subst0 n u (TLRef n) t2)) (lift (S n) O u)
701 (eq_ind_r T (lift (plus h (S n)) O u) (\lambda (t: T).(eq T (lift (S (plus n
702 h)) O u) t)) (eq_ind_r nat (plus h n) (\lambda (n0: nat).(eq T (lift (S n0) O
703 u) (lift (plus h (S n)) O u))) (eq_ind_r nat (plus h (S n)) (\lambda (n0:
704 nat).(eq T (lift n0 O u) (lift (plus h (S n)) O u))) (refl_equal T (lift
705 (plus h (S n)) O u)) (S (plus h n)) (plus_n_Sm h n)) (plus n h) (plus_comm n
706 h)) (lift h d (lift (S n) O u)) (lift_free u (S n) h O d (le_trans_plus_r O d
707 (plus O (S n)) (plus_le_compat O O d (S n) (le_n O) (le_S d n H1))) (le_O_n
708 d))) (subst0_lref u n)) (minus (plus n h) h) (minus_plus_r n h)) x H4) i
709 H3))) (subst0_gen_lref u x i (plus n h) H2)))))))))))) (\lambda (k:
710 K).(\lambda (t: T).(\lambda (H: ((\forall (x: T).(\forall (i: nat).(\forall
711 (h: nat).(\forall (d: nat).((subst0 i u (lift h d t) x) \to ((le (plus d h)
712 i) \to (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda (t2:
713 T).(subst0 (minus i h) u t t2))))))))))).(\lambda (t0: T).(\lambda (H0:
714 ((\forall (x: T).(\forall (i: nat).(\forall (h: nat).(\forall (d:
715 nat).((subst0 i u (lift h d t0) x) \to ((le (plus d h) i) \to (ex2 T (\lambda
716 (t2: T).(eq T x (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u t0
717 t2))))))))))).(\lambda (x: T).(\lambda (i: nat).(\lambda (h: nat).(\lambda
718 (d: nat).(\lambda (H1: (subst0 i u (lift h d (THead k t t0)) x)).(\lambda
719 (H2: (le (plus d h) i)).(let H3 \def (eq_ind T (lift h d (THead k t t0))
720 (\lambda (t2: T).(subst0 i u t2 x)) H1 (THead k (lift h d t) (lift h (s k d)
721 t0)) (lift_head k t t0 h d)) in (or3_ind (ex2 T (\lambda (u2: T).(eq T x
722 (THead k u2 (lift h (s k d) t0)))) (\lambda (u2: T).(subst0 i u (lift h d t)
723 u2))) (ex2 T (\lambda (t2: T).(eq T x (THead k (lift h d t) t2))) (\lambda
724 (t2: T).(subst0 (s k i) u (lift h (s k d) t0) t2))) (ex3_2 T T (\lambda (u2:
725 T).(\lambda (t2: T).(eq T x (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_:
726 T).(subst0 i u (lift h d t) u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s
727 k i) u (lift h (s k d) t0) t2)))) (ex2 T (\lambda (t2: T).(eq T x (lift h d
728 t2))) (\lambda (t2: T).(subst0 (minus i h) u (THead k t t0) t2))) (\lambda
729 (H4: (ex2 T (\lambda (u2: T).(eq T x (THead k u2 (lift h (s k d) t0))))
730 (\lambda (u2: T).(subst0 i u (lift h d t) u2)))).(ex2_ind T (\lambda (u2:
731 T).(eq T x (THead k u2 (lift h (s k d) t0)))) (\lambda (u2: T).(subst0 i u
732 (lift h d t) u2)) (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda
733 (t2: T).(subst0 (minus i h) u (THead k t t0) t2))) (\lambda (x0: T).(\lambda
734 (H5: (eq T x (THead k x0 (lift h (s k d) t0)))).(\lambda (H6: (subst0 i u
735 (lift h d t) x0)).(eq_ind_r T (THead k x0 (lift h (s k d) t0)) (\lambda (t2:
736 T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h d t3))) (\lambda (t3: T).(subst0
737 (minus i h) u (THead k t t0) t3)))) (ex2_ind T (\lambda (t2: T).(eq T x0
738 (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u t t2)) (ex2 T (\lambda
739 (t2: T).(eq T (THead k x0 (lift h (s k d) t0)) (lift h d t2))) (\lambda (t2:
740 T).(subst0 (minus i h) u (THead k t t0) t2))) (\lambda (x1: T).(\lambda (H7:
741 (eq T x0 (lift h d x1))).(\lambda (H8: (subst0 (minus i h) u t x1)).(eq_ind_r
742 T (lift h d x1) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T (THead k t2
743 (lift h (s k d) t0)) (lift h d t3))) (\lambda (t3: T).(subst0 (minus i h) u
744 (THead k t t0) t3)))) (eq_ind T (lift h d (THead k x1 t0)) (\lambda (t2:
745 T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h d t3))) (\lambda (t3: T).(subst0
746 (minus i h) u (THead k t t0) t3)))) (ex_intro2 T (\lambda (t2: T).(eq T (lift
747 h d (THead k x1 t0)) (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u
748 (THead k t t0) t2)) (THead k x1 t0) (refl_equal T (lift h d (THead k x1 t0)))
749 (subst0_fst u x1 t (minus i h) H8 t0 k)) (THead k (lift h d x1) (lift h (s k
750 d) t0)) (lift_head k x1 t0 h d)) x0 H7)))) (H x0 i h d H6 H2)) x H5)))) H4))
751 (\lambda (H4: (ex2 T (\lambda (t2: T).(eq T x (THead k (lift h d t) t2)))
752 (\lambda (t2: T).(subst0 (s k i) u (lift h (s k d) t0) t2)))).(ex2_ind T
753 (\lambda (t2: T).(eq T x (THead k (lift h d t) t2))) (\lambda (t2: T).(subst0
754 (s k i) u (lift h (s k d) t0) t2)) (ex2 T (\lambda (t2: T).(eq T x (lift h d
755 t2))) (\lambda (t2: T).(subst0 (minus i h) u (THead k t t0) t2))) (\lambda
756 (x0: T).(\lambda (H5: (eq T x (THead k (lift h d t) x0))).(\lambda (H6:
757 (subst0 (s k i) u (lift h (s k d) t0) x0)).(eq_ind_r T (THead k (lift h d t)
758 x0) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h d t3)))
759 (\lambda (t3: T).(subst0 (minus i h) u (THead k t t0) t3)))) (ex2_ind T
760 (\lambda (t2: T).(eq T x0 (lift h (s k d) t2))) (\lambda (t2: T).(subst0
761 (minus (s k i) h) u t0 t2)) (ex2 T (\lambda (t2: T).(eq T (THead k (lift h d
762 t) x0) (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u (THead k t t0)
763 t2))) (\lambda (x1: T).(\lambda (H7: (eq T x0 (lift h (s k d) x1))).(\lambda
764 (H8: (subst0 (minus (s k i) h) u t0 x1)).(eq_ind_r T (lift h (s k d) x1)
765 (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T (THead k (lift h d t) t2)
766 (lift h d t3))) (\lambda (t3: T).(subst0 (minus i h) u (THead k t t0) t3))))
767 (eq_ind T (lift h d (THead k t x1)) (\lambda (t2: T).(ex2 T (\lambda (t3:
768 T).(eq T t2 (lift h d t3))) (\lambda (t3: T).(subst0 (minus i h) u (THead k t
769 t0) t3)))) (let H9 \def (eq_ind_r nat (minus (s k i) h) (\lambda (n:
770 nat).(subst0 n u t0 x1)) H8 (s k (minus i h)) (s_minus k i h (le_trans_plus_r
771 d h i H2))) in (ex_intro2 T (\lambda (t2: T).(eq T (lift h d (THead k t x1))
772 (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u (THead k t t0) t2))
773 (THead k t x1) (refl_equal T (lift h d (THead k t x1))) (subst0_snd k u x1 t0
774 (minus i h) H9 t))) (THead k (lift h d t) (lift h (s k d) x1)) (lift_head k t
775 x1 h d)) x0 H7)))) (H0 x0 (s k i) h (s k d) H6 (eq_ind nat (s k (plus d h))
776 (\lambda (n: nat).(le n (s k i))) (s_le k (plus d h) i H2) (plus (s k d) h)
777 (s_plus k d h)))) x H5)))) H4)) (\lambda (H4: (ex3_2 T T (\lambda (u2:
778 T).(\lambda (t2: T).(eq T x (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_:
779 T).(subst0 i u (lift h d t) u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s
780 k i) u (lift h (s k d) t0) t2))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda
781 (t2: T).(eq T x (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i
782 u (lift h d t) u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) u (lift
783 h (s k d) t0) t2))) (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda
784 (t2: T).(subst0 (minus i h) u (THead k t t0) t2))) (\lambda (x0: T).(\lambda
785 (x1: T).(\lambda (H5: (eq T x (THead k x0 x1))).(\lambda (H6: (subst0 i u
786 (lift h d t) x0)).(\lambda (H7: (subst0 (s k i) u (lift h (s k d) t0)
787 x1)).(eq_ind_r T (THead k x0 x1) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq
788 T t2 (lift h d t3))) (\lambda (t3: T).(subst0 (minus i h) u (THead k t t0)
789 t3)))) (ex2_ind T (\lambda (t2: T).(eq T x1 (lift h (s k d) t2))) (\lambda
790 (t2: T).(subst0 (minus (s k i) h) u t0 t2)) (ex2 T (\lambda (t2: T).(eq T
791 (THead k x0 x1) (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u (THead
792 k t t0) t2))) (\lambda (x2: T).(\lambda (H8: (eq T x1 (lift h (s k d)
793 x2))).(\lambda (H9: (subst0 (minus (s k i) h) u t0 x2)).(ex2_ind T (\lambda
794 (t2: T).(eq T x0 (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u t
795 t2)) (ex2 T (\lambda (t2: T).(eq T (THead k x0 x1) (lift h d t2))) (\lambda
796 (t2: T).(subst0 (minus i h) u (THead k t t0) t2))) (\lambda (x3: T).(\lambda
797 (H10: (eq T x0 (lift h d x3))).(\lambda (H11: (subst0 (minus i h) u t
798 x3)).(eq_ind_r T (lift h d x3) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T
799 (THead k t2 x1) (lift h d t3))) (\lambda (t3: T).(subst0 (minus i h) u (THead
800 k t t0) t3)))) (eq_ind_r T (lift h (s k d) x2) (\lambda (t2: T).(ex2 T
801 (\lambda (t3: T).(eq T (THead k (lift h d x3) t2) (lift h d t3))) (\lambda
802 (t3: T).(subst0 (minus i h) u (THead k t t0) t3)))) (eq_ind T (lift h d
803 (THead k x3 x2)) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h d
804 t3))) (\lambda (t3: T).(subst0 (minus i h) u (THead k t t0) t3)))) (let H12
805 \def (eq_ind_r nat (minus (s k i) h) (\lambda (n: nat).(subst0 n u t0 x2)) H9
806 (s k (minus i h)) (s_minus k i h (le_trans_plus_r d h i H2))) in (ex_intro2 T
807 (\lambda (t2: T).(eq T (lift h d (THead k x3 x2)) (lift h d t2))) (\lambda
808 (t2: T).(subst0 (minus i h) u (THead k t t0) t2)) (THead k x3 x2) (refl_equal
809 T (lift h d (THead k x3 x2))) (subst0_both u t x3 (minus i h) H11 k t0 x2
810 H12))) (THead k (lift h d x3) (lift h (s k d) x2)) (lift_head k x3 x2 h d))
811 x1 H8) x0 H10)))) (H x0 i h d H6 H2))))) (H0 x1 (s k i) h (s k d) H7 (eq_ind
812 nat (s k (plus d h)) (\lambda (n: nat).(le n (s k i))) (s_le k (plus d h) i
813 H2) (plus (s k d) h) (s_plus k d h)))) x H5)))))) H4)) (subst0_gen_head k u
814 (lift h d t) (lift h (s k d) t0) x i H3)))))))))))))) t1)).