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/notation/relations/predstar_4.ma".
16 include "basic_2/reduction/cnr.ma".
18 (* CONTEXT-SENSITIVE PARALLEL COMPUTATION ON TERMS **************************)
20 (* Basic_1: includes: pr1_pr0 *)
21 definition cprs: relation4 genv lenv term term ≝
24 interpretation "context-sensitive parallel computation (term)"
25 'PRedStar G L T1 T2 = (cprs G L T1 T2).
27 (* Basic eliminators ********************************************************)
29 lemma cprs_ind: ∀G,L,T1. ∀R:predicate term. R T1 →
30 (∀T,T2. ⦃G, L⦄ ⊢ T1 ➡* T → ⦃G, L⦄ ⊢ T ➡ T2 → R T → R T2) →
31 ∀T2. ⦃G, L⦄ ⊢ T1 ➡* T2 → R T2.
32 #G #L #T1 #R #HT1 #IHT1 #T2 #HT12
33 @(TC_star_ind … HT1 IHT1 … HT12) //
36 lemma cprs_ind_dx: ∀G,L,T2. ∀R:predicate term. R T2 →
37 (∀T1,T. ⦃G, L⦄ ⊢ T1 ➡ T → ⦃G, L⦄ ⊢ T ➡* T2 → R T → R T1) →
38 ∀T1. ⦃G, L⦄ ⊢ T1 ➡* T2 → R T1.
39 #G #L #T2 #R #HT2 #IHT2 #T1 #HT12
40 @(TC_star_ind_dx … HT2 IHT2 … HT12) //
43 (* Basic properties *********************************************************)
45 (* Basic_1: was: pr3_pr2 *)
46 lemma cpr_cprs: ∀G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ➡ T2 → ⦃G, L⦄ ⊢ T1 ➡* T2.
47 /2 width=1 by inj/ qed.
49 (* Basic_1: was: pr3_refl *)
50 lemma cprs_refl: ∀G,L,T. ⦃G, L⦄ ⊢ T ➡* T.
51 /2 width=1 by cpr_cprs/ qed.
53 lemma cprs_strap1: ∀G,L,T1,T,T2.
54 ⦃G, L⦄ ⊢ T1 ➡* T → ⦃G, L⦄ ⊢ T ➡ T2 → ⦃G, L⦄ ⊢ T1 ➡* T2.
55 normalize /2 width=3 by step/ qed.
57 (* Basic_1: was: pr3_step *)
58 lemma cprs_strap2: ∀G,L,T1,T,T2.
59 ⦃G, L⦄ ⊢ T1 ➡ T → ⦃G, L⦄ ⊢ T ➡* T2 → ⦃G, L⦄ ⊢ T1 ➡* T2.
60 normalize /2 width=3 by TC_strap/ qed.
62 lemma lsubr_cprs_trans: ∀G. lsub_trans … (cprs G) lsubr.
63 /3 width=5 by lsubr_cpr_trans, LTC_lsub_trans/
66 (* Basic_1: was: pr3_pr1 *)
67 lemma tprs_cprs: ∀G,L,T1,T2. ⦃G, ⋆⦄ ⊢ T1 ➡* T2 → ⦃G, L⦄ ⊢ T1 ➡* T2.
68 /2 width=3 by lsubr_cprs_trans/ qed.
70 lemma cprs_bind_dx: ∀G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡ V2 → ∀I,T1,T2. ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ➡* T2 →
71 ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V1. T1 ➡* ⓑ{a,I}V2. T2.
72 #G #L #V1 #V2 #HV12 #I #T1 #T2 #HT12 #a @(cprs_ind_dx … HT12) -T1
73 /3 width=3 by cprs_strap2, cpr_cprs, cpr_pair_sn, cpr_bind/ qed.
75 (* Basic_1: was only: pr3_thin_dx *)
76 lemma cprs_flat_dx: ∀I,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡ V2 → ∀T1,T2. ⦃G, L⦄ ⊢ T1 ➡* T2 →
77 ⦃G, L⦄ ⊢ ⓕ{I} V1. T1 ➡* ⓕ{I} V2. T2.
78 #I #G #L #V1 #V2 #HV12 #T1 #T2 #HT12 @(cprs_ind … HT12) -T2
79 /3 width=5 by cprs_strap1, cpr_flat, cpr_cprs, cpr_pair_sn/
82 lemma cprs_flat_sn: ∀I,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ➡ T2 → ∀V1,V2. ⦃G, L⦄ ⊢ V1 ➡* V2 →
83 ⦃G, L⦄ ⊢ ⓕ{I} V1. T1 ➡* ⓕ{I} V2. T2.
84 #I #G #L #T1 #T2 #HT12 #V1 #V2 #H @(cprs_ind … H) -V2
85 /3 width=3 by cprs_strap1, cpr_cprs, cpr_pair_sn, cpr_flat/
88 lemma cprs_zeta: ∀G,L,V,T1,T,T2. ⇧[0, 1] T2 ≡ T →
89 ⦃G, L.ⓓV⦄ ⊢ T1 ➡* T → ⦃G, L⦄ ⊢ +ⓓV.T1 ➡* T2.
90 #G #L #V #T1 #T #T2 #HT2 #H @(cprs_ind_dx … H) -T1
91 /3 width=3 by cprs_strap2, cpr_cprs, cpr_bind, cpr_zeta/
94 lemma cprs_eps: ∀G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ➡* T2 → ∀V. ⦃G, L⦄ ⊢ ⓝV.T1 ➡* T2.
95 #G #L #T1 #T2 #H @(cprs_ind … H) -T2
96 /3 width=3 by cprs_strap1, cpr_cprs, cpr_eps/
99 lemma cprs_beta_dx: ∀a,G,L,V1,V2,W1,W2,T1,T2.
100 ⦃G, L⦄ ⊢ V1 ➡ V2 → ⦃G, L⦄ ⊢ W1 ➡ W2 → ⦃G, L.ⓛW1⦄ ⊢ T1 ➡* T2 →
101 ⦃G, L⦄ ⊢ ⓐV1.ⓛ{a}W1.T1 ➡* ⓓ{a}ⓝW2.V2.T2.
102 #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 #HW12 * -T2
103 /4 width=7 by cprs_strap1, cpr_cprs, cprs_bind_dx, cprs_flat_dx, cpr_beta/
106 lemma cprs_theta_dx: ∀a,G,L,V1,V,V2,W1,W2,T1,T2.
107 ⦃G, L⦄ ⊢ V1 ➡ V → ⇧[0, 1] V ≡ V2 → ⦃G, L.ⓓW1⦄ ⊢ T1 ➡* T2 →
108 ⦃G, L⦄ ⊢ W1 ➡ W2 → ⦃G, L⦄ ⊢ ⓐV1.ⓓ{a}W1.T1 ➡* ⓓ{a}W2.ⓐV2.T2.
109 #a #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 * -T2
110 /4 width=9 by cprs_strap1, cpr_cprs, cprs_bind_dx, cprs_flat_dx, cpr_theta/
113 (* Basic inversion lemmas ***************************************************)
115 (* Basic_1: was: pr3_gen_sort *)
116 lemma cprs_inv_sort1: ∀G,L,U2,k. ⦃G, L⦄ ⊢ ⋆k ➡* U2 → U2 = ⋆k.
117 #G #L #U2 #k #H @(cprs_ind … H) -U2 //
118 #U2 #U #_ #HU2 #IHU2 destruct
119 >(cpr_inv_sort1 … HU2) -HU2 //
122 (* Basic_1: was: pr3_gen_cast *)
123 lemma cprs_inv_cast1: ∀G,L,W1,T1,U2. ⦃G, L⦄ ⊢ ⓝW1.T1 ➡* U2 → ⦃G, L⦄ ⊢ T1 ➡* U2 ∨
124 ∃∃W2,T2. ⦃G, L⦄ ⊢ W1 ➡* W2 & ⦃G, L⦄ ⊢ T1 ➡* T2 & U2 = ⓝW2.T2.
125 #G #L #W1 #T1 #U2 #H @(cprs_ind … H) -U2 /3 width=5/
126 #U2 #U #_ #HU2 * /3 width=3 by cprs_strap1, or_introl/ *
127 #W #T #HW1 #HT1 #H destruct
128 elim (cpr_inv_cast1 … HU2) -HU2 /3 width=3 by cprs_strap1, or_introl/ *
129 #W2 #T2 #HW2 #HT2 #H destruct /4 width=5 by cprs_strap1, ex3_2_intro, or_intror/
132 (* Basic_1: was: nf2_pr3_unfold *)
133 lemma cprs_inv_cnr1: ∀G,L,T,U. ⦃G, L⦄ ⊢ T ➡* U → ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄ → T = U.
134 #G #L #T #U #H @(cprs_ind_dx … H) -T //
135 #T0 #T #H1T0 #_ #IHT #H2T0
136 lapply (H2T0 … H1T0) -H1T0 #H destruct /2 width=1 by/
139 (* Basic_1: removed theorems 13:
140 pr1_head_1 pr1_head_2 pr1_comp
141 clear_pr3_trans pr3_cflat pr3_gen_bind
142 pr3_head_1 pr3_head_2 pr3_head_21 pr3_head_12
143 pr3_iso_appl_bind pr3_iso_appls_appl_bind pr3_iso_appls_bind