]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/static/lfdeq.ma
- updated equivalence on referred entries: it nust be degree-based
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / static / lfdeq.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "basic_2/notation/relations/lazyeq_5.ma".
16 include "basic_2/syntax/tdeq.ma".
17 include "basic_2/static/lfxs.ma".
18
19 (* DEGREE-BASED EQUIVALENCE FOR LOCAL ENVIRONMENTS ON REFERRED ENTRIES ******)
20
21 definition lfdeq: ∀h. sd h → relation3 term lenv lenv ≝
22                   λh,o. lfxs (cdeq h o).
23
24 interpretation
25    "degree-based equivalence on referred entries (local environment)"
26    'LazyEq h o T L1 L2 = (lfdeq h o T L1 L2).
27
28 interpretation
29    "degree-based ranged equivalence (local environment)"
30    'LazyEq h o f L1 L2 = (lexs (cdeq h o) cfull f L1 L2).
31 (*
32 definition lfdeq_transitive: predicate (relation3 lenv term term) ≝
33            λR. ∀L2,T1,T2. R L2 T1 T2 → ∀L1. L1 ≡[h, o, T1] L2 → R L1 T1 T2.
34 *)
35 (* Basic properties ***********************************************************)
36
37 lemma frees_tdeq_conf_lexs: ∀h,o,f,L1,T1. L1 ⊢ 𝐅*⦃T1⦄ ≡ f → ∀T2. T1 ≡[h, o] T2 →
38                             ∀L2. L1 ≡[h, o, f] L2 → L2 ⊢ 𝐅*⦃T2⦄ ≡ f.
39 #h #o #f #L1 #T1 #H elim H -f -L1 -T1
40 [ #f #I1 #Hf #X #H1 elim (tdeq_fwd_atom1 … H1) -H1
41   #I2 #H1 #Y #H2 lapply (lexs_inv_atom1 … H2) -H2
42   #H2 destruct /2 width=1 by frees_atom/
43 | #f #I #L1 #V1 #s1 #_ #IH #X #H1 elim (tdeq_inv_sort1 … H1) -H1
44   #s2 #d #Hs1 #Hs2 #H1 #Y #H2 elim (lexs_inv_push1 … H2) -H2
45   #L2 #V2 #HL12 #_ #H2 destruct /4 width=3 by frees_sort, tdeq_sort/
46 | #f #I #L1 #V1 #_ #IH #X #H1 >(tdeq_inv_lref1 … H1) -H1
47   #Y #H2 elim (lexs_inv_next1 … H2) -H2
48   #L2 #V2 #HL12 #HV12 #H2 destruct /3 width=1 by frees_zero/
49 | #f #I #L1 #V1 #i #_ #IH #X #H1 >(tdeq_inv_lref1 … H1) -H1
50   #Y #H2 elim (lexs_inv_push1 … H2) -H2
51   #L2 #V2 #HL12 #_ #H2 destruct /3 width=1 by frees_lref/
52 | #f #I #L1 #V1 #l #_ #IH #X #H1 >(tdeq_inv_gref1 … H1) -H1
53   #Y #H2 elim (lexs_inv_push1 … H2) -H2
54   #L2 #V2 #HL12 #_ #H2 destruct /3 width=1 by frees_gref/
55 | #f1V #f1T #f1 #p #I #L1 #V1 #T1 #_ #_ #Hf1 #IHV #IHT #X #H1 elim (tdeq_inv_pair1 … H1) -H1
56   #V2 #T2 #HV12 #HT12 #H1 #L2 #HL12 destruct
57   /6 width=5 by frees_bind, lexs_inv_tl, sle_lexs_trans, sor_inv_sle_dx, sor_inv_sle_sn/
58 | #f1V #f1T #f1 #I #L1 #V1 #T1 #_ #_ #Hf1 #IHV #IHT #X #H1 elim (tdeq_inv_pair1 … H1) -H1
59   #V2 #T2 #HV12 #HT12 #H1 #L2 #HL12 destruct
60   /5 width=5 by frees_flat, sle_lexs_trans, sor_inv_sle_dx, sor_inv_sle_sn/
61 ]
62 qed-.
63
64 lemma lfdeq_sym: ∀h,o,T. symmetric … (lfdeq h o T).
65 #h #o #T #L1 #L2 *
66 /4 width=7 by frees_tdeq_conf_lexs, lfxs_sym, tdeq_sym, ex2_intro/
67 qed-.
68
69 lemma lfdeq_atom: ∀h,o,I. ⋆ ≡[h, o, ⓪{I}] ⋆.
70 /2 width=1 by lfxs_atom/ qed.
71
72 lemma lfdeq_sort: ∀h,o,I,L1,L2,V1,V2,s.
73                   L1 ≡[h, o, ⋆s] L2 → L1.ⓑ{I}V1 ≡[h, o, ⋆s] L2.ⓑ{I}V2.
74 /2 width=1 by lfxs_sort/ qed.
75
76 lemma lfdeq_zero: ∀h,o,I,L1,L2,V.
77                   L1 ≡[h, o, V] L2 → L1.ⓑ{I}V ≡[h, o, #0] L2.ⓑ{I}V.
78 /2 width=1 by lfxs_zero/ qed.
79
80 lemma lfdeq_lref: ∀h,o,I,L1,L2,V1,V2,i.
81                   L1 ≡[h, o, #i] L2 → L1.ⓑ{I}V1 ≡[h, o, #⫯i] L2.ⓑ{I}V2.
82 /2 width=1 by lfxs_lref/ qed.
83
84 lemma lfdeq_gref: ∀h,o,I,L1,L2,V1,V2,l.
85                   L1 ≡[h, o, §l] L2 → L1.ⓑ{I}V1 ≡[h, o, §l] L2.ⓑ{I}V2.
86 /2 width=1 by lfxs_gref/ qed.
87
88 lemma lfdeq_pair_repl_dx: ∀h,o,I,L1,L2.∀T:term.∀V,V1.
89                           L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V1 →
90                           ∀V2. V ≡[h, o] V2 →
91                           L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V2.
92 /2 width=2 by lfxs_pair_repl_dx/ qed-.
93
94 (* Basic inversion lemmas ***************************************************)
95
96 lemma lfdeq_inv_atom_sn: ∀h,o,I,Y2. ⋆ ≡[h, o, ⓪{I}] Y2 → Y2 = ⋆.
97 /2 width=3 by lfxs_inv_atom_sn/ qed-.
98
99 lemma lfdeq_inv_atom_dx: ∀h,o,I,Y1. Y1 ≡[h, o, ⓪{I}] ⋆ → Y1 = ⋆.
100 /2 width=3 by lfxs_inv_atom_dx/ qed-.
101
102 lemma lfdeq_inv_zero: ∀h,o,Y1,Y2. Y1 ≡[h, o, #0] Y2 →
103                       (Y1 = ⋆ ∧ Y2 = ⋆) ∨
104                       ∃∃I,L1,L2,V1,V2. L1 ≡[h, o, V1] L2 & V1 ≡[h, o] V2 &
105                                        Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
106 #h #o #Y1 #Y2 #H elim (lfxs_inv_zero … H) -H *
107 /3 width=9 by ex4_5_intro, or_introl, or_intror, conj/
108 qed-.
109
110 lemma lfdeq_inv_lref: ∀h,o,Y1,Y2,i. Y1 ≡[h, o, #⫯i] Y2 →
111                       (Y1 = ⋆ ∧ Y2 = ⋆) ∨ 
112                       ∃∃I,L1,L2,V1,V2. L1 ≡[h, o, #i] L2 &
113                                        Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
114 /2 width=1 by lfxs_inv_lref/ qed-.
115
116 lemma lfdeq_inv_bind: ∀h,o,p,I,L1,L2,V,T. L1 ≡[h, o, ⓑ{p,I}V.T] L2 →
117                       L1 ≡[h, o, V] L2 ∧ L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V.
118 /2 width=2 by lfxs_inv_bind/ qed-.
119
120 lemma lfdeq_inv_flat: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ⓕ{I}V.T] L2 →
121                       L1 ≡[h, o, V] L2 ∧ L1 ≡[h, o, T] L2.
122 /2 width=2 by lfxs_inv_flat/ qed-.
123
124 (* Advanced inversion lemmas ************************************************)
125
126 lemma lfdeq_inv_zero_pair_sn: ∀h,o,I,Y2,L1,V1. L1.ⓑ{I}V1 ≡[h, o, #0] Y2 →
127                               ∃∃L2,V2. L1 ≡[h, o, V1] L2 & V1 ≡[h, o] V2 & Y2 = L2.ⓑ{I}V2.
128 #h #o #I #Y2 #L1 #V1 #H elim (lfxs_inv_zero_pair_sn … H) -H /2 width=5 by ex3_2_intro/
129 qed-.
130
131 lemma lfdeq_inv_zero_pair_dx: ∀h,o,I,Y1,L2,V2. Y1 ≡[h, o, #0] L2.ⓑ{I}V2 →
132                               ∃∃L1,V1. L1 ≡[h, o, V1] L2 & V1 ≡[h, o] V2 & Y1 = L1.ⓑ{I}V1.
133 #h #o #I #Y1 #L2 #V2 #H elim (lfxs_inv_zero_pair_dx … H) -H
134 #L1 #V1 #HL12 #HV12 #H destruct /2 width=5 by ex3_2_intro/
135 qed-.
136
137 lemma lfdeq_inv_lref_pair_sn: ∀h,o,I,Y2,L1,V1,i. L1.ⓑ{I}V1 ≡[h, o, #⫯i] Y2 →
138                               ∃∃L2,V2. L1 ≡[h, o, #i] L2 & Y2 = L2.ⓑ{I}V2.
139 /2 width=2 by lfxs_inv_lref_pair_sn/ qed-.
140
141 lemma lfdeq_inv_lref_pair_dx: ∀h,o,I,Y1,L2,V2,i. Y1 ≡[h, o, #⫯i] L2.ⓑ{I}V2 →
142                               ∃∃L1,V1. L1 ≡[h, o, #i] L2 & Y1 = L1.ⓑ{I}V1.
143 /2 width=2 by lfxs_inv_lref_pair_dx/ qed-.
144
145 (* Basic forward lemmas *****************************************************)
146
147 lemma lfdeq_fwd_bind_sn: ∀h,o,p,I,L1,L2,V,T. L1 ≡[h, o, ⓑ{p,I}V.T] L2 → L1 ≡[h, o, V] L2.
148 /2 width=4 by lfxs_fwd_bind_sn/ qed-.
149
150 lemma lfdeq_fwd_bind_dx: ∀h,o,p,I,L1,L2,V,T.
151                          L1 ≡[h, o, ⓑ{p,I}V.T] L2 → L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V.
152 /2 width=2 by lfxs_fwd_bind_dx/ qed-.
153
154 lemma lfdeq_fwd_flat_sn: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ⓕ{I}V.T] L2 → L1 ≡[h, o, V] L2.
155 /2 width=3 by lfxs_fwd_flat_sn/ qed-.
156
157 lemma lfdeq_fwd_flat_dx: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ⓕ{I}V.T] L2 → L1 ≡[h, o, T] L2.
158 /2 width=3 by lfxs_fwd_flat_dx/ qed-.
159
160 lemma lfdeq_fwd_pair_sn: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ②{I}V.T] L2 → L1 ≡[h, o, V] L2.
161 /2 width=3 by lfxs_fwd_pair_sn/ qed-.
162
163 (* Basic_2A1: removed theorems 30: 
164               lleq_ind lleq_inv_bind lleq_inv_flat lleq_fwd_length lleq_fwd_lref
165               lleq_fwd_drop_sn lleq_fwd_drop_dx
166               lleq_fwd_bind_sn lleq_fwd_bind_dx lleq_fwd_flat_sn lleq_fwd_flat_dx
167               lleq_sort lleq_skip lleq_lref lleq_free lleq_gref lleq_bind lleq_flat
168               lleq_refl lleq_Y lleq_sym lleq_ge_up lleq_ge lleq_bind_O llpx_sn_lrefl
169               lleq_trans lleq_canc_sn lleq_canc_dx lleq_nlleq_trans nlleq_lleq_div
170 *)