]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_transition/cpm.ma
milestone update in basic_2, update in ground and static_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / rt_transition / cpm.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "ground/xoa/ex_4_1.ma".
16 include "ground/xoa/ex_4_3.ma".
17 include "ground/xoa/ex_5_6.ma".
18 include "ground/xoa/ex_6_7.ma".
19 include "ground/steps/rtc_max_shift.ma".
20 include "ground/steps/rtc_isrt_plus.ma".
21 include "ground/steps/rtc_isrt_max_shift.ma".
22 include "static_2/syntax/sh.ma".
23 include "basic_2/notation/relations/pred_6.ma".
24 include "basic_2/rt_transition/cpg.ma".
25
26 (* T-BOUND CONTEXT-SENSITIVE PARALLEL RT-TRANSITION FOR TERMS ***************)
27
28 (* Basic_2A1: includes: cpr *)
29 definition cpm (h) (G) (L) (n): relation2 term term ≝
30            λT1,T2. ∃∃c. 𝐑𝐓❪n,c❫ & ❪G,L❫ ⊢ T1 ⬈[sh_is_next h,rtc_eq_t,c] T2.
31
32 interpretation
33   "t-bound context-sensitive parallel rt-transition (term)"
34   'PRed h n G L T1 T2 = (cpm h G L n T1 T2).
35
36 (* Basic properties *********************************************************)
37
38 lemma cpm_ess (h) (G) (L):
39       ∀s. ❪G,L❫ ⊢ ⋆s ➡[h,1] ⋆(⫯[h]s).
40 /3 width=3 by cpg_ess, ex2_intro/ qed.
41
42 lemma cpm_delta (h) (n) (G) (K):
43       ∀V1,V2,W2. ❪G,K❫ ⊢ V1 ➡[h,n] V2 →
44       ⇧[1] V2 ≘ W2 → ❪G,K.ⓓV1❫ ⊢ #0 ➡[h,n] W2.
45 #h #n #G #K #V1 #V2 #W2 *
46 /3 width=5 by cpg_delta, ex2_intro/
47 qed.
48
49 lemma cpm_ell (h) (n) (G) (K):
50       ∀V1,V2,W2. ❪G,K❫ ⊢ V1 ➡[h,n] V2 →
51       ⇧[1] V2 ≘ W2 → ❪G,K.ⓛV1❫ ⊢ #0 ➡[h,↑n] W2.
52 #h #n #G #K #V1 #V2 #W2 *
53 /3 width=5 by cpg_ell, ex2_intro, isrt_succ/
54 qed.
55
56 lemma cpm_lref (h) (n) (G) (K):
57       ∀I,T,U,i. ❪G,K❫ ⊢ #i ➡[h,n] T →
58       ⇧[1] T ≘ U → ❪G,K.ⓘ[I]❫ ⊢ #↑i ➡[h,n] U.
59 #h #n #G #K #I #T #U #i *
60 /3 width=5 by cpg_lref, ex2_intro/
61 qed.
62
63 (* Basic_2A1: includes: cpr_bind *)
64 lemma cpm_bind (h) (n) (G) (L):
65       ∀p,I,V1,V2,T1,T2.
66       ❪G,L❫ ⊢ V1 ➡[h,0] V2 → ❪G,L.ⓑ[I]V1❫ ⊢ T1 ➡[h,n] T2 →
67       ❪G,L❫ ⊢ ⓑ[p,I]V1.T1 ➡[h,n] ⓑ[p,I]V2.T2.
68 #h #n #G #L #p #I #V1 #V2 #T1 #T2 * #cV #HcV #HV12 *
69 /5 width=5 by cpg_bind, isrt_max_O1, isr_shift, ex2_intro/
70 qed.
71
72 lemma cpm_appl (h) (n) (G) (L):
73       ∀V1,V2,T1,T2.
74       ❪G,L❫ ⊢ V1 ➡[h,0] V2 → ❪G,L❫ ⊢ T1 ➡[h,n] T2 →
75       ❪G,L❫ ⊢ ⓐV1.T1 ➡[h,n] ⓐV2.T2.
76 #h #n #G #L #V1 #V2 #T1 #T2 * #cV #HcV #HV12 *
77 /5 width=5 by isrt_max_O1, isr_shift, cpg_appl, ex2_intro/
78 qed.
79
80 lemma cpm_cast (h) (n) (G) (L):
81       ∀U1,U2,T1,T2.
82       ❪G,L❫ ⊢ U1 ➡[h,n] U2 → ❪G,L❫ ⊢ T1 ➡[h,n] T2 →
83       ❪G,L❫ ⊢ ⓝU1.T1 ➡[h,n] ⓝU2.T2.
84 #h #n #G #L #U1 #U2 #T1 #T2 * #cU #HcU #HU12 *
85 /4 width=6 by cpg_cast, isrt_max_idem1, isrt_mono, ex2_intro/
86 qed.
87
88 (* Basic_2A1: includes: cpr_zeta *)
89 lemma cpm_zeta (h) (n) (G) (L):
90       ∀T1,T. ⇧[1] T ≘ T1 → ∀T2. ❪G,L❫ ⊢ T ➡[h,n] T2 →
91       ∀V. ❪G,L❫ ⊢ +ⓓV.T1 ➡[h,n] T2.
92 #h #n #G #L #T1 #T #HT1 #T2 *
93 /3 width=5 by cpg_zeta, isrt_plus_O2, ex2_intro/
94 qed.
95
96 (* Basic_2A1: includes: cpr_eps *)
97 lemma cpm_eps (h) (n) (G) (L):
98       ∀V,T1,T2. ❪G,L❫ ⊢ T1 ➡[h,n] T2 → ❪G,L❫ ⊢ ⓝV.T1 ➡[h,n] T2.
99 #h #n #G #L #V #T1 #T2 *
100 /3 width=3 by cpg_eps, isrt_plus_O2, ex2_intro/
101 qed.
102
103 lemma cpm_ee (h) (n) (G) (L):
104       ∀V1,V2,T. ❪G,L❫ ⊢ V1 ➡[h,n] V2 → ❪G,L❫ ⊢ ⓝV1.T ➡[h,↑n] V2.
105 #h #n #G #L #V1 #V2 #T *
106 /3 width=3 by cpg_ee, isrt_succ, ex2_intro/
107 qed.
108
109 (* Basic_2A1: includes: cpr_beta *)
110 lemma cpm_beta (h) (n) (G) (L):
111       ∀p,V1,V2,W1,W2,T1,T2.
112       ❪G,L❫ ⊢ V1 ➡[h,0] V2 → ❪G,L❫ ⊢ W1 ➡[h,0] W2 → ❪G,L.ⓛW1❫ ⊢ T1 ➡[h,n] T2 →
113       ❪G,L❫ ⊢ ⓐV1.ⓛ[p]W1.T1 ➡[h,n] ⓓ[p]ⓝW2.V2.T2.
114 #h #n #G #L #p #V1 #V2 #W1 #W2 #T1 #T2 * #riV #rhV #HV12 * #riW #rhW #HW12 *
115 /6 width=7 by cpg_beta, isrt_plus_O2, isrt_max, isr_shift, ex2_intro/
116 qed.
117
118 (* Basic_2A1: includes: cpr_theta *)
119 lemma cpm_theta (h) (n) (G) (L):
120       ∀p,V1,V,V2,W1,W2,T1,T2.
121       ❪G,L❫ ⊢ V1 ➡[h,0] V → ⇧[1] V ≘ V2 → ❪G,L❫ ⊢ W1 ➡[h,0] W2 →
122       ❪G,L.ⓓW1❫ ⊢ T1 ➡[h,n] T2 → ❪G,L❫ ⊢ ⓐV1.ⓓ[p]W1.T1 ➡[h,n] ⓓ[p]W2.ⓐV2.T2.
123 #h #n #G #L #p #V1 #V #V2 #W1 #W2 #T1 #T2 * #riV #rhV #HV1 #HV2 * #riW #rhW #HW12 *
124 /6 width=9 by cpg_theta, isrt_plus_O2, isrt_max, isr_shift, ex2_intro/
125 qed.
126
127 (* Basic properties with r-transition ***************************************)
128
129 (* Note: this is needed by cpms_ind_sn and cpms_ind_dx *)
130 (* Basic_1: includes by definition: pr0_refl *)
131 (* Basic_2A1: includes: cpr_atom *)
132 lemma cpr_refl (h) (G) (L): reflexive … (cpm h G L 0).
133 /3 width=3 by cpg_refl, ex2_intro/ qed.
134
135 (* Advanced properties ******************************************************)
136
137 lemma cpm_sort (h) (n) (G) (L): n ≤ 1 →
138       ∀s. ❪G,L❫ ⊢ ⋆s ➡[h,n] ⋆((next h)^n s).
139 #h * //
140 #n #G #L #H #s <(le_n_O_to_eq n) /2 width=1 by le_S_S_to_le/
141 qed.
142
143 (* Basic inversion lemmas ***************************************************)
144
145 lemma cpm_inv_atom1 (h) (n) (G) (L):
146       ∀J,T2. ❪G,L❫ ⊢ ⓪[J] ➡[h,n] T2 →
147       ∨∨ ∧∧ T2 = ⓪[J] & n = 0
148        | ∃∃s. T2 = ⋆(⫯[h]s) & J = Sort s & n = 1
149        | ∃∃K,V1,V2. ❪G,K❫ ⊢ V1 ➡[h,n] V2 & ⇧[1] V2 ≘ T2 & L = K.ⓓV1 & J = LRef 0
150        | ∃∃m,K,V1,V2. ❪G,K❫ ⊢ V1 ➡[h,m] V2 & ⇧[1] V2 ≘ T2 & L = K.ⓛV1 & J = LRef 0 & n = ↑m
151        | ∃∃I,K,T,i. ❪G,K❫ ⊢ #i ➡[h,n] T & ⇧[1] T ≘ T2 & L = K.ⓘ[I] & J = LRef (↑i).
152 #h #n #G #L #J #T2 * #c #Hc #H elim (cpg_inv_atom1 … H) -H *
153 [ #H1 #H2 destruct /4 width=1 by isrt_inv_00, or5_intro0, conj/
154 | #s1 #s2 #H1 #H2 #H3 #H4 destruct /4 width=3 by isrt_inv_01, or5_intro1, ex3_intro/
155 | #cV #K #V1 #V2 #HV12 #HVT2 #H1 #H2 #H3 destruct
156   /4 width=6 by or5_intro2, ex4_3_intro, ex2_intro/
157 | #cV #K #V1 #V2 #HV12 #HVT2 #H1 #H2 #H3 destruct
158   elim (isrt_inv_plus_SO_dx … Hc) -Hc // #m #Hc #H destruct
159   /4 width=9 by or5_intro3, ex5_4_intro, ex2_intro/
160 | #I #K #V2 #i #HV2 #HVT2 #H1 #H2 destruct
161   /4 width=8 by or5_intro4, ex4_4_intro, ex2_intro/
162 ]
163 qed-.
164
165 lemma cpm_inv_sort1 (h) (n) (G) (L):
166       ∀T2,s1. ❪G,L❫ ⊢ ⋆s1 ➡[h,n] T2 →
167       ∧∧ T2 = ⋆(((next h)^n) s1) & n ≤ 1.
168 #h #n #G #L #T2 #s1 * #c #Hc #H
169 elim (cpg_inv_sort1 … H) -H *
170 [ #H1 #H2 destruct
171   lapply (isrt_inv_00 … Hc)
172 | #s2 #H1 #H2 #H3 destruct
173   lapply (isrt_inv_01 … Hc)
174 ] -Hc
175 #H destruct /2 width=1 by conj/
176 qed-.
177
178 lemma cpm_inv_zero1 (h) (n) (G) (L):
179       ∀T2. ❪G,L❫ ⊢ #0 ➡[h,n] T2 →
180       ∨∨ ∧∧ T2 = #0 & n = 0
181        | ∃∃K,V1,V2. ❪G,K❫ ⊢ V1 ➡[h,n] V2 & ⇧[1] V2 ≘ T2 & L = K.ⓓV1
182        | ∃∃m,K,V1,V2. ❪G,K❫ ⊢ V1 ➡[h,m] V2 & ⇧[1] V2 ≘ T2 & L = K.ⓛV1 & n = ↑m.
183 #h #n #G #L #T2 * #c #Hc #H elim (cpg_inv_zero1 … H) -H *
184 [ #H1 #H2 destruct /4 width=1 by isrt_inv_00, or3_intro0, conj/
185 | #cV #K #V1 #V2 #HV12 #HVT2 #H1 #H2 destruct
186   /4 width=8 by or3_intro1, ex3_3_intro, ex2_intro/
187 | #cV #K #V1 #V2 #HV12 #HVT2 #H1 #H2 destruct
188   elim (isrt_inv_plus_SO_dx … Hc) -Hc // #m #Hc #H destruct
189   /4 width=8 by or3_intro2, ex4_4_intro, ex2_intro/
190 ]
191 qed-.
192
193 lemma cpm_inv_zero1_unit (h) (n) (I) (K) (G):
194       ∀X2. ❪G,K.ⓤ[I]❫ ⊢ #0 ➡[h,n] X2 → ∧∧ X2 = #0 & n = 0.
195 #h #n #I #G #K #X2 #H
196 elim (cpm_inv_zero1 … H) -H *
197 [ #H1 #H2 destruct /2 width=1 by conj/
198 | #Y #X1 #X2 #_ #_ #H destruct
199 | #m #Y #X1 #X2 #_ #_ #H destruct
200 ]
201 qed.
202
203 lemma cpm_inv_lref1 (h) (n) (G) (L):
204       ∀T2,i. ❪G,L❫ ⊢ #↑i ➡[h,n] T2 →
205       ∨∨ ∧∧ T2 = #(↑i) & n = 0
206        | ∃∃I,K,T. ❪G,K❫ ⊢ #i ➡[h,n] T & ⇧[1] T ≘ T2 & L = K.ⓘ[I].
207 #h #n #G #L #T2 #i * #c #Hc #H elim (cpg_inv_lref1 … H) -H *
208 [ #H1 #H2 destruct /4 width=1 by isrt_inv_00, or_introl, conj/
209 | #I #K #V2 #HV2 #HVT2 #H destruct
210  /4 width=6 by ex3_3_intro, ex2_intro, or_intror/
211 ]
212 qed-.
213
214 lemma cpm_inv_lref1_ctop (h) (n) (G):
215       ∀X2,i. ❪G,⋆❫ ⊢ #i ➡[h,n] X2 → ∧∧ X2 = #i & n = 0.
216 #h #n #G #X2 * [| #i ] #H
217 [ elim (cpm_inv_zero1 … H) -H *
218   [ #H1 #H2 destruct /2 width=1 by conj/
219   | #Y #X1 #X2 #_ #_ #H destruct
220   | #m #Y #X1 #X2 #_ #_ #H destruct
221   ]
222 | elim (cpm_inv_lref1 … H) -H *
223   [ #H1 #H2 destruct /2 width=1 by conj/
224   | #Z #Y #X0 #_ #_ #H destruct
225   ]
226 ]
227 qed.
228
229 lemma cpm_inv_gref1 (h) (n) (G) (L):
230       ∀T2,l. ❪G,L❫ ⊢ §l ➡[h,n] T2 → ∧∧ T2 = §l & n = 0.
231 #h #n #G #L #T2 #l * #c #Hc #H elim (cpg_inv_gref1 … H) -H
232 #H1 #H2 destruct /3 width=1 by isrt_inv_00, conj/
233 qed-.
234
235 (* Basic_2A1: includes: cpr_inv_bind1 *)
236 lemma cpm_inv_bind1 (h) (n) (G) (L):
237       ∀p,I,V1,T1,U2. ❪G,L❫ ⊢ ⓑ[p,I]V1.T1 ➡[h,n] U2 →
238       ∨∨ ∃∃V2,T2. ❪G,L❫ ⊢ V1 ➡[h,0] V2 & ❪G,L.ⓑ[I]V1❫ ⊢ T1 ➡[h,n] T2 & U2 = ⓑ[p,I]V2.T2
239        | ∃∃T. ⇧[1] T ≘ T1 & ❪G,L❫ ⊢ T ➡[h,n] U2 & p = true & I = Abbr.
240 #h #n #G #L #p #I #V1 #T1 #U2 * #c #Hc #H elim (cpg_inv_bind1 … H) -H *
241 [ #cV #cT #V2 #T2 #HV12 #HT12 #H1 #H2 destruct
242   elim (isrt_inv_max … Hc) -Hc #nV #nT #HcV #HcT #H destruct
243   elim (isrt_inv_shift … HcV) -HcV #HcV #H destruct
244   /4 width=5 by ex3_2_intro, ex2_intro, or_introl/
245 | #cT #T2 #HT21 #HTU2 #H1 #H2 #H3 destruct
246   /5 width=5 by isrt_inv_plus_O_dx, ex4_intro, ex2_intro, or_intror/
247 ]
248 qed-.
249
250 (* Basic_1: includes: pr0_gen_abbr pr2_gen_abbr *)
251 (* Basic_2A1: includes: cpr_inv_abbr1 *)
252 lemma cpm_inv_abbr1 (h) (n) (G) (L):
253       ∀p,V1,T1,U2. ❪G,L❫ ⊢ ⓓ[p]V1.T1 ➡[h,n] U2 →
254       ∨∨ ∃∃V2,T2. ❪G,L❫ ⊢ V1 ➡[h,0] V2 & ❪G,L.ⓓV1❫ ⊢ T1 ➡[h,n] T2 & U2 = ⓓ[p]V2.T2
255        | ∃∃T. ⇧[1] T ≘ T1 & ❪G,L❫ ⊢ T ➡[h,n] U2 & p = true.
256 #h #n #G #L #p #V1 #T1 #U2 #H
257 elim (cpm_inv_bind1 … H) -H
258 [ /3 width=1 by or_introl/
259 | * /3 width=3 by ex3_intro, or_intror/
260 ]
261 qed-.
262
263 (* Basic_1: includes: pr0_gen_abst pr2_gen_abst *)
264 (* Basic_2A1: includes: cpr_inv_abst1 *)
265 lemma cpm_inv_abst1 (h) (n) (G) (L):
266       ∀p,V1,T1,U2. ❪G,L❫ ⊢ ⓛ[p]V1.T1 ➡[h,n] U2 →
267       ∃∃V2,T2. ❪G,L❫ ⊢ V1 ➡[h,0] V2 & ❪G,L.ⓛV1❫ ⊢ T1 ➡[h,n] T2 & U2 = ⓛ[p]V2.T2.
268 #h #n #G #L #p #V1 #T1 #U2 #H
269 elim (cpm_inv_bind1 … H) -H
270 [ /3 width=1 by or_introl/
271 | * #T #_ #_ #_ #H destruct
272 ]
273 qed-.
274
275 lemma cpm_inv_abst_bi (h) (n) (G) (L):
276       ∀p1,p2,V1,V2,T1,T2. ❪G,L❫ ⊢ ⓛ[p1]V1.T1 ➡[h,n] ⓛ[p2]V2.T2 →
277       ∧∧ ❪G,L❫ ⊢ V1 ➡[h,0] V2 & ❪G,L.ⓛV1❫ ⊢ T1 ➡[h,n] T2 & p1 = p2.
278 #h #n #G #L #p1 #p2 #V1 #V2 #T1 #T2 #H
279 elim (cpm_inv_abst1 … H) -H #XV #XT #HV #HT #H destruct
280 /2 width=1 by and3_intro/
281 qed-.
282
283 (* Basic_1: includes: pr0_gen_appl pr2_gen_appl *)
284 (* Basic_2A1: includes: cpr_inv_appl1 *)
285 lemma cpm_inv_appl1 (h) (n) (G) (L):
286       ∀V1,U1,U2. ❪G,L❫ ⊢ ⓐ V1.U1 ➡[h,n] U2 →
287       ∨∨ ∃∃V2,T2. ❪G,L❫ ⊢ V1 ➡[h,0] V2 & ❪G,L❫ ⊢ U1 ➡[h,n] T2 & U2 = ⓐV2.T2
288        | ∃∃p,V2,W1,W2,T1,T2. ❪G,L❫ ⊢ V1 ➡[h,0] V2 & ❪G,L❫ ⊢ W1 ➡[h,0] W2 & ❪G,L.ⓛW1❫ ⊢ T1 ➡[h,n] T2 & U1 = ⓛ[p]W1.T1 & U2 = ⓓ[p]ⓝW2.V2.T2
289        | ∃∃p,V,V2,W1,W2,T1,T2. ❪G,L❫ ⊢ V1 ➡[h,0] V & ⇧[1] V ≘ V2 & ❪G,L❫ ⊢ W1 ➡[h,0] W2 & ❪G,L.ⓓW1❫ ⊢ T1 ➡[h,n] T2 & U1 = ⓓ[p]W1.T1 & U2 = ⓓ[p]W2.ⓐV2.T2.
290 #h #n #G #L #V1 #U1 #U2 * #c #Hc #H elim (cpg_inv_appl1 … H) -H *
291 [ #cV #cT #V2 #T2 #HV12 #HT12 #H1 #H2 destruct
292   elim (isrt_inv_max … Hc) -Hc #nV #nT #HcV #HcT #H destruct
293   elim (isrt_inv_shift … HcV) -HcV #HcV #H destruct
294   /4 width=5 by or3_intro0, ex3_2_intro, ex2_intro/
295 | #cV #cW #cT #p #V2 #W1 #W2 #T1 #T2 #HV12 #HW12 #HT12 #H1 #H2 #H3 destruct
296   lapply (isrt_inv_plus_O_dx … Hc ?) -Hc // #Hc
297   elim (isrt_inv_max … Hc) -Hc #n0 #nT #Hc #HcT #H destruct
298   elim (isrt_inv_max … Hc) -Hc #nV #nW #HcV #HcW #H destruct
299   elim (isrt_inv_shift … HcV) -HcV #HcV #H destruct
300   elim (isrt_inv_shift … HcW) -HcW #HcW #H destruct
301   /4 width=11 by or3_intro1, ex5_6_intro, ex2_intro/
302 | #cV #cW #cT #p #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 #HW12 #HT12 #H1 #H2 #H3 destruct
303   lapply (isrt_inv_plus_O_dx … Hc ?) -Hc // #Hc
304   elim (isrt_inv_max … Hc) -Hc #n0 #nT #Hc #HcT #H destruct
305   elim (isrt_inv_max … Hc) -Hc #nV #nW #HcV #HcW #H destruct
306   elim (isrt_inv_shift … HcV) -HcV #HcV #H destruct
307   elim (isrt_inv_shift … HcW) -HcW #HcW #H destruct
308   /4 width=13 by or3_intro2, ex6_7_intro, ex2_intro/
309 ]
310 qed-.
311
312 lemma cpm_inv_cast1 (h) (n) (G) (L):
313       ∀V1,U1,U2. ❪G,L❫ ⊢ ⓝV1.U1 ➡[h,n] U2 →
314       ∨∨ ∃∃V2,T2. ❪G,L❫ ⊢ V1 ➡[h,n] V2 & ❪G,L❫ ⊢ U1 ➡[h,n] T2 & U2 = ⓝV2.T2
315        | ❪G,L❫ ⊢ U1 ➡[h,n] U2
316        | ∃∃m. ❪G,L❫ ⊢ V1 ➡[h,m] U2 & n = ↑m.
317 #h #n #G #L #V1 #U1 #U2 * #c #Hc #H elim (cpg_inv_cast1 … H) -H *
318 [ #cV #cT #V2 #T2 #HV12 #HT12 #HcVT #H1 #H2 destruct
319   elim (isrt_inv_max … Hc) -Hc #nV #nT #HcV #HcT #H destruct
320   lapply (isrt_eq_t_trans … HcV HcVT) -HcVT #H
321   lapply (isrt_inj … H HcT) -H #H destruct <idempotent_max
322   /4 width=5 by or3_intro0, ex3_2_intro, ex2_intro/
323 | #cU #U12 #H destruct
324   /4 width=3 by isrt_inv_plus_O_dx, or3_intro1, ex2_intro/
325 | #cU #H12 #H destruct
326   elim (isrt_inv_plus_SO_dx … Hc) -Hc // #m #Hc #H destruct
327   /4 width=3 by or3_intro2, ex2_intro/
328 ]
329 qed-.
330
331 (* Basic forward lemmas *****************************************************)
332
333 (* Basic_2A1: includes: cpr_fwd_bind1_minus *)
334 lemma cpm_fwd_bind1_minus (h) (n) (G) (L):
335       ∀I,V1,T1,T. ❪G,L❫ ⊢ -ⓑ[I]V1.T1 ➡[h,n] T → ∀p.
336       ∃∃V2,T2. ❪G,L❫ ⊢ ⓑ[p,I]V1.T1 ➡[h,n] ⓑ[p,I]V2.T2 & T = -ⓑ[I]V2.T2.
337 #h #n #G #L #I #V1 #T1 #T * #c #Hc #H #p elim (cpg_fwd_bind1_minus … H p) -H
338 /3 width=4 by ex2_2_intro, ex2_intro/
339 qed-.
340
341 (* Basic eliminators ********************************************************)
342
343 lemma cpm_ind (h) (Q:relation5 …):
344       (∀I,G,L. Q 0 G L (⓪[I]) (⓪[I])) →
345       (∀G,L,s. Q 1 G L (⋆s) (⋆(⫯[h]s))) →
346       (∀n,G,K,V1,V2,W2. ❪G,K❫ ⊢ V1 ➡[h,n] V2 → Q n G K V1 V2 →
347         ⇧[1] V2 ≘ W2 → Q n G (K.ⓓV1) (#0) W2
348       ) → (∀n,G,K,V1,V2,W2. ❪G,K❫ ⊢ V1 ➡[h,n] V2 → Q n G K V1 V2 →
349         ⇧[1] V2 ≘ W2 → Q (↑n) G (K.ⓛV1) (#0) W2
350       ) → (∀n,I,G,K,T,U,i. ❪G,K❫ ⊢ #i ➡[h,n] T → Q n G K (#i) T →
351         ⇧[1] T ≘ U → Q n G (K.ⓘ[I]) (#↑i) (U)
352       ) → (∀n,p,I,G,L,V1,V2,T1,T2. ❪G,L❫ ⊢ V1 ➡[h,0] V2 → ❪G,L.ⓑ[I]V1❫ ⊢ T1 ➡[h,n] T2 →
353         Q 0 G L V1 V2 → Q n G (L.ⓑ[I]V1) T1 T2 → Q n G L (ⓑ[p,I]V1.T1) (ⓑ[p,I]V2.T2)
354       ) → (∀n,G,L,V1,V2,T1,T2. ❪G,L❫ ⊢ V1 ➡[h,0] V2 → ❪G,L❫ ⊢ T1 ➡[h,n] T2 →
355         Q 0 G L V1 V2 → Q n G L T1 T2 → Q n G L (ⓐV1.T1) (ⓐV2.T2)
356       ) → (∀n,G,L,V1,V2,T1,T2. ❪G,L❫ ⊢ V1 ➡[h,n] V2 → ❪G,L❫ ⊢ T1 ➡[h,n] T2 →
357         Q n G L V1 V2 → Q n G L T1 T2 → Q n G L (ⓝV1.T1) (ⓝV2.T2)
358       ) → (∀n,G,L,V,T1,T,T2. ⇧[1] T ≘ T1 → ❪G,L❫ ⊢ T ➡[h,n] T2 →
359         Q n G L T T2 → Q n G L (+ⓓV.T1) T2
360       ) → (∀n,G,L,V,T1,T2. ❪G,L❫ ⊢ T1 ➡[h,n] T2 →
361         Q n G L T1 T2 → Q n G L (ⓝV.T1) T2
362       ) → (∀n,G,L,V1,V2,T. ❪G,L❫ ⊢ V1 ➡[h,n] V2 →
363         Q n G L V1 V2 → Q (↑n) G L (ⓝV1.T) V2
364       ) → (∀n,p,G,L,V1,V2,W1,W2,T1,T2. ❪G,L❫ ⊢ V1 ➡[h,0] V2 → ❪G,L❫ ⊢ W1 ➡[h,0] W2 → ❪G,L.ⓛW1❫ ⊢ T1 ➡[h,n] T2 →
365         Q 0 G L V1 V2 → Q 0 G L W1 W2 → Q n G (L.ⓛW1) T1 T2 →
366         Q n G L (ⓐV1.ⓛ[p]W1.T1) (ⓓ[p]ⓝW2.V2.T2)
367       ) → (∀n,p,G,L,V1,V,V2,W1,W2,T1,T2. ❪G,L❫ ⊢ V1 ➡[h,0] V → ❪G,L❫ ⊢ W1 ➡[h,0] W2 → ❪G,L.ⓓW1❫ ⊢ T1 ➡[h,n] T2 →
368         Q 0 G L V1 V → Q 0 G L W1 W2 → Q n G (L.ⓓW1) T1 T2 →
369         ⇧[1] V ≘ V2 → Q n G L (ⓐV1.ⓓ[p]W1.T1) (ⓓ[p]W2.ⓐV2.T2)
370       ) →
371       ∀n,G,L,T1,T2. ❪G,L❫ ⊢ T1 ➡[h,n] T2 → Q n G L T1 T2.
372 #h #Q #IH1 #IH2 #IH3 #IH4 #IH5 #IH6 #IH7 #IH8 #IH9 #IH10 #IH11 #IH12 #IH13 #n #G #L #T1 #T2
373 * #c #HC #H generalize in match HC; -HC generalize in match n; -n
374 elim H -c -G -L -T1 -T2
375 [ #I #G #L #n #H <(isrt_inv_00 … H) -H //
376 | #G #L #s1 #s2 #HRs #n #H <(isrt_inv_01 … H) -H destruct //
377 | /3 width=4 by ex2_intro/
378 | #c #G #L #V1 #V2 #W2 #HV12 #HVW2 #IH #x #H
379   elim (isrt_inv_plus_SO_dx … H) -H // #n #Hc #H destruct
380   /3 width=4 by ex2_intro/
381 | /3 width=4 by ex2_intro/
382 | #cV #cT #p #I #G #L #V1 #V2 #T1 #T2 #HV12 #HT12 #IHV #IHT #n #H
383   elim (isrt_inv_max_shift_sn … H) -H #HcV #HcT
384   /3 width=3 by ex2_intro/
385 | #cV #cT #G #L #V1 #V2 #T1 #T2 #HV12 #HT12 #IHV #IHT #n #H
386   elim (isrt_inv_max_shift_sn … H) -H #HcV #HcT
387   /3 width=3 by ex2_intro/
388 | #cU #cT #G #L #U1 #U2 #T1 #T2 #HUT #HU12 #HT12 #IHU #IHT #n #H
389   elim (isrt_inv_max_eq_t … H) -H // #HcV #HcT
390   /3 width=3 by ex2_intro/
391 | #c #G #L #V #T1 #T #T2 #HT1 #HT2 #IH #n #H
392   lapply (isrt_inv_plus_O_dx … H ?) -H // #Hc
393   /3 width=4 by ex2_intro/
394 | #c #G #L #U #T1 #T2 #HT12 #IH #n #H
395   lapply (isrt_inv_plus_O_dx … H ?) -H // #Hc
396   /3 width=3 by ex2_intro/
397 | #c #G #L #U1 #U2 #T #HU12 #IH #x #H
398   elim (isrt_inv_plus_SO_dx … H) -H // #n #Hc #H destruct
399   /3 width=3 by ex2_intro/
400 | #cV #cW #cT #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 #HW12 #HT12 #IHV #IHW #IHT #n #H
401   lapply (isrt_inv_plus_O_dx … H ?) -H // >max_shift #H
402   elim (isrt_inv_max_shift_sn … H) -H #H #HcT
403   elim (isrt_O_inv_max … H) -H #HcV #HcW
404   /3 width=3 by ex2_intro/
405 | #cV #cW #cT #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 #HW12 #HT12 #IHV #IHW #IHT #n #H
406   lapply (isrt_inv_plus_O_dx … H ?) -H // >max_shift #H
407   elim (isrt_inv_max_shift_sn … H) -H #H #HcT
408   elim (isrt_O_inv_max … H) -H #HcV #HcW
409   /3 width=4 by ex2_intro/
410 ]
411 qed-.