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/reducibility/cpr_lift.ma".
16 include "basic_2/reducibility/cpr_cpr.ma".
17 include "basic_2/reducibility/lfpr_cpr.ma".
18 include "basic_2/computation/cprs_lfpr.ma".
20 (* CONTEXT-SENSITIVE PARALLEL COMPUTATION ON TERMS **************************)
22 (* Advanced properties ******************************************************)
24 lemma cprs_abst_dx: ∀L,V1,V2. L ⊢ V1 ➡ V2 → ∀V,T1,T2.
25 L.ⓛV ⊢ T1 ➡* T2 → ∀a. L ⊢ ⓛ{a}V1. T1 ➡* ⓛ{a}V2. T2.
26 #L #V1 #V2 #HV12 #V #T1 #T2 #HT12 #a @(cprs_ind … HT12) -T2
28 | /3 width=6 by cprs_strap1, cpr_abst/ (**) (* /3 width=6/ is too slow *)
32 lemma cprs_abbr1_dx: ∀L,V1,V2. L ⊢ V1 ➡ V2 → ∀T1,T2. L. ⓓV1 ⊢ T1 ➡* T2 →
33 ∀a. L ⊢ ⓓ{a}V1. T1 ➡* ⓓ{a}V2. T2.
34 #L #V1 #V2 #HV12 #T1 #T2 #HT12 #a @(cprs_ind_dx … HT12) -T1
36 | #T1 #T #HT1 #_ #IHT1
37 @(cprs_strap2 … IHT1) -IHT1 /2 width=1/
41 lemma cpr_abbr1: ∀L,V1,V2. L ⊢ V1 ➡ V2 → ∀T1,T2. L. ⓓV1 ⊢ T1 ➡ T2 →
42 ∀a. L ⊢ ⓓ{a}V1. T1 ➡* ⓓ{a}V2. T2.
45 lemma cpr_abbr2: ∀L,V1,V2. L ⊢ V1 ➡ V2 → ∀T1,T2. L. ⓓV2 ⊢ T1 ➡ T2 →
46 ∀a. L ⊢ ⓓ{a}V1. T1 ➡* ⓓ{a}V2. T2.
47 #L #V1 #V2 #HV12 #T1 #T2 #HT12
48 lapply (lfpr_cpr_trans (L. ⓓV1) … HT12) /2 width=1/
51 (* Basic_1: was: pr3_strip *)
52 lemma cprs_strip: ∀L,T1,T. L ⊢ T ➡* T1 → ∀T2. L ⊢ T ➡ T2 →
53 ∃∃T0. L ⊢ T1 ➡ T0 & L ⊢ T2 ➡* T0.
56 (* Advanced inversion lemmas ************************************************)
58 (* Basic_1: was pr3_gen_appl *)
59 lemma cprs_inv_appl1: ∀L,V1,T1,U2. L ⊢ ⓐV1. T1 ➡* U2 →
60 ∨∨ ∃∃V2,T2. L ⊢ V1 ➡* V2 & L ⊢ T1 ➡* T2 &
62 | ∃∃a,V2,W,T. L ⊢ V1 ➡* V2 &
63 L ⊢ T1 ➡* ⓛ{a}W. T & L ⊢ ⓓ{a}V2. T ➡* U2
64 | ∃∃a,V0,V2,V,T. L ⊢ V1 ➡* V0 & ⇧[0,1] V0 ≡ V2 &
65 L ⊢ T1 ➡* ⓓ{a}V. T & L ⊢ ⓓ{a}V. ⓐV2. T ➡* U2.
66 #L #V1 #T1 #U2 #H @(cprs_ind … H) -U2 /3 width=5/
68 [ #V0 #T0 #HV10 #HT10 #H destruct
69 elim (cpr_inv_appl1 … HU2) -HU2 *
70 [ #V2 #T2 #HV02 #HT02 #H destruct /4 width=5/
71 | #a #V2 #W2 #T #T2 #HV02 #HT2 #H1 #H2 destruct /4 width=7/
72 | #a #V #V2 #W0 #W2 #T #T2 #HV0 #HW02 #HT2 #HV2 #H1 #H2 destruct
73 @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 *)
80 (* Main propertis ***********************************************************)
82 (* Basic_1: was: pr3_confluence *)
83 theorem cprs_conf: ∀L,T1,T. L ⊢ T ➡* T1 → ∀T2. L ⊢ T ➡* T2 →
84 ∃∃T0. L ⊢ T1 ➡* T0 & L ⊢ T2 ➡* T0.
87 (* Basic_1: was: pr3_t *)
88 theorem cprs_trans: ∀L,T1,T. L ⊢ T1 ➡* T → ∀T2. L ⊢ T ➡* T2 → L ⊢ T1 ➡* T2.
91 (* Basic_1: was: pr3_flat *)
92 lemma cprs_flat: ∀I,L,T1,T2. L ⊢ T1 ➡* T2 → ∀V1,V2. L ⊢ V1 ➡* V2 →
93 L ⊢ ⓕ{I} V1. T1 ➡* ⓕ{I} V2. T2.
94 #I #L #T1 #T2 #HT12 #V1 #V2 #HV12 @(cprs_ind … HV12) -V2 /2 width=1/
96 @(cprs_trans … IHV1) -IHV1 /2 width=1/
99 lemma cprs_abst: ∀L,V1,V2. L ⊢ V1 ➡* V2 → ∀V,T1,T2.
100 L.ⓛV ⊢ T1 ➡* T2 → ∀a. L ⊢ ⓛ{a}V1. T1 ➡* ⓛ{a}V2. T2.
101 #L #V1 #V2 #HV12 #V #T1 #T2 #HT12 #a @(cprs_ind … HV12) -V2
102 [ lapply (cprs_lsubs_trans … HT12 (L.ⓛV1) ?) -HT12 /2 width=2/
103 | #V0 #V2 #_ #HV02 #IHV01
104 @(cprs_trans … IHV01) -V1 /2 width=2/
108 lemma cprs_abbr1: ∀L,V1,T1,T2. L. ⓓV1 ⊢ T1 ➡* T2 → ∀V2. L ⊢ V1 ➡* V2 →
109 ∀a.L ⊢ ⓓ{a}V1. T1 ➡* ⓓ{a}V2. T2.
110 #L #V1 #T1 #T2 #HT12 #V2 #HV12 #a @(cprs_ind … HV12) -V2 /2 width=1/
112 @(cprs_trans … IHV1) -IHV1 /2 width=1/
115 lemma cprs_abbr2_dx: ∀L,V1,V2. L ⊢ V1 ➡ V2 → ∀T1,T2. L. ⓓV2 ⊢ T1 ➡* T2 →
116 ∀a. L ⊢ ⓓ{a}V1. T1 ➡* ⓓ{a}V2. T2.
117 #L #V1 #V2 #HV12 #T1 #T2 #HT12 #a @(cprs_ind_dx … HT12) -T1
119 | #T1 #T #HT1 #_ #IHT1
120 lapply (lfpr_cpr_trans (L. ⓓV1) … HT1) -HT1 /2 width=1/ #HT1
121 @(cprs_trans … IHT1) -IHT1 /2 width=1/
125 lemma cprs_abbr2: ∀L,V1,V2. L ⊢ V1 ➡* V2 → ∀T1,T2. L. ⓓV2 ⊢ T1 ➡* T2 →
126 ∀a. L ⊢ ⓓ{a}V1. T1 ➡* ⓓ{a}V2. T2.
127 #L #V1 #V2 #HV12 @(cprs_ind … HV12) -V2 /2 width=1/
128 #V #V2 #_ #HV2 #IHV1 #T1 #T2 #HT12 #a
129 lapply (IHV1 T1 T1 ? a) -IHV1 // #HV1
130 @(cprs_trans … HV1) -HV1 /2 width=1/
133 lemma cprs_beta_dx: ∀L,V1,V2,W,T1,T2.
134 L ⊢ V1 ➡ V2 → L.ⓛW ⊢ T1 ➡* T2 →
135 ∀a.L ⊢ ⓐV1.ⓛ{a}W.T1 ➡* ⓓ{a}V2.T2.
136 #L #V1 #V2 #W #T1 #T2 #HV12 #HT12 #a @(cprs_ind … HT12) -T2
138 | -HV12 #T #T2 #_ #HT2 #IHT1
139 lapply (cpr_lsubs_trans … HT2 (L.ⓓV2) ?) -HT2 /2 width=1/ #HT2
140 @(cprs_trans … IHT1) -V1 -W -T1 /3 width=1/
144 (* Basic_1: was only: pr3_pr2_pr3_t pr3_wcpr0_t *)
145 lemma lcpr_cprs_trans: ∀L1,L2. ⦃L1⦄ ➡ ⦃L2⦄ →
146 ∀T1,T2. L2 ⊢ T1 ➡* T2 → L1 ⊢ T1 ➡* T2.
147 #L1 #L2 #HL12 #T1 #T2 #H @(cprs_ind … H) -T2 //
149 @(cprs_trans … IHT2) /2 width=3/