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/computation/fprs_cprs.ma".
16 include "basic_2/equivalence/cpcs_cpcs.ma".
17 include "basic_2/equivalence/fpcs_fpcs.ma".
19 (* CONTEXT-FREE PARALLEL EQUIVALENCE ON CLOSURES ****************************)
21 (* Advanced properties ******************************************************)
23 lemma fpcs_flat_dx_tpr: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⬌* ⦃L2, T2⦄ → ∀V1,V2. V1 ➡ V2 →
24 ∀I. ⦃L1, ⓕ{I}V1.T1⦄ ⬌* ⦃L2, ⓕ{I}V2.T2⦄.
26 elim (fpcs_inv_fprs … HT12) -HT12
27 /3 width=6 by fprs_flat_dx_tpr, fprs_div/ (**) (* auto too slow without trace *)
30 lemma fpcs_shift: ∀I,L1,L2,V1,V2,T1,T2. ⦃L1, -ⓑ{I}V1.T1⦄ ⬌* ⦃L2, -ⓑ{I}V2.T2⦄ →
31 ⦃L1.ⓑ{I}V1, T1⦄ ⬌* ⦃L2.ⓑ{I}V2, T2⦄.
32 #I #L1 #L2 #V1 #V2 #T1 #T2 #H12
33 elim (fpcs_inv_fprs … H12) -H12 #L #T #H1 #H2
34 elim (fprs_bind2_minus … H1) -H1 #W1 #U1 #HTU1 #H destruct
35 elim (fprs_bind2_minus … H2) -H2 #W2 #U2 #HTU2 #H destruct /2 width=4/
38 (* Advanced inversion lemmas ************************************************)
40 lemma fpcs_inv_shift: ∀I,L1,L2,V1,V2,T1,T2. ⦃L1.ⓑ{I}V1, T1⦄ ⬌* ⦃L2.ⓑ{I}V2, T2⦄ →
41 ⦃L1, -ⓑ{I}V1.T1⦄ ⬌* ⦃L2, -ⓑ{I}V2.T2⦄.
42 #I #L1 #L2 #V1 #V2 #T1 #T2 #H12
43 elim (fpcs_inv_fprs … H12) -H12 #L #T #H1 #H2
44 elim (fprs_inv_pair1 … H1) -H1 #K1 #U1 #_ #HTU1 #H destruct
45 elim (fprs_inv_pair1 … H2) -H2 #K2 #U2 #_ #HTU2 #H destruct /2 width=4/
48 (* Advanced forward lemmas **************************************************)
50 lemma fpcs_fwd_bind_minus: ∀I,L1,L2,V1,V2,T1,T2. ⦃L1, -ⓑ{I}V1.T1⦄ ⬌* ⦃L2, -ⓑ{I}V2.T2⦄ →
51 ∀b. ⦃L1, ⓑ{b,I}V1.T1⦄ ⬌* ⦃L2, ⓑ{b,I}V2.T2⦄.
52 #I #L1 #L2 #V1 #V2 #T1 #T2 #H12 #b
53 elim (fpcs_inv_fprs … H12) -H12 #L #T #H1 #H2
54 elim (fprs_fwd_bind2_minus … H1 b) -H1 #W1 #U1 #HTU1 #H destruct
55 elim (fprs_fwd_bind2_minus … H2 b) -H2 #W2 #U2 #HTU2 #H destruct /2 width=4/
58 lemma fpcs_fwd_shift: ∀I,L1,L2,V1,V2,T1,T2. ⦃L1.ⓑ{I}V1, T1⦄ ⬌* ⦃L2.ⓑ{I}V2, T2⦄ →
59 ∀b. ⦃L1, ⓑ{b,I}V1.T1⦄ ⬌* ⦃L2, ⓑ{b,I}V2.T2⦄.
60 /3 width=1 by fpcs_inv_shift, fpcs_fwd_bind_minus/ qed-.
62 lemma fpcs_fwd_abst24: ∀a,L1,L2,V1,V2,T1,T2. ⦃L1, ⓛ{a}V1.T1⦄ ⬌* ⦃L2, ⓛ{a}V2.T2⦄ →
63 ∀b,I,W. ⦃L1, ⓑ{b,I}W.T1⦄ ⬌* ⦃L2, ⓑ{b,I}W.T2⦄.
64 #a #L1 #L2 #V1 #V2 #T1 #T2 #H12 #b #I #W
65 elim (fpcs_inv_fprs … H12) -H12 #L #U #H1 #H2
66 elim (fprs_fwd_abst2 … H1 b I W) -H1 #W1 #U1 #HTU1 #H destruct
67 elim (fprs_fwd_abst2 … H2 b I W) -H2 #W2 #U2 #HTU2 #H destruct /2 width=4/
70 lemma fpcs_fwd_abst13: ∀L1,L2,V1,V2,T1,T2. ⦃L1.ⓛV1, T1⦄ ⬌* ⦃L2.ⓛV2, T2⦄ →
71 ∀I,W. ⦃L1.ⓑ{I}W, T1⦄ ⬌* ⦃L2.ⓑ{I}W, T2⦄.
72 /4 width=4 by fpcs_fwd_shift, fpcs_fwd_abst24, fpcs_shift/ qed-.
74 (* Properties on context-sensitive parallel equivalence for terms ***********)
76 lemma cpcs_fpcs: ∀L,T1,T2. L ⊢ T1 ⬌* T2 → ⦃L, T1⦄ ⬌* ⦃L, T2⦄.
78 elim (cpcs_inv_cprs … H) -H /3 width=4 by fprs_div, cprs_fprs/ (**) (* too slow without trace *)
81 (* Inversion lemmas on context-sensitive parallel equivalence for terms *****)
83 lemma fpcs_inv_cpcs: ∀L,T1,T2. ⦃L, T1⦄ ⬌* ⦃L, T2⦄ → L ⊢ T1 ⬌* T2.
85 elim (fpcs_inv_fprs … H) -H /3 width=4 by cprs_div, fprs_fwd_cprs/