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