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_2/steps/rtc_max.ma".
16 include "ground_2/steps/rtc_plus.ma".
17 include "basic_2/notation/relations/predty_7.ma".
18 include "static_2/syntax/sh.ma".
19 include "static_2/syntax/lenv.ma".
20 include "static_2/syntax/genv.ma".
21 include "static_2/relocation/lifts.ma".
23 (* BOUND CONTEXT-SENSITIVE PARALLEL RT-TRANSITION FOR TERMS *****************)
26 inductive cpg (Rt:relation rtc) (h): rtc → relation4 genv lenv term term ≝
27 | cpg_atom : ∀I,G,L. cpg Rt h (𝟘𝟘) G L (⓪{I}) (⓪{I})
28 | cpg_ess : ∀G,L,s. cpg Rt h (𝟘𝟙) G L (⋆s) (⋆(⫯[h]s))
29 | cpg_delta: ∀c,G,L,V1,V2,W2. cpg Rt h c G L V1 V2 →
30 ⇧*[1] V2 ≘ W2 → cpg Rt h c G (L.ⓓV1) (#0) W2
31 | cpg_ell : ∀c,G,L,V1,V2,W2. cpg Rt h c G L V1 V2 →
32 ⇧*[1] V2 ≘ W2 → cpg Rt h (c+𝟘𝟙) G (L.ⓛV1) (#0) W2
33 | cpg_lref : ∀c,I,G,L,T,U,i. cpg Rt h c G L (#i) T →
34 ⇧*[1] T ≘ U → cpg Rt h c G (L.ⓘ{I}) (#↑i) U
35 | cpg_bind : ∀cV,cT,p,I,G,L,V1,V2,T1,T2.
36 cpg Rt h cV G L V1 V2 → cpg Rt h cT G (L.ⓑ{I}V1) T1 T2 →
37 cpg Rt h ((↕*cV)∨cT) G L (ⓑ{p,I}V1.T1) (ⓑ{p,I}V2.T2)
38 | cpg_appl : ∀cV,cT,G,L,V1,V2,T1,T2.
39 cpg Rt h cV G L V1 V2 → cpg Rt h cT G L T1 T2 →
40 cpg Rt h ((↕*cV)∨cT) G L (ⓐV1.T1) (ⓐV2.T2)
41 | cpg_cast : ∀cU,cT,G,L,U1,U2,T1,T2. Rt cU cT →
42 cpg Rt h cU G L U1 U2 → cpg Rt h cT G L T1 T2 →
43 cpg Rt h (cU∨cT) G L (ⓝU1.T1) (ⓝU2.T2)
44 | cpg_zeta : ∀c,G,L,V,T1,T,T2. ⇧*[1] T ≘ T1 → cpg Rt h c G L T T2 →
45 cpg Rt h (c+𝟙𝟘) G L (+ⓓV.T1) T2
46 | 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
47 | 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
48 | cpg_beta : ∀cV,cW,cT,p,G,L,V1,V2,W1,W2,T1,T2.
49 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 →
50 cpg Rt h (((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘) G L (ⓐV1.ⓛ{p}W1.T1) (ⓓ{p}ⓝW2.V2.T2)
51 | cpg_theta: ∀cV,cW,cT,p,G,L,V1,V,V2,W1,W2,T1,T2.
52 cpg Rt h cV G L V1 V → ⇧*[1] V ≘ V2 → cpg Rt h cW G L W1 W2 →
53 cpg Rt h cT G (L.ⓓW1) T1 T2 →
54 cpg Rt h (((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘) G L (ⓐV1.ⓓ{p}W1.T1) (ⓓ{p}W2.ⓐV2.T2)
58 "bound context-sensitive parallel rt-transition (term)"
59 'PRedTy Rt c h G L T1 T2 = (cpg Rt h c G L T1 T2).
61 (* Basic properties *********************************************************)
63 (* Note: this is "∀Rt. reflexive … Rt → ∀h,g,L. reflexive … (cpg Rt h (𝟘𝟘) L)" *)
64 lemma cpg_refl: ∀Rt. reflexive … Rt → ∀h,G,T,L. ⦃G,L⦄ ⊢ T ⬈[Rt,𝟘𝟘,h] T.
65 #Rt #HRt #h #G #T elim T -T // * /2 width=1 by cpg_bind/
66 * /2 width=1 by cpg_appl, cpg_cast/
69 (* Basic inversion lemmas ***************************************************)
71 fact cpg_inv_atom1_aux: ∀Rt,c,h,G,L,T1,T2. ⦃G,L⦄ ⊢ T1 ⬈[Rt,c,h] T2 → ∀J. T1 = ⓪{J} →
73 | ∃∃s. J = Sort s & T2 = ⋆(⫯[h]s) & c = 𝟘𝟙
74 | ∃∃cV,K,V1,V2. ⦃G,K⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧*[1] V2 ≘ T2 &
75 L = K.ⓓV1 & J = LRef 0 & c = cV
76 | ∃∃cV,K,V1,V2. ⦃G,K⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧*[1] V2 ≘ T2 &
77 L = K.ⓛV1 & J = LRef 0 & c = cV+𝟘𝟙
78 | ∃∃I,K,T,i. ⦃G,K⦄ ⊢ #i ⬈[Rt,c,h] T & ⇧*[1] T ≘ T2 &
79 L = K.ⓘ{I} & J = LRef (↑i).
80 #Rt #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 #T #U #i #HT #HTU #J #H destruct /3 width=8 by or5_intro4, ex4_4_intro/
86 | #cV #cT #p #I #G #L #V1 #V2 #T1 #T2 #_ #_ #J #H destruct
87 | #cV #cT #G #L #V1 #V2 #T1 #T2 #_ #_ #J #H destruct
88 | #cU #cT #G #L #U1 #U2 #T1 #T2 #_ #_ #_ #J #H destruct
89 | #c #G #L #V #T1 #T #T2 #_ #_ #J #H destruct
90 | #c #G #L #V #T1 #T2 #_ #J #H destruct
91 | #c #G #L #V1 #V2 #T #_ #J #H destruct
92 | #cV #cW #cT #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #J #H destruct
93 | #cV #cW #cT #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #J #H destruct
97 lemma cpg_inv_atom1: ∀Rt,c,h,J,G,L,T2. ⦃G,L⦄ ⊢ ⓪{J} ⬈[Rt,c,h] T2 →
99 | ∃∃s. J = Sort s & T2 = ⋆(⫯[h]s) & c = 𝟘𝟙
100 | ∃∃cV,K,V1,V2. ⦃G,K⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧*[1] V2 ≘ T2 &
101 L = K.ⓓV1 & J = LRef 0 & c = cV
102 | ∃∃cV,K,V1,V2. ⦃G,K⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧*[1] V2 ≘ T2 &
103 L = K.ⓛV1 & J = LRef 0 & c = cV+𝟘𝟙
104 | ∃∃I,K,T,i. ⦃G,K⦄ ⊢ #i ⬈[Rt,c,h] T & ⇧*[1] T ≘ T2 &
105 L = K.ⓘ{I} & J = LRef (↑i).
106 /2 width=3 by cpg_inv_atom1_aux/ qed-.
108 lemma cpg_inv_sort1: ∀Rt,c,h,G,L,T2,s. ⦃G,L⦄ ⊢ ⋆s ⬈[Rt,c,h] T2 →
109 ∨∨ T2 = ⋆s ∧ c = 𝟘𝟘 | T2 = ⋆(⫯[h]s) ∧ c = 𝟘𝟙.
110 #Rt #c #h #G #L #T2 #s #H
111 elim (cpg_inv_atom1 … H) -H * /3 width=1 by or_introl, conj/
112 [ #s0 #H destruct /3 width=1 by or_intror, conj/
113 |2,3: #cV #K #V1 #V2 #_ #_ #_ #H destruct
114 | #I #K #T #i #_ #_ #_ #H destruct
118 lemma cpg_inv_zero1: ∀Rt,c,h,G,L,T2. ⦃G,L⦄ ⊢ #0 ⬈[Rt,c,h] T2 →
120 | ∃∃cV,K,V1,V2. ⦃G,K⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧*[1] V2 ≘ T2 &
122 | ∃∃cV,K,V1,V2. ⦃G,K⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧*[1] V2 ≘ T2 &
123 L = K.ⓛV1 & c = cV+𝟘𝟙.
124 #Rt #c #h #G #L #T2 #H
125 elim (cpg_inv_atom1 … H) -H * /3 width=1 by or3_intro0, conj/
127 |2,3: #cV #K #V1 #V2 #HV12 #HVT2 #H1 #_ #H2 destruct /3 width=8 by or3_intro1, or3_intro2, ex4_4_intro/
128 | #I #K #T #i #_ #_ #_ #H destruct
132 lemma cpg_inv_lref1: ∀Rt,c,h,G,L,T2,i. ⦃G,L⦄ ⊢ #↑i ⬈[Rt,c,h] T2 →
133 ∨∨ T2 = #(↑i) ∧ c = 𝟘𝟘
134 | ∃∃I,K,T. ⦃G,K⦄ ⊢ #i ⬈[Rt,c,h] T & ⇧*[1] T ≘ T2 & L = K.ⓘ{I}.
135 #Rt #c #h #G #L #T2 #i #H
136 elim (cpg_inv_atom1 … H) -H * /3 width=1 by or_introl, conj/
138 |2,3: #cV #K #V1 #V2 #_ #_ #_ #H destruct
139 | #I #K #T #j #HT #HT2 #H1 #H2 destruct /3 width=6 by ex3_3_intro, or_intror/
143 lemma cpg_inv_gref1: ∀Rt,c,h,G,L,T2,l. ⦃G,L⦄ ⊢ §l ⬈[Rt,c,h] T2 → T2 = §l ∧ c = 𝟘𝟘.
144 #Rt #c #h #G #L #T2 #l #H
145 elim (cpg_inv_atom1 … H) -H * /2 width=1 by conj/
147 |2,3: #cV #K #V1 #V2 #_ #_ #_ #H destruct
148 | #I #K #T #i #_ #_ #_ #H destruct
152 fact cpg_inv_bind1_aux: ∀Rt,c,h,G,L,U,U2. ⦃G,L⦄ ⊢ U ⬈[Rt,c,h] U2 →
153 ∀p,J,V1,U1. U = ⓑ{p,J}V1.U1 →
154 ∨∨ ∃∃cV,cT,V2,T2. ⦃G,L⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⦃G,L.ⓑ{J}V1⦄ ⊢ U1 ⬈[Rt,cT,h] T2 &
155 U2 = ⓑ{p,J}V2.T2 & c = ((↕*cV)∨cT)
156 | ∃∃cT,T. ⇧*[1] T ≘ U1 & ⦃G,L⦄ ⊢ T ⬈[Rt,cT,h] U2 &
157 p = true & J = Abbr & c = cT+𝟙𝟘.
158 #Rt #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 #T #U #i #_ #_ #q #J #W #U1 #H destruct
164 | #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/
165 | #cV #cT #G #L #V1 #V2 #T1 #T2 #_ #_ #q #J #W #U1 #H destruct
166 | #cU #cT #G #L #U1 #U2 #T1 #T2 #_ #_ #_ #q #J #W #U1 #H destruct
167 | #c #G #L #V #T1 #T #T2 #HT1 #HT2 #q #J #W #U1 #H destruct /3 width=5 by ex5_2_intro, or_intror/
168 | #c #G #L #V #T1 #T2 #_ #q #J #W #U1 #H destruct
169 | #c #G #L #V1 #V2 #T #_ #q #J #W #U1 #H destruct
170 | #cV #cW #cT #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #q #J #W #U1 #H destruct
171 | #cV #cW #cT #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #q #J #W #U1 #H destruct
175 lemma cpg_inv_bind1: ∀Rt,c,h,p,I,G,L,V1,T1,U2. ⦃G,L⦄ ⊢ ⓑ{p,I}V1.T1 ⬈[Rt,c,h] U2 →
176 ∨∨ ∃∃cV,cT,V2,T2. ⦃G,L⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⦃G,L.ⓑ{I}V1⦄ ⊢ T1 ⬈[Rt,cT,h] T2 &
177 U2 = ⓑ{p,I}V2.T2 & c = ((↕*cV)∨cT)
178 | ∃∃cT,T. ⇧*[1] T ≘ T1 & ⦃G,L⦄ ⊢ T ⬈[Rt,cT,h] U2 &
179 p = true & I = Abbr & c = cT+𝟙𝟘.
180 /2 width=3 by cpg_inv_bind1_aux/ qed-.
182 lemma cpg_inv_abbr1: ∀Rt,c,h,p,G,L,V1,T1,U2. ⦃G,L⦄ ⊢ ⓓ{p}V1.T1 ⬈[Rt,c,h] U2 →
183 ∨∨ ∃∃cV,cT,V2,T2. ⦃G,L⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⦃G,L.ⓓV1⦄ ⊢ T1 ⬈[Rt,cT,h] T2 &
184 U2 = ⓓ{p}V2.T2 & c = ((↕*cV)∨cT)
185 | ∃∃cT,T. ⇧*[1] T ≘ T1 & ⦃G,L⦄ ⊢ T ⬈[Rt,cT,h] U2 &
186 p = true & c = cT+𝟙𝟘.
187 #Rt #c #h #p #G #L #V1 #T1 #U2 #H elim (cpg_inv_bind1 … H) -H *
188 /3 width=8 by ex4_4_intro, ex4_2_intro, or_introl, or_intror/
191 lemma cpg_inv_abst1: ∀Rt,c,h,p,G,L,V1,T1,U2. ⦃G,L⦄ ⊢ ⓛ{p}V1.T1 ⬈[Rt,c,h] U2 →
192 ∃∃cV,cT,V2,T2. ⦃G,L⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⦃G,L.ⓛV1⦄ ⊢ T1 ⬈[Rt,cT,h] T2 &
193 U2 = ⓛ{p}V2.T2 & c = ((↕*cV)∨cT).
194 #Rt #c #h #p #G #L #V1 #T1 #U2 #H elim (cpg_inv_bind1 … H) -H *
195 [ /3 width=8 by ex4_4_intro/
196 | #c #T #_ #_ #_ #H destruct
200 fact cpg_inv_appl1_aux: ∀Rt,c,h,G,L,U,U2. ⦃G,L⦄ ⊢ U ⬈[Rt,c,h] U2 →
202 ∨∨ ∃∃cV,cT,V2,T2. ⦃G,L⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⦃G,L⦄ ⊢ U1 ⬈[Rt,cT,h] T2 &
203 U2 = ⓐV2.T2 & c = ((↕*cV)∨cT)
204 | ∃∃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 &
205 U1 = ⓛ{p}W1.T1 & U2 = ⓓ{p}ⓝW2.V2.T2 & c = ((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘
206 | ∃∃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 &
207 U1 = ⓓ{p}W1.T1 & U2 = ⓓ{p}W2.ⓐV2.T2 & c = ((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘.
208 #Rt #c #h #G #L #U #U2 * -c -G -L -U -U2
209 [ #I #G #L #W #U1 #H destruct
210 | #G #L #s #W #U1 #H destruct
211 | #c #G #L #V1 #V2 #W2 #_ #_ #W #U1 #H destruct
212 | #c #G #L #V1 #V2 #W2 #_ #_ #W #U1 #H destruct
213 | #c #I #G #L #T #U #i #_ #_ #W #U1 #H destruct
214 | #cV #cT #p #I #G #L #V1 #V2 #T1 #T2 #_ #_ #W #U1 #H destruct
215 | #cV #cT #G #L #V1 #V2 #T1 #T2 #HV12 #HT12 #W #U1 #H destruct /3 width=8 by or3_intro0, ex4_4_intro/
216 | #cV #cT #G #L #V1 #V2 #T1 #T2 #_ #_ #_ #W #U1 #H destruct
217 | #c #G #L #V #T1 #T #T2 #_ #_ #W #U1 #H destruct
218 | #c #G #L #V #T1 #T2 #_ #W #U1 #H destruct
219 | #c #G #L #V1 #V2 #T #_ #W #U1 #H destruct
220 | #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/
221 | #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/
225 lemma cpg_inv_appl1: ∀Rt,c,h,G,L,V1,U1,U2. ⦃G,L⦄ ⊢ ⓐV1.U1 ⬈[Rt,c,h] U2 →
226 ∨∨ ∃∃cV,cT,V2,T2. ⦃G,L⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⦃G,L⦄ ⊢ U1 ⬈[Rt,cT,h] T2 &
227 U2 = ⓐV2.T2 & c = ((↕*cV)∨cT)
228 | ∃∃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 &
229 U1 = ⓛ{p}W1.T1 & U2 = ⓓ{p}ⓝW2.V2.T2 & c = ((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘
230 | ∃∃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 &
231 U1 = ⓓ{p}W1.T1 & U2 = ⓓ{p}W2.ⓐV2.T2 & c = ((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘.
232 /2 width=3 by cpg_inv_appl1_aux/ qed-.
234 fact cpg_inv_cast1_aux: ∀Rt,c,h,G,L,U,U2. ⦃G,L⦄ ⊢ U ⬈[Rt,c,h] U2 →
236 ∨∨ ∃∃cV,cT,V2,T2. ⦃G,L⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⦃G,L⦄ ⊢ U1 ⬈[Rt,cT,h] T2 &
237 Rt cV cT & U2 = ⓝV2.T2 & c = (cV∨cT)
238 | ∃∃cT. ⦃G,L⦄ ⊢ U1 ⬈[Rt,cT,h] U2 & c = cT+𝟙𝟘
239 | ∃∃cV. ⦃G,L⦄ ⊢ V1 ⬈[Rt,cV,h] U2 & c = cV+𝟘𝟙.
240 #Rt #c #h #G #L #U #U2 * -c -G -L -U -U2
241 [ #I #G #L #W #U1 #H destruct
242 | #G #L #s #W #U1 #H destruct
243 | #c #G #L #V1 #V2 #W2 #_ #_ #W #U1 #H destruct
244 | #c #G #L #V1 #V2 #W2 #_ #_ #W #U1 #H destruct
245 | #c #I #G #L #T #U #i #_ #_ #W #U1 #H destruct
246 | #cV #cT #p #I #G #L #V1 #V2 #T1 #T2 #_ #_ #W #U1 #H destruct
247 | #cV #cT #G #L #V1 #V2 #T1 #T2 #_ #_ #W #U1 #H destruct
248 | #cV #cT #G #L #V1 #V2 #T1 #T2 #HRt #HV12 #HT12 #W #U1 #H destruct /3 width=9 by or3_intro0, ex5_4_intro/
249 | #c #G #L #V #T1 #T #T2 #_ #_ #W #U1 #H destruct
250 | #c #G #L #V #T1 #T2 #HT12 #W #U1 #H destruct /3 width=3 by or3_intro1, ex2_intro/
251 | #c #G #L #V1 #V2 #T #HV12 #W #U1 #H destruct /3 width=3 by or3_intro2, ex2_intro/
252 | #cV #cW #cT #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 #HW12 #HT12 #W #U1 #H destruct
253 | #cV #cW #cT #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 #HW12 #HT12 #W #U1 #H destruct
257 lemma cpg_inv_cast1: ∀Rt,c,h,G,L,V1,U1,U2. ⦃G,L⦄ ⊢ ⓝV1.U1 ⬈[Rt,c,h] U2 →
258 ∨∨ ∃∃cV,cT,V2,T2. ⦃G,L⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⦃G,L⦄ ⊢ U1 ⬈[Rt,cT,h] T2 &
259 Rt cV cT & U2 = ⓝV2.T2 & c = (cV∨cT)
260 | ∃∃cT. ⦃G,L⦄ ⊢ U1 ⬈[Rt,cT,h] U2 & c = cT+𝟙𝟘
261 | ∃∃cV. ⦃G,L⦄ ⊢ V1 ⬈[Rt,cV,h] U2 & c = cV+𝟘𝟙.
262 /2 width=3 by cpg_inv_cast1_aux/ qed-.
264 (* Advanced inversion lemmas ************************************************)
266 lemma cpg_inv_zero1_pair: ∀Rt,c,h,I,G,K,V1,T2. ⦃G,K.ⓑ{I}V1⦄ ⊢ #0 ⬈[Rt,c,h] T2 →
268 | ∃∃cV,V2. ⦃G,K⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧*[1] V2 ≘ T2 &
270 | ∃∃cV,V2. ⦃G,K⦄ ⊢ V1 ⬈[Rt,cV,h] V2 & ⇧*[1] V2 ≘ T2 &
271 I = Abst & c = cV+𝟘𝟙.
272 #Rt #c #h #I #G #K #V1 #T2 #H elim (cpg_inv_zero1 … H) -H /2 width=1 by or3_intro0/
273 * #z #Y #X1 #X2 #HX12 #HXT2 #H1 #H2 destruct /3 width=5 by or3_intro1, or3_intro2, ex4_2_intro/
276 lemma cpg_inv_lref1_bind: ∀Rt,c,h,I,G,K,T2,i. ⦃G,K.ⓘ{I}⦄ ⊢ #↑i ⬈[Rt,c,h] T2 →
277 ∨∨ T2 = #(↑i) ∧ c = 𝟘𝟘
278 | ∃∃T. ⦃G,K⦄ ⊢ #i ⬈[Rt,c,h] T & ⇧*[1] T ≘ T2.
279 #Rt #c #h #I #G #L #T2 #i #H elim (cpg_inv_lref1 … H) -H /2 width=1 by or_introl/
280 * #Z #Y #T #HT #HT2 #H destruct /3 width=3 by ex2_intro, or_intror/
283 (* Basic forward lemmas *****************************************************)
285 lemma cpg_fwd_bind1_minus: ∀Rt,c,h,I,G,L,V1,T1,T. ⦃G,L⦄ ⊢ -ⓑ{I}V1.T1 ⬈[Rt,c,h] T → ∀p.
286 ∃∃V2,T2. ⦃G,L⦄ ⊢ ⓑ{p,I}V1.T1 ⬈[Rt,c,h] ⓑ{p,I}V2.T2 &
288 #Rt #c #h #I #G #L #V1 #T1 #T #H #p elim (cpg_inv_bind1 … H) -H *
289 [ #cV #cT #V2 #T2 #HV12 #HT12 #H1 #H2 destruct /3 width=4 by cpg_bind, ex2_2_intro/
290 | #c #T2 #_ #_ #H destruct