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/cfpr_cpr.ma".
17 (* CONTEXT-FREE PARALLEL REDUCTION ON CLOSURES ******************************)
19 (* Properties on context-sensitive parallel reduction for terms *************)
21 lemma ltpr_tpr_fpr: ∀L1,L2. L1 ➡ L2 → ∀T1,T2. T1 ➡ T2 → ⦃L1, T1⦄ ➡ ⦃L2, T2⦄.
24 lemma cpr_fpr: ∀L,T1,T2. L ⊢ T1 ➡ T2 → ⦃L, T1⦄ ➡ ⦃L, T2⦄.
27 lemma fpr_lift: ∀K1,K2,T1,T2. ⦃K1, T1⦄ ➡ ⦃K2, T2⦄ →
28 ∀d,e,L1. ⇩[d, e] L1 ≡ K1 →
29 ∀U1,U2. ⇧[d, e] T1 ≡ U1 → ⇧[d, e] T2 ≡ U2 →
30 ∃∃L2. ⦃L1, U1⦄ ➡ ⦃L2, U2⦄ & ⇩[d, e] L2 ≡ K2.
31 #K1 #K2 #T1 #T2 #HT12 #d #e #L1 #HLK1 #U1 #U2 #HTU1 #HTU2
32 elim (fpr_inv_all … HT12) -HT12 #K #HK1 #HT12 #HK2
33 elim (ldrop_ltpr_trans … HLK1 … HK1) -K1 #L #HL1 #HLK
34 lapply (cpr_lift … HLK … HTU1 … HTU2 HT12) -T1 -T2 #HU12
35 elim (le_or_ge (|K|) d) #Hd
36 [ elim (ldrop_ltpss_sn_trans_ge … HLK … HK2 …)
37 | elim (ldrop_ltpss_sn_trans_be … HLK … HK2 …)
38 ] // -Hd #L2 #HL2 #HLK2
39 lapply (ltpss_sn_weak_full … HL2) -K /3 width=4/
42 (* Advanced properties ******************************************************)
44 lemma fpr_flat_dx: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ➡ ⦃L2, T2⦄ → ∀V1,V2. V1 ➡ V2 →
45 ∀I. ⦃L1, ⓕ{I}V1.T1⦄ ➡ ⦃L2, ⓕ{I}V2.T2⦄.
47 elim (fpr_inv_all … HT12) -HT12 /4 width=4/
50 lemma fpr_bind_sn: ∀L1,L2,V1,V2. ⦃L1, V1⦄ ➡ ⦃L2, V2⦄ → ∀T1,T2. T1 ➡ T2 →
51 ∀a,I. ⦃L1, ⓑ{a,I}V1.T1⦄ ➡ ⦃L2, ⓑ{a,I}V2.T2⦄.
52 #L1 #L2 #V1 #V2 #H #T1 #T2 #HT12 #a #I
53 elim (fpr_inv_all … H) /3 width=4/
56 lemma fpr_bind2_minus: ∀I,L1,L2,V1,T1,U2. ⦃L1, -ⓑ{I}V1.T1⦄ ➡ ⦃L2, U2⦄ →
57 ∃∃V2,T2. ⦃L1.ⓑ{I}V1, T1⦄ ➡ ⦃L2.ⓑ{I}V2, T2⦄ &
59 #I1 #L1 #L2 #V1 #T1 #U2 #H
60 elim (fpr_inv_all … H) -H #L #HL1 #H #HL2
61 elim (cpr_fwd_bind1_minus … H false) -H /4 width=4/
64 (* Advanced forward lemmas **************************************************)
66 lemma fpr_fwd_bind2_minus: ∀I,L1,L,V1,T1,T. ⦃L1, -ⓑ{I}V1.T1⦄ ➡ ⦃L, T⦄ → ∀b.
67 ∃∃V2,T2. ⦃L1, ⓑ{b,I}V1.T1⦄ ➡ ⦃L, ⓑ{b,I}V2.T2⦄ &
69 #I #L1 #L #V1 #T1 #T #H1 #b
70 elim (fpr_inv_all … H1) -H1 #L0 #HL10 #HT1 #HL0
71 elim (cpr_fwd_bind1_minus … HT1 b) -HT1 /3 width=4/
74 lemma fpr_fwd_shift_bind_minus: ∀I1,I2,L1,L2,V1,V2,T1,T2.
75 ⦃L1, -ⓑ{I1}V1.T1⦄ ➡ ⦃L2, -ⓑ{I2}V2.T2⦄ →
76 ⦃L1, V1⦄ ➡ ⦃L2, V2⦄ ∧ I1 = I2.
77 * #I2 #L1 #L2 #V1 #V2 #T1 #T2 #H
78 elim (fpr_inv_all … H) -H #L #HL1 #H #HL2
79 [ elim (cpr_inv_abbr1 … H) -H *
80 [ #V #V0 #T #HV1 #HV0 #_ #H destruct /4 width=4/
81 | #T #_ #_ #H destruct
83 | elim (cpr_inv_abst1 … H Abst V2) -H
84 #V #T #HV1 #_ #H destruct /3 width=4/
88 lemma fpr_fwd_abst2: ∀a,L1,L2,V1,T1,U2. ⦃L1, ⓛ{a}V1.T1⦄ ➡ ⦃L2, U2⦄ → ∀b,I,W.
89 ∃∃V2,T2. ⦃L1, ⓑ{b,I}W.T1⦄ ➡ ⦃L2, ⓑ{b,I}W.T2⦄ &
91 #a #L1 #L2 #V1 #T1 #U2 #H
92 elim (fpr_inv_all … H) #L #HL1 #H #HL2 #b #I #W
93 elim (cpr_fwd_abst1 … H b I W) -H /3 width=4/
96 (* Advanced inversion lemmas ************************************************)
98 lemma fpr_inv_pair1: ∀I,K1,L2,V1,T1,T2. ⦃K1.ⓑ{I}V1, T1⦄ ➡ ⦃L2, T2⦄ →
99 ∃∃K2,V2. ⦃K1, V1⦄ ➡ ⦃K2, V2⦄ &
100 ⦃K1, -ⓑ{I}V1.T1⦄ ➡ ⦃K2, -ⓑ{I}V2.T2⦄ &
102 #I1 #K1 #X #V1 #T1 #T2 #H
103 elim (fpr_fwd_pair1 … H) -H #I2 #K2 #V2 #HT12 #H destruct
104 elim (fpr_fwd_shift_bind_minus … HT12) #HV12 #H destruct /2 width=5/
107 lemma fpr_inv_pair3: ∀I,L1,K2,V2,T1,T2. ⦃L1, T1⦄ ➡ ⦃K2.ⓑ{I}V2, T2⦄ →
108 ∃∃K1,V1. ⦃K1, V1⦄ ➡ ⦃K2, V2⦄ &
109 ⦃K1, -ⓑ{I}V1.T1⦄ ➡ ⦃K2, -ⓑ{I}V2.T2⦄ &
111 #I2 #X #K2 #V2 #T1 #T2 #H
112 elim (fpr_fwd_pair3 … H) -H #I1 #K1 #V1 #HT12 #H destruct
113 elim (fpr_fwd_shift_bind_minus … HT12) #HV12 #H destruct /2 width=5/
116 (* More advanced forward lemmas *********************************************)
118 lemma fpr_fwd_pair1_full: ∀I,K1,L2,V1,T1,T2. ⦃K1.ⓑ{I}V1, T1⦄ ➡ ⦃L2, T2⦄ →
119 ∀b. ∃∃K2,V2. ⦃K1, V1⦄ ➡ ⦃K2, V2⦄ &
120 ⦃K1, ⓑ{b,I}V1.T1⦄ ➡ ⦃K2, ⓑ{b,I}V2.T2⦄ &
122 #I #K1 #L2 #V1 #T1 #T2 #H #b
123 elim (fpr_inv_pair1 … H) -H #K2 #V2 #HV12 #HT12 #H destruct
124 elim (fpr_fwd_bind2_minus … HT12 b) -HT12 #W1 #U1 #HTU1 #H destruct /2 width=5/