]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/computation/cpxs_cpxs.ma
commit completed: now we support two versions of slicing for local
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / computation / cpxs_cpxs.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/reduction/lpx_ldrop.ma".
16 include "basic_2/computation/cpxs_lift.ma".
17
18 (* CONTEXT-SENSITIVE EXTENDED PARALLEL COMPUTATION ON TERMS *****************)
19
20 (* Main properties **********************************************************)
21
22 theorem cpxs_trans: ∀h,g,G,L. Transitive … (cpxs h g G L).
23 #h #g #G #L #T1 #T #HT1 #T2
24 @trans_TC @HT1 qed-. (**) (* auto /3 width=3/ does not work because a δ-expansion gets in the way *)
25
26 theorem cpxs_bind: ∀h,g,a,I,G,L,V1,V2,T1,T2. ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ➡*[h, g] T2 →
27                    ⦃G, L⦄ ⊢ V1 ➡*[h, g] V2 →
28                    ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡*[h, g] ⓑ{a,I}V2.T2.
29 #h #g #a #I #G #L #V1 #V2 #T1 #T2 #HT12 #H @(cpxs_ind … H) -V2
30 /3 width=5 by cpxs_trans, cpxs_bind_dx/
31 qed.
32
33 theorem cpxs_flat: ∀h,g,I,G,L,V1,V2,T1,T2. ⦃G, L⦄ ⊢ T1 ➡*[h, g] T2 →
34                    ⦃G, L⦄ ⊢ V1 ➡*[h, g] V2 →
35                    ⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ➡*[h, g] ⓕ{I}V2.T2.
36 #h #g #I #G #L #V1 #V2 #T1 #T2 #HT12 #H @(cpxs_ind … H) -V2
37 /3 width=5 by cpxs_trans, cpxs_flat_dx/
38 qed.
39
40 theorem cpxs_beta_rc: ∀h,g,a,G,L,V1,V2,W1,W2,T1,T2.
41                       ⦃G, L⦄ ⊢ V1 ➡[h, g] V2 → ⦃G, L.ⓛW1⦄ ⊢ T1 ➡*[h, g] T2 → ⦃G, L⦄ ⊢ W1 ➡*[h, g] W2 →
42                       ⦃G, L⦄ ⊢ ⓐV1.ⓛ{a}W1.T1 ➡*[h, g] ⓓ{a}ⓝW2.V2.T2.
43 #h #g #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 #HT12 #H @(cpxs_ind … H) -W2
44 /4 width=5 by cpxs_trans, cpxs_beta_dx, cpxs_bind_dx, cpx_pair_sn/
45 qed.
46
47 theorem cpxs_beta: ∀h,g,a,G,L,V1,V2,W1,W2,T1,T2.
48                    ⦃G, L.ⓛW1⦄ ⊢ T1 ➡*[h, g] T2 → ⦃G, L⦄ ⊢ W1 ➡*[h, g] W2 → ⦃G, L⦄ ⊢ V1 ➡*[h, g] V2 →
49                    ⦃G, L⦄ ⊢ ⓐV1.ⓛ{a}W1.T1 ➡*[h, g] ⓓ{a}ⓝW2.V2.T2.
50 #h #g #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HT12 #HW12 #H @(cpxs_ind … H) -V2
51 /4 width=5 by cpxs_trans, cpxs_beta_rc, cpxs_bind_dx, cpx_flat/
52 qed.
53
54 theorem cpxs_theta_rc: ∀h,g,a,G,L,V1,V,V2,W1,W2,T1,T2.
55                        ⦃G, L⦄ ⊢ V1 ➡[h, g] V → ⇧[0, 1] V ≡ V2 →
56                        ⦃G, L.ⓓW1⦄ ⊢ T1 ➡*[h, g] T2 → ⦃G, L⦄ ⊢ W1 ➡*[h, g] W2 →
57                        ⦃G, L⦄ ⊢ ⓐV1.ⓓ{a}W1.T1 ➡*[h, g] ⓓ{a}W2.ⓐV2.T2.
58 #h #g #a #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 #HT12 #H @(cpxs_ind … H) -W2
59 /3 width=5 by cpxs_trans, cpxs_theta_dx, cpxs_bind_dx/
60 qed.
61
62 theorem cpxs_theta: ∀h,g,a,G,L,V1,V,V2,W1,W2,T1,T2.
63                     ⇧[0, 1] V ≡ V2 → ⦃G, L⦄ ⊢ W1 ➡*[h, g] W2 →
64                     ⦃G, L.ⓓW1⦄ ⊢ T1 ➡*[h, g] T2 → ⦃G, L⦄ ⊢ V1 ➡*[h, g] V →
65                     ⦃G, L⦄ ⊢ ⓐV1.ⓓ{a}W1.T1 ➡*[h, g] ⓓ{a}W2.ⓐV2.T2.
66 #h #g #a #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV2 #HW12 #HT12 #H @(TC_ind_dx … V1 H) -V1
67 /3 width=5 by cpxs_trans, cpxs_theta_rc, cpxs_flat_dx/
68 qed.
69
70 (* Advanced inversion lemmas ************************************************)
71
72 lemma cpxs_inv_appl1: ∀h,g,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓐV1.T1 ➡*[h, g] U2 →
73                       ∨∨ ∃∃V2,T2.       ⦃G, L⦄ ⊢ V1 ➡*[h, g] V2 & ⦃G, L⦄ ⊢ T1 ➡*[h, g] T2 &
74                                         U2 = ⓐV2. T2
75                        | ∃∃a,W,T.       ⦃G, L⦄ ⊢ T1 ➡*[h, g] ⓛ{a}W.T & ⦃G, L⦄ ⊢ ⓓ{a}ⓝW.V1.T ➡*[h, g] U2
76                        | ∃∃a,V0,V2,V,T. ⦃G, L⦄ ⊢ V1 ➡*[h, g] V0 & ⇧[0,1] V0 ≡ V2 &
77                                         ⦃G, L⦄ ⊢ T1 ➡*[h, g] ⓓ{a}V.T & ⦃G, L⦄ ⊢ ⓓ{a}V.ⓐV2.T ➡*[h, g] U2.
78 #h #g #G #L #V1 #T1 #U2 #H @(cpxs_ind … H) -U2 [ /3 width=5 by or3_intro0, ex3_2_intro/ ]
79 #U #U2 #_ #HU2 * *
80 [ #V0 #T0 #HV10 #HT10 #H destruct
81   elim (cpx_inv_appl1 … HU2) -HU2 *
82   [ #V2 #T2 #HV02 #HT02 #H destruct /4 width=5 by cpxs_strap1, or3_intro0, ex3_2_intro/
83   | #a #V2 #W #W2 #T #T2 #HV02 #HW2 #HT2 #H1 #H2 destruct
84     lapply (cpxs_strap1 … HV10 … HV02) -V0 #HV12
85     lapply (lsubr_cpx_trans … HT2 (L.ⓓⓝW.V1) ?) -HT2
86     /5 width=5 by cpxs_bind, cpxs_flat_dx, cpx_cpxs, lsubr_abst, ex2_3_intro, or3_intro1/
87   | #a #V #V2 #W0 #W2 #T #T2 #HV0 #HV2 #HW02 #HT2 #H1 #H2 destruct
88     /5 width=10 by cpxs_flat_sn, cpxs_bind_dx, cpxs_strap1, ex4_5_intro, or3_intro2/
89   ]
90 | /4 width=9 by cpxs_strap1, or3_intro1, ex2_3_intro/
91 | /4 width=11 by cpxs_strap1, or3_intro2, ex4_5_intro/
92 ]
93 qed-.
94
95 (* Properties on sn extended parallel reduction for local environments ******)
96
97 lemma lpx_cpx_trans: ∀h,g,G. s_r_trans … (cpx h g G) (lpx h g G).
98 #h #g #G #L2 #T1 #T2 #HT12 elim HT12 -G -L2 -T1 -T2
99 [ /2 width=3 by /
100 | /3 width=2 by cpx_cpxs, cpx_sort/
101 | #I #G #L2 #K2 #V0 #V2 #W2 #i #HLK2 #_ #HVW2 #IHV02 #L1 #HL12
102   elim (lpx_ldrop_trans_O1 … HL12 … HLK2) -L2 #X #HLK1 #H
103   elim (lpx_inv_pair2 … H) -H #K1 #V1 #HK12 #HV10 #H destruct
104   lapply (IHV02 … HK12) -K2 #HV02
105   lapply (cpxs_strap2 … HV10 … HV02) -V0 /2 width=7 by cpxs_delta/
106 | #a #I #G #L2 #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #L1 #HL12
107   lapply (IHT12 (L1.ⓑ{I}V1) ?) -IHT12 /3 width=1 by cpxs_bind, lpx_pair/
108 |5,7,8: /3 width=1 by cpxs_flat, cpxs_ti, cpxs_tau/
109 | #G #L2 #V2 #T1 #T #T2 #_ #HT2 #IHT1 #L1 #HL12
110   lapply (IHT1 (L1.ⓓV2) ?) -IHT1 /2 width=3 by cpxs_zeta, lpx_pair/
111 | #a #G #L2 #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #IHV12 #IHW12 #IHT12 #L1 #HL12
112   lapply (IHT12 (L1.ⓛW1) ?) -IHT12 /3 width=1 by cpxs_beta, lpx_pair/
113 | #a #G #L2 #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #HV2 #_ #_ #IHV1 #IHW12 #IHT12 #L1 #HL12
114   lapply (IHT12 (L1.ⓓW1) ?) -IHT12 /3 width=3 by cpxs_theta, cpxs_strap1, lpx_pair/
115 ]
116 qed-.
117
118 lemma cpx_bind2: ∀h,g,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡[h, g] V2 →
119                  ∀I,T1,T2. ⦃G, L.ⓑ{I}V2⦄ ⊢ T1 ➡[h, g] T2 →
120                  ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡*[h, g] ⓑ{a,I}V2.T2.
121 #h #g #G #L #V1 #V2 #HV12 #I #T1 #T2 #HT12
122 lapply (lpx_cpx_trans … HT12 (L.ⓑ{I}V1) ?) /2 width=1 by cpxs_bind_dx, lpx_pair/
123 qed.
124
125 (* Advanced properties ******************************************************)
126
127 lemma lpx_cpxs_trans: ∀h,g,G. s_rs_trans … (cpx h g G) (lpx h g G).
128 /3 width=5 by s_r_trans_TC1, lpx_cpx_trans/ qed-.
129
130 lemma cpxs_bind2_dx: ∀h,g,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡[h, g] V2 →
131                      ∀I,T1,T2. ⦃G, L.ⓑ{I}V2⦄ ⊢ T1 ➡*[h, g] T2 →
132                      ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡*[h, g] ⓑ{a,I}V2.T2.
133 #h #g #G #L #V1 #V2 #HV12 #I #T1 #T2 #HT12
134 lapply (lpx_cpxs_trans … HT12 (L.ⓑ{I}V1) ?) /2 width=1 by cpxs_bind_dx, lpx_pair/
135 qed.
136
137 (* Properties on supclosure *************************************************)
138
139 lemma fqu_cpxs_trans_neq: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃ ⦃G2, L2, T2⦄ →
140                           ∀U2. ⦃G2, L2⦄ ⊢ T2 ➡*[h, g] U2 → (T2 = U2 → ⊥) →
141                           ∃∃U1. ⦃G1, L1⦄ ⊢ T1 ➡*[h, g] U1 & T1 = U1 → ⊥ & ⦃G1, L1, U1⦄ ⊃ ⦃G2, L2, U2⦄.
142 #h #g #G1 #G2 #L1 #L2 #T1 #T2 #H elim H -G1 -G2 -L1 -L2 -T1 -T2
143 [ #I #G #L #V1 #V2 #HV12 #_ elim (lift_total V2 0 1)
144   #U2 #HVU2 @(ex3_intro … U2)
145   [1,3: /3 width=7 by fqu_drop, cpxs_delta, ldrop_pair, ldrop_drop/
146   | #H destruct /2 width=7 by lift_inv_lref2_be/
147   ]
148 | #I #G #L #V1 #T #V2 #HV12 #H @(ex3_intro … (②{I}V2.T))
149   [1,3: /2 width=4 by fqu_pair_sn, cpxs_pair_sn/
150   | #H0 destruct /2 width=1 by/
151   ]
152 | #a #I #G #L #V #T1 #T2 #HT12 #H @(ex3_intro … (ⓑ{a,I}V.T2))
153   [1,3: /2 width=4 by fqu_bind_dx, cpxs_bind/
154   | #H0 destruct /2 width=1 by/
155   ]
156 | #I #G #L #V #T1 #T2 #HT12 #H @(ex3_intro … (ⓕ{I}V.T2))
157   [1,3: /2 width=4 by fqu_flat_dx, cpxs_flat/
158   | #H0 destruct /2 width=1 by/
159   ]
160 | #G #L #K #T1 #U1 #e #HLK #HTU1 #T2 #HT12 #H elim (lift_total T2 0 (e+1))
161   #U2 #HTU2 @(ex3_intro … U2)
162   [1,3: /2 width=10 by cpxs_lift, fqu_drop/
163   | #H0 destruct /3 width=5 by lift_inj/
164 ]
165 qed-.
166
167 lemma fquq_cpxs_trans_neq: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃⸮ ⦃G2, L2, T2⦄ →
168                            ∀U2. ⦃G2, L2⦄ ⊢ T2 ➡*[h, g] U2 → (T2 = U2 → ⊥) →
169                            ∃∃U1. ⦃G1, L1⦄ ⊢ T1 ➡*[h, g] U1 & T1 = U1 → ⊥ & ⦃G1, L1, U1⦄ ⊃⸮ ⦃G2, L2, U2⦄.
170 #h #g #G1 #G2 #L1 #L2 #T1 #T2 #H12 #U2 #HTU2 #H elim (fquq_inv_gen … H12) -H12
171 [ #H12 elim (fqu_cpxs_trans_neq … H12 … HTU2 H) -T2
172   /3 width=4 by fqu_fquq, ex3_intro/
173 | * #HG #HL #HT destruct /3 width=4 by ex3_intro/
174 ]
175 qed-.
176
177 lemma fqup_cpxs_trans_neq: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃+ ⦃G2, L2, T2⦄ →
178                            ∀U2. ⦃G2, L2⦄ ⊢ T2 ➡*[h, g] U2 → (T2 = U2 → ⊥) →
179                            ∃∃U1. ⦃G1, L1⦄ ⊢ T1 ➡*[h, g] U1 & T1 = U1 → ⊥ & ⦃G1, L1, U1⦄ ⊃+ ⦃G2, L2, U2⦄.
180 #h #g #G1 #G2 #L1 #L2 #T1 #T2 #H @(fqup_ind_dx … H) -G1 -L1 -T1
181 [ #G1 #L1 #T1 #H12 #U2 #HTU2 #H elim (fqu_cpxs_trans_neq … H12 … HTU2 H) -T2
182   /3 width=4 by fqu_fqup, ex3_intro/
183 | #G #G1 #L #L1 #T #T1 #H1 #_ #IH12 #U2 #HTU2 #H elim (IH12 … HTU2 H) -T2
184   #U1 #HTU1 #H #H12 elim (fqu_cpxs_trans_neq … H1 … HTU1 H) -T1
185   /3 width=8 by fqup_strap2, ex3_intro/
186 ]
187 qed-.
188
189 lemma fqus_cpxs_trans_neq: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃* ⦃G2, L2, T2⦄ →
190                            ∀U2. ⦃G2, L2⦄ ⊢ T2 ➡*[h, g] U2 → (T2 = U2 → ⊥) →
191                            ∃∃U1. ⦃G1, L1⦄ ⊢ T1 ➡*[h, g] U1 & T1 = U1 → ⊥ & ⦃G1, L1, U1⦄ ⊃* ⦃G2, L2, U2⦄.
192 #h #g #G1 #G2 #L1 #L2 #T1 #T2 #H12 #U2 #HTU2 #H elim (fqus_inv_gen … H12) -H12
193 [ #H12 elim (fqup_cpxs_trans_neq … H12 … HTU2 H) -T2
194   /3 width=4 by fqup_fqus, ex3_intro/
195 | * #HG #HL #HT destruct /3 width=4 by ex3_intro/
196 ]
197 qed-.