]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_transition/cpg.ma
first definition of cpm:
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / rt_transition / cpg.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/steps/rtc_plus.ma".
16 include "basic_2/notation/relations/predty_6.ma".
17 include "basic_2/grammar/lenv.ma".
18 include "basic_2/grammar/genv.ma".
19 include "basic_2/relocation/lifts.ma".
20 include "basic_2/static/sh.ma".
21
22 (* COUNTED CONTEXT-SENSITIVE PARALLEL RT-TRANSITION FOR TERMS ***************)
23
24 (* avtivate genv *)
25 inductive cpg (h): rtc → relation4 genv lenv term term ≝
26 | cpg_atom : ∀I,G,L. cpg h (𝟘𝟘) G L (⓪{I}) (⓪{I})
27 | cpg_ess  : ∀G,L,s. cpg h (𝟘𝟙) G L (⋆s) (⋆(next h s))
28 | cpg_delta: ∀c,G,L,V1,V2,W2. cpg h c G L V1 V2 →
29              ⬆*[1] V2 ≡ W2 → cpg h c G (L.ⓓV1) (#0) W2
30 | cpg_ell  : ∀c,G,L,V1,V2,W2. cpg h c G L V1 V2 →
31              ⬆*[1] V2 ≡ W2 → cpg h (c+𝟘𝟙) G (L.ⓛV1) (#0) W2
32 | cpg_lref : ∀c,I,G,L,V,T,U,i. cpg h c G L (#i) T → 
33              ⬆*[1] T ≡ U → cpg h c G (L.ⓑ{I}V) (#⫯i) U
34 | cpg_bind : ∀cV,cT,p,I,G,L,V1,V2,T1,T2.
35              cpg h cV G L V1 V2 → cpg h cT G (L.ⓑ{I}V1) T1 T2 →
36              cpg h ((↓cV)+cT) G L (ⓑ{p,I}V1.T1) (ⓑ{p,I}V2.T2)
37 | cpg_flat : ∀cV,cT,I,G,L,V1,V2,T1,T2.
38              cpg h cV G L V1 V2 → cpg h cT G L T1 T2 →
39              cpg h ((↓cV)+cT) G L (ⓕ{I}V1.T1) (ⓕ{I}V2.T2)
40 | cpg_zeta : ∀c,G,L,V,T1,T,T2. cpg h c G (L.ⓓV) T1 T →
41              ⬆*[1] T2 ≡ T → cpg h (c+𝟙𝟘) G L (+ⓓV.T1) T2
42 | cpg_eps  : ∀c,G,L,V,T1,T2. cpg h c G L T1 T2 → cpg h (c+𝟙𝟘) G L (ⓝV.T1) T2
43 | cpg_ee   : ∀c,G,L,V1,V2,T. cpg h c G L V1 V2 → cpg h (c+𝟘𝟙) G L (ⓝV1.T) V2
44 | cpg_beta : ∀cV,cW,cT,p,G,L,V1,V2,W1,W2,T1,T2.
45              cpg h cV G L V1 V2 → cpg h cW G L W1 W2 → cpg h cT G (L.ⓛW1) T1 T2 →
46              cpg h ((↓cV)+(↓cW)+cT+𝟙𝟘) G L (ⓐV1.ⓛ{p}W1.T1) (ⓓ{p}ⓝW2.V2.T2)
47 | cpg_theta: ∀cV,cW,cT,p,G,L,V1,V,V2,W1,W2,T1,T2.
48              cpg h cV G L V1 V → ⬆*[1] V ≡ V2 → cpg h cW G L W1 W2 →
49              cpg h cT G (L.ⓓW1) T1 T2 →
50              cpg h ((↓cV)+(↓cW)+cT+𝟙𝟘) G L (ⓐV1.ⓓ{p}W1.T1) (ⓓ{p}W2.ⓐV2.T2)
51 .
52
53 interpretation
54    "counted context-sensitive parallel rt-transition (term)"
55    'PRedTy c h G L T1 T2 = (cpg h c G L T1 T2).
56
57 (* Basic properties *********************************************************)
58
59 (* Note: this is "∀h,g,L. reflexive … (cpg h (𝟘𝟘) L)" *)
60 lemma cpg_refl: ∀h,G,T,L. ⦃G, L⦄ ⊢ T ⬈[𝟘𝟘, h] T.
61 #h #G #T elim T -T // * /2 width=1 by cpg_bind, cpg_flat/
62 qed.
63
64 lemma cpg_pair_sn: ∀c,h,I,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ⬈[c, h] V2 →
65                    ∀T. ⦃G, L⦄ ⊢ ②{I}V1.T ⬈[↓c, h] ②{I}V2.T.
66 #c #h * /2 width=1 by cpg_bind, cpg_flat/
67 qed.
68
69 (* Basic inversion lemmas ***************************************************)
70
71 fact cpg_inv_atom1_aux: ∀c,h,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ⬈[c, h] T2 → ∀J. T1 = ⓪{J} →
72                         ∨∨ T2 = ⓪{J} ∧ c = 𝟘𝟘 
73                          | ∃∃s. J = Sort s & T2 = ⋆(next h s) & c = 𝟘𝟙
74                          | ∃∃cV,K,V1,V2. ⦃G, K⦄ ⊢ V1 ⬈[cV, h] V2 & ⬆*[1] V2 ≡ T2 &
75                                          L = K.ⓓV1 & J = LRef 0 & c = cV
76                          | ∃∃cV,K,V1,V2. ⦃G, K⦄ ⊢ V1 ⬈[cV, h] V2 & ⬆*[1] V2 ≡ T2 &
77                                          L = K.ⓛV1 & J = LRef 0 & c = cV+𝟘𝟙
78                          | ∃∃I,K,V,T,i. ⦃G, K⦄ ⊢ #i ⬈[c, h] T & ⬆*[1] T ≡ T2 &
79                                         L = K.ⓑ{I}V & J = LRef (⫯i).
80 #c #h #G #L #T1 #T2 * -c -G -L -T1 -T2
81 [ #I #G #L #J #H destruct /3 width=1 by or5_intro0, conj/
82 | #G #L #s #J #H destruct /3 width=3 by or5_intro1, ex3_intro/
83 | #c #G #L #V1 #V2 #W2 #HV12 #VW2 #J #H destruct /3 width=8 by or5_intro2, ex5_4_intro/
84 | #c #G #L #V1 #V2 #W2 #HV12 #VW2 #J #H destruct /3 width=8 by or5_intro3, ex5_4_intro/
85 | #c #I #G #L #V #T #U #i #HT #HTU #J #H destruct /3 width=9 by or5_intro4, ex4_5_intro/
86 | #cV #cT #p #I #G #L #V1 #V2 #T1 #T2 #_ #_ #J #H destruct
87 | #cV #cT #I #G #L #V1 #V2 #T1 #T2 #_ #_ #J #H destruct
88 | #c #G #L #V #T1 #T #T2 #_ #_ #J #H destruct
89 | #c #G #L #V #T1 #T2 #_ #J #H destruct
90 | #c #G #L #V1 #V2 #T #_ #J #H destruct
91 | #cV #cW #cT #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #J #H destruct
92 | #cV #cW #cT #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #J #H destruct
93 ]
94 qed-.
95
96 lemma cpg_inv_atom1: ∀c,h,J,G,L,T2. ⦃G, L⦄ ⊢ ⓪{J} ⬈[c, h] T2 →
97                      ∨∨ T2 = ⓪{J} ∧ c = 𝟘𝟘 
98                       | ∃∃s. J = Sort s & T2 = ⋆(next h s) & c = 𝟘𝟙
99                       | ∃∃cV,K,V1,V2. ⦃G, K⦄ ⊢ V1 ⬈[cV, h] V2 & ⬆*[1] V2 ≡ T2 &
100                                       L = K.ⓓV1 & J = LRef 0 & c = cV
101                       | ∃∃cV,K,V1,V2. ⦃G, K⦄ ⊢ V1 ⬈[cV, h] V2 & ⬆*[1] V2 ≡ T2 &
102                                       L = K.ⓛV1 & J = LRef 0 & c = cV+𝟘𝟙
103                       | ∃∃I,K,V,T,i. ⦃G, K⦄ ⊢ #i ⬈[c, h] T & ⬆*[1] T ≡ T2 &
104                                      L = K.ⓑ{I}V & J = LRef (⫯i).
105 /2 width=3 by cpg_inv_atom1_aux/ qed-.
106
107 lemma cpg_inv_sort1: ∀c,h,G,L,T2,s. ⦃G, L⦄ ⊢ ⋆s ⬈[c, h] T2 →
108                      (T2 = ⋆s ∧ c = 𝟘𝟘) ∨ (T2 = ⋆(next h s) ∧ c = 𝟘𝟙).
109 #c #h #G #L #T2 #s #H
110 elim (cpg_inv_atom1 … H) -H * /3 width=1 by or_introl, conj/
111 [ #s0 #H destruct /3 width=1 by or_intror, conj/
112 |2,3: #cV #K #V1 #V2 #_ #_ #_ #H destruct
113 | #I #K #V1 #V2 #i #_ #_ #_ #H destruct
114 ]
115 qed-.
116
117 lemma cpg_inv_zero1: ∀c,h,G,L,T2. ⦃G, L⦄ ⊢ #0 ⬈[c, h] T2 →
118                      ∨∨ (T2 = #0 ∧ c = 𝟘𝟘)
119                       | ∃∃cV,K,V1,V2. ⦃G, K⦄ ⊢ V1 ⬈[cV, h] V2 & ⬆*[1] V2 ≡ T2 &
120                                       L = K.ⓓV1 & c = cV
121                       | ∃∃cV,K,V1,V2. ⦃G, K⦄ ⊢ V1 ⬈[cV, h] V2 & ⬆*[1] V2 ≡ T2 &
122                                       L = K.ⓛV1 & c = cV+𝟘𝟙.
123 #c #h #G #L #T2 #H
124 elim (cpg_inv_atom1 … H) -H * /3 width=1 by or3_intro0, conj/
125 [ #s #H destruct
126 |2,3: #cV #K #V1 #V2 #HV12 #HVT2 #H1 #_ #H2 destruct /3 width=8 by or3_intro1, or3_intro2, ex4_4_intro/
127 | #I #K #V1 #V2 #i #_ #_ #_ #H destruct
128 ]
129 qed-.
130
131 lemma cpg_inv_lref1: ∀c,h,G,L,T2,i. ⦃G, L⦄ ⊢ #⫯i ⬈[c, h] T2 →
132                      (T2 = #(⫯i) ∧ c = 𝟘𝟘) ∨
133                      ∃∃I,K,V,T. ⦃G, K⦄ ⊢ #i ⬈[c, h] T & ⬆*[1] T ≡ T2 & L = K.ⓑ{I}V.
134 #c #h #G #L #T2 #i #H
135 elim (cpg_inv_atom1 … H) -H * /3 width=1 by or_introl, conj/
136 [ #s #H destruct
137 |2,3: #cV #K #V1 #V2 #_ #_ #_ #H destruct
138 | #I #K #V1 #V2 #j #HV2 #HVT2 #H1 #H2 destruct /3 width=7 by ex3_4_intro, or_intror/
139 ]
140 qed-.
141
142 lemma cpg_inv_gref1: ∀c,h,G,L,T2,l. ⦃G, L⦄ ⊢ §l ⬈[c, h] T2 → T2 = §l ∧ c = 𝟘𝟘.
143 #c #h #G #L #T2 #l #H
144 elim (cpg_inv_atom1 … H) -H * /2 width=1 by conj/
145 [ #s #H destruct
146 |2,3: #cV #K #V1 #V2 #_ #_ #_ #H destruct
147 | #I #K #V1 #V2 #i #_ #_ #_ #H destruct
148 ]
149 qed-.
150
151 fact cpg_inv_bind1_aux: ∀c,h,G,L,U,U2. ⦃G, L⦄ ⊢ U ⬈[c, h] U2 →
152                         ∀p,J,V1,U1. U = ⓑ{p,J}V1.U1 → (
153                         ∃∃cV,cT,V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V2 & ⦃G, L.ⓑ{J}V1⦄ ⊢ U1 ⬈[cT, h] T2 &
154                                        U2 = ⓑ{p,J}V2.T2 & c = (↓cV)+cT
155                         ) ∨
156                         ∃∃cT,T. ⦃G, L.ⓓV1⦄ ⊢ U1 ⬈[cT, h] T & ⬆*[1] U2 ≡ T &
157                                 p = true & J = Abbr & c = cT+𝟙𝟘.
158 #c #h #G #L #U #U2 * -c -G -L -U -U2
159 [ #I #G #L #q #J #W #U1 #H destruct
160 | #G #L #s #q #J #W #U1 #H destruct
161 | #c #G #L #V1 #V2 #W2 #_ #_ #q #J #W #U1 #H destruct
162 | #c #G #L #V1 #V2 #W2 #_ #_ #q #J #W #U1 #H destruct
163 | #c #I #G #L #V #T #U #i #_ #_ #q #J #W #U1 #H destruct
164 | #rv #cT #p #I #G #L #V1 #V2 #T1 #T2 #HV12 #HT12 #q #J #W #U1 #H destruct /3 width=8 by ex4_4_intro, or_introl/
165 | #rv #cT #I #G #L #V1 #V2 #T1 #T2 #_ #_ #q #J #W #U1 #H destruct
166 | #c #G #L #V #T1 #T #T2 #HT1 #HT2 #q #J #W #U1 #H destruct /3 width=5 by ex5_2_intro, or_intror/
167 | #c #G #L #V #T1 #T2 #_ #q #J #W #U1 #H destruct
168 | #c #G #L #V1 #V2 #T #_ #q #J #W #U1 #H destruct
169 | #rv #cW #cT #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #q #J #W #U1 #H destruct
170 | #rv #cW #cT #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #q #J #W #U1 #H destruct
171 ]
172 qed-.
173
174 lemma cpg_inv_bind1: ∀c,h,p,I,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓑ{p,I}V1.T1 ⬈[c, h] U2 → (
175                      ∃∃cV,cT,V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V2 & ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ⬈[cT, h] T2 &
176                                     U2 = ⓑ{p,I}V2.T2 & c = (↓cV)+cT
177                      ) ∨
178                      ∃∃cT,T. ⦃G, L.ⓓV1⦄ ⊢ T1 ⬈[cT, h] T & ⬆*[1] U2 ≡ T &
179                              p = true & I = Abbr & c = cT+𝟙𝟘.
180 /2 width=3 by cpg_inv_bind1_aux/ qed-.
181
182 lemma cpg_inv_abbr1: ∀c,h,p,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓓ{p}V1.T1 ⬈[c, h] U2 → (
183                      ∃∃cV,cT,V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V2 & ⦃G, L.ⓓV1⦄ ⊢ T1 ⬈[cT, h] T2 &
184                                     U2 = ⓓ{p}V2.T2 & c = (↓cV)+cT
185                      ) ∨
186                      ∃∃cT,T. ⦃G, L.ⓓV1⦄ ⊢ T1 ⬈[cT, h] T & ⬆*[1] U2 ≡ T &
187                              p = true & c = cT+𝟙𝟘.
188 #c #h #p #G #L #V1 #T1 #U2 #H elim (cpg_inv_bind1 … H) -H *
189 /3 width=8 by ex4_4_intro, ex4_2_intro, or_introl, or_intror/
190 qed-.
191
192 lemma cpg_inv_abst1: ∀c,h,p,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓛ{p}V1.T1 ⬈[c, h] U2 →
193                      ∃∃cV,cT,V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V2 & ⦃G, L.ⓛV1⦄ ⊢ T1 ⬈[cT, h] T2 &
194                                     U2 = ⓛ{p}V2.T2 & c = (↓cV)+cT.
195 #c #h #p #G #L #V1 #T1 #U2 #H elim (cpg_inv_bind1 … H) -H * 
196 [ /3 width=8 by ex4_4_intro/
197 | #c #T #_ #_ #_ #H destruct
198 ]
199 qed-.
200
201 fact cpg_inv_flat1_aux: ∀c,h,G,L,U,U2. ⦃G, L⦄ ⊢ U ⬈[c, h] U2 →
202                         ∀J,V1,U1. U = ⓕ{J}V1.U1 →
203                         ∨∨ ∃∃cV,cT,V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V2 & ⦃G, L⦄ ⊢ U1 ⬈[cT, h] T2 &
204                                           U2 = ⓕ{J}V2.T2 & c = (↓cV)+cT
205                          | ∃∃cT. ⦃G, L⦄ ⊢ U1 ⬈[cT, h] U2 & J = Cast & c = cT+𝟙𝟘
206                          | ∃∃cV. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] U2 & J = Cast & c = cV+𝟘𝟙
207                          | ∃∃cV,cW,cT,p,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V2 & ⦃G, L⦄ ⊢ W1 ⬈[cW, h] W2 & ⦃G, L.ⓛW1⦄ ⊢ T1 ⬈[cT, h] T2 &
208                                                         J = Appl & U1 = ⓛ{p}W1.T1 & U2 = ⓓ{p}ⓝW2.V2.T2 & c = (↓cV)+(↓cW)+cT+𝟙𝟘
209                          | ∃∃cV,cW,cT,p,V,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V & ⬆*[1] V ≡ V2 & ⦃G, L⦄ ⊢ W1 ⬈[cW, h] W2 & ⦃G, L.ⓓW1⦄ ⊢ T1 ⬈[cT, h] T2 &
210                                                           J = Appl & U1 = ⓓ{p}W1.T1 & U2 = ⓓ{p}W2.ⓐV2.T2 & c = (↓cV)+(↓cW)+cT+𝟙𝟘.
211 #c #h #G #L #U #U2 * -c -G -L -U -U2
212 [ #I #G #L #J #W #U1 #H destruct
213 | #G #L #s #J #W #U1 #H destruct
214 | #c #G #L #V1 #V2 #W2 #_ #_ #J #W #U1 #H destruct
215 | #c #G #L #V1 #V2 #W2 #_ #_ #J #W #U1 #H destruct
216 | #c #I #G #L #V #T #U #i #_ #_ #J #W #U1 #H destruct
217 | #rv #cT #p #I #G #L #V1 #V2 #T1 #T2 #_ #_ #J #W #U1 #H destruct
218 | #rv #cT #I #G #L #V1 #V2 #T1 #T2 #HV12 #HT12 #J #W #U1 #H destruct /3 width=8 by or5_intro0, ex4_4_intro/
219 | #c #G #L #V #T1 #T #T2 #_ #_ #J #W #U1 #H destruct
220 | #c #G #L #V #T1 #T2 #HT12 #J #W #U1 #H destruct /3 width=3 by or5_intro1, ex3_intro/
221 | #c #G #L #V1 #V2 #T #HV12 #J #W #U1 #H destruct /3 width=3 by or5_intro2, ex3_intro/
222 | #rv #cW #cT #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 #HW12 #HT12 #J #W #U1 #H destruct /3 width=15 by or5_intro3, ex7_9_intro/
223 | #rv #cW #cT #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 #HW12 #HT12 #J #W #U1 #H destruct /3 width=17 by or5_intro4, ex8_10_intro/
224 ]
225 qed-.
226
227 lemma cpg_inv_flat1: ∀c,h,I,G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓕ{I}V1.U1 ⬈[c, h] U2 →
228                      ∨∨ ∃∃cV,cT,V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V2 & ⦃G, L⦄ ⊢ U1 ⬈[cT, h] T2 &
229                                        U2 = ⓕ{I}V2.T2 & c = (↓cV)+cT
230                       | ∃∃cT. ⦃G, L⦄ ⊢ U1 ⬈[cT, h] U2 & I = Cast & c = cT+𝟙𝟘
231                       | ∃∃cV. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] U2 & I = Cast & c = cV+𝟘𝟙
232                       | ∃∃cV,cW,cT,p,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V2 & ⦃G, L⦄ ⊢ W1 ⬈[cW, h] W2 & ⦃G, L.ⓛW1⦄ ⊢ T1 ⬈[cT, h] T2 &
233                                                      I = Appl & U1 = ⓛ{p}W1.T1 & U2 = ⓓ{p}ⓝW2.V2.T2 & c = (↓cV)+(↓cW)+cT+𝟙𝟘
234                       | ∃∃cV,cW,cT,p,V,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V & ⬆*[1] V ≡ V2 & ⦃G, L⦄ ⊢ W1 ⬈[cW, h] W2 & ⦃G, L.ⓓW1⦄ ⊢ T1 ⬈[cT, h] T2 &
235                                                        I = Appl & U1 = ⓓ{p}W1.T1 & U2 = ⓓ{p}W2.ⓐV2.T2 & c = (↓cV)+(↓cW)+cT+𝟙𝟘.
236 /2 width=3 by cpg_inv_flat1_aux/ qed-.
237
238 lemma cpg_inv_appl1: ∀c,h,G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓐV1.U1 ⬈[c, h] U2 →
239                      ∨∨ ∃∃cV,cT,V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V2 & ⦃G, L⦄ ⊢ U1 ⬈[cT, h] T2 &
240                                        U2 = ⓐV2.T2 & c = (↓cV)+cT
241                       | ∃∃cV,cW,cT,p,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V2 & ⦃G, L⦄ ⊢ W1 ⬈[cW, h] W2 & ⦃G, L.ⓛW1⦄ ⊢ T1 ⬈[cT, h] T2 &
242                                                      U1 = ⓛ{p}W1.T1 & U2 = ⓓ{p}ⓝW2.V2.T2 & c = (↓cV)+(↓cW)+cT+𝟙𝟘
243                       | ∃∃cV,cW,cT,p,V,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V & ⬆*[1] V ≡ V2 & ⦃G, L⦄ ⊢ W1 ⬈[cW, h] W2 & ⦃G, L.ⓓW1⦄ ⊢ T1 ⬈[cT, h] T2 &
244                                                        U1 = ⓓ{p}W1.T1 & U2 = ⓓ{p}W2.ⓐV2.T2 & c = (↓cV)+(↓cW)+cT+𝟙𝟘.
245 #c #h #G #L #V1 #U1 #U2 #H elim (cpg_inv_flat1 … H) -H *
246 [ /3 width=8 by or3_intro0, ex4_4_intro/
247 |2,3: #c #_ #H destruct
248 | /3 width=15 by or3_intro1, ex6_9_intro/
249 | /3 width=17 by or3_intro2, ex7_10_intro/
250 ]
251 qed-.
252
253 lemma cpg_inv_cast1: ∀c,h,G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓝV1.U1 ⬈[c, h] U2 →
254                      ∨∨ ∃∃cV,cT,V2,T2. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] V2 & ⦃G, L⦄ ⊢ U1 ⬈[cT, h] T2 &
255                                        U2 = ⓝV2.T2 & c = (↓cV)+cT
256                       | ∃∃cT. ⦃G, L⦄ ⊢ U1 ⬈[cT, h] U2 & c = cT+𝟙𝟘
257                       | ∃∃cV. ⦃G, L⦄ ⊢ V1 ⬈[cV, h] U2 & c = cV+𝟘𝟙.
258 #c #h #G #L #V1 #U1 #U2 #H elim (cpg_inv_flat1 … H) -H *
259 [ /3 width=8 by or3_intro0, ex4_4_intro/
260 |2,3: /3 width=3 by or3_intro1, or3_intro2, ex2_intro/
261 | #rv #cW #cT #p #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #H destruct
262 | #rv #cW #cT #p #V #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #H destruct
263 ]
264 qed-.
265
266 (* Basic forward lemmas *****************************************************)
267
268 lemma cpg_fwd_bind1_minus: ∀c,h,I,G,L,V1,T1,T. ⦃G, L⦄ ⊢ -ⓑ{I}V1.T1 ⬈[c, h] T → ∀p.
269                            ∃∃V2,T2. ⦃G, L⦄ ⊢ ⓑ{p,I}V1.T1 ⬈[c, h] ⓑ{p,I}V2.T2 &
270                                     T = -ⓑ{I}V2.T2.
271 #c #h #I #G #L #V1 #T1 #T #H #p elim (cpg_inv_bind1 … H) -H *
272 [ #cV #cT #V2 #T2 #HV12 #HT12 #H1 #H2 destruct /3 width=4 by cpg_bind, ex2_2_intro/
273 | #c #T2 #_ #_ #H destruct
274 ]
275 qed-.