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