]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_transition/cpg.ma
milestone update in basic_2, update in ground and static_2
[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/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/lenv.ma".
27 include "static_2/syntax/genv.ma".
28 include "static_2/relocation/lifts.ma".
29
30 (* BOUND CONTEXT-SENSITIVE PARALLEL RT-TRANSITION FOR TERMS *****************)
31
32 (* avtivate genv *)
33 inductive cpg (Rs:relation nat) (Rk:relation rtc): rtc → relation4 genv lenv term term ≝
34 | cpg_atom : ∀I,G,L. cpg Rs Rk (𝟘𝟘) G L (⓪[I]) (⓪[I])
35 | cpg_ess  : ∀G,L,s1,s2. Rs s1 s2 → cpg Rs Rk (𝟘𝟙) G L (⋆s1) (⋆s2)
36 | cpg_delta: ∀c,G,L,V1,V2,W2. cpg Rs Rk c G L V1 V2 →
37              ⇧[1] V2 ≘ W2 → cpg Rs Rk c G (L.ⓓV1) (#0) W2
38 | cpg_ell  : ∀c,G,L,V1,V2,W2. cpg Rs Rk c G L V1 V2 →
39              ⇧[1] V2 ≘ W2 → cpg Rs Rk (c+𝟘𝟙) G (L.ⓛV1) (#0) W2
40 | cpg_lref : ∀c,I,G,L,T,U,i. cpg Rs Rk c G L (#i) T →
41              ⇧[1] T ≘ U → cpg Rs Rk c G (L.ⓘ[I]) (#↑i) U
42 | cpg_bind : ∀cV,cT,p,I,G,L,V1,V2,T1,T2.
43              cpg Rs Rk cV G L V1 V2 → cpg Rs Rk cT G (L.ⓑ[I]V1) T1 T2 →
44              cpg Rs Rk ((↕*cV)∨cT) G L (ⓑ[p,I]V1.T1) (ⓑ[p,I]V2.T2)
45 | cpg_appl : ∀cV,cT,G,L,V1,V2,T1,T2.
46              cpg Rs Rk cV G L V1 V2 → cpg Rs Rk cT G L T1 T2 →
47              cpg Rs Rk ((↕*cV)∨cT) G L (ⓐV1.T1) (ⓐV2.T2)
48 | cpg_cast : ∀cU,cT,G,L,U1,U2,T1,T2. Rk cU cT →
49              cpg Rs Rk cU G L U1 U2 → cpg Rs Rk cT G L T1 T2 →
50              cpg Rs Rk (cU∨cT) G L (ⓝU1.T1) (ⓝU2.T2)
51 | cpg_zeta : ∀c,G,L,V,T1,T,T2. ⇧[1] T ≘ T1 → cpg Rs Rk c G L T T2 →
52              cpg Rs Rk (c+𝟙𝟘) G L (+ⓓV.T1) T2
53 | cpg_eps  : ∀c,G,L,V,T1,T2. cpg Rs Rk c G L T1 T2 → cpg Rs Rk (c+𝟙𝟘) G L (ⓝV.T1) T2
54 | cpg_ee   : ∀c,G,L,V1,V2,T. cpg Rs Rk c G L V1 V2 → cpg Rs Rk (c+𝟘𝟙) G L (ⓝV1.T) V2
55 | cpg_beta : ∀cV,cW,cT,p,G,L,V1,V2,W1,W2,T1,T2.
56              cpg Rs Rk cV G L V1 V2 → cpg Rs Rk cW G L W1 W2 → cpg Rs Rk cT G (L.ⓛW1) T1 T2 →
57              cpg Rs Rk (((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘) G L (ⓐV1.ⓛ[p]W1.T1) (ⓓ[p]ⓝW2.V2.T2)
58 | cpg_theta: ∀cV,cW,cT,p,G,L,V1,V,V2,W1,W2,T1,T2.
59              cpg Rs Rk cV G L V1 V → ⇧[1] V ≘ V2 → cpg Rs Rk cW G L W1 W2 →
60              cpg Rs Rk cT G (L.ⓓW1) T1 T2 →
61              cpg Rs Rk (((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘) G L (ⓐV1.ⓓ[p]W1.T1) (ⓓ[p]W2.ⓐV2.T2)
62 .
63
64 interpretation
65    "bound context-sensitive parallel rt-transition (term)"
66    'PRedTy Rs Rk c G L T1 T2 = (cpg Rs Rk c G L T1 T2).
67
68 (* Basic properties *********************************************************)
69
70 (* Note: this is "∀Rs,Rk. reflexive … Rk → ∀G,L. reflexive … (cpg Rs Rk (𝟘𝟘) G L)" *)
71 lemma cpg_refl (Rs) (Rk):
72       reflexive … Rk → ∀G,T,L. ❪G,L❫ ⊢ T ⬈[Rs,Rk,𝟘𝟘] T.
73 #Rk #HRk #h #G #T elim T -T // * /2 width=1 by cpg_bind/
74 * /2 width=1 by cpg_appl, cpg_cast/
75 qed.
76
77 (* Basic inversion lemmas ***************************************************)
78
79 fact cpg_inv_atom1_aux (Rs) (Rk) (c) (G) (L):
80      ∀T1,T2. ❪G,L❫ ⊢ T1 ⬈[Rs,Rk,c] T2 → ∀J. T1 = ⓪[J] →
81      ∨∨ ∧∧ T2 = ⓪[J] & c = 𝟘𝟘
82       | ∃∃s1,s2. Rs s1 s2 & J = Sort s1 & T2 = ⋆s2 & c = 𝟘𝟙
83       | ∃∃cV,K,V1,V2. ❪G,K❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ⇧[1] V2 ≘ T2 & L = K.ⓓV1 & J = LRef 0 & c = cV
84       | ∃∃cV,K,V1,V2. ❪G,K❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ⇧[1] V2 ≘ T2 & L = K.ⓛV1 & J = LRef 0 & c = cV+𝟘𝟙
85       | ∃∃I,K,T,i. ❪G,K❫ ⊢ #i ⬈[Rs,Rk,c] T & ⇧[1] T ≘ T2 & L = K.ⓘ[I] & J = LRef (↑i).
86 #Rs #Rk #c #G #L #T1 #T2 * -c -G -L -T1 -T2
87 [ #I #G #L #J #H destruct /3 width=1 by or5_intro0, conj/
88 | #G #L #s1 #s2 #HRs #J #H destruct /3 width=5 by or5_intro1, ex4_2_intro/
89 | #c #G #L #V1 #V2 #W2 #HV12 #VW2 #J #H destruct /3 width=8 by or5_intro2, ex5_4_intro/
90 | #c #G #L #V1 #V2 #W2 #HV12 #VW2 #J #H destruct /3 width=8 by or5_intro3, ex5_4_intro/
91 | #c #I #G #L #T #U #i #HT #HTU #J #H destruct /3 width=8 by or5_intro4, ex4_4_intro/
92 | #cV #cT #p #I #G #L #V1 #V2 #T1 #T2 #_ #_ #J #H destruct
93 | #cV #cT #G #L #V1 #V2 #T1 #T2 #_ #_ #J #H destruct
94 | #cU #cT #G #L #U1 #U2 #T1 #T2 #_ #_ #_ #J #H destruct
95 | #c #G #L #V #T1 #T #T2 #_ #_ #J #H destruct
96 | #c #G #L #V #T1 #T2 #_ #J #H destruct
97 | #c #G #L #V1 #V2 #T #_ #J #H destruct
98 | #cV #cW #cT #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #J #H destruct
99 | #cV #cW #cT #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #J #H destruct
100 ]
101 qed-.
102
103 lemma cpg_inv_atom1 (Rs) (Rk) (c) (G) (L):
104       ∀J,T2. ❪G,L❫ ⊢ ⓪[J] ⬈[Rs,Rk,c] T2 →
105       ∨∨ ∧∧ T2 = ⓪[J] & c = 𝟘𝟘
106        | ∃∃s1,s2. Rs s1 s2 & J = Sort s1 & T2 = ⋆s2 & c = 𝟘𝟙
107        | ∃∃cV,K,V1,V2. ❪G,K❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ⇧[1] V2 ≘ T2 & L = K.ⓓV1 & J = LRef 0 & c = cV
108        | ∃∃cV,K,V1,V2. ❪G,K❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ⇧[1] V2 ≘ T2 & L = K.ⓛV1 & J = LRef 0 & c = cV+𝟘𝟙
109        | ∃∃I,K,T,i. ❪G,K❫ ⊢ #i ⬈[Rs,Rk,c] T & ⇧[1] T ≘ T2 & L = K.ⓘ[I] & J = LRef (↑i).
110 /2 width=3 by cpg_inv_atom1_aux/ qed-.
111
112 lemma cpg_inv_sort1 (Rs) (Rk) (c) (G) (L):
113       ∀T2,s1. ❪G,L❫ ⊢ ⋆s1 ⬈[Rs,Rk,c] T2 →
114       ∨∨ ∧∧ T2 = ⋆s1 & c = 𝟘𝟘
115        | ∃∃s2. Rs s1 s2 & T2 = ⋆s2 & c = 𝟘𝟙.
116 #Rs #Rk #c #G #L #T2 #s #H
117 elim (cpg_inv_atom1 … H) -H * /3 width=1 by or_introl, conj/
118 [ #s1 #s2 #HRs #H1 #H2 #H3 destruct /3 width=3 by ex3_intro, or_intror/
119 |2,3: #cV #K #V1 #V2 #_ #_ #_ #H destruct
120 | #I #K #T #i #_ #_ #_ #H destruct
121 ]
122 qed-.
123
124 lemma cpg_inv_zero1 (Rs) (Rk) (c) (G) (L):
125       ∀T2. ❪G,L❫ ⊢ #0 ⬈[Rs,Rk,c] T2 →
126       ∨∨ ∧∧ T2 = #0 & c = 𝟘𝟘
127        | ∃∃cV,K,V1,V2. ❪G,K❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ⇧[1] V2 ≘ T2 & L = K.ⓓV1 & c = cV
128        | ∃∃cV,K,V1,V2. ❪G,K❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ⇧[1] V2 ≘ T2 & L = K.ⓛV1 & c = cV+𝟘𝟙.
129 #Rs #Rk #c #G #L #T2 #H
130 elim (cpg_inv_atom1 … H) -H * /3 width=1 by or3_intro0, conj/
131 [ #s1 #s2 #_ #H destruct
132 |2,3: #cV #K #V1 #V2 #HV12 #HVT2 #H1 #_ #H2 destruct /3 width=8 by or3_intro1, or3_intro2, ex4_4_intro/
133 | #I #K #T #i #_ #_ #_ #H destruct
134 ]
135 qed-.
136
137 lemma cpg_inv_lref1 (Rs) (Rk) (c) (G) (L):
138       ∀T2,i. ❪G,L❫ ⊢ #↑i ⬈[Rs,Rk,c] T2 →
139       ∨∨ ∧∧ T2 = #(↑i) & c = 𝟘𝟘
140        | ∃∃I,K,T. ❪G,K❫ ⊢ #i ⬈[Rs,Rk,c] T & ⇧[1] T ≘ T2 & L = K.ⓘ[I].
141 #Rs #Rk #c #G #L #T2 #i #H
142 elim (cpg_inv_atom1 … H) -H * /3 width=1 by or_introl, conj/
143 [ #s1 #s2 #_ #H destruct
144 |2,3: #cV #K #V1 #V2 #_ #_ #_ #H destruct
145 | #I #K #T #j #HT #HT2 #H1 #H2 destruct /3 width=6 by ex3_3_intro, or_intror/
146 ]
147 qed-.
148
149 lemma cpg_inv_gref1 (Rs) (Rk) (c) (G) (L):
150       ∀T2,l. ❪G,L❫ ⊢ §l ⬈[Rs,Rk,c] T2 → ∧∧ T2 = §l & c = 𝟘𝟘.
151 #Rs #Rk #c #G #L #T2 #l #H
152 elim (cpg_inv_atom1 … H) -H * /2 width=1 by conj/
153 [ #s1 #s2 #_ #H destruct
154 |2,3: #cV #K #V1 #V2 #_ #_ #_ #H destruct
155 | #I #K #T #i #_ #_ #_ #H destruct
156 ]
157 qed-.
158
159 fact cpg_inv_bind1_aux (Rs) (Rk) (c) (G) (L):
160      ∀U,U2. ❪G,L❫ ⊢ U ⬈[Rs,Rk,c] U2 →
161      ∀p,J,V1,U1. U = ⓑ[p,J]V1.U1 →
162      ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ❪G,L.ⓑ[J]V1❫ ⊢ U1 ⬈[Rs,Rk,cT] T2 & U2 = ⓑ[p,J]V2.T2 & c = ((↕*cV)∨cT)
163       | ∃∃cT,T. ⇧[1] T ≘ U1 & ❪G,L❫ ⊢ T ⬈[Rs,Rk,cT] U2 & p = true & J = Abbr & c = cT+𝟙𝟘.
164 #Rs #Rk #c #G #L #U #U2 * -c -G -L -U -U2
165 [ #I #G #L #q #J #W #U1 #H destruct
166 | #G #L #s1 #s2 #_ #q #J #W #U1 #H destruct
167 | #c #G #L #V1 #V2 #W2 #_ #_ #q #J #W #U1 #H destruct
168 | #c #G #L #V1 #V2 #W2 #_ #_ #q #J #W #U1 #H destruct
169 | #c #I #G #L #T #U #i #_ #_ #q #J #W #U1 #H destruct
170 | #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/
171 | #cV #cT #G #L #V1 #V2 #T1 #T2 #_ #_ #q #J #W #U1 #H destruct
172 | #cU #cT #G #L #U1 #U2 #T1 #T2 #_ #_ #_ #q #J #W #U1 #H destruct
173 | #c #G #L #V #T1 #T #T2 #HT1 #HT2 #q #J #W #U1 #H destruct /3 width=5 by ex5_2_intro, or_intror/
174 | #c #G #L #V #T1 #T2 #_ #q #J #W #U1 #H destruct
175 | #c #G #L #V1 #V2 #T #_ #q #J #W #U1 #H destruct
176 | #cV #cW #cT #p #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #q #J #W #U1 #H destruct
177 | #cV #cW #cT #p #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #q #J #W #U1 #H destruct
178 ]
179 qed-.
180
181 lemma cpg_inv_bind1 (Rs) (Rk) (c) (G) (L):
182       ∀p,I,V1,T1,U2. ❪G,L❫ ⊢ ⓑ[p,I]V1.T1 ⬈[Rs,Rk,c] U2 →
183       ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ❪G,L.ⓑ[I]V1❫ ⊢ T1 ⬈[Rs,Rk,cT] T2 & U2 = ⓑ[p,I]V2.T2 & c = ((↕*cV)∨cT)
184        | ∃∃cT,T. ⇧[1] T ≘ T1 & ❪G,L❫ ⊢ T ⬈[Rs,Rk,cT] U2 & p = true & I = Abbr & c = cT+𝟙𝟘.
185 /2 width=3 by cpg_inv_bind1_aux/ qed-.
186
187 lemma cpg_inv_abbr1 (Rs) (Rk) (c) (G) (L):
188       ∀p,V1,T1,U2. ❪G,L❫ ⊢ ⓓ[p]V1.T1 ⬈[Rs,Rk,c] U2 →
189       ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ❪G,L.ⓓV1❫ ⊢ T1 ⬈[Rs,Rk,cT] T2 & U2 = ⓓ[p]V2.T2 & c = ((↕*cV)∨cT)
190        | ∃∃cT,T. ⇧[1] T ≘ T1 & ❪G,L❫ ⊢ T ⬈[Rs,Rk,cT] U2 & p = true & c = cT+𝟙𝟘.
191 #Rs #Rk #c #p #G #L #V1 #T1 #U2 #H elim (cpg_inv_bind1 … H) -H *
192 /3 width=8 by ex4_4_intro, ex4_2_intro, or_introl, or_intror/
193 qed-.
194
195 lemma cpg_inv_abst1 (Rs) (Rk) (c) (G) (L):
196       ∀p,V1,T1,U2. ❪G,L❫ ⊢ ⓛ[p]V1.T1 ⬈[Rs,Rk,c] U2 →
197       ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ❪G,L.ⓛV1❫ ⊢ T1 ⬈[Rs,Rk,cT] T2 & U2 = ⓛ[p]V2.T2 & c = ((↕*cV)∨cT).
198 #Rs #Rk #c #p #G #L #V1 #T1 #U2 #H elim (cpg_inv_bind1 … H) -H *
199 [ /3 width=8 by ex4_4_intro/
200 | #c #T #_ #_ #_ #H destruct
201 ]
202 qed-.
203
204 fact cpg_inv_appl1_aux (Rs) (Rk) (c) (G) (L):
205      ∀U,U2. ❪G,L❫ ⊢ U ⬈[Rs,Rk,c] U2 →
206      ∀V1,U1. U = ⓐV1.U1 →
207      ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ❪G,L❫ ⊢ U1 ⬈[Rs,Rk,cT] T2 & U2 = ⓐV2.T2 & c = ((↕*cV)∨cT)
208       | ∃∃cV,cW,cT,p,V2,W1,W2,T1,T2. ❪G,L❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ❪G,L❫ ⊢ W1 ⬈[Rs,Rk,cW] W2 & ❪G,L.ⓛW1❫ ⊢ T1 ⬈[Rs,Rk,cT] T2 & 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 ⬈[Rs,Rk,cV] V & ⇧[1] V ≘ V2 & ❪G,L❫ ⊢ W1 ⬈[Rs,Rk,cW] W2 & ❪G,L.ⓓW1❫ ⊢ T1 ⬈[Rs,Rk,cT] T2 & U1 = ⓓ[p]W1.T1 & U2 = ⓓ[p]W2.ⓐV2.T2 & c = ((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘.
210 #Rs #Rk #c #G #L #U #U2 * -c -G -L -U -U2
211 [ #I #G #L #W #U1 #H destruct
212 | #G #L #s1 #s2 #_ #W #U1 #H destruct
213 | #c #G #L #V1 #V2 #W2 #_ #_ #W #U1 #H destruct
214 | #c #G #L #V1 #V2 #W2 #_ #_ #W #U1 #H destruct
215 | #c #I #G #L #T #U #i #_ #_ #W #U1 #H destruct
216 | #cV #cT #p #I #G #L #V1 #V2 #T1 #T2 #_ #_ #W #U1 #H destruct
217 | #cV #cT #G #L #V1 #V2 #T1 #T2 #HV12 #HT12 #W #U1 #H destruct /3 width=8 by or3_intro0, ex4_4_intro/
218 | #cV #cT #G #L #V1 #V2 #T1 #T2 #_ #_ #_ #W #U1 #H destruct
219 | #c #G #L #V #T1 #T #T2 #_ #_ #W #U1 #H destruct
220 | #c #G #L #V #T1 #T2 #_ #W #U1 #H destruct
221 | #c #G #L #V1 #V2 #T #_ #W #U1 #H destruct
222 | #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/
223 | #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/
224 ]
225 qed-.
226
227 lemma cpg_inv_appl1 (Rs) (Rk) (c) (G) (L):
228       ∀V1,U1,U2. ❪G,L❫ ⊢ ⓐV1.U1 ⬈[Rs,Rk,c] U2 →
229       ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ❪G,L❫ ⊢ U1 ⬈[Rs,Rk,cT] T2 & U2 = ⓐV2.T2 & c = ((↕*cV)∨cT)
230        | ∃∃cV,cW,cT,p,V2,W1,W2,T1,T2. ❪G,L❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ❪G,L❫ ⊢ W1 ⬈[Rs,Rk,cW] W2 & ❪G,L.ⓛW1❫ ⊢ T1 ⬈[Rs,Rk,cT] T2 & U1 = ⓛ[p]W1.T1 & U2 = ⓓ[p]ⓝW2.V2.T2 & c = ((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘
231        | ∃∃cV,cW,cT,p,V,V2,W1,W2,T1,T2. ❪G,L❫ ⊢ V1 ⬈[Rs,Rk,cV] V & ⇧[1] V ≘ V2 & ❪G,L❫ ⊢ W1 ⬈[Rs,Rk,cW] W2 & ❪G,L.ⓓW1❫ ⊢ T1 ⬈[Rs,Rk,cT] T2 & U1 = ⓓ[p]W1.T1 & U2 = ⓓ[p]W2.ⓐV2.T2 & c = ((↕*cV)∨(↕*cW)∨cT)+𝟙𝟘.
232 /2 width=3 by cpg_inv_appl1_aux/ qed-.
233
234 fact cpg_inv_cast1_aux (Rs) (Rk) (c) (G) (L):
235      ∀U,U2. ❪G,L❫ ⊢ U ⬈[Rs,Rk,c] U2 →
236      ∀V1,U1. U = ⓝV1.U1 →
237      ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ❪G,L❫ ⊢ U1 ⬈[Rs,Rk,cT] T2 & Rk cV cT & U2 = ⓝV2.T2 & c = (cV∨cT)
238       | ∃∃cT. ❪G,L❫ ⊢ U1 ⬈[Rs,Rk,cT] U2 & c = cT+𝟙𝟘
239       | ∃∃cV. ❪G,L❫ ⊢ V1 ⬈[Rs,Rk,cV] U2 & c = cV+𝟘𝟙.
240 #Rs #Rk #c #G #L #U #U2 * -c -G -L -U -U2
241 [ #I #G #L #W #U1 #H destruct
242 | #G #L #s1 #s2 #_ #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 #HRk #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
254 ]
255 qed-.
256
257 lemma cpg_inv_cast1 (Rs) (Rk) (c) (G) (L):
258       ∀V1,U1,U2. ❪G,L❫ ⊢ ⓝV1.U1 ⬈[Rs,Rk,c] U2 →
259       ∨∨ ∃∃cV,cT,V2,T2. ❪G,L❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ❪G,L❫ ⊢ U1 ⬈[Rs,Rk,cT] T2 & Rk cV cT & U2 = ⓝV2.T2 & c = (cV∨cT)
260        | ∃∃cT. ❪G,L❫ ⊢ U1 ⬈[Rs,Rk,cT] U2 & c = cT+𝟙𝟘
261        | ∃∃cV. ❪G,L❫ ⊢ V1 ⬈[Rs,Rk,cV] U2 & c = cV+𝟘𝟙.
262 /2 width=3 by cpg_inv_cast1_aux/ qed-.
263
264 (* Advanced inversion lemmas ************************************************)
265
266 lemma cpg_inv_zero1_pair (Rs) (Rk) (c) (G) (K):
267       ∀I,V1,T2. ❪G,K.ⓑ[I]V1❫ ⊢ #0 ⬈[Rs,Rk,c] T2 →
268       ∨∨ ∧∧ T2 = #0 & c = 𝟘𝟘
269        | ∃∃cV,V2. ❪G,K❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ⇧[1] V2 ≘ T2 & I = Abbr & c = cV
270        | ∃∃cV,V2. ❪G,K❫ ⊢ V1 ⬈[Rs,Rk,cV] V2 & ⇧[1] V2 ≘ T2 & I = Abst & c = cV+𝟘𝟙.
271 #Rs #Rk #c #G #K #I #V1 #T2 #H elim (cpg_inv_zero1 … H) -H /2 width=1 by or3_intro0/
272 * #z #Y #X1 #X2 #HX12 #HXT2 #H1 #H2 destruct /3 width=5 by or3_intro1, or3_intro2, ex4_2_intro/
273 qed-.
274
275 lemma cpg_inv_lref1_bind (Rs) (Rk) (c) (G) (K):
276       ∀I,T2,i. ❪G,K.ⓘ[I]❫ ⊢ #↑i ⬈[Rs,Rk,c] T2 →
277       ∨∨ ∧∧ T2 = #(↑i) & c = 𝟘𝟘
278        | ∃∃T. ❪G,K❫ ⊢ #i ⬈[Rs,Rk,c] T & ⇧[1] T ≘ T2.
279 #Rs #Rk #c #G #K #I #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/
281 qed-.
282
283 (* Basic forward lemmas *****************************************************)
284
285 lemma cpg_fwd_bind1_minus (Rs) (Rk) (c) (G) (L):
286       ∀I,V1,T1,T. ❪G,L❫ ⊢ -ⓑ[I]V1.T1 ⬈[Rs,Rk,c] T → ∀p.
287       ∃∃V2,T2. ❪G,L❫ ⊢ ⓑ[p,I]V1.T1 ⬈[Rs,Rk,c] ⓑ[p,I]V2.T2 & T = -ⓑ[I]V2.T2.
288 #Rs #Rk #c #G #L #I #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
291 ]
292 qed-.