]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/static/frees.ma
update in ground and delayed updating
[helm.git] / matita / matita / contribs / lambdadelta / static_2 / static / frees.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 "ground/relocation/rtmap_sor.ma".
16 include "static_2/notation/relations/freeplus_3.ma".
17 include "static_2/syntax/lenv.ma".
18
19 (* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
20
21 inductive frees: relation3 lenv term pr_map โ‰
22 | frees_sort: โˆ€f,L,s. ๐ˆโจfโฉ โ†’ frees L (โ‹†s) f
23 | frees_atom: โˆ€f,i. ๐ˆโจfโฉ โ†’ frees (โ‹†) (#i) (โซฏ*[i]โ†‘f)
24 | frees_pair: โˆ€f,I,L,V. frees L V f โ†’
25               frees (L.โ“‘[I]V) (#0) (โ†‘f)
26 | frees_unit: โˆ€f,I,L. ๐ˆโจfโฉ โ†’ frees (L.โ“ค[I]) (#0) (โ†‘f)
27 | frees_lref: โˆ€f,I,L,i. frees L (#i) f โ†’
28               frees (L.โ“˜[I]) (#โ†‘i) (โซฏf)
29 | frees_gref: โˆ€f,L,l. ๐ˆโจfโฉ โ†’ frees L (ยงl) f
30 | frees_bind: โˆ€f1,f2,f,p,I,L,V,T. frees L V f1 โ†’ frees (L.โ“‘[I]V) T f2 โ†’
31               f1 โ‹“ โซฐf2 โ‰˜ f โ†’ frees L (โ“‘[p,I]V.T) f
32 | frees_flat: โˆ€f1,f2,f,I,L,V,T. frees L V f1 โ†’ frees L T f2 โ†’
33               f1 โ‹“ f2 โ‰˜ f โ†’ frees L (โ“•[I]V.T) f
34 .
35
36 interpretation
37    "context-sensitive free variables (term)"
38    'FreePlus L T f = (frees L T f).
39
40 (* Basic inversion lemmas ***************************************************)
41
42 fact frees_inv_sort_aux: โˆ€f,L,X. L โŠข ๐…+โจXโฉ โ‰˜ f โ†’ โˆ€x. X = โ‹†x โ†’ ๐ˆโจfโฉ.
43 #L #X #f #H elim H -f -L -X //
44 [ #f #i #_ #x #H destruct
45 | #f #_ #L #V #_ #_ #x #H destruct
46 | #f #_ #L #_ #x #H destruct
47 | #f #_ #L #i #_ #_ #x #H destruct
48 | #f1 #f2 #f #p #I #L #V #T #_ #_ #_ #_ #_ #x #H destruct
49 | #f1 #f2 #f #I #L #V #T #_ #_ #_ #_ #_ #x #H destruct
50 ]
51 qed-.
52
53 lemma frees_inv_sort: โˆ€f,L,s. L โŠข ๐…+โจโ‹†sโฉ โ‰˜ f โ†’ ๐ˆโจfโฉ.
54 /2 width=5 by frees_inv_sort_aux/ qed-.
55
56 fact frees_inv_atom_aux:
57      โˆ€f,L,X. L โŠข ๐…+โจXโฉ โ‰˜ f โ†’ โˆ€i. L = โ‹† โ†’ X = #i โ†’
58      โˆƒโˆƒg. ๐ˆโจgโฉ & f = โซฏ*[i]โ†‘g.
59 #f #L #X #H elim H -f -L -X
60 [ #f #L #s #_ #j #_ #H destruct
61 | #f #i #Hf #j #_ #H destruct /2 width=3 by ex2_intro/
62 | #f #I #L #V #_ #_ #j #H destruct
63 | #f #I #L #_ #j #H destruct
64 | #f #I #L #i #_ #_ #j #H destruct
65 | #f #L #l #_ #j #_ #H destruct
66 | #f1 #f2 #f #p #I #L #V #T #_ #_ #_ #_ #_ #j #_ #H destruct
67 | #f1 #f2 #f #I #L #V #T #_ #_ #_ #_ #_ #j #_ #H destruct
68 ]
69 qed-.
70
71 lemma frees_inv_atom: โˆ€f,i. โ‹† โŠข ๐…+โจ#iโฉ โ‰˜ f โ†’ โˆƒโˆƒg. ๐ˆโจgโฉ & f = โซฏ*[i]โ†‘g.
72 /2 width=5 by frees_inv_atom_aux/ qed-.
73
74 fact frees_inv_pair_aux:
75      โˆ€f,L,X. L โŠข ๐…+โจXโฉ โ‰˜ f โ†’ โˆ€I,K,V. L = K.โ“‘[I]V โ†’ X = #0 โ†’
76      โˆƒโˆƒg. K โŠข ๐…+โจVโฉ โ‰˜ g & f = โ†‘g.
77 #f #L #X * -f -L -X
78 [ #f #L #s #_ #Z #Y #X #_ #H destruct
79 | #f #i #_ #Z #Y #X #H destruct
80 | #f #I #L #V #Hf #Z #Y #X #H #_ destruct /2 width=3 by ex2_intro/
81 | #f #I #L #_ #Z #Y #X #H destruct
82 | #f #I #L #i #_ #Z #Y #X #_ #H destruct
83 | #f #L #l #_ #Z #Y #X #_ #H destruct
84 | #f1 #f2 #f #p #I #L #V #T #_ #_ #_ #Z #Y #X #_ #H destruct
85 | #f1 #f2 #f #I #L #V #T #_ #_ #_ #Z #Y #X #_ #H destruct
86 ]
87 qed-.
88
89 lemma frees_inv_pair: โˆ€f,I,K,V. K.โ“‘[I]V โŠข ๐…+โจ#0โฉ โ‰˜ f โ†’ โˆƒโˆƒg. K โŠข ๐…+โจVโฉ โ‰˜ g & f = โ†‘g.
90 /2 width=6 by frees_inv_pair_aux/ qed-.
91
92 fact frees_inv_unit_aux:
93      โˆ€f,L,X. L โŠข ๐…+โจXโฉ โ‰˜ f โ†’ โˆ€I,K. L = K.โ“ค[I] โ†’ X = #0 โ†’
94      โˆƒโˆƒg. ๐ˆโจgโฉ & f = โ†‘g.
95 #f #L #X * -f -L -X
96 [ #f #L #s #_ #Z #Y #_ #H destruct
97 | #f #i #_ #Z #Y #H destruct
98 | #f #I #L #V #_ #Z #Y #H destruct
99 | #f #I #L #Hf #Z #Y #H destruct /2 width=3 by ex2_intro/
100 | #f #I #L #i #_ #Z #Y #_ #H destruct
101 | #f #L #l #_ #Z #Y #_ #H destruct
102 | #f1 #f2 #f #p #I #L #V #T #_ #_ #_ #Z #Y #_ #H destruct
103 | #f1 #f2 #f #I #L #V #T #_ #_ #_ #Z #Y #_ #H destruct
104 ]
105 qed-.
106
107 lemma frees_inv_unit: โˆ€f,I,K. K.โ“ค[I] โŠข ๐…+โจ#0โฉ โ‰˜ f โ†’ โˆƒโˆƒg. ๐ˆโจgโฉ & f = โ†‘g.
108 /2 width=7 by frees_inv_unit_aux/ qed-.
109
110 fact frees_inv_lref_aux:
111      โˆ€f,L,X. L โŠข ๐…+โจXโฉ โ‰˜ f โ†’ โˆ€I,K,j. L = K.โ“˜[I] โ†’ X = #(โ†‘j) โ†’
112      โˆƒโˆƒg. K โŠข ๐…+โจ#jโฉ โ‰˜ g & f = โซฏg.
113 #f #L #X * -f -L -X
114 [ #f #L #s #_ #Z #Y #j #_ #H destruct
115 | #f #i #_ #Z #Y #j #H destruct
116 | #f #I #L #V #_ #Z #Y #j #_ #H destruct
117 | #f #I #L #_ #Z #Y #j #_ #H destruct
118 | #f #I #L #i #Hf #Z #Y #j #H1 #H2 destruct /2 width=3 by ex2_intro/
119 | #f #L #l #_ #Z #Y #j #_ #H destruct
120 | #f1 #f2 #f #p #I #L #V #T #_ #_ #_ #Z #Y #j #_ #H destruct
121 | #f1 #f2 #f #I #L #V #T #_ #_ #_ #Z #Y #j #_ #H destruct
122 ]
123 qed-.
124
125 lemma frees_inv_lref:
126       โˆ€f,I,K,i. K.โ“˜[I] โŠข ๐…+โจ#(โ†‘i)โฉ โ‰˜ f โ†’
127       โˆƒโˆƒg. K โŠข ๐…+โจ#iโฉ โ‰˜ g & f = โซฏg.
128 /2 width=6 by frees_inv_lref_aux/ qed-.
129
130 fact frees_inv_gref_aux: โˆ€f,L,X. L โŠข ๐…+โจXโฉ โ‰˜ f โ†’ โˆ€x. X = ยงx โ†’ ๐ˆโจfโฉ.
131 #f #L #X #H elim H -f -L -X //
132 [ #f #i #_ #x #H destruct
133 | #f #_ #L #V #_ #_ #x #H destruct
134 | #f #_ #L #_ #x #H destruct
135 | #f #_ #L #i #_ #_ #x #H destruct
136 | #f1 #f2 #f #p #I #L #V #T #_ #_ #_ #_ #_ #x #H destruct
137 | #f1 #f2 #f #I #L #V #T #_ #_ #_ #_ #_ #x #H destruct
138 ]
139 qed-.
140
141 lemma frees_inv_gref: โˆ€f,L,l. L โŠข ๐…+โจยงlโฉ โ‰˜ f โ†’ ๐ˆโจfโฉ.
142 /2 width=5 by frees_inv_gref_aux/ qed-.
143
144 fact frees_inv_bind_aux:
145      โˆ€f,L,X. L โŠข ๐…+โจXโฉ โ‰˜ f โ†’ โˆ€p,I,V,T. X = โ“‘[p,I]V.T โ†’
146      โˆƒโˆƒf1,f2. L โŠข ๐…+โจVโฉ โ‰˜ f1 & L.โ“‘[I]V โŠข ๐…+โจTโฉ โ‰˜ f2 & f1 โ‹“ โซฐf2 โ‰˜ f.
147 #f #L #X * -f -L -X
148 [ #f #L #s #_ #q #J #W #U #H destruct
149 | #f #i #_ #q #J #W #U #H destruct
150 | #f #I #L #V #_ #q #J #W #U #H destruct
151 | #f #I #L #_ #q #J #W #U #H destruct
152 | #f #I #L #i #_ #q #J #W #U #H destruct
153 | #f #L #l #_ #q #J #W #U #H destruct
154 | #f1 #f2 #f #p #I #L #V #T #HV #HT #Hf #q #J #W #U #H destruct /2 width=5 by ex3_2_intro/
155 | #f1 #f2 #f #I #L #V #T #_ #_ #_ #q #J #W #U #H destruct
156 ]
157 qed-.
158
159 lemma frees_inv_bind:
160       โˆ€f,p,I,L,V,T. L โŠข ๐…+โจโ“‘[p,I]V.Tโฉ โ‰˜ f โ†’
161       โˆƒโˆƒf1,f2. L โŠข ๐…+โจVโฉ โ‰˜ f1 & L.โ“‘[I]V โŠข ๐…+โจTโฉ โ‰˜ f2 & f1 โ‹“ โซฐf2 โ‰˜ f.
162 /2 width=4 by frees_inv_bind_aux/ qed-.
163
164 fact frees_inv_flat_aux: โˆ€f,L,X. L โŠข ๐…+โจXโฉ โ‰˜ f โ†’ โˆ€I,V,T. X = โ“•[I]V.T โ†’
165                          โˆƒโˆƒf1,f2. L โŠข ๐…+โจVโฉ โ‰˜ f1 & L โŠข ๐…+โจTโฉ โ‰˜ f2 & f1 โ‹“ f2 โ‰˜ f.
166 #f #L #X * -f -L -X
167 [ #f #L #s #_ #J #W #U #H destruct
168 | #f #i #_ #J #W #U #H destruct
169 | #f #I #L #V #_ #J #W #U #H destruct
170 | #f #I #L #_ #J #W #U #H destruct
171 | #f #I #L #i #_ #J #W #U #H destruct
172 | #f #L #l #_ #J #W #U #H destruct
173 | #f1 #f2 #f #p #I #L #V #T #_ #_ #_ #J #W #U #H destruct
174 | #f1 #f2 #f #I #L #V #T #HV #HT #Hf #J #W #U #H destruct /2 width=5 by ex3_2_intro/
175 ]
176 qed-.
177
178 lemma frees_inv_flat:
179       โˆ€f,I,L,V,T. L โŠข ๐…+โจโ“•[I]V.Tโฉ โ‰˜ f โ†’
180       โˆƒโˆƒf1,f2. L โŠข ๐…+โจVโฉ โ‰˜ f1 & L โŠข ๐…+โจTโฉ โ‰˜ f2 & f1 โ‹“ f2 โ‰˜ f.
181 /2 width=4 by frees_inv_flat_aux/ qed-.
182
183 (* Basic properties ********************************************************)
184
185 lemma frees_eq_repl_back: โˆ€L,T. pr_eq_repl_back โ€ฆ (ฮปf. L โŠข ๐…+โจTโฉ โ‰˜ f).
186 #L #T #f1 #H elim H -f1 -L -T
187 [ /3 width=3 by frees_sort, pr_isi_eq_repl_back/
188 | #f1 #i #Hf1 #g2 #H
189   elim (pr_eq_inv_pushs_sn โ€ฆ H) -H #g #Hg #H destruct
190   elim (eq_inv_nx โ€ฆ Hg) -Hg
191   /3 width=3 by frees_atom, pr_isi_eq_repl_back/
192 | #f1 #I #L #V #_ #IH #g2 #H
193   elim (eq_inv_nx โ€ฆ H) -H
194   /3 width=3 by frees_pair/
195 | #f1 #I #L #Hf1 #g2 #H
196   elim (eq_inv_nx โ€ฆ H) -H
197   /3 width=3 by frees_unit, pr_isi_eq_repl_back/
198 | #f1 #I #L #i #_ #IH #g2 #H
199   elim (eq_inv_px โ€ฆ H) -H /3 width=3 by frees_lref/
200 | /3 width=3 by frees_gref, pr_isi_eq_repl_back/
201 | /3 width=7 by frees_bind, pr_sor_eq_repl_back/
202 | /3 width=7 by frees_flat, pr_sor_eq_repl_back/
203 ]
204 qed-.
205
206 lemma frees_eq_repl_fwd: โˆ€L,T. pr_eq_repl_fwd โ€ฆ (ฮปf. L โŠข ๐…+โจTโฉ โ‰˜ f).
207 #L #T @pr_eq_repl_sym /2 width=3 by frees_eq_repl_back/
208 qed-.
209
210 lemma frees_lref_push: โˆ€f,i. โ‹† โŠข ๐…+โจ#iโฉ โ‰˜ f โ†’ โ‹† โŠข ๐…+โจ#โ†‘iโฉ โ‰˜ โซฏf.
211 #f #i #H
212 elim (frees_inv_atom โ€ฆ H) -H #g #Hg #H destruct
213 /2 width=1 by frees_atom/
214 qed.
215
216 (* Forward lemmas with test for finite colength *****************************)
217
218 lemma frees_fwd_isfin: โˆ€f,L,T. L โŠข ๐…+โจTโฉ โ‰˜ f โ†’ ๐…โจfโฉ.
219 #f #L #T #H elim H -f -L -T
220 /4 width=5 by pr_sor_inv_isf_bi, pr_isf_isi, pr_isf_tl, pr_isf_pushs, pr_isf_push, pr_isf_next/
221 qed-.
222
223 (* Basic_2A1: removed theorems 30:
224               frees_eq frees_be frees_inv
225               frees_inv_sort frees_inv_gref frees_inv_lref frees_inv_lref_free
226               frees_inv_lref_skip frees_inv_lref_ge frees_inv_lref_lt
227               frees_inv_bind frees_inv_flat frees_inv_bind_O
228               frees_lref_eq frees_lref_be frees_weak
229               frees_bind_sn frees_bind_dx frees_flat_sn frees_flat_dx
230               frees_lift_ge frees_inv_lift_be frees_inv_lift_ge
231               lreq_frees_trans frees_lreq_conf
232               llor_atom llor_skip llor_total
233               llor_tail_frees llor_tail_cofrees
234 *)