]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/static/lfdeq.ma
renaming
[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) (o): relation3 term lenv lenv โ‰
22                           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 lemma lfdeq_sort (h) (o): โˆ€I1,I2,L1,L2,s.
96                           L1 โ‰›[h, o, โ‹†s] L2 โ†’ L1.โ“˜{I1} โ‰›[h, o, โ‹†s] L2.โ“˜{I2}.
97 /2 width=1 by lfxs_sort/ qed.
98
99 lemma lfdeq_pair (h) (o): โˆ€I,L1,L2,V1,V2. L1 โ‰›[h, o, V1] L2 โ†’ V1 โ‰›[h, o] V2 โ†’
100                           L1.โ“‘{I}V1 โ‰›[h, o, #0] L2.โ“‘{I}V2.
101 /2 width=1 by lfxs_pair/ qed.
102 (*
103 lemma lfdeq_unit (h) (o): โˆ€f,I,L1,L2. ๐ˆโฆƒfโฆ„ โ†’ L1 โชค*[cdeq_ext h o, cfull, f] L2 โ†’
104                           L1.โ“ค{I} โ‰›[h, o, #0] L2.โ“ค{I}.
105 /2 width=3 by lfxs_unit/ qed.
106 *)
107 lemma lfdeq_lref (h) (o): โˆ€I1,I2,L1,L2,i.
108                           L1 โ‰›[h, o, #i] L2 โ†’ L1.โ“˜{I1} โ‰›[h, o, #โ†‘i] L2.โ“˜{I2}.
109 /2 width=1 by lfxs_lref/ qed.
110
111 lemma lfdeq_gref (h) (o): โˆ€I1,I2,L1,L2,l.
112                           L1 โ‰›[h, o, ยงl] L2 โ†’ L1.โ“˜{I1} โ‰›[h, o, ยงl] L2.โ“˜{I2}.
113 /2 width=1 by lfxs_gref/ qed.
114
115 lemma lfdeq_bind_repl_dx (h) (o): โˆ€I,I1,L1,L2.โˆ€T:term.
116                                   L1.โ“˜{I} โ‰›[h, o, T] L2.โ“˜{I1} โ†’
117                                   โˆ€I2. I โ‰›[h, o] I2 โ†’
118                                   L1.โ“˜{I} โ‰›[h, o, T] L2.โ“˜{I2}.
119 /2 width=2 by lfxs_bind_repl_dx/ qed-.
120
121 (* Basic inversion lemmas ***************************************************)
122
123 lemma lfdeq_inv_atom_sn (h) (o): โˆ€Y2. โˆ€T:term. โ‹† โ‰›[h, o, T] Y2 โ†’ Y2 = โ‹†.
124 /2 width=3 by lfxs_inv_atom_sn/ qed-.
125
126 lemma lfdeq_inv_atom_dx (h) (o): โˆ€Y1. โˆ€T:term. Y1 โ‰›[h, o, T] โ‹† โ†’ Y1 = โ‹†.
127 /2 width=3 by lfxs_inv_atom_dx/ qed-.
128 (*
129 lemma lfdeq_inv_zero (h) (o): โˆ€Y1,Y2. Y1 โ‰›[h, o, #0] Y2 โ†’
130                               โˆจโˆจ โˆงโˆง Y1 = โ‹† & Y2 = โ‹†
131                                | โˆƒโˆƒI,L1,L2,V1,V2. L1 โ‰›[h, o, V1] L2 & V1 โ‰›[h, o] V2 &
132                                                   Y1 = L1.โ“‘{I}V1 & Y2 = L2.โ“‘{I}V2
133                                | โˆƒโˆƒf,I,L1,L2. ๐ˆโฆƒfโฆ„ & L1 โชค*[cdeq_ext h o, cfull, f] L2 &
134                                               Y1 = L1.โ“ค{I} & Y2 = L2.โ“ค{I}.
135 #h #o #Y1 #Y2 #H elim (lfxs_inv_zero โ€ฆ H) -H *
136 /3 width=9 by or3_intro0, or3_intro1, or3_intro2, ex4_5_intro, ex4_4_intro, conj/
137 qed-.
138 *)
139 lemma lfdeq_inv_lref (h) (o): โˆ€Y1,Y2,i. Y1 โ‰›[h, o, #โ†‘i] Y2 โ†’
140                               โˆจโˆจ โˆงโˆง Y1 = โ‹† & Y2 = โ‹†
141                                | โˆƒโˆƒI1,I2,L1,L2. L1 โ‰›[h, o, #i] L2 &
142                                                 Y1 = L1.โ“˜{I1} & Y2 = L2.โ“˜{I2}.
143 /2 width=1 by lfxs_inv_lref/ qed-.
144
145 (* Basic_2A1: uses: lleq_inv_bind lleq_inv_bind_O *)
146 lemma lfdeq_inv_bind (h) (o): โˆ€p,I,L1,L2,V,T. L1 โ‰›[h, o, โ“‘{p,I}V.T] L2 โ†’
147                               โˆงโˆง L1 โ‰›[h, o, V] L2 & L1.โ“‘{I}V โ‰›[h, o, T] L2.โ“‘{I}V.
148 /2 width=2 by lfxs_inv_bind/ qed-.
149
150 (* Basic_2A1: uses: lleq_inv_flat *)
151 lemma lfdeq_inv_flat (h) (o): โˆ€I,L1,L2,V,T. L1 โ‰›[h, o, โ“•{I}V.T] L2 โ†’
152                               โˆงโˆง L1 โ‰›[h, o, V] L2 & L1 โ‰›[h, o, T] L2.
153 /2 width=2 by lfxs_inv_flat/ qed-.
154
155 (* Advanced inversion lemmas ************************************************)
156
157 lemma lfdeq_inv_zero_pair_sn (h) (o): โˆ€I,Y2,L1,V1. L1.โ“‘{I}V1 โ‰›[h, o, #0] Y2 โ†’
158                                       โˆƒโˆƒL2,V2. L1 โ‰›[h, o, V1] L2 & V1 โ‰›[h, o] V2 & Y2 = L2.โ“‘{I}V2.
159 /2 width=1 by lfxs_inv_zero_pair_sn/ qed-.
160
161 lemma lfdeq_inv_zero_pair_dx (h) (o): โˆ€I,Y1,L2,V2. Y1 โ‰›[h, o, #0] L2.โ“‘{I}V2 โ†’
162                                       โˆƒโˆƒL1,V1. L1 โ‰›[h, o, V1] L2 & V1 โ‰›[h, o] V2 & Y1 = L1.โ“‘{I}V1.
163 /2 width=1 by lfxs_inv_zero_pair_dx/ qed-.
164
165 lemma lfdeq_inv_lref_bind_sn (h) (o): โˆ€I1,Y2,L1,i. L1.โ“˜{I1} โ‰›[h, o, #โ†‘i] Y2 โ†’
166                                       โˆƒโˆƒI2,L2. L1 โ‰›[h, o, #i] L2 & Y2 = L2.โ“˜{I2}.
167 /2 width=2 by lfxs_inv_lref_bind_sn/ qed-.
168
169 lemma lfdeq_inv_lref_bind_dx (h) (o): โˆ€I2,Y1,L2,i. Y1 โ‰›[h, o, #โ†‘i] L2.โ“˜{I2} โ†’
170                                       โˆƒโˆƒI1,L1. L1 โ‰›[h, o, #i] L2 & Y1 = L1.โ“˜{I1}.
171 /2 width=2 by lfxs_inv_lref_bind_dx/ qed-.
172
173 (* Basic forward lemmas *****************************************************)
174
175 lemma lfdeq_fwd_zero_pair (h) (o): โˆ€I,K1,K2,V1,V2.
176                                    K1.โ“‘{I}V1 โ‰›[h, o, #0] K2.โ“‘{I}V2 โ†’ K1 โ‰›[h, o, V1] K2.
177 /2 width=3 by lfxs_fwd_zero_pair/ qed-.
178
179 (* Basic_2A1: uses: lleq_fwd_bind_sn lleq_fwd_flat_sn *)
180 lemma lfdeq_fwd_pair_sn (h) (o): โˆ€I,L1,L2,V,T. L1 โ‰›[h, o, โ‘ก{I}V.T] L2 โ†’ L1 โ‰›[h, o, V] L2.
181 /2 width=3 by lfxs_fwd_pair_sn/ qed-.
182
183 (* Basic_2A1: uses: lleq_fwd_bind_dx lleq_fwd_bind_O_dx *)
184 lemma lfdeq_fwd_bind_dx (h) (o): โˆ€p,I,L1,L2,V,T.
185                                  L1 โ‰›[h, o, โ“‘{p,I}V.T] L2 โ†’ L1.โ“‘{I}V โ‰›[h, o, T] L2.โ“‘{I}V.
186 /2 width=2 by lfxs_fwd_bind_dx/ qed-.
187
188 (* Basic_2A1: uses: lleq_fwd_flat_dx *)
189 lemma lfdeq_fwd_flat_dx (h) (o): โˆ€I,L1,L2,V,T. L1 โ‰›[h, o, โ“•{I}V.T] L2 โ†’ L1 โ‰›[h, o, T] L2.
190 /2 width=3 by lfxs_fwd_flat_dx/ qed-.
191
192 lemma lfdeq_fwd_dx (h) (o): โˆ€I2,L1,K2. โˆ€T:term. L1 โ‰›[h, o, T] K2.โ“˜{I2} โ†’
193                             โˆƒโˆƒI1,K1. L1 = K1.โ“˜{I1}.
194 /2 width=5 by lfxs_fwd_dx/ qed-.