]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/static/lfdeq.ma
- exclusion binder added in local environments
[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_ext.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_ext 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 #L1 #s1 #Hf #X #H1 #L2 #_
41   elim (tdeq_inv_sort1 … H1) -H1 #s2 #d #_ #_ #H destruct
42   /2 width=3 by frees_sort/
43 | #f #i #Hf #X #H1
44   >(tdeq_inv_lref1 … H1) -X #Y #H2
45   >(lexs_inv_atom1 … H2) -Y
46   /2 width=1 by frees_atom/
47 | #f #I #L1 #V1 #_ #IH #X #H1
48   >(tdeq_inv_lref1 … H1) -X #Y #H2
49   elim (lexs_inv_next1 … H2) -H2 #Z #L2 #HL12 #HZ #H destruct
50   elim (ext2_inv_pair_sn … HZ) -HZ #V2 #HV12 #H destruct
51   /3 width=1 by frees_pair/
52 | #f #I #L1 #Hf #X #H1
53   >(tdeq_inv_lref1 … H1) -X #Y #H2
54   elim (lexs_inv_next1 … H2) -H2 #Z #L2 #_ #HZ #H destruct
55   >(ext2_inv_unit_sn … HZ) -Z /2 width=1 by frees_unit/
56 | #f #I #L1 #i #_ #IH #X #H1
57   >(tdeq_inv_lref1 … H1) -X #Y #H2
58   elim (lexs_inv_push1 … H2) -H2 #J #L2 #HL12 #_ #H destruct
59   /3 width=1 by frees_lref/
60 | #f #L1 #l #Hf #X #H1 #L2 #_
61   >(tdeq_inv_gref1 … H1) -X /2 width=1 by frees_gref/
62 | #f1V #f1T #f1 #p #I #L1 #V1 #T1 #_ #_ #Hf1 #IHV #IHT #X #H1
63   elim (tdeq_inv_pair1 … H1) -H1 #V2 #T2 #HV12 #HT12 #H1 #L2 #HL12 destruct
64   /6 width=5 by frees_bind, lexs_inv_tl, ext2_pair, sle_lexs_trans, sor_inv_sle_dx, sor_inv_sle_sn/
65 | #f1V #f1T #f1 #I #L1 #V1 #T1 #_ #_ #Hf1 #IHV #IHT #X #H1
66   elim (tdeq_inv_pair1 … H1) -H1 #V2 #T2 #HV12 #HT12 #H1 #L2 #HL12 destruct
67   /5 width=5 by frees_flat, sle_lexs_trans, sor_inv_sle_dx, sor_inv_sle_sn/
68 ]
69 qed-.
70
71 lemma frees_tdeq_conf: ∀h,o,f,L,T1. L ⊢ 𝐅*⦃T1⦄ ≡ f →
72                        ∀T2. T1 ≡[h, o] T2 → L ⊢ 𝐅*⦃T2⦄ ≡ f.
73 /4 width=7 by frees_tdeq_conf_lexs, lexs_refl, ext2_refl/ qed-.
74
75 lemma frees_lexs_conf: ∀h,o,f,L1,T. L1 ⊢ 𝐅*⦃T⦄ ≡ f →
76                        ∀L2. L1 ≡[h, o, f] L2 → L2 ⊢ 𝐅*⦃T⦄ ≡ f.
77 /2 width=7 by frees_tdeq_conf_lexs, tdeq_refl/ qed-.
78
79 lemma frees_lfdeq_conf_lexs: ∀h,o. lexs_frees_confluent (cdeq_ext h o) cfull.
80 /3 width=7 by frees_tdeq_conf_lexs, ex2_intro/ qed-.
81
82 lemma tdeq_lfdeq_conf_sn: ∀h,o. s_r_confluent1 … (cdeq h o) (lfdeq h o).
83 #h #o #L1 #T1 #T2 #HT12 #L2 *
84 /3 width=5 by frees_tdeq_conf, ex2_intro/
85 qed-.
86
87 (* Basic_2A1: uses: lleq_sym *)
88 lemma lfdeq_sym: ∀h,o,T. symmetric … (lfdeq h o T).
89 #h #o #T #L1 #L2 *
90 /4 width=7 by frees_tdeq_conf_lexs, lfxs_sym, tdeq_sym, ex2_intro/
91 qed-.
92
93 lemma lfdeq_atom: ∀h,o,I. ⋆ ≡[h, o, ⓪{I}] ⋆.
94 /2 width=1 by lfxs_atom/ qed.
95
96 (* Basic_2A1: uses: lleq_sort *)
97 lemma lfdeq_sort: ∀h,o,I,L1,L2,V1,V2,s.
98                   L1 ≡[h, o, ⋆s] L2 → L1.ⓑ{I}V1 ≡[h, o, ⋆s] L2.ⓑ{I}V2.
99 /2 width=1 by lfxs_sort/ qed.
100
101 lemma lfdeq_pair: ∀h,o,I,L1,L2,V.
102                   L1 ≡[h, o, V] L2 → L1.ⓑ{I}V ≡[h, o, #0] L2.ⓑ{I}V.
103 /2 width=1 by lfxs_pair/ qed.
104
105 lemma lfdeq_unit: ∀h,o,f,I,L1,L2. 𝐈⦃f⦄ → L1 ⪤*[cdeq_ext h o, cfull, f] L2 →
106                   L1.ⓤ{I} ≡[h, o, #0] L2.ⓤ{I}.
107 /2 width=3 by lfxs_unit/ qed.
108
109 lemma lfdeq_lref: ∀h,o,I,L1,L2,V1,V2,i.
110                   L1 ≡[h, o, #i] L2 → L1.ⓑ{I}V1 ≡[h, o, #⫯i] L2.ⓑ{I}V2.
111 /2 width=1 by lfxs_lref/ qed.
112
113 (* Basic_2A1: uses: lleq_gref *)
114 lemma lfdeq_gref: ∀h,o,I,L1,L2,V1,V2,l.
115                   L1 ≡[h, o, §l] L2 → L1.ⓑ{I}V1 ≡[h, o, §l] L2.ⓑ{I}V2.
116 /2 width=1 by lfxs_gref/ qed.
117
118 lemma lfdeq_bind_repl_dx: ∀h,o,I,I1,L1,L2.∀T:term.
119                           L1.ⓘ{I} ≡[h, o, T] L2.ⓘ{I1} →
120                           ∀I2. I ≡[h, o] I2 →
121                           L1.ⓘ{I} ≡[h, o, T] L2.ⓘ{I2}.
122 /2 width=2 by lfxs_bind_repl_dx/ qed-.
123
124 (* Basic inversion lemmas ***************************************************)
125
126 lemma lfdeq_inv_atom_sn: ∀h,o,Y2. ∀T:term. ⋆ ≡[h, o, T] Y2 → Y2 = ⋆.
127 /2 width=3 by lfxs_inv_atom_sn/ qed-.
128
129 lemma lfdeq_inv_atom_dx: ∀h,o,Y1. ∀T:term. Y1 ≡[h, o, T] ⋆ → Y1 = ⋆.
130 /2 width=3 by lfxs_inv_atom_dx/ qed-.
131
132 lemma lfdeq_inv_zero: ∀h,o,Y1,Y2. Y1 ≡[h, o, #0] Y2 →
133                       ∨∨ Y1 = ⋆ ∧ Y2 = ⋆
134                        | ∃∃I,L1,L2,V1,V2. L1 ≡[h, o, V1] L2 & V1 ≡[h, o] V2 &
135                                           Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2
136                        | ∃∃f,I,L1,L2. 𝐈⦃f⦄ & L1 ⪤*[cdeq_ext h o, cfull, f] L2 &
137                                            Y1 = L1.ⓤ{I} & Y2 = L2.ⓤ{I}.
138 #h #o #Y1 #Y2 #H elim (lfxs_inv_zero … H) -H *
139 /3 width=9 by or3_intro0, or3_intro1, or3_intro2, ex4_5_intro, ex4_4_intro, conj/
140 qed-.
141
142 lemma lfdeq_inv_lref: ∀h,o,Y1,Y2,i. Y1 ≡[h, o, #⫯i] Y2 →
143                       (Y1 = ⋆ ∧ Y2 = ⋆) ∨
144                       ∃∃I1,I2,L1,L2. L1 ≡[h, o, #i] L2 &
145                                      Y1 = L1.ⓘ{I1} & Y2 = L2.ⓘ{I2}.
146 /2 width=1 by lfxs_inv_lref/ qed-.
147
148 (* Basic_2A1: uses: lleq_inv_bind lleq_inv_bind_O *)
149 lemma lfdeq_inv_bind: ∀h,o,p,I,L1,L2,V,T. L1 ≡[h, o, ⓑ{p,I}V.T] L2 →
150                       L1 ≡[h, o, V] L2 ∧ L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V.
151 /2 width=2 by lfxs_inv_bind/ qed-.
152
153 (* Basic_2A1: uses: lleq_inv_flat *)
154 lemma lfdeq_inv_flat: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ⓕ{I}V.T] L2 →
155                       L1 ≡[h, o, V] L2 ∧ L1 ≡[h, o, T] L2.
156 /2 width=2 by lfxs_inv_flat/ qed-.
157
158 (* Advanced inversion lemmas ************************************************)
159
160 lemma lfdeq_inv_zero_pair_sn: ∀h,o,I,Y2,L1,V1. L1.ⓑ{I}V1 ≡[h, o, #0] Y2 →
161                               ∃∃L2,V2. L1 ≡[h, o, V1] L2 & V1 ≡[h, o] V2 & Y2 = L2.ⓑ{I}V2.
162 /2 width=1 by lfxs_inv_zero_pair_sn/ qed-.
163
164 lemma lfdeq_inv_zero_pair_dx: ∀h,o,I,Y1,L2,V2. Y1 ≡[h, o, #0] L2.ⓑ{I}V2 →
165                               ∃∃L1,V1. L1 ≡[h, o, V1] L2 & V1 ≡[h, o] V2 & Y1 = L1.ⓑ{I}V1.
166 /2 width=1 by lfxs_inv_zero_pair_dx/ qed-.
167
168 lemma lfdeq_inv_lref_bind_sn: ∀h,o,I1,Y2,L1,i. L1.ⓘ{I1} ≡[h, o, #⫯i] Y2 →
169                               ∃∃I2,L2. L1 ≡[h, o, #i] L2 & Y2 = L2.ⓘ{I2}.
170 /2 width=2 by lfxs_inv_lref_bind_sn/ qed-.
171
172 lemma lfdeq_inv_lref_bind_dx: ∀h,o,I2,Y1,L2,i. Y1 ≡[h, o, #⫯i] L2.ⓘ{I2} →
173                               ∃∃I1,L1. L1 ≡[h, o, #i] L2 & Y1 = L1.ⓘ{I1}.
174 /2 width=2 by lfxs_inv_lref_bind_dx/ qed-.
175
176 (* Basic forward lemmas *****************************************************)
177
178 (* Basic_2A1: uses: lleq_fwd_bind_sn lleq_fwd_flat_sn *)
179 lemma lfdeq_fwd_pair_sn: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ②{I}V.T] L2 → L1 ≡[h, o, V] L2.
180 /2 width=3 by lfxs_fwd_pair_sn/ qed-.
181
182 (* Basic_2A1: uses: lleq_fwd_bind_dx lleq_fwd_bind_O_dx *)
183 lemma lfdeq_fwd_bind_dx: ∀h,o,p,I,L1,L2,V,T.
184                          L1 ≡[h, o, ⓑ{p,I}V.T] L2 → L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V.
185 /2 width=2 by lfxs_fwd_bind_dx/ qed-.
186
187 (* Basic_2A1: uses: lleq_fwd_flat_dx *)
188 lemma lfdeq_fwd_flat_dx: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ⓕ{I}V.T] L2 → L1 ≡[h, o, T] L2.
189 /2 width=3 by lfxs_fwd_flat_dx/ qed-.
190
191 lemma lfdeq_fwd_dx: ∀h,o,I2,L1,K2. ∀T:term. L1 ≡[h, o, T] K2.ⓘ{I2} →
192                     ∃∃I1,K1. L1 = K1.ⓘ{I1}.
193 /2 width=5 by lfxs_fwd_dx/ qed-.
194
195 (* Basic_2A1: removed theorems 10:
196               lleq_ind lleq_fwd_lref
197               lleq_fwd_drop_sn lleq_fwd_drop_dx
198               lleq_skip lleq_lref lleq_free
199               lleq_Y lleq_ge_up lleq_ge
200                
201 *)