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/pdeltaconvstar_6.ma".
16 include "basic_2/substitution/cpye_lift.ma".
18 (* CONTEXT-SENSITIVE EXTENDED DELTA-EQUIVALENCE FOR TERMS *******************)
20 definition cpzs: ynat → ynat → relation4 genv lenv term term ≝
22 ∃∃T. ⦃G, L⦄ ⊢ T1 ▶*[d, e] 𝐍⦃T⦄ & ⦃G, L⦄ ⊢ T2 ▶*[d, e] 𝐍⦃T⦄.
24 interpretation "context-sensitive extended delta-equivalence (term)"
25 'PDeltaConvStar G L T1 d e T2 = (cpzs d e G L T1 T2).
27 (* Basic properties **********************************************************)
29 lemma cpye_div: ∀G,L,T1,T,d,e. ⦃G, L⦄ ⊢ T1 ▶*[d, e] 𝐍⦃T⦄ →
30 ∀T2. ⦃G, L⦄ ⊢ T2 ▶*[d, e] 𝐍⦃T⦄ → ⦃G, L⦄ ⊢ T1 ◆*[d, e] T2.
31 /2 width=3 by ex2_intro/ qed.
33 lemma cpzs_refl: ∀G,L,d,e. reflexive … (cpzs d e G L).
34 #G #L #d #e #T elim (cpye_total G L T d e) /2 width=3 by cpye_div/
37 lemma cpzs_bind: ∀G,L,V1,V2,d,e. ⦃G, L⦄ ⊢ V1 ◆*[d, e] V2 →
38 ∀I,T1,T2. ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ◆*[⫯d, e] T2 →
39 ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ◆*[d, e] ⓑ{a,I}V2.T2.
40 #G #L #V1 #V2 #d #e * #V #HV1 #HV2 #I #T1 #T2 *
41 /5 width=10 by cpye_div, cpye_bind, leqy_cpye_trans, cny_bind, lsuby_succ/
44 lemma cpzs_flat: ∀G,L,V1,V2,d,e. ⦃G, L⦄ ⊢ V1 ◆*[d, e] V2 →
45 ∀T1,T2. ⦃G, L⦄ ⊢ T1 ◆*[d, e] T2 →
46 ∀I. ⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ◆*[d, e] ⓕ{I}V2.T2.
47 #G #L #V1 #V2 #d #e * #V #HV1 #HV2 #T1 #T2 *
48 /3 width=5 by cpye_div, cpye_flat, cny_flat/
51 (* Basic inversion lemmas ***************************************************)
53 lemma cpzs_inv_sort: ∀G,L,d,e,k1,k2. ⦃G, L⦄ ⊢ ⋆k1 ◆*[d, e] ⋆k2 → k1 = k2.
54 #G #L #d #e #k1 #k2 * #X #H1 #H2
55 lapply (cpye_inv_sort1 … H1) -H1 #H1
56 lapply (cpye_inv_sort1 … H2) -H2 #H2
60 lemma cpzs_inv_bind: ∀a1,a2,I1,I2,G,L,V1,V2,T1,T2,d,e. ⦃G, L⦄ ⊢ ⓑ{a1,I1}V1.T1 ◆*[d, e] ⓑ{a2,I2}V2.T2 →
62 & ⦃G, L⦄ ⊢ V1 ◆*[d, e] V2 & ⦃G, L.ⓑ{I1}V1⦄ ⊢ T1 ◆*[⫯d, e] T2.
63 #a1 #a2 #I1 #I2 #G #L #V1 #V2 #T1 #T2 #d #e * #X #H1 #H2
64 elim (cpye_inv_bind1 … H1) -H1 #V2 #T2 #HV12 #HT12 #H1
65 elim (cpye_inv_bind1 … H2) -H2 #W2 #U2 #HW12 #HU12 #H2
66 destruct /5 width=8 by cpye_div, leqy_cpye_trans, lsuby_succ, and4_intro/
69 lemma cpzs_inv_flat: ∀I1,I2,G,L,V1,V2,T1,T2,d,e. ⦃G, L⦄ ⊢ ⓕ{I1}V1.T1 ◆*[d, e] ⓕ{I2}V2.T2 →
71 & ⦃G, L⦄ ⊢ V1 ◆*[d, e] V2 & ⦃G, L⦄ ⊢ T1 ◆*[d, e] T2.
72 #I1 #I2 #G #L #V1 #V2 #T1 #T2 #d #e * #X #H1 #H2
73 elim (cpye_inv_flat1 … H1) -H1 #V2 #T2 #HV12 #HT12 #H1
74 elim (cpye_inv_flat1 … H2) -H2 #W2 #U2 #HW12 #HU12 #H2
75 destruct /3 width=3 by cpye_div, and3_intro/
78 lemma cpzs_inv_flat_bind: ∀a2,I1,I2,G,L,V1,V2,T1,T2,d,e. ⦃G, L⦄ ⊢ ⓕ{I1}V1.T1 ◆*[d, e] ⓑ{a2,I2}V2.T2 → ⊥.
79 #a2 #I1 #I2 #G #L #V1 #V2 #T1 #T2 #d #e * #X #H1 #H2
80 elim (cpye_inv_flat1 … H1) -H1 #V2 #T2 #HV12 #HT12 #H1
81 elim (cpye_inv_bind1 … H2) -H2 #W2 #U2 #HW12 #HU12 #H2