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/reduction/lpr_lpr.ma".
16 include "basic_2/computation/cprs_lift.ma".
18 (* CONTEXT-SENSITIVE PARALLEL COMPUTATION ON TERMS **************************)
20 (* Main properties **********************************************************)
22 (* Basic_1: was: pr3_t *)
23 (* Basic_1: includes: pr1_t *)
24 theorem cprs_trans: ∀G,L. Transitive … (cprs G L).
25 #G #L #T1 #T #HT1 #T2 @trans_TC @HT1 qed-. (**) (* auto /3 width=3/ does not work because a δ-expansion gets in the way *)
27 (* Basic_1: was: pr3_confluence *)
28 (* Basic_1: includes: pr1_confluence *)
29 theorem cprs_conf: ∀G,L. confluent2 … (cprs G L) (cprs G L).
30 #G #L @TC_confluent2 /2 width=3 by cpr_conf/ qed-. (**) (* auto /3 width=3/ does not work because a δ-expansion gets in the way *)
32 theorem cprs_bind: ∀a,I,G,L,V1,V2,T1,T2. ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ➡* T2 → ⦃G, L⦄ ⊢ V1 ➡* V2 →
33 ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡* ⓑ{a,I}V2.T2.
34 #a #I #G #L #V1 #V2 #T1 #T2 #HT12 #H @(cprs_ind … H) -V2 /2 width=1/
36 @(cprs_trans … IHV1) -V1 /2 width=1/
39 (* Basic_1: was: pr3_flat *)
40 theorem cprs_flat: ∀I,G,L,V1,V2,T1,T2. ⦃G, L⦄ ⊢ T1 ➡* T2 → ⦃G, L⦄ ⊢ V1 ➡* V2 →
41 ⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ➡* ⓕ{I}V2.T2.
42 #I #G #L #V1 #V2 #T1 #T2 #HT12 #H @(cprs_ind … H) -V2 /2 width=1/
44 @(cprs_trans … IHV1) -IHV1 /2 width=1/
47 theorem cprs_beta_rc: ∀a,G,L,V1,V2,W1,W2,T1,T2.
48 ⦃G, L⦄ ⊢ V1 ➡ V2 → ⦃G, L.ⓛW1⦄ ⊢ T1 ➡* T2 → ⦃G, L⦄ ⊢ W1 ➡* W2 →
49 ⦃G, L⦄ ⊢ ⓐV1.ⓛ{a}W1.T1 ➡* ⓓ{a}ⓝW2.V2.T2.
50 #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 #HT12 #H @(cprs_ind … H) -W2 /2 width=1/
52 @(cprs_trans … IHW1) -IHW1 /3 width=1/
55 theorem cprs_beta: ∀a,G,L,V1,V2,W1,W2,T1,T2.
56 ⦃G, L.ⓛW1⦄ ⊢ T1 ➡* T2 → ⦃G, L⦄ ⊢ W1 ➡* W2 → ⦃G, L⦄ ⊢ V1 ➡* V2 →
57 ⦃G, L⦄ ⊢ ⓐV1.ⓛ{a}W1.T1 ➡* ⓓ{a}ⓝW2.V2.T2.
58 #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HT12 #HW12 #H @(cprs_ind … H) -V2 /2 width=1/
60 @(cprs_trans … IHV1) -IHV1 /3 width=1/
63 theorem cprs_theta_rc: ∀a,G,L,V1,V,V2,W1,W2,T1,T2.
64 ⦃G, L⦄ ⊢ V1 ➡ V → ⇧[0, 1] V ≡ V2 → ⦃G, L.ⓓW1⦄ ⊢ T1 ➡* T2 →
65 ⦃G, L⦄ ⊢ W1 ➡* W2 → ⦃G, L⦄ ⊢ ⓐV1.ⓓ{a}W1.T1 ➡* ⓓ{a}W2.ⓐV2.T2.
66 #a #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 #HT12 #H elim H -W2 /2 width=3/
68 @(cprs_trans … IHW1) /2 width=1/
71 theorem cprs_theta: ∀a,G,L,V1,V,V2,W1,W2,T1,T2.
72 ⇧[0, 1] V ≡ V2 → ⦃G, L⦄ ⊢ W1 ➡* W2 → ⦃G, L.ⓓW1⦄ ⊢ T1 ➡* T2 →
73 ⦃G, L⦄ ⊢ V1 ➡* V → ⦃G, L⦄ ⊢ ⓐV1.ⓓ{a}W1.T1 ➡* ⓓ{a}W2.ⓐV2.T2.
74 #a #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV2 #HW12 #HT12 #H @(TC_ind_dx … V1 H) -V1 /2 width=3/
75 #V1 #V0 #HV10 #_ #IHV0
76 @(cprs_trans … IHV0) /2 width=1/
79 (* Advanced inversion lemmas ************************************************)
81 (* Basic_1: was pr3_gen_appl *)
82 lemma cprs_inv_appl1: ∀G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓐV1.T1 ➡* U2 →
83 ∨∨ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡* V2 & ⦃G, L⦄ ⊢ T1 ➡* T2 &
85 | ∃∃a,W,T. ⦃G, L⦄ ⊢ T1 ➡* ⓛ{a}W.T &
86 ⦃G, L⦄ ⊢ ⓓ{a}ⓝW.V1.T ➡* U2
87 | ∃∃a,V0,V2,V,T. ⦃G, L⦄ ⊢ V1 ➡* V0 & ⇧[0,1] V0 ≡ V2 &
88 ⦃G, L⦄ ⊢ T1 ➡* ⓓ{a}V.T &
89 ⦃G, L⦄ ⊢ ⓓ{a}V.ⓐV2.T ➡* U2.
90 #G #L #V1 #T1 #U2 #H @(cprs_ind … H) -U2 [ /3 width=5/ ]
92 [ #V0 #T0 #HV10 #HT10 #H destruct
93 elim (cpr_inv_appl1 … HU2) -HU2 *
94 [ #V2 #T2 #HV02 #HT02 #H destruct /4 width=5/
95 | #a #V2 #W #W2 #T #T2 #HV02 #HW2 #HT2 #H1 #H2 destruct
96 lapply (cprs_strap1 … HV10 … HV02) -V0 #HV12
97 lapply (lsubr_cpr_trans … HT2 (L.ⓓⓝW.V1) ?) -HT2 /2 width=1/ #HT2
98 @or3_intro1 @(ex2_3_intro … HT10) -HT10 /3 width=1/ (**) (* explicit constructor. /5 width=8/ is too slow because TC_transitive gets in the way *)
99 | #a #V #V2 #W0 #W2 #T #T2 #HV0 #HV2 #HW02 #HT2 #H1 #H2 destruct
100 @or3_intro2 @(ex4_5_intro … HV2 HT10) /2 width=3/ /3 width=1/ (**) (* explicit constructor. /5 width=8/ is too slow because TC_transitive gets in the way *)
107 (* Properties concerning sn parallel reduction on local environments ********)
109 (* Basic_1: was just: pr3_pr2_pr2_t *)
110 (* Basic_1: includes: pr3_pr0_pr2_t *)
111 lemma lpr_cpr_trans: ∀G. s_r_trans … (cpr G) (lpr G).
112 #G #L2 #T1 #T2 #HT12 elim HT12 -G -L2 -T1 -T2
114 | #G #L2 #K2 #V0 #V2 #W2 #i #HLK2 #_ #HVW2 #IHV02 #L1 #HL12
115 elim (lpr_ldrop_trans_O1 … HL12 … HLK2) -L2 #X #HLK1 #H
116 elim (lpr_inv_pair2 … H) -H #K1 #V1 #HK12 #HV10 #H destruct
117 lapply (IHV02 … HK12) -K2 #HV02
118 lapply (cprs_strap2 … HV10 … HV02) -V0 /2 width=6/
119 | #a #I #G #L2 #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #L1 #HL12
120 lapply (IHT12 (L1.ⓑ{I}V1) ?) -IHT12 /2 width=1/ /3 width=1/
122 | #G #L2 #V2 #T1 #T #T2 #_ #HT2 #IHT1 #L1 #HL12
123 lapply (IHT1 (L1.ⓓV2) ?) -IHT1 /2 width=1/ /2 width=3/
124 | #a #G #L2 #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #IHV12 #IHW12 #IHT12 #L1 #HL12
125 lapply (IHT12 (L1.ⓛW1) ?) -IHT12 /2 width=1/ /3 width=1/
126 | #a #G #L2 #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #HV2 #_ #_ #IHV1 #IHW12 #IHT12 #L1 #HL12
127 lapply (IHT12 (L1.ⓓW1) ?) -IHT12 /2 width=1/ /3 width=3/
131 lemma cpr_bind2: ∀G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡ V2 → ∀I,T1,T2. ⦃G, L.ⓑ{I}V2⦄ ⊢ T1 ➡ T2 →
132 ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡* ⓑ{a,I}V2.T2.
133 #G #L #V1 #V2 #HV12 #I #T1 #T2 #HT12
134 lapply (lpr_cpr_trans … HT12 (L.ⓑ{I}V1) ?) /2 width=1/
137 (* Advanced properties ******************************************************)
139 (* Basic_1: was only: pr3_pr2_pr3_t pr3_wcpr0_t *)
140 lemma lpr_cprs_trans: ∀G. s_rs_trans … (cpr G) (lpr G).
141 /3 width=5 by s_r_trans_TC1, lpr_cpr_trans/ qed-.
143 (* Basic_1: was: pr3_strip *)
144 (* Basic_1: includes: pr1_strip *)
145 lemma cprs_strip: ∀G,L. confluent2 … (cprs G L) (cpr G L).
146 #G #L @TC_strip1 /2 width=3 by cpr_conf/ qed-. (**) (* auto /3 width=3/ does not work because a δ-expansion gets in the way *)
148 lemma cprs_lpr_conf_dx: ∀G,L0,T0,T1. ⦃G, L0⦄ ⊢ T0 ➡* T1 → ∀L1. ⦃G, L0⦄ ⊢ ➡ L1 →
149 ∃∃T. ⦃G, L1⦄ ⊢ T1 ➡* T & ⦃G, L1⦄ ⊢ T0 ➡* T.
150 #G #L0 #T0 #T1 #H elim H -T1
151 [ #T1 #HT01 #L1 #HL01
152 elim (lpr_cpr_conf_dx … HT01 … HL01) -L0 /3 width=3/
153 | #T #T1 #_ #HT1 #IHT0 #L1 #HL01
154 elim (IHT0 … HL01) #T2 #HT2 #HT02
155 elim (lpr_cpr_conf_dx … HT1 … HL01) -L0 #T3 #HT3 #HT13
156 elim (cprs_strip … HT2 … HT3) -T #T #HT2 #HT3
157 lapply (cprs_strap2 … HT13 … HT3) -T3
158 lapply (cprs_strap1 … HT02 … HT2) -T2 /2 width=3/
162 lemma cprs_lpr_conf_sn: ∀G,L0,T0,T1. ⦃G, L0⦄ ⊢ T0 ➡* T1 →
163 ∀L1. ⦃G, L0⦄ ⊢ ➡ L1 →
164 ∃∃T. ⦃G, L0⦄ ⊢ T1 ➡* T & ⦃G, L1⦄ ⊢ T0 ➡* T.
165 #G #L0 #T0 #T1 #HT01 #L1 #HL01
166 elim (cprs_lpr_conf_dx … HT01 … HL01) -HT01 #T #HT1
167 lapply (lpr_cprs_trans … HT1 … HL01) -HT1 /2 width=3/
170 lemma cprs_bind2_dx: ∀G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡ V2 →
171 ∀I,T1,T2. ⦃G, L.ⓑ{I}V2⦄ ⊢ T1 ➡* T2 →
172 ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡* ⓑ{a,I}V2.T2.
173 #G #L #V1 #V2 #HV12 #I #T1 #T2 #HT12
174 lapply (lpr_cprs_trans … HT12 (L.ⓑ{I}V1) ?) /2 width=1/