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 "basic_2/relocation/llpx_sn_tc.ma".
16 include "basic_2/computation/cpxs_llpx.ma".
17 include "basic_2/computation/llpxs.ma".
19 (* LAZY SN EXTENDED PARALLEL COMPUTATION ON LOCAL ENVIRONMENTS **************)
21 (* Advanced properties ******************************************************)
23 lemma llpxs_pair_dx: ∀h,g,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡*[h, g] V2 →
24 ∀I,T. ⦃G, L.ⓑ{I}V1⦄ ⊢ ➡*[h, g, T, 0] L.ⓑ{I}V2.
25 /2 width=1 by llpx_sn_TC_pair_dx/ qed.
27 (* Properties on context-sensitive extended parallel computation for terms **)
29 lemma llpxs_cpx_trans: ∀h,g,G. s_r_transitive … (cpx h g G) (llpxs h g G 0).
30 /3 width=5 by s_r_trans_LTC2, llpx_cpxs_trans/ qed-.
32 lemma llpxs_cpxs_trans: ∀h,g,G. s_rs_transitive … (cpx h g G) (llpxs h g G 0).
33 #h #g #G @s_r_to_s_rs_trans @s_r_trans_LTC2
34 /3 width=5 by llpx_cpxs_trans, s_rs_trans_TC1/ (**) (* full auto too slow *)
37 (* Note: this is an instance of a general theorem *)
38 lemma llpxs_cpxs_conf_dx: ∀h,g,G2,L2,T2,U2. ⦃G2, L2⦄ ⊢ T2 ➡*[h, g] U2 →
39 ∀L0. ⦃G2, L0⦄ ⊢ ➡*[h, g, T2, O] L2 → ⦃G2, L0⦄ ⊢ ➡*[h, g, U2, O] L2.
40 #h #g #G2 #L2 #T2 #U2 #HTU2 #L0 #H @(llpxs_ind_dx … H) -L0 //
41 #L0 #L #HL0 #HL2 #IHL2 @(llpxs_strap2 … IHL2) -IHL2
42 lapply (llpxs_cpxs_trans … HTU2 … HL2) -L2 #HTU2
43 /3 width=3 by llpx_cpxs_trans, cpxs_llpx_conf/
46 (* Note: this is an instance of a general theorem *)
47 lemma llpxs_cpx_conf_dx: ∀h,g,G2,L2,T2,U2. ⦃G2, L2⦄ ⊢ T2 ➡[h, g] U2 →
48 ∀L0. ⦃G2, L0⦄ ⊢ ➡*[h, g, T2, O] L2 → ⦃G2, L0⦄ ⊢ ➡*[h, g, U2, O] L2.
49 #h #g #G2 #L2 #T2 #U2 #HTU2 #L0 #H @(llpxs_ind_dx … H) -L0 //
50 #L0 #L #HL0 #HL2 #IHL2 @(llpxs_strap2 … IHL2) -IHL2
51 lapply (llpxs_cpx_trans … HTU2 … HL2) -L2 #HTU2
52 /3 width=3 by llpx_cpxs_trans, cpxs_llpx_conf/
55 lemma cpxs_bind2: ∀h,g,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡*[h, g] V2 →
56 ∀I,T1,T2. ⦃G, L.ⓑ{I}V2⦄ ⊢ T1 ➡*[h, g] T2 →
57 ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡*[h, g] ⓑ{a,I}V2.T2.
58 /4 width=5 by llpxs_cpxs_trans, llpxs_pair_dx, cpxs_bind/ qed.
60 (* Advanced forward lemmas **************************************************)
62 (* Note: this might be moved *)
63 lemma llpxs_fwd_lref_ge_sn: ∀h,g,G,L1,L2,d,i. ⦃G, L1⦄ ⊢ ➡*[h, g, #i, d] L2 → d ≤ i →
64 ∀I,K1,V1. ⇩[i] L1 ≡ K1.ⓑ{I}V1 →
65 ∃∃K2,V2. ⇩[i] L2 ≡ K2.ⓑ{I}V2 &
66 ⦃G, K1⦄ ⊢ ➡*[h, g, V2, 0] K2 & ⦃G, K1⦄ ⊢ V1 ➡*[h, g] V2.
67 #h #g #G #L1 #L2 #d #i #H #Hdi #I #K1 #V1 #HLK1 @(llpxs_ind … H) -L2 /2 width=5 by ex3_2_intro/ -HLK1
68 #L #L2 #_ #HL2 * #K #V #HLK #HK1 #HV1 elim (llpx_inv_lref_ge_sn … HL2 … HLK) // -HL2 -HLK -Hdi
69 #K2 #V2 #HLK2 #HK2 #HV2
70 @(ex3_2_intro … HLK2) -HLK2
71 [ /3 width=5 by llpxs_cpx_conf_dx, llpxs_strap1, llpx_cpx_conf/
72 | /3 width=5 by llpxs_cpx_trans, cpxs_trans/
76 (* Inversion lemmas on context-sensitive ext parallel computation for terms *)
78 lemma cpxs_inv_abst1: ∀h,g,a,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓛ{a}V1.T1 ➡*[h, g] U2 →
79 ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡*[h, g] V2 & ⦃G, L.ⓛV1⦄ ⊢ T1 ➡*[h, g] T2 &
81 #h #g #a #G #L #V1 #T1 #U2 #H @(cpxs_ind … H) -U2 /2 width=5 by ex3_2_intro/
82 #U0 #U2 #_ #HU02 * #V0 #T0 #HV10 #HT10 #H destruct
83 elim (cpx_inv_abst1 … HU02) -HU02 #V2 #T2 #HV02 #HT02 #H destruct
84 lapply (llpxs_cpx_trans … HT02 (L.ⓛV1) ?)
85 /3 width=5 by llpxs_pair_dx, cpxs_trans, cpxs_strap1, ex3_2_intro/
88 lemma cpxs_inv_abbr1: ∀h,g,a,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓓ{a}V1.T1 ➡*[h, g] U2 → (
89 ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡*[h, g] V2 & ⦃G, L.ⓓV1⦄ ⊢ T1 ➡*[h, g] T2 &
92 ∃∃T2. ⦃G, L.ⓓV1⦄ ⊢ T1 ➡*[h, g] T2 & ⇧[0, 1] U2 ≡ T2 & a = true.
93 #h #g #a #G #L #V1 #T1 #U2 #H @(cpxs_ind … H) -U2 /3 width=5 by ex3_2_intro, or_introl/
95 [ #V0 #T0 #HV10 #HT10 #H destruct
96 elim (cpx_inv_abbr1 … HU02) -HU02 *
97 [ #V2 #T2 #HV02 #HT02 #H destruct
98 lapply (llpxs_cpx_trans … HT02 (L.ⓓV1) ?)
99 /4 width=5 by llpxs_pair_dx, cpxs_trans, cpxs_strap1, ex3_2_intro, or_introl/
101 lapply (llpxs_cpx_trans … HT02 (L.ⓓV1) ?) -HT02
102 /4 width=3 by llpxs_pair_dx, cpxs_trans, ex3_intro, or_intror/
105 elim (lift_total U2 0 1) #U #HU2
106 /6 width=12 by cpxs_strap1, cpx_lift, ldrop_drop, ex3_intro, or_intror/
110 (* Properties on supclosure *************************************************)
112 lemma llpx_fqup_trans: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃+ ⦃G2, L2, T2⦄ →
113 ∀K1. ⦃G1, K1⦄ ⊢ ➡[h, g, T1, 0] L1 →
114 ∃∃K2,T. ⦃G1, K1⦄ ⊢ T1 ➡*[h, g] T & ⦃G1, K1, T⦄ ⊃+ ⦃G2, K2, T2⦄ & ⦃G2, K2⦄ ⊢ ➡[h, g, T2, 0] L2.
115 #h #g #G1 #G2 #L1 #L2 #T1 #T2 #H @(fqup_ind … H) -G2 -L2 -T2
116 [ #G2 #L2 #T2 #H12 #K1 #HKL1 elim (llpx_fqu_trans … H12 … HKL1) -L1
117 /3 width=5 by cpx_cpxs, fqu_fqup, ex3_2_intro/
118 | #G #G2 #L #L2 #T #T2 #_ #H2 #IH1 #K1 #HLK1 elim (IH1 … HLK1) -L1
119 #L0 #T0 #HT10 #HT0 #HL0 elim (llpx_fqu_trans … H2 … HL0) -L
120 #L #T3 #HT3 #HT32 #HL2 elim (fqup_cpx_trans … HT0 … HT3) -T
121 /3 width=7 by cpxs_strap1, fqup_strap1, ex3_2_intro/
125 lemma llpx_fqus_trans: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃* ⦃G2, L2, T2⦄ →
126 ∀K1. ⦃G1, K1⦄ ⊢ ➡[h, g, T1, 0] L1 →
127 ∃∃K2,T. ⦃G1, K1⦄ ⊢ T1 ➡*[h, g] T & ⦃G1, K1, T⦄ ⊃* ⦃G2, K2, T2⦄ & ⦃G2, K2⦄ ⊢ ➡[h, g, T2, 0] L2.
128 #h #g #G1 #G2 #L1 #L2 #T1 #T2 #H @(fqus_ind … H) -G2 -L2 -T2 /2 width=5 by ex3_2_intro/
129 #G #G2 #L #L2 #T #T2 #_ #H2 #IH1 #K1 #HLK1 elim (IH1 … HLK1) -L1
130 #L0 #T0 #HT10 #HT0 #HL0 elim (llpx_fquq_trans … H2 … HL0) -L
131 #L #T3 #HT3 #HT32 #HL2 elim (fqus_cpx_trans … HT0 … HT3) -T
132 /3 width=7 by cpxs_strap1, fqus_strap1, ex3_2_intro/
135 lemma llpxs_fquq_trans: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃⸮ ⦃G2, L2, T2⦄ →
136 ∀K1. ⦃G1, K1⦄ ⊢ ➡*[h, g, T1, 0] L1 →
137 ∃∃K2,T. ⦃G1, K1⦄ ⊢ T1 ➡*[h, g] T & ⦃G1, K1, T⦄ ⊃⸮ ⦃G2, K2, T2⦄ & ⦃G2, K2⦄ ⊢ ➡*[h, g, T2, 0] L2.
138 #h #g #G1 #G2 #L1 #L2 #T1 #T2 #HT12 #K1 #H @(llpxs_ind_dx … H) -K1
139 [ /2 width=5 by ex3_2_intro/
140 | #K1 #K #HK1 #_ * #L #T #HT1 #HT2 #HL2 -HT12
141 lapply (llpx_cpxs_trans … HT1 … HK1) -HT1 #HT1
142 lapply (cpxs_llpx_conf … HT1 … HK1) -HK1 #HK1
143 elim (llpx_fquq_trans … HT2 … HK1) -K
144 /3 width=7 by llpxs_strap2, cpxs_strap1, ex3_2_intro/
148 lemma llpxs_fqup_trans: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃+ ⦃G2, L2, T2⦄ →
149 ∀K1. ⦃G1, K1⦄ ⊢ ➡*[h, g, T1, 0] L1 →
150 ∃∃K2,T. ⦃G1, K1⦄ ⊢ T1 ➡*[h, g] T & ⦃G1, K1, T⦄ ⊃+ ⦃G2, K2, T2⦄ & ⦃G2, K2⦄ ⊢ ➡*[h, g, T2, 0] L2.
151 #h #g #G1 #G2 #L1 #L2 #T1 #T2 #HT12 #K1 #H @(llpxs_ind_dx … H) -K1
152 [ /2 width=5 by ex3_2_intro/
153 | #K1 #K #HK1 #_ * #L #T #HT1 #HT2 #HL2 -HT12
154 lapply (llpx_cpxs_trans … HT1 … HK1) -HT1 #HT1
155 lapply (cpxs_llpx_conf … HT1 … HK1) -HK1 #HK1
156 elim (llpx_fqup_trans … HT2 … HK1) -K
157 /3 width=7 by llpxs_strap2, cpxs_trans, ex3_2_intro/
161 lemma llpxs_fqus_trans: ∀h,g,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊃* ⦃G2, L2, T2⦄ →
162 ∀K1. ⦃G1, K1⦄ ⊢ ➡*[h, g, T1, 0] L1 →
163 ∃∃K2,T. ⦃G1, K1⦄ ⊢ T1 ➡*[h, g] T & ⦃G1, K1, T⦄ ⊃* ⦃G2, K2, T2⦄ & ⦃G2, K2⦄ ⊢ ➡*[h, g, T2, 0] L2.
164 #h #g #G1 #G2 #L1 #L2 #T1 #T2 #HT12 #K1 #H @(llpxs_ind_dx … H) -K1
165 [ /2 width=5 by ex3_2_intro/
166 | #K1 #K #HK1 #_ * #L #T #HT1 #HT2 #HL2 -HT12
167 lapply (llpx_cpxs_trans … HT1 … HK1) -HT1 #HT1
168 lapply (cpxs_llpx_conf … HT1 … HK1) -HK1 #HK1
169 elim (llpx_fqus_trans … HT2 … HK1) -K
170 /3 width=7 by llpxs_strap2, cpxs_trans, ex3_2_intro/