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