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/cnf.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 #H elim H -T2 /3 width=1/
119 @(cprs_strap1 … IHT1) -V1 -T1 /3 width=2/
122 lemma cprs_theta_dx: ∀a,L,V1,V,V2,W1,T1,T2.
123 L ⊢ V1 ➡ V → ⇧[0, 1] V ≡ V2 → L.ⓓW1 ⊢ T1 ➡* T2 →
124 ∀W2. L ⊢ W1 ➡ W2 → L ⊢ ⓐV1.ⓓ{a}W1.T1 ➡* ⓓ{a}W2.ⓐV2.T2.
125 #a #L #V1 #V #V2 #W1 #T1 #T2 #HV1 #HV2 #H elim H -T2 [ /3 width=3/ ]
126 #T #T2 #_ #HT2 #IHT1 #W2 #HW12
127 lapply (IHT1 W1 ?) -IHT1 // #HT1
128 @(cprs_strap1 … HT1) -HT1 -V -V1 /3 width=1/
131 (* Basic inversion lemmas ***************************************************)
133 (* Basic_1: was: pr3_gen_sort *)
134 lemma cprs_inv_sort1: ∀L,U2,k. L ⊢ ⋆k ➡* U2 → U2 = ⋆k.
135 #L #U2 #k #H @(cprs_ind … H) -U2 //
136 #U2 #U #_ #HU2 #IHU2 destruct
137 >(cpr_inv_sort1 … HU2) -HU2 //
140 (* Basic_1: was pr3_gen_appl *)
141 lemma cprs_inv_appl1: ∀L,V1,T1,U2. L ⊢ ⓐV1. T1 ➡* U2 →
142 ∨∨ ∃∃V2,T2. L ⊢ V1 ➡* V2 & L ⊢ T1 ➡* T2 &
144 | ∃∃a,V2,W,T. L ⊢ V1 ➡* V2 &
145 L ⊢ T1 ➡* ⓛ{a}W. T & L ⊢ ⓓ{a}V2. T ➡* U2
146 | ∃∃a,V0,V2,V,T. L ⊢ V1 ➡* V0 & ⇧[0,1] V0 ≡ V2 &
147 L ⊢ T1 ➡* ⓓ{a}V. T & L ⊢ ⓓ{a}V. ⓐV2. T ➡* U2.
148 #L #V1 #T1 #U2 #H @(cprs_ind … H) -U2 /3 width=5/
150 [ #V0 #T0 #HV10 #HT10 #H destruct
151 elim (cpr_inv_appl1 … HU2) -HU2 *
152 [ #V2 #T2 #HV02 #HT02 #H destruct /4 width=5/
153 | #a #V2 #W2 #T #T2 #HV02 #HT2 #H1 #H2 destruct
154 lapply (cprs_strap1 … HV10 … HV02) -V0 /5 width=7/
155 | #a #V #V2 #W0 #W2 #T #T2 #HV0 #HV2 #HW02 #HT2 #H1 #H2 destruct
156 @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 *)
163 (* Basic_1: was: pr3_gen_cast *)
164 lemma cprs_inv_cast1: ∀L,W1,T1,U2. L ⊢ ⓝW1.T1 ➡* U2 → L ⊢ T1 ➡* U2 ∨
165 ∃∃W2,T2. L ⊢ W1 ➡* W2 & L ⊢ T1 ➡* T2 & U2 = ⓝW2.T2.
166 #L #W1 #T1 #U2 #H @(cprs_ind … H) -U2 /3 width=5/
167 #U2 #U #_ #HU2 * /3 width=3/ *
168 #W #T #HW1 #HT1 #H destruct
169 elim (cpr_inv_cast1 … HU2) -HU2 /3 width=3/ *
170 #W2 #T2 #HW2 #HT2 #H destruct /4 width=5/
173 (* Basic_1: was: nf2_pr3_unfold *)
174 lemma cprs_inv_cnf1: ∀L,T,U. L ⊢ T ➡* U → L ⊢ 𝐍⦃T⦄ → T = U.
175 #L #T #U #H @(cprs_ind_dx … H) -T //
176 #T0 #T #H1T0 #_ #IHT #H2T0
177 lapply (H2T0 … H1T0) -H1T0 #H destruct /2 width=1/
180 (* Basic forward lemmas *****************************************************)
182 (* Basic_1: was: pr3_gen_abst *)
183 lemma cprs_fwd_abst1: ∀a,L,V1,T1,U2. L ⊢ ⓛ{a}V1. T1 ➡* U2 → ∀I,W.
184 ∃∃V2,T2. L ⊢ V1 ➡* V2 & L. ⓑ{I} W ⊢ T1 ➡* T2 &
186 #a #L #V1 #T1 #U2 #H @(cprs_ind … H) -U2 /2 width=5/
187 #U #U2 #_ #HU2 #IHU1 #I #W
188 elim (IHU1 I W) -IHU1 #V #T #HV1 #HT1 #H destruct
189 elim (cpr_fwd_abst1 … HU2 I W) -HU2 #V2 #T2 #HV2 #HT2 #H destruct /3 width=5/
192 lemma cprs_fwd_abst: ∀a,L,V1,V2,T1,T2. L ⊢ ⓛ{a}V1. T1 ➡* ⓛ{a}V2. T2 → ∀I,W.
193 L ⊢ V1 ➡* V2 ∧ L. ⓑ{I} W ⊢ T1 ➡* T2.
194 #a #L #V1 #V2 #T1 #T2 #H #I #W
195 elim (cprs_fwd_abst1 … H I W) -H #V #T #HV1 #HT1 #H destruct /2 width=1/
198 (* Basic_1: removed theorems 13:
199 pr1_head_1 pr1_head_2 pr1_comp
200 clear_pr3_trans pr3_cflat pr3_gen_bind
201 pr3_head_1 pr3_head_2 pr3_head_21 pr3_head_12
202 pr3_iso_appl_bind pr3_iso_appls_appl_bind pr3_iso_appls_bind