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/ideqsn_3.ma".
16 include "basic_2/static/lfxs.ma".
18 (* SYNTACTIC EQUIVALENCE FOR LOCAL ENVIRONMENTS ON REFERRED ENTRIES *********)
20 (* Basic_2A1: was: lleq *)
21 definition lfeq: relation3 term lenv lenv ≝
25 "syntactic equivalence on referred entries (local environment)"
26 'IdEqSn T L1 L2 = (lfeq T L1 L2).
28 (* Note: "lfeq_transitive R" is equivalent to "lfxs_transitive ceq R R" *)
29 (* Basic_2A1: uses: lleq_transitive *)
30 definition lfeq_transitive: predicate (relation3 lenv term term) ≝
31 λR. ∀L2,T1,T2. R L2 T1 T2 → ∀L1. L1 ≡[T1] L2 → R L1 T1 T2.
33 (* Basic inversion lemmas ***************************************************)
35 lemma lfeq_inv_bind: ∀p,I,L1,L2,V,T. L1 ≡[ⓑ{p,I}V.T] L2 →
36 ∧∧ L1 ≡[V] L2 & L1.ⓑ{I}V ≡[T] L2.ⓑ{I}V.
37 /2 width=2 by lfxs_inv_bind/ qed-.
39 lemma lfeq_inv_flat: ∀I,L1,L2,V,T. L1 ≡[ⓕ{I}V.T] L2 →
40 ∧∧ L1 ≡[V] L2 & L1 ≡[T] L2.
41 /2 width=2 by lfxs_inv_flat/ qed-.
43 (* Advanced inversion lemmas ************************************************)
45 lemma lfeq_inv_zero_pair_sn: ∀I,L2,K1,V. K1.ⓑ{I}V ≡[#0] L2 →
46 ∃∃K2. K1 ≡[V] K2 & L2 = K2.ⓑ{I}V.
48 elim (lfxs_inv_zero_pair_sn … H) -H #K2 #X #HK12 #HX #H destruct
49 /2 width=3 by ex2_intro/
52 lemma lfeq_inv_zero_pair_dx: ∀I,L1,K2,V. L1 ≡[#0] K2.ⓑ{I}V →
53 ∃∃K1. K1 ≡[V] K2 & L1 = K1.ⓑ{I}V.
55 elim (lfxs_inv_zero_pair_dx … H) -H #K1 #X #HK12 #HX #H destruct
56 /2 width=3 by ex2_intro/
59 lemma lfeq_inv_lref_bind_sn: ∀I1,K1,L2,i. K1.ⓘ{I1} ≡[#↑i] L2 →
60 ∃∃I2,K2. K1 ≡[#i] K2 & L2 = K2.ⓘ{I2}.
61 /2 width=2 by lfxs_inv_lref_bind_sn/ qed-.
63 lemma lfeq_inv_lref_bind_dx: ∀I2,K2,L1,i. L1 ≡[#↑i] K2.ⓘ{I2} →
64 ∃∃I1,K1. K1 ≡[#i] K2 & L1 = K1.ⓘ{I1}.
65 /2 width=2 by lfxs_inv_lref_bind_dx/ qed-.
67 (* Basic forward lemmas *****************************************************)
69 (* Basic_2A1: was: llpx_sn_lrefl *)
70 (* Note: this should have been lleq_fwd_llpx_sn *)
71 lemma lfeq_fwd_lfxs: ∀R. c_reflexive … R →
72 ∀L1,L2,T. L1 ≡[T] L2 → L1 ⪤*[R, T] L2.
73 #R #HR #L1 #L2 #T * #f #Hf #HL12
74 /4 width=7 by lexs_co, cext2_co, ex2_intro/
77 (* Basic_properties *********************************************************)
79 lemma frees_lfeq_conf: ∀f,L1,T. L1 ⊢ 𝐅*⦃T⦄ ≘ f →
80 ∀L2. L1 ≡[T] L2 → L2 ⊢ 𝐅*⦃T⦄ ≘ f.
81 #f #L1 #T #H elim H -f -L1 -T
82 [ /2 width=3 by frees_sort/
84 >(lfxs_inv_atom_sn … H2) -L2
85 /2 width=1 by frees_atom/
86 | #f #I #L1 #V1 #_ #IH #Y #H2
87 elim (lfeq_inv_zero_pair_sn … H2) -H2 #L2 #HL12 #H destruct
88 /3 width=1 by frees_pair/
89 | #f #I #L1 #Hf #Y #H2
90 elim (lfxs_inv_zero_unit_sn … H2) -H2 #g #L2 #_ #_ #H destruct
91 /2 width=1 by frees_unit/
92 | #f #I #L1 #i #_ #IH #Y #H2
93 elim (lfeq_inv_lref_bind_sn … H2) -H2 #J #L2 #HL12 #H destruct
94 /3 width=1 by frees_lref/
95 | /2 width=1 by frees_gref/
96 | #f1V #f1T #f1 #p #I #L1 #V1 #T1 #_ #_ #Hf1 #IHV #IHT #L2 #H2
97 elim (lfeq_inv_bind … H2) -H2 /3 width=5 by frees_bind/
98 | #f1V #f1T #f1 #I #L1 #V1 #T1 #_ #_ #Hf1 #IHV #IHT #L2 #H2
99 elim (lfeq_inv_flat … H2) -H2 /3 width=5 by frees_flat/
103 (* Basic_2A1: removed theorems 10:
104 lleq_ind lleq_fwd_lref
105 lleq_fwd_drop_sn lleq_fwd_drop_dx
106 lleq_skip lleq_lref lleq_free
107 lleq_Y lleq_ge_up lleq_ge