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/fwd.ma".
20 \forall (u: T).(\forall (t: T).(\forall (d: nat).((subst0 d u t t) \to
21 (\forall (P: Prop).P))))
23 \lambda (u: T).(\lambda (t: T).(T_ind (\lambda (t0: T).(\forall (d:
24 nat).((subst0 d u t0 t0) \to (\forall (P: Prop).P)))) (\lambda (n:
25 nat).(\lambda (d: nat).(\lambda (H: (subst0 d u (TSort n) (TSort
26 n))).(\lambda (P: Prop).(subst0_gen_sort u (TSort n) d n H P))))) (\lambda
27 (n: nat).(\lambda (d: nat).(\lambda (H: (subst0 d u (TLRef n) (TLRef
28 n))).(\lambda (P: Prop).(land_ind (eq nat n d) (eq T (TLRef n) (lift (S n) O
29 u)) P (\lambda (_: (eq nat n d)).(\lambda (H1: (eq T (TLRef n) (lift (S n) O
30 u))).(lift_gen_lref_false (S n) O n (le_O_n n) (le_n (plus O (S n))) u H1
31 P))) (subst0_gen_lref u (TLRef n) d n H)))))) (\lambda (k: K).(\lambda (t0:
32 T).(\lambda (H: ((\forall (d: nat).((subst0 d u t0 t0) \to (\forall (P:
33 Prop).P))))).(\lambda (t1: T).(\lambda (H0: ((\forall (d: nat).((subst0 d u
34 t1 t1) \to (\forall (P: Prop).P))))).(\lambda (d: nat).(\lambda (H1: (subst0
35 d u (THead k t0 t1) (THead k t0 t1))).(\lambda (P: Prop).(or3_ind (ex2 T
36 (\lambda (u2: T).(eq T (THead k t0 t1) (THead k u2 t1))) (\lambda (u2:
37 T).(subst0 d u t0 u2))) (ex2 T (\lambda (t2: T).(eq T (THead k t0 t1) (THead
38 k t0 t2))) (\lambda (t2: T).(subst0 (s k d) u t1 t2))) (ex3_2 T T (\lambda
39 (u2: T).(\lambda (t2: T).(eq T (THead k t0 t1) (THead k u2 t2)))) (\lambda
40 (u2: T).(\lambda (_: T).(subst0 d u t0 u2))) (\lambda (_: T).(\lambda (t2:
41 T).(subst0 (s k d) u t1 t2)))) P (\lambda (H2: (ex2 T (\lambda (u2: T).(eq T
42 (THead k t0 t1) (THead k u2 t1))) (\lambda (u2: T).(subst0 d u t0
43 u2)))).(ex2_ind T (\lambda (u2: T).(eq T (THead k t0 t1) (THead k u2 t1)))
44 (\lambda (u2: T).(subst0 d u t0 u2)) P (\lambda (x: T).(\lambda (H3: (eq T
45 (THead k t0 t1) (THead k x t1))).(\lambda (H4: (subst0 d u t0 x)).(let H5
46 \def (f_equal T T (\lambda (e: T).(match e with [(TSort _) \Rightarrow t0 |
47 (TLRef _) \Rightarrow t0 | (THead _ t2 _) \Rightarrow t2])) (THead k t0 t1)
48 (THead k x t1) H3) in (let H6 \def (eq_ind_r T x (\lambda (t2: T).(subst0 d u
49 t0 t2)) H4 t0 H5) in (H d H6 P)))))) H2)) (\lambda (H2: (ex2 T (\lambda (t2:
50 T).(eq T (THead k t0 t1) (THead k t0 t2))) (\lambda (t2: T).(subst0 (s k d) u
51 t1 t2)))).(ex2_ind T (\lambda (t2: T).(eq T (THead k t0 t1) (THead k t0 t2)))
52 (\lambda (t2: T).(subst0 (s k d) u t1 t2)) P (\lambda (x: T).(\lambda (H3:
53 (eq T (THead k t0 t1) (THead k t0 x))).(\lambda (H4: (subst0 (s k d) u t1
54 x)).(let H5 \def (f_equal T T (\lambda (e: T).(match e with [(TSort _)
55 \Rightarrow t1 | (TLRef _) \Rightarrow t1 | (THead _ _ t2) \Rightarrow t2]))
56 (THead k t0 t1) (THead k t0 x) H3) in (let H6 \def (eq_ind_r T x (\lambda
57 (t2: T).(subst0 (s k d) u t1 t2)) H4 t1 H5) in (H0 (s k d) H6 P)))))) H2))
58 (\lambda (H2: (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead k t0
59 t1) (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 d u t0 u2)))
60 (\lambda (_: T).(\lambda (t2: T).(subst0 (s k d) u t1 t2))))).(ex3_2_ind T T
61 (\lambda (u2: T).(\lambda (t2: T).(eq T (THead k t0 t1) (THead k u2 t2))))
62 (\lambda (u2: T).(\lambda (_: T).(subst0 d u t0 u2))) (\lambda (_:
63 T).(\lambda (t2: T).(subst0 (s k d) u t1 t2))) P (\lambda (x0: T).(\lambda
64 (x1: T).(\lambda (H3: (eq T (THead k t0 t1) (THead k x0 x1))).(\lambda (H4:
65 (subst0 d u t0 x0)).(\lambda (H5: (subst0 (s k d) u t1 x1)).(let H6 \def
66 (f_equal T T (\lambda (e: T).(match e with [(TSort _) \Rightarrow t0 | (TLRef
67 _) \Rightarrow t0 | (THead _ t2 _) \Rightarrow t2])) (THead k t0 t1) (THead k
68 x0 x1) H3) in ((let H7 \def (f_equal T T (\lambda (e: T).(match e with
69 [(TSort _) \Rightarrow t1 | (TLRef _) \Rightarrow t1 | (THead _ _ t2)
70 \Rightarrow t2])) (THead k t0 t1) (THead k x0 x1) H3) in (\lambda (H8: (eq T
71 t0 x0)).(let H9 \def (eq_ind_r T x1 (\lambda (t2: T).(subst0 (s k d) u t1
72 t2)) H5 t1 H7) in (let H10 \def (eq_ind_r T x0 (\lambda (t2: T).(subst0 d u
73 t0 t2)) H4 t0 H8) in (H d H10 P))))) H6))))))) H2)) (subst0_gen_head k u t0
74 t1 (THead k t0 t1) d H1)))))))))) t)).
77 \forall (t1: T).(\forall (t2: T).(\forall (u: T).(\forall (i: nat).((subst0
78 i u t1 t2) \to (\forall (d: nat).((lt i d) \to (\forall (h: nat).(subst0 i
79 (lift h (minus d (S i)) u) (lift h d t1) (lift h d t2)))))))))
81 \lambda (t1: T).(\lambda (t2: T).(\lambda (u: T).(\lambda (i: nat).(\lambda
82 (H: (subst0 i u t1 t2)).(subst0_ind (\lambda (n: nat).(\lambda (t:
83 T).(\lambda (t0: T).(\lambda (t3: T).(\forall (d: nat).((lt n d) \to (\forall
84 (h: nat).(subst0 n (lift h (minus d (S n)) t) (lift h d t0) (lift h d
85 t3))))))))) (\lambda (v: T).(\lambda (i0: nat).(\lambda (d: nat).(\lambda
86 (H0: (lt i0 d)).(\lambda (h: nat).(eq_ind_r T (TLRef i0) (\lambda (t:
87 T).(subst0 i0 (lift h (minus d (S i0)) v) t (lift h d (lift (S i0) O v))))
88 (let w \def (minus d (S i0)) in (eq_ind nat (plus (S i0) (minus d (S i0)))
89 (\lambda (n: nat).(subst0 i0 (lift h w v) (TLRef i0) (lift h n (lift (S i0) O
90 v)))) (eq_ind_r T (lift (S i0) O (lift h (minus d (S i0)) v)) (\lambda (t:
91 T).(subst0 i0 (lift h w v) (TLRef i0) t)) (subst0_lref (lift h (minus d (S
92 i0)) v) i0) (lift h (plus (S i0) (minus d (S i0))) (lift (S i0) O v)) (lift_d
93 v h (S i0) (minus d (S i0)) O (le_O_n (minus d (S i0))))) d (le_plus_minus_r
94 (S i0) d H0))) (lift h d (TLRef i0)) (lift_lref_lt i0 h d H0))))))) (\lambda
95 (v: T).(\lambda (u2: T).(\lambda (u1: T).(\lambda (i0: nat).(\lambda (_:
96 (subst0 i0 v u1 u2)).(\lambda (H1: ((\forall (d: nat).((lt i0 d) \to (\forall
97 (h: nat).(subst0 i0 (lift h (minus d (S i0)) v) (lift h d u1) (lift h d
98 u2))))))).(\lambda (t: T).(\lambda (k: K).(\lambda (d: nat).(\lambda (H2: (lt
99 i0 d)).(\lambda (h: nat).(eq_ind_r T (THead k (lift h d u1) (lift h (s k d)
100 t)) (\lambda (t0: T).(subst0 i0 (lift h (minus d (S i0)) v) t0 (lift h d
101 (THead k u2 t)))) (eq_ind_r T (THead k (lift h d u2) (lift h (s k d) t))
102 (\lambda (t0: T).(subst0 i0 (lift h (minus d (S i0)) v) (THead k (lift h d
103 u1) (lift h (s k d) t)) t0)) (subst0_fst (lift h (minus d (S i0)) v) (lift h
104 d u2) (lift h d u1) i0 (H1 d H2 h) (lift h (s k d) t) k) (lift h d (THead k
105 u2 t)) (lift_head k u2 t h d)) (lift h d (THead k u1 t)) (lift_head k u1 t h
106 d))))))))))))) (\lambda (k: K).(\lambda (v: T).(\lambda (t0: T).(\lambda (t3:
107 T).(\lambda (i0: nat).(\lambda (_: (subst0 (s k i0) v t3 t0)).(\lambda (H1:
108 ((\forall (d: nat).((lt (s k i0) d) \to (\forall (h: nat).(subst0 (s k i0)
109 (lift h (minus d (S (s k i0))) v) (lift h d t3) (lift h d t0))))))).(\lambda
110 (u0: T).(\lambda (d: nat).(\lambda (H2: (lt i0 d)).(\lambda (h: nat).(let H3
111 \def (eq_ind_r nat (S (s k i0)) (\lambda (n: nat).(\forall (d0: nat).((lt (s
112 k i0) d0) \to (\forall (h0: nat).(subst0 (s k i0) (lift h0 (minus d0 n) v)
113 (lift h0 d0 t3) (lift h0 d0 t0)))))) H1 (s k (S i0)) (s_S k i0)) in (eq_ind_r
114 T (THead k (lift h d u0) (lift h (s k d) t3)) (\lambda (t: T).(subst0 i0
115 (lift h (minus d (S i0)) v) t (lift h d (THead k u0 t0)))) (eq_ind_r T (THead
116 k (lift h d u0) (lift h (s k d) t0)) (\lambda (t: T).(subst0 i0 (lift h
117 (minus d (S i0)) v) (THead k (lift h d u0) (lift h (s k d) t3)) t)) (eq_ind
118 nat (minus (s k d) (s k (S i0))) (\lambda (n: nat).(subst0 i0 (lift h n v)
119 (THead k (lift h d u0) (lift h (s k d) t3)) (THead k (lift h d u0) (lift h (s
120 k d) t0)))) (subst0_snd k (lift h (minus (s k d) (s k (S i0))) v) (lift h (s
121 k d) t0) (lift h (s k d) t3) i0 (H3 (s k d) (s_lt k i0 d H2) h) (lift h d
122 u0)) (minus d (S i0)) (minus_s_s k d (S i0))) (lift h d (THead k u0 t0))
123 (lift_head k u0 t0 h d)) (lift h d (THead k u0 t3)) (lift_head k u0 t3 h
124 d)))))))))))))) (\lambda (v: T).(\lambda (u1: T).(\lambda (u2: T).(\lambda
125 (i0: nat).(\lambda (_: (subst0 i0 v u1 u2)).(\lambda (H1: ((\forall (d:
126 nat).((lt i0 d) \to (\forall (h: nat).(subst0 i0 (lift h (minus d (S i0)) v)
127 (lift h d u1) (lift h d u2))))))).(\lambda (k: K).(\lambda (t0: T).(\lambda
128 (t3: T).(\lambda (_: (subst0 (s k i0) v t0 t3)).(\lambda (H3: ((\forall (d:
129 nat).((lt (s k i0) d) \to (\forall (h: nat).(subst0 (s k i0) (lift h (minus d
130 (S (s k i0))) v) (lift h d t0) (lift h d t3))))))).(\lambda (d: nat).(\lambda
131 (H4: (lt i0 d)).(\lambda (h: nat).(let H5 \def (eq_ind_r nat (S (s k i0))
132 (\lambda (n: nat).(\forall (d0: nat).((lt (s k i0) d0) \to (\forall (h0:
133 nat).(subst0 (s k i0) (lift h0 (minus d0 n) v) (lift h0 d0 t0) (lift h0 d0
134 t3)))))) H3 (s k (S i0)) (s_S k i0)) in (eq_ind_r T (THead k (lift h d u1)
135 (lift h (s k d) t0)) (\lambda (t: T).(subst0 i0 (lift h (minus d (S i0)) v) t
136 (lift h d (THead k u2 t3)))) (eq_ind_r T (THead k (lift h d u2) (lift h (s k
137 d) t3)) (\lambda (t: T).(subst0 i0 (lift h (minus d (S i0)) v) (THead k (lift
138 h d u1) (lift h (s k d) t0)) t)) (subst0_both (lift h (minus d (S i0)) v)
139 (lift h d u1) (lift h d u2) i0 (H1 d H4 h) k (lift h (s k d) t0) (lift h (s k
140 d) t3) (eq_ind nat (minus (s k d) (s k (S i0))) (\lambda (n: nat).(subst0 (s
141 k i0) (lift h n v) (lift h (s k d) t0) (lift h (s k d) t3))) (H5 (s k d)
142 (s_lt k i0 d H4) h) (minus d (S i0)) (minus_s_s k d (S i0)))) (lift h d
143 (THead k u2 t3)) (lift_head k u2 t3 h d)) (lift h d (THead k u1 t0))
144 (lift_head k u1 t0 h d))))))))))))))))) i u t1 t2 H))))).
146 lemma subst0_lift_ge:
147 \forall (t1: T).(\forall (t2: T).(\forall (u: T).(\forall (i: nat).(\forall
148 (h: nat).((subst0 i u t1 t2) \to (\forall (d: nat).((le d i) \to (subst0
149 (plus i h) u (lift h d t1) (lift h d t2)))))))))
151 \lambda (t1: T).(\lambda (t2: T).(\lambda (u: T).(\lambda (i: nat).(\lambda
152 (h: nat).(\lambda (H: (subst0 i u t1 t2)).(subst0_ind (\lambda (n:
153 nat).(\lambda (t: T).(\lambda (t0: T).(\lambda (t3: T).(\forall (d: nat).((le
154 d n) \to (subst0 (plus n h) t (lift h d t0) (lift h d t3)))))))) (\lambda (v:
155 T).(\lambda (i0: nat).(\lambda (d: nat).(\lambda (H0: (le d i0)).(eq_ind_r T
156 (TLRef (plus i0 h)) (\lambda (t: T).(subst0 (plus i0 h) v t (lift h d (lift
157 (S i0) O v)))) (eq_ind_r T (lift (plus h (S i0)) O v) (\lambda (t: T).(subst0
158 (plus i0 h) v (TLRef (plus i0 h)) t)) (eq_ind nat (S (plus h i0)) (\lambda
159 (n: nat).(subst0 (plus i0 h) v (TLRef (plus i0 h)) (lift n O v))) (eq_ind_r
160 nat (plus h i0) (\lambda (n: nat).(subst0 n v (TLRef n) (lift (S (plus h i0))
161 O v))) (subst0_lref v (plus h i0)) (plus i0 h) (plus_sym i0 h)) (plus h (S
162 i0)) (plus_n_Sm h i0)) (lift h d (lift (S i0) O v)) (lift_free v (S i0) h O d
163 (le_S d i0 H0) (le_O_n d))) (lift h d (TLRef i0)) (lift_lref_ge i0 h d
164 H0)))))) (\lambda (v: T).(\lambda (u2: T).(\lambda (u1: T).(\lambda (i0:
165 nat).(\lambda (_: (subst0 i0 v u1 u2)).(\lambda (H1: ((\forall (d: nat).((le
166 d i0) \to (subst0 (plus i0 h) v (lift h d u1) (lift h d u2)))))).(\lambda (t:
167 T).(\lambda (k: K).(\lambda (d: nat).(\lambda (H2: (le d i0)).(eq_ind_r T
168 (THead k (lift h d u1) (lift h (s k d) t)) (\lambda (t0: T).(subst0 (plus i0
169 h) v t0 (lift h d (THead k u2 t)))) (eq_ind_r T (THead k (lift h d u2) (lift
170 h (s k d) t)) (\lambda (t0: T).(subst0 (plus i0 h) v (THead k (lift h d u1)
171 (lift h (s k d) t)) t0)) (subst0_fst v (lift h d u2) (lift h d u1) (plus i0
172 h) (H1 d H2) (lift h (s k d) t) k) (lift h d (THead k u2 t)) (lift_head k u2
173 t h d)) (lift h d (THead k u1 t)) (lift_head k u1 t h d)))))))))))) (\lambda
174 (k: K).(\lambda (v: T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (i0:
175 nat).(\lambda (_: (subst0 (s k i0) v t3 t0)).(\lambda (H1: ((\forall (d:
176 nat).((le d (s k i0)) \to (subst0 (plus (s k i0) h) v (lift h d t3) (lift h d
177 t0)))))).(\lambda (u0: T).(\lambda (d: nat).(\lambda (H2: (le d i0)).(let H3
178 \def (eq_ind_r nat (plus (s k i0) h) (\lambda (n: nat).(\forall (d0:
179 nat).((le d0 (s k i0)) \to (subst0 n v (lift h d0 t3) (lift h d0 t0))))) H1
180 (s k (plus i0 h)) (s_plus k i0 h)) in (eq_ind_r T (THead k (lift h d u0)
181 (lift h (s k d) t3)) (\lambda (t: T).(subst0 (plus i0 h) v t (lift h d (THead
182 k u0 t0)))) (eq_ind_r T (THead k (lift h d u0) (lift h (s k d) t0)) (\lambda
183 (t: T).(subst0 (plus i0 h) v (THead k (lift h d u0) (lift h (s k d) t3)) t))
184 (subst0_snd k v (lift h (s k d) t0) (lift h (s k d) t3) (plus i0 h) (H3 (s k
185 d) (s_le k d i0 H2)) (lift h d u0)) (lift h d (THead k u0 t0)) (lift_head k
186 u0 t0 h d)) (lift h d (THead k u0 t3)) (lift_head k u0 t3 h d)))))))))))))
187 (\lambda (v: T).(\lambda (u1: T).(\lambda (u2: T).(\lambda (i0: nat).(\lambda
188 (_: (subst0 i0 v u1 u2)).(\lambda (H1: ((\forall (d: nat).((le d i0) \to
189 (subst0 (plus i0 h) v (lift h d u1) (lift h d u2)))))).(\lambda (k:
190 K).(\lambda (t0: T).(\lambda (t3: T).(\lambda (_: (subst0 (s k i0) v t0
191 t3)).(\lambda (H3: ((\forall (d: nat).((le d (s k i0)) \to (subst0 (plus (s k
192 i0) h) v (lift h d t0) (lift h d t3)))))).(\lambda (d: nat).(\lambda (H4: (le
193 d i0)).(let H5 \def (eq_ind_r nat (plus (s k i0) h) (\lambda (n:
194 nat).(\forall (d0: nat).((le d0 (s k i0)) \to (subst0 n v (lift h d0 t0)
195 (lift h d0 t3))))) H3 (s k (plus i0 h)) (s_plus k i0 h)) in (eq_ind_r T
196 (THead k (lift h d u1) (lift h (s k d) t0)) (\lambda (t: T).(subst0 (plus i0
197 h) v t (lift h d (THead k u2 t3)))) (eq_ind_r T (THead k (lift h d u2) (lift
198 h (s k d) t3)) (\lambda (t: T).(subst0 (plus i0 h) v (THead k (lift h d u1)
199 (lift h (s k d) t0)) t)) (subst0_both v (lift h d u1) (lift h d u2) (plus i0
200 h) (H1 d H4) k (lift h (s k d) t0) (lift h (s k d) t3) (H5 (s k d) (s_le k d
201 i0 H4))) (lift h d (THead k u2 t3)) (lift_head k u2 t3 h d)) (lift h d (THead
202 k u1 t0)) (lift_head k u1 t0 h d)))))))))))))))) i u t1 t2 H)))))).
204 lemma subst0_lift_ge_S:
205 \forall (t1: T).(\forall (t2: T).(\forall (u: T).(\forall (i: nat).((subst0
206 i u t1 t2) \to (\forall (d: nat).((le d i) \to (subst0 (S i) u (lift (S O) d
207 t1) (lift (S O) d t2))))))))
209 \lambda (t1: T).(\lambda (t2: T).(\lambda (u: T).(\lambda (i: nat).(\lambda
210 (H: (subst0 i u t1 t2)).(\lambda (d: nat).(\lambda (H0: (le d i)).(eq_ind nat
211 (plus i (S O)) (\lambda (n: nat).(subst0 n u (lift (S O) d t1) (lift (S O) d
212 t2))) (subst0_lift_ge t1 t2 u i (S O) H d H0) (S i) (eq_ind_r nat (plus (S O)
213 i) (\lambda (n: nat).(eq nat n (S i))) (le_antisym (plus (S O) i) (S i) (le_n
214 (S i)) (le_n (plus (S O) i))) (plus i (S O)) (plus_sym i (S O)))))))))).
216 lemma subst0_lift_ge_s:
217 \forall (t1: T).(\forall (t2: T).(\forall (u: T).(\forall (i: nat).((subst0
218 i u t1 t2) \to (\forall (d: nat).((le d i) \to (\forall (b: B).(subst0 (s
219 (Bind b) i) u (lift (S O) d t1) (lift (S O) d t2)))))))))
221 \lambda (t1: T).(\lambda (t2: T).(\lambda (u: T).(\lambda (i: nat).(\lambda
222 (H: (subst0 i u t1 t2)).(\lambda (d: nat).(\lambda (H0: (le d i)).(\lambda
223 (_: B).(subst0_lift_ge_S t1 t2 u i H d H0)))))))).