1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "ground/xoa/ex_3_3.ma".
16 include "ground/xoa/ex_4_2.ma".
17 include "ground/xoa/ex_4_4.ma".
18 include "ground/xoa/ex_5_2.ma".
19 include "ground/xoa/ex_6_9.ma".
20 include "ground/xoa/ex_7_10.ma".
21 include "ground/xoa/or_5.ma".
22 include "ground/steps/rtc_shift.ma".
23 include "ground/steps/rtc_plus.ma".
24 include "ground/steps/rtc_max.ma".
25 include "basic_2/notation/relations/predty_7.ma".
26 include "static_2/syntax/sh.ma".
27 include "static_2/syntax/lenv.ma".
28 include "static_2/syntax/genv.ma".
29 include "static_2/relocation/lifts.ma".
31 (* BOUND CONTEXT-SENSITIVE PARALLEL RT-TRANSITION FOR TERMS *****************)
34 inductive cpg (Rt:relation rtc) (h): rtc → relation4 genv lenv term term ≝
35 | cpg_atom : ∀I,G,L. cpg Rt h (𝟘𝟘) G L (⓪[I]) (⓪[I])
36 | cpg_ess : ∀G,L,s. cpg Rt h (𝟘𝟙) G L (⋆s) (⋆(⫯[h]s))
37 | cpg_delta: ∀c,G,L,V1,V2,W2. cpg Rt h c G L V1 V2 →
38 ⇧[1] V2 ≘ W2 → cpg Rt h c G (L.ⓓV1) (#0) W2
39 | cpg_ell : ∀c,G,L,V1,V2,W2. cpg Rt h c G L V1 V2 →
40 ⇧[1] V2 ≘ W2 → cpg Rt h (c+𝟘𝟙) G (L.ⓛV1) (#0) W2
41 | cpg_lref : ∀c,I,G,L,T,U,i. cpg Rt h c G L (#i) T →
42 ⇧[1] T ≘ U → cpg Rt h c G (L.ⓘ[I]) (#↑i) U
43 | cpg_bind : ∀cV,cT,p,I,G,L,V1,V2,T1,T2.
44 cpg Rt h cV G L V1 V2 → cpg Rt h cT G (L.ⓑ[I]V1) T1 T2 →
45 cpg Rt h ((↕*cV)∨cT) G L (ⓑ[p,I]V1.T1) (ⓑ[p,I]V2.T2)
46 | cpg_appl : ∀cV,cT,G,L,V1,V2,T1,T2.
47 cpg Rt h cV G L V1 V2 → cpg Rt h cT G L T1 T2 →
48 cpg Rt h ((↕*cV)∨cT) G L (ⓐV1.T1) (ⓐV2.T2)
49 | cpg_cast : ∀cU,cT,G,L,U1,U2,T1,T2. Rt cU cT →
50 cpg Rt h cU G L U1 U2 → cpg Rt h cT G L T1 T2 →
51 cpg Rt h (cU∨cT) G L (ⓝU1.T1) (ⓝU2.T2)
52 | cpg_zeta : ∀c,G,L,V,T1,T,T2. ⇧[1] T ≘ T1 → cpg Rt h c G L T T2 →
53 cpg Rt h (c+𝟙𝟘) G L (+ⓓV.T1) T2
54 | cpg_eps : ∀c,G,L,V,T1,T2. cpg Rt h c G L T1 T2 → cpg Rt h (c+𝟙𝟘) G L (ⓝV.T1) T2
55 | cpg_ee : ∀c,G,L,V1,V2,T. cpg Rt h c G L V1 V2 → cpg Rt h (c+𝟘𝟙) G L (ⓝV1.T) V2
56 | cpg_beta : ∀cV,cW,cT,p,G,L,V1,V2,W1,W2,T1,T2.
57 cpg Rt h cV G L V1 V2 → cpg Rt h cW G L W1 W2 → cpg Rt h cT G (L.ⓛW1) T1 T2 →
58 cpg Rt h (((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘) G L (ⓐV1.ⓛ[p]W1.T1) (ⓓ[p]ⓝW2.V2.T2)
59 | cpg_theta: ∀cV,cW,cT,p,G,L,V1,V,V2,W1,W2,T1,T2.
60 cpg Rt h cV G L V1 V → ⇧[1] V ≘ V2 → cpg Rt h cW G L W1 W2 →
61 cpg Rt h cT G (L.ⓓW1) T1 T2 →
62 cpg Rt h (((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘) G L (ⓐV1.ⓓ[p]W1.T1) (ⓓ[p]W2.ⓐV2.T2)
66 "bound context-sensitive parallel rt-transition (term)"
67 'PRedTy Rt c h G L T1 T2 = (cpg Rt h c G L T1 T2).
69 (* Basic properties *********************************************************)
71 (* Note: this is "∀Rt. reflexive … Rt → ∀h,g,L. reflexive … (cpg Rt h (𝟘𝟘) L)" *)
72 lemma cpg_refl: ∀Rt. reflexive … Rt → ∀h,G,T,L. ❪G,L❫ ⊢ T ⬈[Rt,𝟘𝟘,h] T.
73 #Rt #HRt #h #G #T elim T -T // * /2 width=1 by cpg_bind/
74 * /2 width=1 by cpg_appl, cpg_cast/
77 (* Basic inversion lemmas ***************************************************)
79 fact cpg_inv_atom1_aux: ∀Rt,c,h,G,L,T1,T2. ❪G,L❫ ⊢ T1 ⬈[Rt,c,h] T2 → ∀J. T1 = ⓪[J] →
81 | ∃∃s. J = Sort s & T2 = ⋆(⫯[h]s) & c = 𝟘𝟙
82 | ∃∃cV,K,V1,V2. ❪G,K❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧[1] V2 ≘ T2 &
83 L = K.ⓓV1 & J = LRef 0 & c = cV
84 | ∃∃cV,K,V1,V2. ❪G,K❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧[1] V2 ≘ T2 &
85 L = K.ⓛV1 & J = LRef 0 & c = cV+𝟘𝟙
86 | ∃∃I,K,T,i. ❪G,K❫ ⊢ #i ⬈[Rt,c,h] T & ⇧[1] T ≘ T2 &
87 L = K.ⓘ[I] & J = LRef (↑i).
88 #Rt #c #h #G #L #T1 #T2 * -c -G -L -T1 -T2
89 [ #I #G #L #J #H destruct /3 width=1 by or5_intro0, conj/
90 | #G #L #s #J #H destruct /3 width=3 by or5_intro1, ex3_intro/
91 | #c #G #L #V1 #V2 #W2 #HV12 #VW2 #J #H destruct /3 width=8 by or5_intro2, ex5_4_intro/
92 | #c #G #L #V1 #V2 #W2 #HV12 #VW2 #J #H destruct /3 width=8 by or5_intro3, ex5_4_intro/
93 | #c #I #G #L #T #U #i #HT #HTU #J #H destruct /3 width=8 by or5_intro4, ex4_4_intro/
94 | #cV #cT #p #I #G #L #V1 #V2 #T1 #T2 #_ #_ #J #H destruct
95 | #cV #cT #G #L #V1 #V2 #T1 #T2 #_ #_ #J #H destruct
96 | #cU #cT #G #L #U1 #U2 #T1 #T2 #_ #_ #_ #J #H destruct
97 | #c #G #L #V #T1 #T #T2 #_ #_ #J #H destruct
98 | #c #G #L #V #T1 #T2 #_ #J #H destruct
99 | #c #G #L #V1 #V2 #T #_ #J #H destruct
100 | #cV #cW #cT #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #J #H destruct
101 | #cV #cW #cT #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #J #H destruct
105 lemma cpg_inv_atom1: ∀Rt,c,h,J,G,L,T2. ❪G,L❫ ⊢ ⓪[J] ⬈[Rt,c,h] T2 →
106 ∨∨ T2 = ⓪[J] ∧ c = 𝟘𝟘
107 | ∃∃s. J = Sort s & T2 = ⋆(⫯[h]s) & c = 𝟘𝟙
108 | ∃∃cV,K,V1,V2. ❪G,K❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧[1] V2 ≘ T2 &
109 L = K.ⓓV1 & J = LRef 0 & c = cV
110 | ∃∃cV,K,V1,V2. ❪G,K❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧[1] V2 ≘ T2 &
111 L = K.ⓛV1 & J = LRef 0 & c = cV+𝟘𝟙
112 | ∃∃I,K,T,i. ❪G,K❫ ⊢ #i ⬈[Rt,c,h] T & ⇧[1] T ≘ T2 &
113 L = K.ⓘ[I] & J = LRef (↑i).
114 /2 width=3 by cpg_inv_atom1_aux/ qed-.
116 lemma cpg_inv_sort1: ∀Rt,c,h,G,L,T2,s. ❪G,L❫ ⊢ ⋆s ⬈[Rt,c,h] T2 →
117 ∨∨ T2 = ⋆s ∧ c = 𝟘𝟘 | T2 = ⋆(⫯[h]s) ∧ c = 𝟘𝟙.
118 #Rt #c #h #G #L #T2 #s #H
119 elim (cpg_inv_atom1 … H) -H * /3 width=1 by or_introl, conj/
120 [ #s0 #H destruct /3 width=1 by or_intror, conj/
121 |2,3: #cV #K #V1 #V2 #_ #_ #_ #H destruct
122 | #I #K #T #i #_ #_ #_ #H destruct
126 lemma cpg_inv_zero1: ∀Rt,c,h,G,L,T2. ❪G,L❫ ⊢ #0 ⬈[Rt,c,h] T2 →
128 | ∃∃cV,K,V1,V2. ❪G,K❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧[1] V2 ≘ T2 &
130 | ∃∃cV,K,V1,V2. ❪G,K❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧[1] V2 ≘ T2 &
131 L = K.ⓛV1 & c = cV+𝟘𝟙.
132 #Rt #c #h #G #L #T2 #H
133 elim (cpg_inv_atom1 … H) -H * /3 width=1 by or3_intro0, conj/
135 |2,3: #cV #K #V1 #V2 #HV12 #HVT2 #H1 #_ #H2 destruct /3 width=8 by or3_intro1, or3_intro2, ex4_4_intro/
136 | #I #K #T #i #_ #_ #_ #H destruct
140 lemma cpg_inv_lref1: ∀Rt,c,h,G,L,T2,i. ❪G,L❫ ⊢ #↑i ⬈[Rt,c,h] T2 →
141 ∨∨ T2 = #(↑i) ∧ c = 𝟘𝟘
142 | ∃∃I,K,T. ❪G,K❫ ⊢ #i ⬈[Rt,c,h] T & ⇧[1] T ≘ T2 & L = K.ⓘ[I].
143 #Rt #c #h #G #L #T2 #i #H
144 elim (cpg_inv_atom1 … H) -H * /3 width=1 by or_introl, conj/
146 |2,3: #cV #K #V1 #V2 #_ #_ #_ #H destruct
147 | #I #K #T #j #HT #HT2 #H1 #H2 destruct /3 width=6 by ex3_3_intro, or_intror/
151 lemma cpg_inv_gref1: ∀Rt,c,h,G,L,T2,l. ❪G,L❫ ⊢ §l ⬈[Rt,c,h] T2 → T2 = §l ∧ c = 𝟘𝟘.
152 #Rt #c #h #G #L #T2 #l #H
153 elim (cpg_inv_atom1 … H) -H * /2 width=1 by conj/
155 |2,3: #cV #K #V1 #V2 #_ #_ #_ #H destruct
156 | #I #K #T #i #_ #_ #_ #H destruct
160 fact cpg_inv_bind1_aux: ∀Rt,c,h,G,L,U,U2. ❪G,L❫ ⊢ U ⬈[Rt,c,h] U2 →
161 ∀p,J,V1,U1. U = ⓑ[p,J]V1.U1 →
162 ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ❪G,L.ⓑ[J]V1❫ ⊢ U1 ⬈[Rt,cT,h] T2 &
163 U2 = ⓑ[p,J]V2.T2 & c = ((↕*cV)∨cT)
164 | ∃∃cT,T. ⇧[1] T ≘ U1 & ❪G,L❫ ⊢ T ⬈[Rt,cT,h] U2 &
165 p = true & J = Abbr & c = cT+𝟙𝟘.
166 #Rt #c #h #G #L #U #U2 * -c -G -L -U -U2
167 [ #I #G #L #q #J #W #U1 #H destruct
168 | #G #L #s #q #J #W #U1 #H destruct
169 | #c #G #L #V1 #V2 #W2 #_ #_ #q #J #W #U1 #H destruct
170 | #c #G #L #V1 #V2 #W2 #_ #_ #q #J #W #U1 #H destruct
171 | #c #I #G #L #T #U #i #_ #_ #q #J #W #U1 #H destruct
172 | #cV #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/
173 | #cV #cT #G #L #V1 #V2 #T1 #T2 #_ #_ #q #J #W #U1 #H destruct
174 | #cU #cT #G #L #U1 #U2 #T1 #T2 #_ #_ #_ #q #J #W #U1 #H destruct
175 | #c #G #L #V #T1 #T #T2 #HT1 #HT2 #q #J #W #U1 #H destruct /3 width=5 by ex5_2_intro, or_intror/
176 | #c #G #L #V #T1 #T2 #_ #q #J #W #U1 #H destruct
177 | #c #G #L #V1 #V2 #T #_ #q #J #W #U1 #H destruct
178 | #cV #cW #cT #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #q #J #W #U1 #H destruct
179 | #cV #cW #cT #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #q #J #W #U1 #H destruct
183 lemma cpg_inv_bind1: ∀Rt,c,h,p,I,G,L,V1,T1,U2. ❪G,L❫ ⊢ ⓑ[p,I]V1.T1 ⬈[Rt,c,h] U2 →
184 ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ❪G,L.ⓑ[I]V1❫ ⊢ T1 ⬈[Rt,cT,h] T2 &
185 U2 = ⓑ[p,I]V2.T2 & c = ((↕*cV)∨cT)
186 | ∃∃cT,T. ⇧[1] T ≘ T1 & ❪G,L❫ ⊢ T ⬈[Rt,cT,h] U2 &
187 p = true & I = Abbr & c = cT+𝟙𝟘.
188 /2 width=3 by cpg_inv_bind1_aux/ qed-.
190 lemma cpg_inv_abbr1: ∀Rt,c,h,p,G,L,V1,T1,U2. ❪G,L❫ ⊢ ⓓ[p]V1.T1 ⬈[Rt,c,h] U2 →
191 ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ❪G,L.ⓓV1❫ ⊢ T1 ⬈[Rt,cT,h] T2 &
192 U2 = ⓓ[p]V2.T2 & c = ((↕*cV)∨cT)
193 | ∃∃cT,T. ⇧[1] T ≘ T1 & ❪G,L❫ ⊢ T ⬈[Rt,cT,h] U2 &
194 p = true & c = cT+𝟙𝟘.
195 #Rt #c #h #p #G #L #V1 #T1 #U2 #H elim (cpg_inv_bind1 … H) -H *
196 /3 width=8 by ex4_4_intro, ex4_2_intro, or_introl, or_intror/
199 lemma cpg_inv_abst1: ∀Rt,c,h,p,G,L,V1,T1,U2. ❪G,L❫ ⊢ ⓛ[p]V1.T1 ⬈[Rt,c,h] U2 →
200 ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ❪G,L.ⓛV1❫ ⊢ T1 ⬈[Rt,cT,h] T2 &
201 U2 = ⓛ[p]V2.T2 & c = ((↕*cV)∨cT).
202 #Rt #c #h #p #G #L #V1 #T1 #U2 #H elim (cpg_inv_bind1 … H) -H *
203 [ /3 width=8 by ex4_4_intro/
204 | #c #T #_ #_ #_ #H destruct
208 fact cpg_inv_appl1_aux: ∀Rt,c,h,G,L,U,U2. ❪G,L❫ ⊢ U ⬈[Rt,c,h] U2 →
210 ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ❪G,L❫ ⊢ U1 ⬈[Rt,cT,h] T2 &
211 U2 = ⓐV2.T2 & c = ((↕*cV)∨cT)
212 | ∃∃cV,cW,cT,p,V2,W1,W2,T1,T2. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ❪G,L❫ ⊢ W1 ⬈[Rt,cW,h] W2 & ❪G,L.ⓛW1❫ ⊢ T1 ⬈[Rt,cT,h] T2 &
213 U1 = ⓛ[p]W1.T1 & U2 = ⓓ[p]ⓝW2.V2.T2 & c = ((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘
214 | ∃∃cV,cW,cT,p,V,V2,W1,W2,T1,T2. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] V & ⇧[1] V ≘ V2 & ❪G,L❫ ⊢ W1 ⬈[Rt,cW,h] W2 & ❪G,L.ⓓW1❫ ⊢ T1 ⬈[Rt,cT,h] T2 &
215 U1 = ⓓ[p]W1.T1 & U2 = ⓓ[p]W2.ⓐV2.T2 & c = ((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘.
216 #Rt #c #h #G #L #U #U2 * -c -G -L -U -U2
217 [ #I #G #L #W #U1 #H destruct
218 | #G #L #s #W #U1 #H destruct
219 | #c #G #L #V1 #V2 #W2 #_ #_ #W #U1 #H destruct
220 | #c #G #L #V1 #V2 #W2 #_ #_ #W #U1 #H destruct
221 | #c #I #G #L #T #U #i #_ #_ #W #U1 #H destruct
222 | #cV #cT #p #I #G #L #V1 #V2 #T1 #T2 #_ #_ #W #U1 #H destruct
223 | #cV #cT #G #L #V1 #V2 #T1 #T2 #HV12 #HT12 #W #U1 #H destruct /3 width=8 by or3_intro0, ex4_4_intro/
224 | #cV #cT #G #L #V1 #V2 #T1 #T2 #_ #_ #_ #W #U1 #H destruct
225 | #c #G #L #V #T1 #T #T2 #_ #_ #W #U1 #H destruct
226 | #c #G #L #V #T1 #T2 #_ #W #U1 #H destruct
227 | #c #G #L #V1 #V2 #T #_ #W #U1 #H destruct
228 | #cV #cW #cT #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 #HW12 #HT12 #W #U1 #H destruct /3 width=15 by or3_intro1, ex6_9_intro/
229 | #cV #cW #cT #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 #HW12 #HT12 #W #U1 #H destruct /3 width=17 by or3_intro2, ex7_10_intro/
233 lemma cpg_inv_appl1: ∀Rt,c,h,G,L,V1,U1,U2. ❪G,L❫ ⊢ ⓐV1.U1 ⬈[Rt,c,h] U2 →
234 ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ❪G,L❫ ⊢ U1 ⬈[Rt,cT,h] T2 &
235 U2 = ⓐV2.T2 & c = ((↕*cV)∨cT)
236 | ∃∃cV,cW,cT,p,V2,W1,W2,T1,T2. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ❪G,L❫ ⊢ W1 ⬈[Rt,cW,h] W2 & ❪G,L.ⓛW1❫ ⊢ T1 ⬈[Rt,cT,h] T2 &
237 U1 = ⓛ[p]W1.T1 & U2 = ⓓ[p]ⓝW2.V2.T2 & c = ((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘
238 | ∃∃cV,cW,cT,p,V,V2,W1,W2,T1,T2. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] V & ⇧[1] V ≘ V2 & ❪G,L❫ ⊢ W1 ⬈[Rt,cW,h] W2 & ❪G,L.ⓓW1❫ ⊢ T1 ⬈[Rt,cT,h] T2 &
239 U1 = ⓓ[p]W1.T1 & U2 = ⓓ[p]W2.ⓐV2.T2 & c = ((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘.
240 /2 width=3 by cpg_inv_appl1_aux/ qed-.
242 fact cpg_inv_cast1_aux: ∀Rt,c,h,G,L,U,U2. ❪G,L❫ ⊢ U ⬈[Rt,c,h] U2 →
244 ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ❪G,L❫ ⊢ U1 ⬈[Rt,cT,h] T2 &
245 Rt cV cT & U2 = ⓝV2.T2 & c = (cV∨cT)
246 | ∃∃cT. ❪G,L❫ ⊢ U1 ⬈[Rt,cT,h] U2 & c = cT+𝟙𝟘
247 | ∃∃cV. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] U2 & c = cV+𝟘𝟙.
248 #Rt #c #h #G #L #U #U2 * -c -G -L -U -U2
249 [ #I #G #L #W #U1 #H destruct
250 | #G #L #s #W #U1 #H destruct
251 | #c #G #L #V1 #V2 #W2 #_ #_ #W #U1 #H destruct
252 | #c #G #L #V1 #V2 #W2 #_ #_ #W #U1 #H destruct
253 | #c #I #G #L #T #U #i #_ #_ #W #U1 #H destruct
254 | #cV #cT #p #I #G #L #V1 #V2 #T1 #T2 #_ #_ #W #U1 #H destruct
255 | #cV #cT #G #L #V1 #V2 #T1 #T2 #_ #_ #W #U1 #H destruct
256 | #cV #cT #G #L #V1 #V2 #T1 #T2 #HRt #HV12 #HT12 #W #U1 #H destruct /3 width=9 by or3_intro0, ex5_4_intro/
257 | #c #G #L #V #T1 #T #T2 #_ #_ #W #U1 #H destruct
258 | #c #G #L #V #T1 #T2 #HT12 #W #U1 #H destruct /3 width=3 by or3_intro1, ex2_intro/
259 | #c #G #L #V1 #V2 #T #HV12 #W #U1 #H destruct /3 width=3 by or3_intro2, ex2_intro/
260 | #cV #cW #cT #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 #HW12 #HT12 #W #U1 #H destruct
261 | #cV #cW #cT #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 #HW12 #HT12 #W #U1 #H destruct
265 lemma cpg_inv_cast1: ∀Rt,c,h,G,L,V1,U1,U2. ❪G,L❫ ⊢ ⓝV1.U1 ⬈[Rt,c,h] U2 →
266 ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ❪G,L❫ ⊢ U1 ⬈[Rt,cT,h] T2 &
267 Rt cV cT & U2 = ⓝV2.T2 & c = (cV∨cT)
268 | ∃∃cT. ❪G,L❫ ⊢ U1 ⬈[Rt,cT,h] U2 & c = cT+𝟙𝟘
269 | ∃∃cV. ❪G,L❫ ⊢ V1 ⬈[Rt,cV,h] U2 & c = cV+𝟘𝟙.
270 /2 width=3 by cpg_inv_cast1_aux/ qed-.
272 (* Advanced inversion lemmas ************************************************)
274 lemma cpg_inv_zero1_pair: ∀Rt,c,h,I,G,K,V1,T2. ❪G,K.ⓑ[I]V1❫ ⊢ #0 ⬈[Rt,c,h] T2 →
276 | ∃∃cV,V2. ❪G,K❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧[1] V2 ≘ T2 &
278 | ∃∃cV,V2. ❪G,K❫ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧[1] V2 ≘ T2 &
279 I = Abst & c = cV+𝟘𝟙.
280 #Rt #c #h #I #G #K #V1 #T2 #H elim (cpg_inv_zero1 … H) -H /2 width=1 by or3_intro0/
281 * #z #Y #X1 #X2 #HX12 #HXT2 #H1 #H2 destruct /3 width=5 by or3_intro1, or3_intro2, ex4_2_intro/
284 lemma cpg_inv_lref1_bind: ∀Rt,c,h,I,G,K,T2,i. ❪G,K.ⓘ[I]❫ ⊢ #↑i ⬈[Rt,c,h] T2 →
285 ∨∨ T2 = #(↑i) ∧ c = 𝟘𝟘
286 | ∃∃T. ❪G,K❫ ⊢ #i ⬈[Rt,c,h] T & ⇧[1] T ≘ T2.
287 #Rt #c #h #I #G #L #T2 #i #H elim (cpg_inv_lref1 … H) -H /2 width=1 by or_introl/
288 * #Z #Y #T #HT #HT2 #H destruct /3 width=3 by ex2_intro, or_intror/
291 (* Basic forward lemmas *****************************************************)
293 lemma cpg_fwd_bind1_minus: ∀Rt,c,h,I,G,L,V1,T1,T. ❪G,L❫ ⊢ -ⓑ[I]V1.T1 ⬈[Rt,c,h] T → ∀p.
294 ∃∃V2,T2. ❪G,L❫ ⊢ ⓑ[p,I]V1.T1 ⬈[Rt,c,h] ⓑ[p,I]V2.T2 &
296 #Rt #c #h #I #G #L #V1 #T1 #T #H #p elim (cpg_inv_bind1 … H) -H *
297 [ #cV #cT #V2 #T2 #HV12 #HT12 #H1 #H2 destruct /3 width=4 by cpg_bind, ex2_2_intro/
298 | #c #T2 #_ #_ #H destruct