]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_transition/cpx.ma
first definition of cpm:
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / rt_transition / cpx.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/predty_5.ma".
16 include "basic_2/rt_transition/cpg.ma".
17
18 (* UNCOUNTED CONTEXT-SENSITIVE PARALLEL RT-TRANSITION FOR TERMS *************)
19
20 definition cpx (h): relation4 genv lenv term term ≝
21                     λG,L,T1,T2. ∃c. ⦃G, L⦄ ⊢ T1 ⬈[c, h] T2.
22
23 interpretation
24    "uncounted context-sensitive parallel rt-transition (term)"
25    'PRedTy h G L T1 T2 = (cpx h G L T1 T2).
26
27 (* Basic properties *********************************************************)
28
29 (* Basic_2A1: was: cpx_st *)
30 lemma cpx_ess: ∀h,G,L,s. ⦃G, L⦄ ⊢ ⋆s ⬈[h] ⋆(next h s).
31 /2 width=2 by cpg_ess, ex_intro/ qed.
32
33 lemma cpx_delta: ∀h,I,G,K,V1,V2,W2. ⦃G, K⦄ ⊢ V1 ⬈[h] V2 →
34                  ⬆*[1] V2 ≡ W2 → ⦃G, K.ⓑ{I}V1⦄ ⊢ #0 ⬈[h] W2.
35 #h * #G #K #V1 #V2 #W2 *
36 /3 width=4 by cpg_delta, cpg_ell, ex_intro/
37 qed.
38
39 lemma cpx_lref: ∀h,I,G,K,V,T,U,i. ⦃G, K⦄ ⊢ #i ⬈[h] T →
40                 ⬆*[1] T ≡ U → ⦃G, K.ⓑ{I}V⦄ ⊢ #⫯i ⬈[h] U.
41 #h #I #G #K #V #T #U #i *
42 /3 width=4 by cpg_lref, ex_intro/
43 qed.
44
45 lemma cpx_bind: ∀h,p,I,G,L,V1,V2,T1,T2.
46                 ⦃G, L⦄ ⊢ V1 ⬈[h] V2 → ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ⬈[h] T2 →
47                 ⦃G, L⦄ ⊢ ⓑ{p,I}V1.T1 ⬈[h] ⓑ{p,I}V2.T2.
48 #h #p #I #G #L #V1 #V2 #T1 #T2 * #cV #HV12 *
49 /3 width=2 by cpg_bind, ex_intro/
50 qed.
51
52 lemma cpx_flat: ∀h,I,G,L,V1,V2,T1,T2.
53                 ⦃G, L⦄ ⊢ V1 ⬈[h] V2 → ⦃G, L⦄ ⊢ T1 ⬈[h] T2 →
54                 ⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ⬈[h] ⓕ{I}V2.T2.
55 #h #I #G #L #V1 #V2 #T1 #T2 * #cV #HV12 *
56 /3 width=2 by cpg_flat, ex_intro/
57 qed.
58
59 lemma cpx_zeta: ∀h,G,L,V,T1,T,T2. ⦃G, L.ⓓV⦄ ⊢ T1 ⬈[h] T →
60                 ⬆*[1] T2 ≡ T → ⦃G, L⦄ ⊢ +ⓓV.T1 ⬈[h] T2.
61 #h #G #L #V #T1 #T #T2 *
62 /3 width=4 by cpg_zeta, ex_intro/
63 qed.
64
65 lemma cpx_eps: ∀h,G,L,V,T1,T2. ⦃G, L⦄ ⊢ T1 ⬈[h] T2 → ⦃G, L⦄ ⊢ ⓝV.T1 ⬈[h] T2.
66 #h #G #L #V #T1 #T2 *
67 /3 width=2 by cpg_eps, ex_intro/
68 qed.
69
70 (* Basic_2A1: was: cpx_ct *)
71 lemma cpx_ee: ∀h,G,L,V1,V2,T. ⦃G, L⦄ ⊢ V1 ⬈[h] V2 → ⦃G, L⦄ ⊢ ⓝV1.T ⬈[h] V2.
72 #h #G #L #V1 #V2 #T *
73 /3 width=2 by cpg_ee, ex_intro/
74 qed.
75
76 lemma cpx_beta: ∀h,p,G,L,V1,V2,W1,W2,T1,T2.
77                 ⦃G, L⦄ ⊢ V1 ⬈[h] V2 → ⦃G, L⦄ ⊢ W1 ⬈[h] W2 → ⦃G, L.ⓛW1⦄ ⊢ T1 ⬈[h] T2 →
78                 ⦃G, L⦄ ⊢ ⓐV1.ⓛ{p}W1.T1 ⬈[h] ⓓ{p}ⓝW2.V2.T2.
79 #h #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 * #cV #HV12 * #cW #HW12 * 
80 /3 width=2 by cpg_beta, ex_intro/
81 qed.
82
83 lemma cpx_theta: ∀h,p,G,L,V1,V,V2,W1,W2,T1,T2.
84                  ⦃G, L⦄ ⊢ V1 ⬈[h] V → ⬆*[1] V ≡ V2 → ⦃G, L⦄ ⊢ W1 ⬈[h] W2 →
85                  ⦃G, L.ⓓW1⦄ ⊢ T1 ⬈[h] T2 →
86                  ⦃G, L⦄ ⊢ ⓐV1.ⓓ{p}W1.T1 ⬈[h] ⓓ{p}W2.ⓐV2.T2.
87 #h #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 * #cV #HV1 #HV2 * #cW #HW12 * 
88 /3 width=4 by cpg_theta, ex_intro/
89 qed.
90
91 (* Basic_2A1: includes: cpx_atom *)
92 lemma cpx_refl: ∀h,G,L. reflexive … (cpx h G L).
93 /2 width=2 by ex_intro/ qed.
94
95 lemma cpx_pair_sn: ∀h,I,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ⬈[h] V2 →
96                    ∀T. ⦃G, L⦄ ⊢ ②{I}V1.T ⬈[h] ②{I}V2.T.
97 #h #I #G #L #V1 #V2 *
98 /3 width=2 by cpg_pair_sn, ex_intro/
99 qed.
100
101 (* Basic inversion lemmas ***************************************************)
102
103 lemma cpx_inv_atom1: ∀h,J,G,L,T2. ⦃G, L⦄ ⊢ ⓪{J} ⬈[h] T2 →
104                      ∨∨ T2 = ⓪{J}
105                       | ∃∃s. T2 = ⋆(next h s) & J = Sort s
106                       | ∃∃I,K,V1,V2. ⦃G, K⦄ ⊢ V1 ⬈[h] V2 & ⬆*[1] V2 ≡ T2 &
107                                      L = K.ⓑ{I}V1 & J = LRef 0
108                       | ∃∃I,K,V,T,i. ⦃G, K⦄ ⊢ #i ⬈[h] T & ⬆*[1] T ≡ T2 &
109                                      L = K.ⓑ{I}V & J = LRef (⫯i).
110 #h #J #G #L #T2 * #c #H elim (cpg_inv_atom1 … H) -H *
111 /4 width=9 by or4_intro0, or4_intro1, or4_intro2, or4_intro3, ex4_5_intro, ex4_4_intro, ex2_intro, ex_intro/
112 qed-.
113
114 lemma cpx_inv_sort1: ∀h,G,L,T2,s. ⦃G, L⦄ ⊢ ⋆s ⬈[h] T2 →
115                      T2 = ⋆s ∨ T2 = ⋆(next h s).
116 #h #G #L #T2 #s * #c #H elim (cpg_inv_sort1 … H) -H *
117 /2 width=1 by or_introl, or_intror/
118 qed-.
119
120 lemma cpx_inv_zero1: ∀h,G,L,T2. ⦃G, L⦄ ⊢ #0 ⬈[h] T2 →
121                      T2 = #0 ∨
122                      ∃∃I,K,V1,V2. ⦃G, K⦄ ⊢ V1 ⬈[h] V2 & ⬆*[1] V2 ≡ T2 &
123                                   L = K.ⓑ{I}V1.
124 #h #G #L #T2 * #c #H elim (cpg_inv_zero1 … H) -H *
125 /4 width=7 by ex3_4_intro, ex_intro, or_introl, or_intror/
126 qed-.
127
128 lemma cpx_inv_lref1: ∀h,G,L,T2,i. ⦃G, L⦄ ⊢ #⫯i ⬈[h] T2 →
129                      T2 = #(⫯i) ∨
130                      ∃∃I,K,V,T. ⦃G, K⦄ ⊢ #i ⬈[h] T & ⬆*[1] T ≡ T2 & L = K.ⓑ{I}V.
131 #h #G #L #T2 #i * #c #H elim (cpg_inv_lref1 … H) -H *
132 /4 width=7 by ex3_4_intro, ex_intro, or_introl, or_intror/
133 qed-.
134
135 lemma cpx_inv_gref1: ∀h,G,L,T2,l. ⦃G, L⦄ ⊢ §l ⬈[h] T2 → T2 = §l.
136 #h #G #L #T2 #l * #c #H elim (cpg_inv_gref1 … H) -H //
137 qed-.
138
139 lemma cpx_inv_bind1: ∀h,p,I,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓑ{p,I}V1.T1 ⬈[h] U2 → (
140                      ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[h] V2 & ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ⬈[h] T2 &
141                               U2 = ⓑ{p,I}V2.T2
142                      ) ∨
143                      ∃∃T. ⦃G, L.ⓓV1⦄ ⊢ T1 ⬈[h] T & ⬆*[1] U2 ≡ T &
144                           p = true & I = Abbr.
145 #h #p #I #G #L #V1 #T1 #U2 * #c #H elim (cpg_inv_bind1 … H) -H *
146 /4 width=5 by ex4_intro, ex3_2_intro, ex_intro, or_introl, or_intror/
147 qed-.
148
149 lemma cpx_inv_abbr1: ∀h,p,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓓ{p}V1.T1 ⬈[h] U2 → (
150                      ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[h] V2 & ⦃G, L.ⓓV1⦄ ⊢ T1 ⬈[h] T2 &
151                               U2 = ⓓ{p}V2.T2
152                      ) ∨
153                      ∃∃T. ⦃G, L.ⓓV1⦄ ⊢ T1 ⬈[h] T & ⬆*[1] U2 ≡ T & p = true.
154 #h #p #G #L #V1 #T1 #U2 * #c #H elim (cpg_inv_abbr1 … H) -H *
155 /4 width=5 by ex3_2_intro, ex3_intro, ex_intro, or_introl, or_intror/
156 qed-.
157
158 lemma cpx_inv_abst1: ∀h,p,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓛ{p}V1.T1 ⬈[h] U2 →
159                      ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[h] V2 & ⦃G, L.ⓛV1⦄ ⊢ T1 ⬈[h] T2 &
160                               U2 = ⓛ{p}V2.T2.
161 #h #p #G #L #V1 #T1 #U2 * #c #H elim (cpg_inv_abst1 … H) -H
162 /3 width=5 by ex3_2_intro, ex_intro/
163 qed-.
164
165 lemma cpx_inv_flat1: ∀h,I,G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓕ{I}V1.U1 ⬈[h] U2 →
166                      ∨∨ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[h] V2 & ⦃G, L⦄ ⊢ U1 ⬈[h] T2 &
167                                  U2 = ⓕ{I}V2.T2
168                       | (⦃G, L⦄ ⊢ U1 ⬈[h] U2 ∧ I = Cast)
169                       | (⦃G, L⦄ ⊢ V1 ⬈[h] U2 ∧ I = Cast)
170                       | ∃∃p,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ⬈[h] V2 & ⦃G, L⦄ ⊢ W1 ⬈[h] W2 &
171                                             ⦃G, L.ⓛW1⦄ ⊢ T1 ⬈[h] T2 &
172                                             U1 = ⓛ{p}W1.T1 &
173                                             U2 = ⓓ{p}ⓝW2.V2.T2 & I = Appl
174                       | ∃∃p,V,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ⬈[h] V & ⬆*[1] V ≡ V2 &
175                                               ⦃G, L⦄ ⊢ W1 ⬈[h] W2 & ⦃G, L.ⓓW1⦄ ⊢ T1 ⬈[h] T2 &
176                                               U1 = ⓓ{p}W1.T1 &
177                                               U2 = ⓓ{p}W2.ⓐV2.T2 & I = Appl.
178 #h #I #G #L #V1 #U1 #U2 * #c #H elim (cpg_inv_flat1 … H) -H *
179 /4 width=14 by or5_intro0, or5_intro1, or5_intro2, or5_intro3, or5_intro4, ex7_7_intro, ex6_6_intro, ex3_2_intro, ex_intro, conj/
180 qed-.
181
182 lemma cpx_inv_appl1: ∀h,G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓐ V1.U1 ⬈[h] U2 →
183                      ∨∨ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[h] V2 & ⦃G, L⦄ ⊢ U1 ⬈[h] T2 &
184                                  U2 = ⓐV2.T2
185                       | ∃∃p,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ⬈[h] V2 & ⦃G, L⦄ ⊢ W1 ⬈[h] W2 &
186                                             ⦃G, L.ⓛW1⦄ ⊢ T1 ⬈[h] T2 &
187                                             U1 = ⓛ{p}W1.T1 & U2 = ⓓ{p}ⓝW2.V2.T2
188                       | ∃∃p,V,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ⬈[h] V & ⬆*[1] V ≡ V2 &
189                                               ⦃G, L⦄ ⊢ W1 ⬈[h] W2 & ⦃G, L.ⓓW1⦄ ⊢ T1 ⬈[h] T2 &
190                                               U1 = ⓓ{p}W1.T1 & U2 = ⓓ{p}W2.ⓐV2.T2.
191 #h #G #L #V1 #U1 #U2 * #c #H elim (cpg_inv_appl1 … H) -H *
192 /4 width=13 by or3_intro0, or3_intro1, or3_intro2, ex6_7_intro, ex5_6_intro, ex3_2_intro, ex_intro/
193 qed-.
194
195 lemma cpx_inv_cast1: ∀h,G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓝV1.U1 ⬈[h] U2 →
196                      ∨∨ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[h] V2 & ⦃G, L⦄ ⊢ U1 ⬈[h] T2 &
197                                  U2 = ⓝV2.T2
198                       | ⦃G, L⦄ ⊢ U1 ⬈[h] U2
199                       | ⦃G, L⦄ ⊢ V1 ⬈[h] U2.
200 #h #G #L #V1 #U1 #U2 * #c #H elim (cpg_inv_cast1 … H) -H *
201 /4 width=5 by or3_intro0, or3_intro1, or3_intro2, ex3_2_intro, ex_intro/
202 qed-.
203
204 (* Basic forward lemmas *****************************************************)
205
206 lemma cpx_fwd_bind1_minus: ∀h,I,G,L,V1,T1,T. ⦃G, L⦄ ⊢ -ⓑ{I}V1.T1 ⬈[h] T → ∀p.
207                            ∃∃V2,T2. ⦃G, L⦄ ⊢ ⓑ{p,I}V1.T1 ⬈[h] ⓑ{p,I}V2.T2 &
208                                     T = -ⓑ{I}V2.T2.
209 #h #I #G #L #V1 #T1 #T * #c #H #p elim (cpg_fwd_bind1_minus … H p) -H
210 /3 width=4 by ex2_2_intro, ex_intro/
211 qed-.