]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_transition/cpm.ma
notational update in ground_2 and 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 "basic_2/notation/relations/pred_6.ma".
16 include "basic_2/notation/relations/pred_5.ma".
17 include "basic_2/rt_transition/cpg.ma".
18
19 (* T-BOUND CONTEXT-SENSITIVE PARALLEL RT-TRANSITION FOR TERMS ***************)
20
21 (* Basic_2A1: includes: cpr *)
22 definition cpm (n) (h): relation4 genv lenv term term ≝
23                         λG,L,T1,T2. ∃∃c. 𝐑𝐓⦃n, c⦄ & ⦃G, L⦄ ⊢ T1 ⬈[eq_t, c, h] T2.
24
25 interpretation
26    "semi-counted context-sensitive parallel rt-transition (term)"
27    'PRed n h G L T1 T2 = (cpm n h G L T1 T2).
28
29 interpretation
30    "context-sensitive parallel r-transition (term)"
31    'PRed h G L T1 T2 = (cpm O h G L T1 T2).
32
33 (* Basic properties *********************************************************)
34
35 lemma cpm_ess: ∀h,G,L,s. ⦃G, L⦄ ⊢ ⋆s ➡[1, h] ⋆(next h s).
36 /2 width=3 by cpg_ess, ex2_intro/ qed.
37
38 lemma cpm_delta: ∀n,h,G,K,V1,V2,W2. ⦃G, K⦄ ⊢ V1 ➡[n, h] V2 →
39                  ⬆*[1] V2 ≘ W2 → ⦃G, K.ⓓV1⦄ ⊢ #0 ➡[n, h] W2.
40 #n #h #G #K #V1 #V2 #W2 *
41 /3 width=5 by cpg_delta, ex2_intro/
42 qed.
43
44 lemma cpm_ell: ∀n,h,G,K,V1,V2,W2. ⦃G, K⦄ ⊢ V1 ➡[n, h] V2 →
45                ⬆*[1] V2 ≘ W2 → ⦃G, K.ⓛV1⦄ ⊢ #0 ➡[↑n, h] W2.
46 #n #h #G #K #V1 #V2 #W2 *
47 /3 width=5 by cpg_ell, ex2_intro, isrt_succ/
48 qed.
49
50 lemma cpm_lref: ∀n,h,I,G,K,T,U,i. ⦃G, K⦄ ⊢ #i ➡[n, h] T →
51                 ⬆*[1] T ≘ U → ⦃G, K.ⓘ{I}⦄ ⊢ #↑i ➡[n, h] U.
52 #n #h #I #G #K #T #U #i *
53 /3 width=5 by cpg_lref, ex2_intro/
54 qed.
55
56 (* Basic_2A1: includes: cpr_bind *)
57 lemma cpm_bind: ∀n,h,p,I,G,L,V1,V2,T1,T2.
58                 ⦃G, L⦄ ⊢ V1 ➡[h] V2 → ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ➡[n, h] T2 →
59                 ⦃G, L⦄ ⊢ ⓑ{p,I}V1.T1 ➡[n, h] ⓑ{p,I}V2.T2.
60 #n #h #p #I #G #L #V1 #V2 #T1 #T2 * #cV #HcV #HV12 *
61 /5 width=5 by cpg_bind, isrt_max_O1, isr_shift, ex2_intro/
62 qed.
63
64 lemma cpm_appl: ∀n,h,G,L,V1,V2,T1,T2.
65                 ⦃G, L⦄ ⊢ V1 ➡[h] V2 → ⦃G, L⦄ ⊢ T1 ➡[n, h] T2 →
66                 ⦃G, L⦄ ⊢ ⓐV1.T1 ➡[n, h] ⓐV2.T2.
67 #n #h #G #L #V1 #V2 #T1 #T2 * #cV #HcV #HV12 *
68 /5 width=5 by isrt_max_O1, isr_shift, cpg_appl, ex2_intro/
69 qed.
70
71 lemma cpm_cast: ∀n,h,G,L,U1,U2,T1,T2.
72                 ⦃G, L⦄ ⊢ U1 ➡[n, h] U2 → ⦃G, L⦄ ⊢ T1 ➡[n, h] T2 →
73                 ⦃G, L⦄ ⊢ ⓝU1.T1 ➡[n, h] ⓝU2.T2.
74 #n #h #G #L #U1 #U2 #T1 #T2 * #cU #HcU #HU12 *
75 /4 width=6 by cpg_cast, isrt_max_idem1, isrt_mono, ex2_intro/
76 qed.
77
78 (* Basic_2A1: includes: cpr_zeta *)
79 lemma cpm_zeta: ∀n,h,G,L,V,T1,T,T2. ⦃G, L.ⓓV⦄ ⊢ T1 ➡[n, h] T →
80                 ⬆*[1] T2 ≘ T → ⦃G, L⦄ ⊢ +ⓓV.T1 ➡[n, h] T2.
81 #n #h #G #L #V #T1 #T #T2 *
82 /3 width=5 by cpg_zeta, isrt_plus_O2, ex2_intro/
83 qed.
84
85 (* Basic_2A1: includes: cpr_eps *)
86 lemma cpm_eps: ∀n,h,G,L,V,T1,T2. ⦃G, L⦄ ⊢ T1 ➡[n, h] T2 → ⦃G, L⦄ ⊢ ⓝV.T1 ➡[n, h] T2.
87 #n #h #G #L #V #T1 #T2 *
88 /3 width=3 by cpg_eps, isrt_plus_O2, ex2_intro/
89 qed.
90
91 lemma cpm_ee: ∀n,h,G,L,V1,V2,T. ⦃G, L⦄ ⊢ V1 ➡[n, h] V2 → ⦃G, L⦄ ⊢ ⓝV1.T ➡[↑n, h] V2.
92 #n #h #G #L #V1 #V2 #T *
93 /3 width=3 by cpg_ee, isrt_succ, ex2_intro/
94 qed.
95
96 (* Basic_2A1: includes: cpr_beta *)
97 lemma cpm_beta: ∀n,h,p,G,L,V1,V2,W1,W2,T1,T2.
98                 ⦃G, L⦄ ⊢ V1 ➡[h] V2 → ⦃G, L⦄ ⊢ W1 ➡[h] W2 → ⦃G, L.ⓛW1⦄ ⊢ T1 ➡[n, h] T2 →
99                 ⦃G, L⦄ ⊢ ⓐV1.ⓛ{p}W1.T1 ➡[n, h] ⓓ{p}ⓝW2.V2.T2.
100 #n #h #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 * #riV #rhV #HV12 * #riW #rhW #HW12 *
101 /6 width=7 by cpg_beta, isrt_plus_O2, isrt_max, isr_shift, ex2_intro/
102 qed.
103
104 (* Basic_2A1: includes: cpr_theta *)
105 lemma cpm_theta: ∀n,h,p,G,L,V1,V,V2,W1,W2,T1,T2.
106                  ⦃G, L⦄ ⊢ V1 ➡[h] V → ⬆*[1] V ≘ V2 → ⦃G, L⦄ ⊢ W1 ➡[h] W2 →
107                  ⦃G, L.ⓓW1⦄ ⊢ T1 ➡[n, h] T2 →
108                  ⦃G, L⦄ ⊢ ⓐV1.ⓓ{p}W1.T1 ➡[n, h] ⓓ{p}W2.ⓐV2.T2.
109 #n #h #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 * #riV #rhV #HV1 #HV2 * #riW #rhW #HW12 *
110 /6 width=9 by cpg_theta, isrt_plus_O2, isrt_max, isr_shift, ex2_intro/
111 qed.
112
113 (* Basic properties on r-transition *****************************************)
114
115 (* Basic_1: includes by definition: pr0_refl *)
116 (* Basic_2A1: includes: cpr_atom *)
117 lemma cpr_refl: ∀h,G,L. reflexive … (cpm 0 h G L).
118 /3 width=3 by cpg_refl, ex2_intro/ qed.
119
120 (* Basic inversion lemmas ***************************************************)
121
122 lemma cpm_inv_atom1: ∀n,h,J,G,L,T2. ⦃G, L⦄ ⊢ ⓪{J} ➡[n, h] T2 →
123                      ∨∨ T2 = ⓪{J} ∧ n = 0
124                       | ∃∃s. T2 = ⋆(next h s) & J = Sort s & n = 1
125                       | ∃∃K,V1,V2. ⦃G, K⦄ ⊢ V1 ➡[n, h] V2 & ⬆*[1] V2 ≘ T2 &
126                                    L = K.ⓓV1 & J = LRef 0
127                       | ∃∃k,K,V1,V2. ⦃G, K⦄ ⊢ V1 ➡[k, h] V2 & ⬆*[1] V2 ≘ T2 &
128                                      L = K.ⓛV1 & J = LRef 0 & n = ↑k
129                       | ∃∃I,K,T,i. ⦃G, K⦄ ⊢ #i ➡[n, h] T & ⬆*[1] T ≘ T2 &
130                                    L = K.ⓘ{I} & J = LRef (↑i).
131 #n #h #J #G #L #T2 * #c #Hc #H elim (cpg_inv_atom1 … H) -H *
132 [ #H1 #H2 destruct /4 width=1 by isrt_inv_00, or5_intro0, conj/
133 | #s #H1 #H2 #H3 destruct /4 width=3 by isrt_inv_01, or5_intro1, ex3_intro/
134 | #cV #K #V1 #V2 #HV12 #HVT2 #H1 #H2 #H3 destruct
135   /4 width=6 by or5_intro2, ex4_3_intro, ex2_intro/
136 | #cV #K #V1 #V2 #HV12 #HVT2 #H1 #H2 #H3 destruct
137   elim (isrt_inv_plus_SO_dx … Hc) -Hc // #k #Hc #H destruct
138   /4 width=9 by or5_intro3, ex5_4_intro, ex2_intro/
139 | #I #K #V2 #i #HV2 #HVT2 #H1 #H2 destruct
140   /4 width=8 by or5_intro4, ex4_4_intro, ex2_intro/
141 ]
142 qed-.
143
144 lemma cpm_inv_sort1: ∀n,h,G,L,T2,s. ⦃G, L⦄ ⊢ ⋆s ➡[n,h] T2 →
145                      ∨∨ T2 = ⋆s ∧ n = 0
146                       | T2 = ⋆(next h s) ∧ n = 1.
147 #n #h #G #L #T2 #s * #c #Hc #H elim (cpg_inv_sort1 … H) -H *
148 #H1 #H2 destruct
149 /4 width=1 by isrt_inv_01, isrt_inv_00, or_introl, or_intror, conj/
150 qed-.
151
152 lemma cpm_inv_zero1: ∀n,h,G,L,T2. ⦃G, L⦄ ⊢ #0 ➡[n, h] T2 →
153                      ∨∨ T2 = #0 ∧ n = 0
154                       | ∃∃K,V1,V2. ⦃G, K⦄ ⊢ V1 ➡[n, h] V2 & ⬆*[1] V2 ≘ T2 &
155                                    L = K.ⓓV1
156                       | ∃∃k,K,V1,V2. ⦃G, K⦄ ⊢ V1 ➡[k, h] V2 & ⬆*[1] V2 ≘ T2 &
157                                      L = K.ⓛV1 & n = ↑k.
158 #n #h #G #L #T2 * #c #Hc #H elim (cpg_inv_zero1 … H) -H *
159 [ #H1 #H2 destruct /4 width=1 by isrt_inv_00, or3_intro0, conj/
160 | #cV #K #V1 #V2 #HV12 #HVT2 #H1 #H2 destruct
161   /4 width=8 by or3_intro1, ex3_3_intro, ex2_intro/
162 | #cV #K #V1 #V2 #HV12 #HVT2 #H1 #H2 destruct
163   elim (isrt_inv_plus_SO_dx … Hc) -Hc // #k #Hc #H destruct
164   /4 width=8 by or3_intro2, ex4_4_intro, ex2_intro/
165 ]
166 qed-.
167
168 lemma cpm_inv_lref1: ∀n,h,G,L,T2,i. ⦃G, L⦄ ⊢ #↑i ➡[n, h] T2 →
169                      ∨∨ T2 = #(↑i) ∧ n = 0
170                       | ∃∃I,K,T. ⦃G, K⦄ ⊢ #i ➡[n, h] T & ⬆*[1] T ≘ T2 & L = K.ⓘ{I}.
171 #n #h #G #L #T2 #i * #c #Hc #H elim (cpg_inv_lref1 … H) -H *
172 [ #H1 #H2 destruct /4 width=1 by isrt_inv_00, or_introl, conj/
173 | #I #K #V2 #HV2 #HVT2 #H destruct
174  /4 width=6 by ex3_3_intro, ex2_intro, or_intror/
175 ]
176 qed-.
177
178 lemma cpm_inv_gref1: ∀n,h,G,L,T2,l. ⦃G, L⦄ ⊢ §l ➡[n, h] T2 → T2 = §l ∧ n = 0.
179 #n #h #G #L #T2 #l * #c #Hc #H elim (cpg_inv_gref1 … H) -H
180 #H1 #H2 destruct /3 width=1 by isrt_inv_00, conj/ 
181 qed-.
182
183 (* Basic_2A1: includes: cpr_inv_bind1 *)
184 lemma cpm_inv_bind1: ∀n,h,p,I,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓑ{p,I}V1.T1 ➡[n, h] U2 →
185                      ∨∨ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V2 & ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ➡[n, h] T2 &
186                                  U2 = ⓑ{p,I}V2.T2
187                       | ∃∃T. ⦃G, L.ⓓV1⦄ ⊢ T1 ➡[n, h] T & ⬆*[1] U2 ≘ T &
188                              p = true & I = Abbr.
189 #n #h #p #I #G #L #V1 #T1 #U2 * #c #Hc #H elim (cpg_inv_bind1 … H) -H *
190 [ #cV #cT #V2 #T2 #HV12 #HT12 #H1 #H2 destruct
191   elim (isrt_inv_max … Hc) -Hc #nV #nT #HcV #HcT #H destruct
192   elim (isrt_inv_shift … HcV) -HcV #HcV #H destruct
193   /4 width=5 by ex3_2_intro, ex2_intro, or_introl/
194 | #cT #T2 #HT12 #HUT2 #H1 #H2 #H3 destruct
195   /5 width=3 by isrt_inv_plus_O_dx, ex4_intro, ex2_intro, or_intror/
196 ]
197 qed-.
198
199 (* Basic_1: includes: pr0_gen_abbr pr2_gen_abbr *)
200 (* Basic_2A1: includes: cpr_inv_abbr1 *)
201 lemma cpm_inv_abbr1: ∀n,h,p,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓓ{p}V1.T1 ➡[n, h] U2 →
202                      ∨∨ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V2 & ⦃G, L.ⓓV1⦄ ⊢ T1 ➡[n, h] T2 &
203                                  U2 = ⓓ{p}V2.T2
204                       | ∃∃T. ⦃G, L.ⓓV1⦄ ⊢ T1 ➡[n, h] T & ⬆*[1] U2 ≘ T & p = true.
205 #n #h #p #G #L #V1 #T1 #U2 * #c #Hc #H elim (cpg_inv_abbr1 … H) -H *
206 [ #cV #cT #V2 #T2 #HV12 #HT12 #H1 #H2 destruct
207   elim (isrt_inv_max … Hc) -Hc #nV #nT #HcV #HcT #H destruct
208   elim (isrt_inv_shift … HcV) -HcV #HcV #H destruct
209   /4 width=5 by ex3_2_intro, ex2_intro, or_introl/
210 | #cT #T2 #HT12 #HUT2 #H1 #H2 destruct
211   /5 width=3 by isrt_inv_plus_O_dx, ex3_intro, ex2_intro, or_intror/
212 ]
213 qed-.
214
215 (* Basic_1: includes: pr0_gen_abst pr2_gen_abst *)
216 (* Basic_2A1: includes: cpr_inv_abst1 *)
217 lemma cpm_inv_abst1: ∀n,h,p,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓛ{p}V1.T1 ➡[n, h] U2 →
218                      ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V2 & ⦃G, L.ⓛV1⦄ ⊢ T1 ➡[n, h] T2 &
219                               U2 = ⓛ{p}V2.T2.
220 #n #h #p #G #L #V1 #T1 #U2 * #c #Hc #H elim (cpg_inv_abst1 … H) -H
221 #cV #cT #V2 #T2 #HV12 #HT12 #H1 #H2 destruct
222 elim (isrt_inv_max … Hc) -Hc #nV #nT #HcV #HcT #H destruct
223 elim (isrt_inv_shift … HcV) -HcV #HcV #H destruct
224 /3 width=5 by ex3_2_intro, ex2_intro/
225 qed-.
226
227 (* Basic_1: includes: pr0_gen_appl pr2_gen_appl *)
228 (* Basic_2A1: includes: cpr_inv_appl1 *)
229 lemma cpm_inv_appl1: ∀n,h,G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓐ V1.U1 ➡[n, h] U2 →
230                      ∨∨ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V2 & ⦃G, L⦄ ⊢ U1 ➡[n, h] T2 &
231                                  U2 = ⓐV2.T2
232                       | ∃∃p,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V2 & ⦃G, L⦄ ⊢ W1 ➡[h] W2 &
233                                             ⦃G, L.ⓛW1⦄ ⊢ T1 ➡[n, h] T2 &
234                                             U1 = ⓛ{p}W1.T1 & U2 = ⓓ{p}ⓝW2.V2.T2
235                       | ∃∃p,V,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V & ⬆*[1] V ≘ V2 &
236                                               ⦃G, L⦄ ⊢ W1 ➡[h] W2 & ⦃G, L.ⓓW1⦄ ⊢ T1 ➡[n, h] T2 &
237                                               U1 = ⓓ{p}W1.T1 & U2 = ⓓ{p}W2.ⓐV2.T2.
238 #n #h #G #L #V1 #U1 #U2 * #c #Hc #H elim (cpg_inv_appl1 … H) -H *
239 [ #cV #cT #V2 #T2 #HV12 #HT12 #H1 #H2 destruct
240   elim (isrt_inv_max … Hc) -Hc #nV #nT #HcV #HcT #H destruct
241   elim (isrt_inv_shift … HcV) -HcV #HcV #H destruct
242   /4 width=5 by or3_intro0, ex3_2_intro, ex2_intro/
243 | #cV #cW #cT #p #V2 #W1 #W2 #T1 #T2 #HV12 #HW12 #HT12 #H1 #H2 #H3 destruct
244   lapply (isrt_inv_plus_O_dx … Hc ?) -Hc // #Hc
245   elim (isrt_inv_max … Hc) -Hc #n0 #nT #Hc #HcT #H destruct
246   elim (isrt_inv_max … Hc) -Hc #nV #nW #HcV #HcW #H destruct
247   elim (isrt_inv_shift … HcV) -HcV #HcV #H destruct
248   elim (isrt_inv_shift … HcW) -HcW #HcW #H destruct
249   /4 width=11 by or3_intro1, ex5_6_intro, ex2_intro/
250 | #cV #cW #cT #p #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 #HW12 #HT12 #H1 #H2 #H3 destruct
251   lapply (isrt_inv_plus_O_dx … Hc ?) -Hc // #Hc
252   elim (isrt_inv_max … Hc) -Hc #n0 #nT #Hc #HcT #H destruct
253   elim (isrt_inv_max … Hc) -Hc #nV #nW #HcV #HcW #H destruct
254   elim (isrt_inv_shift … HcV) -HcV #HcV #H destruct
255   elim (isrt_inv_shift … HcW) -HcW #HcW #H destruct
256   /4 width=13 by or3_intro2, ex6_7_intro, ex2_intro/
257 ]
258 qed-.
259
260 lemma cpm_inv_cast1: ∀n,h,G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓝV1.U1 ➡[n, h] U2 →
261                      ∨∨ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡[n, h] V2 & ⦃G, L⦄ ⊢ U1 ➡[n, h] T2 &
262                                  U2 = ⓝV2.T2
263                       | ⦃G, L⦄ ⊢ U1 ➡[n, h] U2
264                       | ∃∃k. ⦃G, L⦄ ⊢ V1 ➡[k, h] U2 & n = ↑k.
265 #n #h #G #L #V1 #U1 #U2 * #c #Hc #H elim (cpg_inv_cast1 … H) -H *
266 [ #cV #cT #V2 #T2 #HV12 #HT12 #HcVT #H1 #H2 destruct
267   elim (isrt_inv_max … Hc) -Hc #nV #nT #HcV #HcT #H destruct
268   lapply (isrt_eq_t_trans … HcV HcVT) -HcVT #H
269   lapply (isrt_inj … H HcT) -H #H destruct <idempotent_max
270   /4 width=5 by or3_intro0, ex3_2_intro, ex2_intro/
271 | #cU #U12 #H destruct
272   /4 width=3 by isrt_inv_plus_O_dx, or3_intro1, ex2_intro/
273 | #cU #H12 #H destruct
274   elim (isrt_inv_plus_SO_dx … Hc) -Hc // #k #Hc #H destruct
275   /4 width=3 by or3_intro2, ex2_intro/
276 ]
277 qed-.
278
279 (* Basic forward lemmas *****************************************************)
280
281 (* Basic_2A1: includes: cpr_fwd_bind1_minus *)
282 lemma cpm_fwd_bind1_minus: ∀n,h,I,G,L,V1,T1,T. ⦃G, L⦄ ⊢ -ⓑ{I}V1.T1 ➡[n, h] T → ∀p.
283                            ∃∃V2,T2. ⦃G, L⦄ ⊢ ⓑ{p,I}V1.T1 ➡[n, h] ⓑ{p,I}V2.T2 &
284                                     T = -ⓑ{I}V2.T2.
285 #n #h #I #G #L #V1 #T1 #T * #c #Hc #H #p elim (cpg_fwd_bind1_minus … H p) -H
286 /3 width=4 by ex2_2_intro, ex2_intro/
287 qed-.