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/cnr.ma".
17 (* CONTEXT-SENSITIVE PARALLEL COMPUTATION ON TERMS **************************)
19 (* Basic_1: includes: pr1_pr0 *)
20 definition cprs: lenv → relation term ≝ LTC … cpr.
22 interpretation "context-sensitive parallel computation (term)"
23 'PRedStar L T1 T2 = (cprs L T1 T2).
25 (* Basic eliminators ********************************************************)
27 lemma cprs_ind: ∀L,T1. ∀R:predicate term. R T1 →
28 (∀T,T2. L ⊢ T1 ➡* T → L ⊢ T ➡ T2 → R T → R T2) →
29 ∀T2. L ⊢ T1 ➡* T2 → R T2.
30 #L #T1 #R #HT1 #IHT1 #T2 #HT12
31 @(TC_star_ind … HT1 IHT1 … HT12) //
34 lemma cprs_ind_dx: ∀L,T2. ∀R:predicate term. R T2 →
35 (∀T1,T. L ⊢ T1 ➡ T → L ⊢ T ➡* T2 → R T → R T1) →
36 ∀T1. L ⊢ T1 ➡* T2 → R T1.
37 #L #T2 #R #HT2 #IHT2 #T1 #HT12
38 @(TC_star_ind_dx … HT2 IHT2 … HT12) //
41 (* Basic properties *********************************************************)
43 (* Basic_1: was: pr3_pr2 *)
44 lemma cpr_cprs: ∀L,T1,T2. L ⊢ T1 ➡ T2 → L ⊢ T1 ➡* T2.
47 lemma cpss_cprs: ∀L,T1,T2. L ⊢ T1 ▶* T2 → L ⊢ T1 ➡* T2.
50 (* Basic_1: was: pr3_refl *)
51 lemma cprs_refl: ∀L,T. L ⊢ T ➡* T.
54 lemma cprs_strap1: ∀L,T1,T,T2.
55 L ⊢ T1 ➡* T → L ⊢ T ➡ T2 → L ⊢ T1 ➡* T2.
56 normalize /2 width=3/ qed.
58 (* Basic_1: was: pr3_step *)
59 lemma cprs_strap2: ∀L,T1,T,T2.
60 L ⊢ T1 ➡ T → L ⊢ T ➡* T2 → L ⊢ T1 ➡* T2.
61 normalize /2 width=3/ qed.
63 lemma cprs_cpss_trans: ∀L,T1,T. L ⊢ T1 ➡* T → ∀T2. L ⊢ T ▶* T2 → L ⊢ T1 ➡* T2.
66 lemma cpss_cprs_trans: ∀L,T1,T. L ⊢ T1 ▶* T → ∀T2. L ⊢ T ➡* T2 → L ⊢ T1 ➡* T2.
69 lemma cprs_lsubr_trans: lsubr_trans … cprs.
70 /3 width=3 by cpr_lsubr_trans, TC_lsubr_trans/
73 (* Basic_1: was: pr3_pr1 *)
74 lemma tprs_cprs: ∀L,T1,T2. ⋆ ⊢ T1 ➡* T2 → L ⊢ T1 ➡* T2.
75 #L #T1 #T2 #H @(cprs_lsubr_trans … H) -H //
78 lemma cprs_ext_bind_dx: ∀L,V1,V2. L ⊢ V1 ➡ V2 → ∀V,T1,T2. L.ⓛV ⊢ T1 ➡* T2 →
79 ∀a,I. L ⊢ ⓑ{a,I}V1.T1 ➡* ⓑ{a,I}V2.T2.
80 #L #V1 #V2 #HV12 #V #T1 #T2 #HT12 #a @(cprs_ind … HT12) -T2
81 /3 width=1/ /3 width=6/
84 lemma cprs_bind_dx: ∀L,V1,V2. L ⊢ V1 ➡ V2 → ∀I,T1,T2. L. ⓑ{I}V1 ⊢ T1 ➡* T2 →
85 ∀a. L ⊢ ⓑ{a,I}V1. T1 ➡* ⓑ{a,I}V2. T2.
86 #L #V1 #V2 #HV12 #I #T1 #T2 #HT12 #a @(cprs_ind_dx … HT12) -T1
87 /3 width=1/ /3 width=3/
90 (* Basic_1: was only: pr3_thin_dx *)
91 lemma cprs_flat_dx: ∀I,L,V1,V2. L ⊢ V1 ➡ V2 → ∀T1,T2. L ⊢ T1 ➡* T2 →
92 L ⊢ ⓕ{I} V1. T1 ➡* ⓕ{I} V2. T2.
93 #I #L #V1 #V2 #HV12 #T1 #T2 #HT12 @(cprs_ind … HT12) -T2 /3 width=1/
95 @(cprs_strap1 … IHT1) -V1 -T1 /2 width=1/
98 lemma cprs_flat_sn: ∀I,L,T1,T2. L ⊢ T1 ➡ T2 → ∀V1,V2. L ⊢ V1 ➡* V2 →
99 L ⊢ ⓕ{I} V1. T1 ➡* ⓕ{I} V2. T2.
100 #I #L #T1 #T2 #HT12 #V1 #V2 #H @(cprs_ind … H) -V2 /3 width=1/
102 @(cprs_strap1 … IHV1) -V1 -T1 /2 width=1/
105 lemma cprs_zeta: ∀L,V,T1,T,T2. ⇧[0, 1] T2 ≡ T →
106 L.ⓓV ⊢ T1 ➡* T → L ⊢ +ⓓV.T1 ➡* T2.
107 #L #V #T1 #T #T2 #HT2 #H @(TC_ind_dx … T1 H) -T1 /3 width=3/
110 lemma cprs_tau: ∀L,T1,T2. L ⊢ T1 ➡* T2 → ∀V. L ⊢ ⓝV.T1 ➡* T2.
111 #L #T1 #T2 #H elim H -T2 /2 width=3/ /3 width=1/
114 lemma cprs_beta_dx: ∀a,L,V1,V2,W,T1,T2.
115 L ⊢ V1 ➡ V2 → L.ⓛW ⊢ T1 ➡* T2 →
116 L ⊢ ⓐV1.ⓛ{a}W.T1 ➡* ⓓ{a}V2.T2.
117 #a #L #V1 #V2 #W #T1 #T2 #HV12 * -T2 /3 width=1/
118 /4 width=6 by cprs_strap1, cprs_bind_dx, cprs_flat_dx, cpr_beta/ (**) (* auto too slow without trace *)
121 lemma cprs_theta_dx: ∀a,L,V1,V,V2,W1,W2,T1,T2.
122 L ⊢ V1 ➡ V → ⇧[0, 1] V ≡ V2 → L.ⓓW1 ⊢ T1 ➡* T2 →
123 L ⊢ W1 ➡ W2 → L ⊢ ⓐV1.ⓓ{a}W1.T1 ➡* ⓓ{a}W2.ⓐV2.T2.
124 #a #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 * -T2 [ /3 width=3/ ]
125 /4 width=9 by cprs_strap1, cprs_bind_dx, cprs_flat_dx, cpr_theta/ (**) (* auto too slow without trace *)
128 (* Basic inversion lemmas ***************************************************)
130 (* Basic_1: was: pr3_gen_sort *)
131 lemma cprs_inv_sort1: ∀L,U2,k. L ⊢ ⋆k ➡* U2 → U2 = ⋆k.
132 #L #U2 #k #H @(cprs_ind … H) -U2 //
133 #U2 #U #_ #HU2 #IHU2 destruct
134 >(cpr_inv_sort1 … HU2) -HU2 //
137 (* Basic_1: was pr3_gen_appl *)
138 lemma cprs_inv_appl1: ∀L,V1,T1,U2. L ⊢ ⓐV1. T1 ➡* U2 →
139 ∨∨ ∃∃V2,T2. L ⊢ V1 ➡* V2 & L ⊢ T1 ➡* T2 &
141 | ∃∃a,V2,W,T. L ⊢ V1 ➡* V2 &
142 L ⊢ T1 ➡* ⓛ{a}W. T & L ⊢ ⓓ{a}V2. T ➡* U2
143 | ∃∃a,V0,V2,V,T. L ⊢ V1 ➡* V0 & ⇧[0,1] V0 ≡ V2 &
144 L ⊢ T1 ➡* ⓓ{a}V. T & L ⊢ ⓓ{a}V. ⓐV2. T ➡* U2.
145 #L #V1 #T1 #U2 #H @(cprs_ind … H) -U2 /3 width=5/
147 [ #V0 #T0 #HV10 #HT10 #H destruct
148 elim (cpr_inv_appl1 … HU2) -HU2 *
149 [ #V2 #T2 #HV02 #HT02 #H destruct /4 width=5/
150 | #a #V2 #W2 #T #T2 #HV02 #HT2 #H1 #H2 destruct
151 lapply (cprs_strap1 … HV10 … HV02) -V0 /5 width=7/
152 | #a #V #V2 #W0 #W2 #T #T2 #HV0 #HV2 #HW02 #HT2 #H1 #H2 destruct
153 @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 *)
160 (* Basic_1: was: pr3_gen_cast *)
161 lemma cprs_inv_cast1: ∀L,W1,T1,U2. L ⊢ ⓝW1.T1 ➡* U2 → L ⊢ T1 ➡* U2 ∨
162 ∃∃W2,T2. L ⊢ W1 ➡* W2 & L ⊢ T1 ➡* T2 & U2 = ⓝW2.T2.
163 #L #W1 #T1 #U2 #H @(cprs_ind … H) -U2 /3 width=5/
164 #U2 #U #_ #HU2 * /3 width=3/ *
165 #W #T #HW1 #HT1 #H destruct
166 elim (cpr_inv_cast1 … HU2) -HU2 /3 width=3/ *
167 #W2 #T2 #HW2 #HT2 #H destruct /4 width=5/
170 (* Basic_1: was: nf2_pr3_unfold *)
171 lemma cprs_inv_cnr1: ∀L,T,U. L ⊢ T ➡* U → L ⊢ 𝐍⦃T⦄ → T = U.
172 #L #T #U #H @(cprs_ind_dx … H) -T //
173 #T0 #T #H1T0 #_ #IHT #H2T0
174 lapply (H2T0 … H1T0) -H1T0 #H destruct /2 width=1/
177 (* Basic forward lemmas *****************************************************)
179 (* Basic_1: was: pr3_gen_abst *)
180 lemma cprs_fwd_abst1: ∀a,L,V1,T1,U2. L ⊢ ⓛ{a}V1. T1 ➡* U2 → ∀I,W.
181 ∃∃V2,T2. L ⊢ V1 ➡* V2 & L. ⓑ{I} W ⊢ T1 ➡* T2 &
183 #a #L #V1 #T1 #U2 #H @(cprs_ind … H) -U2 /2 width=5/
184 #U #U2 #_ #HU2 #IHU1 #I #W
185 elim (IHU1 I W) -IHU1 #V #T #HV1 #HT1 #H destruct
186 elim (cpr_fwd_abst1 … HU2 I W) -HU2 #V2 #T2 #HV2 #HT2 #H destruct /3 width=5/
189 lemma cprs_fwd_abst: ∀a,L,V1,V2,T1,T2. L ⊢ ⓛ{a}V1. T1 ➡* ⓛ{a}V2. T2 → ∀I,W.
190 L ⊢ V1 ➡* V2 ∧ L. ⓑ{I} W ⊢ T1 ➡* T2.
191 #a #L #V1 #V2 #T1 #T2 #H #I #W
192 elim (cprs_fwd_abst1 … H I W) -H #V #T #HV1 #HT1 #H destruct /2 width=1/
195 (* Basic_1: removed theorems 13:
196 pr1_head_1 pr1_head_2 pr1_comp
197 clear_pr3_trans pr3_cflat pr3_gen_bind
198 pr3_head_1 pr3_head_2 pr3_head_21 pr3_head_12
199 pr3_iso_appl_bind pr3_iso_appls_appl_bind pr3_iso_appls_bind