27404
|
1 |
(* Title: HOLCF/Completion.thy
|
|
2 |
ID: $Id$
|
|
3 |
Author: Brian Huffman
|
|
4 |
*)
|
|
5 |
|
|
6 |
header {* Defining bifinite domains by ideal completion *}
|
|
7 |
|
|
8 |
theory Completion
|
|
9 |
imports Bifinite
|
|
10 |
begin
|
|
11 |
|
|
12 |
subsection {* Ideals over a preorder *}
|
|
13 |
|
|
14 |
locale preorder =
|
|
15 |
fixes r :: "'a::type \<Rightarrow> 'a \<Rightarrow> bool" (infix "\<preceq>" 50)
|
|
16 |
assumes r_refl: "x \<preceq> x"
|
|
17 |
assumes r_trans: "\<lbrakk>x \<preceq> y; y \<preceq> z\<rbrakk> \<Longrightarrow> x \<preceq> z"
|
|
18 |
begin
|
|
19 |
|
|
20 |
definition
|
|
21 |
ideal :: "'a set \<Rightarrow> bool" where
|
|
22 |
"ideal A = ((\<exists>x. x \<in> A) \<and> (\<forall>x\<in>A. \<forall>y\<in>A. \<exists>z\<in>A. x \<preceq> z \<and> y \<preceq> z) \<and>
|
|
23 |
(\<forall>x y. x \<preceq> y \<longrightarrow> y \<in> A \<longrightarrow> x \<in> A))"
|
|
24 |
|
|
25 |
lemma idealI:
|
|
26 |
assumes "\<exists>x. x \<in> A"
|
|
27 |
assumes "\<And>x y. \<lbrakk>x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> \<exists>z\<in>A. x \<preceq> z \<and> y \<preceq> z"
|
|
28 |
assumes "\<And>x y. \<lbrakk>x \<preceq> y; y \<in> A\<rbrakk> \<Longrightarrow> x \<in> A"
|
|
29 |
shows "ideal A"
|
|
30 |
unfolding ideal_def using prems by fast
|
|
31 |
|
|
32 |
lemma idealD1:
|
|
33 |
"ideal A \<Longrightarrow> \<exists>x. x \<in> A"
|
|
34 |
unfolding ideal_def by fast
|
|
35 |
|
|
36 |
lemma idealD2:
|
|
37 |
"\<lbrakk>ideal A; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> \<exists>z\<in>A. x \<preceq> z \<and> y \<preceq> z"
|
|
38 |
unfolding ideal_def by fast
|
|
39 |
|
|
40 |
lemma idealD3:
|
|
41 |
"\<lbrakk>ideal A; x \<preceq> y; y \<in> A\<rbrakk> \<Longrightarrow> x \<in> A"
|
|
42 |
unfolding ideal_def by fast
|
|
43 |
|
|
44 |
lemma ideal_directed_finite:
|
|
45 |
assumes A: "ideal A"
|
|
46 |
shows "\<lbrakk>finite U; U \<subseteq> A\<rbrakk> \<Longrightarrow> \<exists>z\<in>A. \<forall>x\<in>U. x \<preceq> z"
|
|
47 |
apply (induct U set: finite)
|
|
48 |
apply (simp add: idealD1 [OF A])
|
|
49 |
apply (simp, clarify, rename_tac y)
|
|
50 |
apply (drule (1) idealD2 [OF A])
|
|
51 |
apply (clarify, erule_tac x=z in rev_bexI)
|
|
52 |
apply (fast intro: r_trans)
|
|
53 |
done
|
|
54 |
|
|
55 |
lemma ideal_principal: "ideal {x. x \<preceq> z}"
|
|
56 |
apply (rule idealI)
|
|
57 |
apply (rule_tac x=z in exI)
|
|
58 |
apply (fast intro: r_refl)
|
|
59 |
apply (rule_tac x=z in bexI, fast)
|
|
60 |
apply (fast intro: r_refl)
|
|
61 |
apply (fast intro: r_trans)
|
|
62 |
done
|
|
63 |
|
|
64 |
lemma ex_ideal: "\<exists>A. ideal A"
|
|
65 |
by (rule exI, rule ideal_principal)
|
|
66 |
|
|
67 |
lemma directed_image_ideal:
|
|
68 |
assumes A: "ideal A"
|
|
69 |
assumes f: "\<And>x y. x \<preceq> y \<Longrightarrow> f x \<sqsubseteq> f y"
|
|
70 |
shows "directed (f ` A)"
|
|
71 |
apply (rule directedI)
|
|
72 |
apply (cut_tac idealD1 [OF A], fast)
|
|
73 |
apply (clarify, rename_tac a b)
|
|
74 |
apply (drule (1) idealD2 [OF A])
|
|
75 |
apply (clarify, rename_tac c)
|
|
76 |
apply (rule_tac x="f c" in rev_bexI)
|
|
77 |
apply (erule imageI)
|
|
78 |
apply (simp add: f)
|
|
79 |
done
|
|
80 |
|
|
81 |
lemma lub_image_principal:
|
|
82 |
assumes f: "\<And>x y. x \<preceq> y \<Longrightarrow> f x \<sqsubseteq> f y"
|
|
83 |
shows "(\<Squnion>x\<in>{x. x \<preceq> y}. f x) = f y"
|
|
84 |
apply (rule thelubI)
|
|
85 |
apply (rule is_lub_maximal)
|
|
86 |
apply (rule ub_imageI)
|
|
87 |
apply (simp add: f)
|
|
88 |
apply (rule imageI)
|
|
89 |
apply (simp add: r_refl)
|
|
90 |
done
|
|
91 |
|
|
92 |
text {* The set of ideals is a cpo *}
|
|
93 |
|
|
94 |
lemma ideal_UN:
|
|
95 |
fixes A :: "nat \<Rightarrow> 'a set"
|
|
96 |
assumes ideal_A: "\<And>i. ideal (A i)"
|
|
97 |
assumes chain_A: "\<And>i j. i \<le> j \<Longrightarrow> A i \<subseteq> A j"
|
|
98 |
shows "ideal (\<Union>i. A i)"
|
|
99 |
apply (rule idealI)
|
|
100 |
apply (cut_tac idealD1 [OF ideal_A], fast)
|
|
101 |
apply (clarify, rename_tac i j)
|
|
102 |
apply (drule subsetD [OF chain_A [OF le_maxI1]])
|
|
103 |
apply (drule subsetD [OF chain_A [OF le_maxI2]])
|
|
104 |
apply (drule (1) idealD2 [OF ideal_A])
|
|
105 |
apply blast
|
|
106 |
apply clarify
|
|
107 |
apply (drule (1) idealD3 [OF ideal_A])
|
|
108 |
apply fast
|
|
109 |
done
|
|
110 |
|
|
111 |
lemma typedef_ideal_po:
|
|
112 |
fixes Abs :: "'a set \<Rightarrow> 'b::sq_ord"
|
|
113 |
assumes type: "type_definition Rep Abs {S. ideal S}"
|
|
114 |
assumes less: "\<And>x y. x \<sqsubseteq> y \<longleftrightarrow> Rep x \<subseteq> Rep y"
|
|
115 |
shows "OFCLASS('b, po_class)"
|
|
116 |
apply (intro_classes, unfold less)
|
|
117 |
apply (rule subset_refl)
|
|
118 |
apply (erule (1) subset_trans)
|
|
119 |
apply (rule type_definition.Rep_inject [OF type, THEN iffD1])
|
|
120 |
apply (erule (1) subset_antisym)
|
|
121 |
done
|
|
122 |
|
|
123 |
lemma
|
|
124 |
fixes Abs :: "'a set \<Rightarrow> 'b::po"
|
|
125 |
assumes type: "type_definition Rep Abs {S. ideal S}"
|
|
126 |
assumes less: "\<And>x y. x \<sqsubseteq> y \<longleftrightarrow> Rep x \<subseteq> Rep y"
|
|
127 |
assumes S: "chain S"
|
|
128 |
shows typedef_ideal_lub: "range S <<| Abs (\<Union>i. Rep (S i))"
|
|
129 |
and typedef_ideal_rep_contlub: "Rep (\<Squnion>i. S i) = (\<Union>i. Rep (S i))"
|
|
130 |
proof -
|
|
131 |
have 1: "ideal (\<Union>i. Rep (S i))"
|
|
132 |
apply (rule ideal_UN)
|
|
133 |
apply (rule type_definition.Rep [OF type, unfolded mem_Collect_eq])
|
|
134 |
apply (subst less [symmetric])
|
|
135 |
apply (erule chain_mono [OF S])
|
|
136 |
done
|
|
137 |
hence 2: "Rep (Abs (\<Union>i. Rep (S i))) = (\<Union>i. Rep (S i))"
|
|
138 |
by (simp add: type_definition.Abs_inverse [OF type])
|
|
139 |
show 3: "range S <<| Abs (\<Union>i. Rep (S i))"
|
|
140 |
apply (rule is_lubI)
|
|
141 |
apply (rule is_ubI)
|
|
142 |
apply (simp add: less 2, fast)
|
|
143 |
apply (simp add: less 2 is_ub_def, fast)
|
|
144 |
done
|
|
145 |
hence 4: "(\<Squnion>i. S i) = Abs (\<Union>i. Rep (S i))"
|
|
146 |
by (rule thelubI)
|
|
147 |
show 5: "Rep (\<Squnion>i. S i) = (\<Union>i. Rep (S i))"
|
|
148 |
by (simp add: 4 2)
|
|
149 |
qed
|
|
150 |
|
|
151 |
lemma typedef_ideal_cpo:
|
|
152 |
fixes Abs :: "'a set \<Rightarrow> 'b::po"
|
|
153 |
assumes type: "type_definition Rep Abs {S. ideal S}"
|
|
154 |
assumes less: "\<And>x y. x \<sqsubseteq> y \<longleftrightarrow> Rep x \<subseteq> Rep y"
|
|
155 |
shows "OFCLASS('b, cpo_class)"
|
|
156 |
by (default, rule exI, erule typedef_ideal_lub [OF type less])
|
|
157 |
|
|
158 |
end
|
|
159 |
|
|
160 |
interpretation sq_le: preorder ["sq_le :: 'a::po \<Rightarrow> 'a \<Rightarrow> bool"]
|
|
161 |
apply unfold_locales
|
|
162 |
apply (rule refl_less)
|
|
163 |
apply (erule (1) trans_less)
|
|
164 |
done
|
|
165 |
|
28133
|
166 |
subsection {* Lemmas about least upper bounds *}
|
27404
|
167 |
|
|
168 |
lemma finite_directed_contains_lub:
|
|
169 |
"\<lbrakk>finite S; directed S\<rbrakk> \<Longrightarrow> \<exists>u\<in>S. S <<| u"
|
|
170 |
apply (drule (1) directed_finiteD, rule subset_refl)
|
|
171 |
apply (erule bexE)
|
|
172 |
apply (rule rev_bexI, assumption)
|
|
173 |
apply (erule (1) is_lub_maximal)
|
|
174 |
done
|
|
175 |
|
|
176 |
lemma lub_finite_directed_in_self:
|
|
177 |
"\<lbrakk>finite S; directed S\<rbrakk> \<Longrightarrow> lub S \<in> S"
|
|
178 |
apply (drule (1) finite_directed_contains_lub, clarify)
|
|
179 |
apply (drule thelubI, simp)
|
|
180 |
done
|
|
181 |
|
|
182 |
lemma finite_directed_has_lub: "\<lbrakk>finite S; directed S\<rbrakk> \<Longrightarrow> \<exists>u. S <<| u"
|
|
183 |
by (drule (1) finite_directed_contains_lub, fast)
|
|
184 |
|
|
185 |
lemma is_ub_thelub0: "\<lbrakk>\<exists>u. S <<| u; x \<in> S\<rbrakk> \<Longrightarrow> x \<sqsubseteq> lub S"
|
|
186 |
apply (erule exE, drule lubI)
|
|
187 |
apply (drule is_lubD1)
|
|
188 |
apply (erule (1) is_ubD)
|
|
189 |
done
|
|
190 |
|
|
191 |
lemma is_lub_thelub0: "\<lbrakk>\<exists>u. S <<| u; S <| x\<rbrakk> \<Longrightarrow> lub S \<sqsubseteq> x"
|
|
192 |
by (erule exE, drule lubI, erule is_lub_lub)
|
|
193 |
|
28133
|
194 |
subsection {* Locale for ideal completion *}
|
|
195 |
|
27404
|
196 |
locale basis_take = preorder +
|
|
197 |
fixes take :: "nat \<Rightarrow> 'a::type \<Rightarrow> 'a"
|
|
198 |
assumes take_less: "take n a \<preceq> a"
|
|
199 |
assumes take_take: "take n (take n a) = take n a"
|
|
200 |
assumes take_mono: "a \<preceq> b \<Longrightarrow> take n a \<preceq> take n b"
|
|
201 |
assumes take_chain: "take n a \<preceq> take (Suc n) a"
|
|
202 |
assumes finite_range_take: "finite (range (take n))"
|
|
203 |
assumes take_covers: "\<exists>n. take n a = a"
|
|
204 |
begin
|
|
205 |
|
|
206 |
lemma take_chain_less: "m < n \<Longrightarrow> take m a \<preceq> take n a"
|
|
207 |
by (erule less_Suc_induct, rule take_chain, erule (1) r_trans)
|
|
208 |
|
|
209 |
lemma take_chain_le: "m \<le> n \<Longrightarrow> take m a \<preceq> take n a"
|
|
210 |
by (cases "m = n", simp add: r_refl, simp add: take_chain_less)
|
|
211 |
|
|
212 |
end
|
|
213 |
|
|
214 |
locale ideal_completion = basis_take +
|
|
215 |
fixes principal :: "'a::type \<Rightarrow> 'b::cpo"
|
|
216 |
fixes rep :: "'b::cpo \<Rightarrow> 'a::type set"
|
|
217 |
assumes ideal_rep: "\<And>x. preorder.ideal r (rep x)"
|
|
218 |
assumes rep_contlub: "\<And>Y. chain Y \<Longrightarrow> rep (\<Squnion>i. Y i) = (\<Union>i. rep (Y i))"
|
|
219 |
assumes rep_principal: "\<And>a. rep (principal a) = {b. b \<preceq> a}"
|
|
220 |
assumes subset_repD: "\<And>x y. rep x \<subseteq> rep y \<Longrightarrow> x \<sqsubseteq> y"
|
|
221 |
begin
|
|
222 |
|
|
223 |
lemma finite_take_rep: "finite (take n ` rep x)"
|
|
224 |
by (rule finite_subset [OF image_mono [OF subset_UNIV] finite_range_take])
|
|
225 |
|
28133
|
226 |
lemma rep_mono: "x \<sqsubseteq> y \<Longrightarrow> rep x \<subseteq> rep y"
|
|
227 |
apply (frule bin_chain)
|
|
228 |
apply (drule rep_contlub)
|
|
229 |
apply (simp only: thelubI [OF lub_bin_chain])
|
|
230 |
apply (rule subsetI, rule UN_I [where a=0], simp_all)
|
|
231 |
done
|
|
232 |
|
|
233 |
lemma less_def: "x \<sqsubseteq> y \<longleftrightarrow> rep x \<subseteq> rep y"
|
|
234 |
by (rule iffI [OF rep_mono subset_repD])
|
|
235 |
|
|
236 |
lemma rep_eq: "rep x = {a. principal a \<sqsubseteq> x}"
|
|
237 |
unfolding less_def rep_principal
|
|
238 |
apply safe
|
|
239 |
apply (erule (1) idealD3 [OF ideal_rep])
|
|
240 |
apply (erule subsetD, simp add: r_refl)
|
|
241 |
done
|
|
242 |
|
|
243 |
lemma mem_rep_iff_principal_less: "a \<in> rep x \<longleftrightarrow> principal a \<sqsubseteq> x"
|
|
244 |
by (simp add: rep_eq)
|
|
245 |
|
|
246 |
lemma principal_less_iff_mem_rep: "principal a \<sqsubseteq> x \<longleftrightarrow> a \<in> rep x"
|
|
247 |
by (simp add: rep_eq)
|
|
248 |
|
|
249 |
lemma principal_less_iff [simp]: "principal a \<sqsubseteq> principal b \<longleftrightarrow> a \<preceq> b"
|
|
250 |
by (simp add: principal_less_iff_mem_rep rep_principal)
|
|
251 |
|
|
252 |
lemma principal_eq_iff: "principal a = principal b \<longleftrightarrow> a \<preceq> b \<and> b \<preceq> a"
|
|
253 |
unfolding po_eq_conv [where 'a='b] principal_less_iff ..
|
|
254 |
|
|
255 |
lemma repD: "a \<in> rep x \<Longrightarrow> principal a \<sqsubseteq> x"
|
|
256 |
by (simp add: rep_eq)
|
|
257 |
|
|
258 |
lemma principal_mono: "a \<preceq> b \<Longrightarrow> principal a \<sqsubseteq> principal b"
|
|
259 |
by (simp only: principal_less_iff)
|
|
260 |
|
|
261 |
lemma lessI: "(\<And>a. principal a \<sqsubseteq> x \<Longrightarrow> principal a \<sqsubseteq> u) \<Longrightarrow> x \<sqsubseteq> u"
|
|
262 |
unfolding principal_less_iff_mem_rep
|
|
263 |
by (simp add: less_def subset_eq)
|
|
264 |
|
|
265 |
lemma lub_principal_rep: "principal ` rep x <<| x"
|
|
266 |
apply (rule is_lubI)
|
|
267 |
apply (rule ub_imageI)
|
|
268 |
apply (erule repD)
|
|
269 |
apply (subst less_def)
|
|
270 |
apply (rule subsetI)
|
|
271 |
apply (drule (1) ub_imageD)
|
|
272 |
apply (simp add: rep_eq)
|
|
273 |
done
|
|
274 |
|
|
275 |
subsection {* Defining functions in terms of basis elements *}
|
|
276 |
|
|
277 |
definition
|
|
278 |
basis_fun :: "('a::type \<Rightarrow> 'c::cpo) \<Rightarrow> 'b \<rightarrow> 'c" where
|
|
279 |
"basis_fun = (\<lambda>f. (\<Lambda> x. lub (f ` rep x)))"
|
|
280 |
|
27404
|
281 |
lemma basis_fun_lemma0:
|
|
282 |
fixes f :: "'a::type \<Rightarrow> 'c::cpo"
|
|
283 |
assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
|
|
284 |
shows "\<exists>u. f ` take i ` rep x <<| u"
|
|
285 |
apply (rule finite_directed_has_lub)
|
|
286 |
apply (rule finite_imageI)
|
|
287 |
apply (rule finite_take_rep)
|
|
288 |
apply (subst image_image)
|
|
289 |
apply (rule directed_image_ideal)
|
|
290 |
apply (rule ideal_rep)
|
|
291 |
apply (rule f_mono)
|
|
292 |
apply (erule take_mono)
|
|
293 |
done
|
|
294 |
|
|
295 |
lemma basis_fun_lemma1:
|
|
296 |
fixes f :: "'a::type \<Rightarrow> 'c::cpo"
|
|
297 |
assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
|
|
298 |
shows "chain (\<lambda>i. lub (f ` take i ` rep x))"
|
|
299 |
apply (rule chainI)
|
|
300 |
apply (rule is_lub_thelub0)
|
|
301 |
apply (rule basis_fun_lemma0, erule f_mono)
|
|
302 |
apply (rule is_ubI, clarsimp, rename_tac a)
|
28053
|
303 |
apply (rule trans_less [OF f_mono [OF take_chain]])
|
27404
|
304 |
apply (rule is_ub_thelub0)
|
|
305 |
apply (rule basis_fun_lemma0, erule f_mono)
|
|
306 |
apply simp
|
|
307 |
done
|
|
308 |
|
|
309 |
lemma basis_fun_lemma2:
|
|
310 |
fixes f :: "'a::type \<Rightarrow> 'c::cpo"
|
|
311 |
assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
|
|
312 |
shows "f ` rep x <<| (\<Squnion>i. lub (f ` take i ` rep x))"
|
|
313 |
apply (rule is_lubI)
|
|
314 |
apply (rule ub_imageI, rename_tac a)
|
|
315 |
apply (cut_tac a=a in take_covers, erule exE, rename_tac i)
|
|
316 |
apply (erule subst)
|
|
317 |
apply (rule rev_trans_less)
|
|
318 |
apply (rule_tac x=i in is_ub_thelub)
|
|
319 |
apply (rule basis_fun_lemma1, erule f_mono)
|
|
320 |
apply (rule is_ub_thelub0)
|
|
321 |
apply (rule basis_fun_lemma0, erule f_mono)
|
|
322 |
apply simp
|
|
323 |
apply (rule is_lub_thelub [OF _ ub_rangeI])
|
|
324 |
apply (rule basis_fun_lemma1, erule f_mono)
|
|
325 |
apply (rule is_lub_thelub0)
|
|
326 |
apply (rule basis_fun_lemma0, erule f_mono)
|
|
327 |
apply (rule is_ubI, clarsimp, rename_tac a)
|
28053
|
328 |
apply (rule trans_less [OF f_mono [OF take_less]])
|
27404
|
329 |
apply (erule (1) ub_imageD)
|
|
330 |
done
|
|
331 |
|
|
332 |
lemma basis_fun_lemma:
|
|
333 |
fixes f :: "'a::type \<Rightarrow> 'c::cpo"
|
|
334 |
assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
|
|
335 |
shows "\<exists>u. f ` rep x <<| u"
|
|
336 |
by (rule exI, rule basis_fun_lemma2, erule f_mono)
|
|
337 |
|
|
338 |
lemma basis_fun_beta:
|
|
339 |
fixes f :: "'a::type \<Rightarrow> 'c::cpo"
|
|
340 |
assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
|
|
341 |
shows "basis_fun f\<cdot>x = lub (f ` rep x)"
|
|
342 |
unfolding basis_fun_def
|
|
343 |
proof (rule beta_cfun)
|
|
344 |
have lub: "\<And>x. \<exists>u. f ` rep x <<| u"
|
|
345 |
using f_mono by (rule basis_fun_lemma)
|
|
346 |
show cont: "cont (\<lambda>x. lub (f ` rep x))"
|
|
347 |
apply (rule contI2)
|
|
348 |
apply (rule monofunI)
|
|
349 |
apply (rule is_lub_thelub0 [OF lub ub_imageI])
|
|
350 |
apply (rule is_ub_thelub0 [OF lub imageI])
|
|
351 |
apply (erule (1) subsetD [OF rep_mono])
|
|
352 |
apply (rule is_lub_thelub0 [OF lub ub_imageI])
|
|
353 |
apply (simp add: rep_contlub, clarify)
|
|
354 |
apply (erule rev_trans_less [OF is_ub_thelub])
|
|
355 |
apply (erule is_ub_thelub0 [OF lub imageI])
|
|
356 |
done
|
|
357 |
qed
|
|
358 |
|
|
359 |
lemma basis_fun_principal:
|
|
360 |
fixes f :: "'a::type \<Rightarrow> 'c::cpo"
|
|
361 |
assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
|
|
362 |
shows "basis_fun f\<cdot>(principal a) = f a"
|
|
363 |
apply (subst basis_fun_beta, erule f_mono)
|
|
364 |
apply (subst rep_principal)
|
|
365 |
apply (rule lub_image_principal, erule f_mono)
|
|
366 |
done
|
|
367 |
|
|
368 |
lemma basis_fun_mono:
|
|
369 |
assumes f_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> f a \<sqsubseteq> f b"
|
|
370 |
assumes g_mono: "\<And>a b. a \<preceq> b \<Longrightarrow> g a \<sqsubseteq> g b"
|
|
371 |
assumes less: "\<And>a. f a \<sqsubseteq> g a"
|
|
372 |
shows "basis_fun f \<sqsubseteq> basis_fun g"
|
|
373 |
apply (rule less_cfun_ext)
|
|
374 |
apply (simp only: basis_fun_beta f_mono g_mono)
|
|
375 |
apply (rule is_lub_thelub0)
|
|
376 |
apply (rule basis_fun_lemma, erule f_mono)
|
|
377 |
apply (rule ub_imageI, rename_tac a)
|
28053
|
378 |
apply (rule trans_less [OF less])
|
27404
|
379 |
apply (rule is_ub_thelub0)
|
|
380 |
apply (rule basis_fun_lemma, erule g_mono)
|
|
381 |
apply (erule imageI)
|
|
382 |
done
|
|
383 |
|
|
384 |
lemma compact_principal [simp]: "compact (principal a)"
|
|
385 |
by (rule compactI2, simp add: principal_less_iff_mem_rep rep_contlub)
|
|
386 |
|
28133
|
387 |
subsection {* Bifiniteness of ideal completions *}
|
|
388 |
|
27404
|
389 |
definition
|
|
390 |
completion_approx :: "nat \<Rightarrow> 'b \<rightarrow> 'b" where
|
|
391 |
"completion_approx = (\<lambda>i. basis_fun (\<lambda>a. principal (take i a)))"
|
|
392 |
|
|
393 |
lemma completion_approx_beta:
|
|
394 |
"completion_approx i\<cdot>x = (\<Squnion>a\<in>rep x. principal (take i a))"
|
|
395 |
unfolding completion_approx_def
|
|
396 |
by (simp add: basis_fun_beta principal_mono take_mono)
|
|
397 |
|
|
398 |
lemma completion_approx_principal:
|
|
399 |
"completion_approx i\<cdot>(principal a) = principal (take i a)"
|
|
400 |
unfolding completion_approx_def
|
|
401 |
by (simp add: basis_fun_principal principal_mono take_mono)
|
|
402 |
|
|
403 |
lemma chain_completion_approx: "chain completion_approx"
|
|
404 |
unfolding completion_approx_def
|
|
405 |
apply (rule chainI)
|
|
406 |
apply (rule basis_fun_mono)
|
|
407 |
apply (erule principal_mono [OF take_mono])
|
|
408 |
apply (erule principal_mono [OF take_mono])
|
|
409 |
apply (rule principal_mono [OF take_chain])
|
|
410 |
done
|
|
411 |
|
|
412 |
lemma lub_completion_approx: "(\<Squnion>i. completion_approx i\<cdot>x) = x"
|
|
413 |
unfolding completion_approx_beta
|
|
414 |
apply (subst image_image [where f=principal, symmetric])
|
|
415 |
apply (rule unique_lub [OF _ lub_principal_rep])
|
|
416 |
apply (rule basis_fun_lemma2, erule principal_mono)
|
|
417 |
done
|
|
418 |
|
|
419 |
lemma completion_approx_eq_principal:
|
|
420 |
"\<exists>a\<in>rep x. completion_approx i\<cdot>x = principal (take i a)"
|
|
421 |
unfolding completion_approx_beta
|
|
422 |
apply (subst image_image [where f=principal, symmetric])
|
|
423 |
apply (subgoal_tac "finite (principal ` take i ` rep x)")
|
|
424 |
apply (subgoal_tac "directed (principal ` take i ` rep x)")
|
|
425 |
apply (drule (1) lub_finite_directed_in_self, fast)
|
|
426 |
apply (subst image_image)
|
|
427 |
apply (rule directed_image_ideal)
|
|
428 |
apply (rule ideal_rep)
|
|
429 |
apply (erule principal_mono [OF take_mono])
|
|
430 |
apply (rule finite_imageI)
|
|
431 |
apply (rule finite_take_rep)
|
|
432 |
done
|
|
433 |
|
|
434 |
lemma completion_approx_idem:
|
|
435 |
"completion_approx i\<cdot>(completion_approx i\<cdot>x) = completion_approx i\<cdot>x"
|
|
436 |
using completion_approx_eq_principal [where i=i and x=x]
|
|
437 |
by (auto simp add: completion_approx_principal take_take)
|
|
438 |
|
|
439 |
lemma finite_fixes_completion_approx:
|
|
440 |
"finite {x. completion_approx i\<cdot>x = x}" (is "finite ?S")
|
|
441 |
apply (subgoal_tac "?S \<subseteq> principal ` range (take i)")
|
|
442 |
apply (erule finite_subset)
|
|
443 |
apply (rule finite_imageI)
|
|
444 |
apply (rule finite_range_take)
|
|
445 |
apply (clarify, erule subst)
|
|
446 |
apply (cut_tac x=x and i=i in completion_approx_eq_principal)
|
|
447 |
apply fast
|
|
448 |
done
|
|
449 |
|
|
450 |
lemma principal_induct:
|
|
451 |
assumes adm: "adm P"
|
|
452 |
assumes P: "\<And>a. P (principal a)"
|
|
453 |
shows "P x"
|
|
454 |
apply (subgoal_tac "P (\<Squnion>i. completion_approx i\<cdot>x)")
|
|
455 |
apply (simp add: lub_completion_approx)
|
|
456 |
apply (rule admD [OF adm])
|
|
457 |
apply (simp add: chain_completion_approx)
|
|
458 |
apply (cut_tac x=x and i=i in completion_approx_eq_principal)
|
|
459 |
apply (clarify, simp add: P)
|
|
460 |
done
|
|
461 |
|
|
462 |
lemma principal_induct2:
|
|
463 |
"\<lbrakk>\<And>y. adm (\<lambda>x. P x y); \<And>x. adm (\<lambda>y. P x y);
|
|
464 |
\<And>a b. P (principal a) (principal b)\<rbrakk> \<Longrightarrow> P x y"
|
|
465 |
apply (rule_tac x=y in spec)
|
|
466 |
apply (rule_tac x=x in principal_induct, simp)
|
|
467 |
apply (rule allI, rename_tac y)
|
|
468 |
apply (rule_tac x=y in principal_induct, simp)
|
|
469 |
apply simp
|
|
470 |
done
|
|
471 |
|
|
472 |
lemma compact_imp_principal: "compact x \<Longrightarrow> \<exists>a. x = principal a"
|
|
473 |
apply (drule adm_compact_neq [OF _ cont_id])
|
|
474 |
apply (drule admD2 [where Y="\<lambda>n. completion_approx n\<cdot>x"])
|
|
475 |
apply (simp add: chain_completion_approx)
|
|
476 |
apply (simp add: lub_completion_approx)
|
|
477 |
apply (erule exE, erule ssubst)
|
|
478 |
apply (cut_tac i=i and x=x in completion_approx_eq_principal)
|
|
479 |
apply (clarify, erule exI)
|
|
480 |
done
|
|
481 |
|
|
482 |
end
|
|
483 |
|
|
484 |
end
|