13383

1 
(* Title: HOL/ex/Tarski.thy

7112

2 
ID: $Id$

13383

3 
Author: Florian Kammüller, Cambridge University Computer Laboratory


4 
*)

7112

5 

13585

6 
header {* The Full Theorem of Tarski *}

7112

7 

13585

8 
theory Tarski = Main + FuncSet:

7112

9 

13383

10 
text {*


11 
Minimal version of lattice theory plus the full theorem of Tarski:


12 
The fixedpoints of a complete lattice themselves form a complete


13 
lattice.


14 


15 
Illustrates firstclass theories, using the Sigma representation of


16 
structures. Tidied and converted to Isar by lcp.


17 
*}


18 


19 
record 'a potype =

7112

20 
pset :: "'a set"


21 
order :: "('a * 'a) set"


22 


23 
constdefs


24 
monotone :: "['a => 'a, 'a set, ('a *'a)set] => bool"

13383

25 
"monotone f A r == \<forall>x\<in>A. \<forall>y\<in>A. (x, y): r > ((f x), (f y)) : r"

7112

26 


27 
least :: "['a => bool, 'a potype] => 'a"

13585

28 
"least P po == @ x. x: pset po & P x &


29 
(\<forall>y \<in> pset po. P y > (x,y): order po)"

7112

30 


31 
greatest :: "['a => bool, 'a potype] => 'a"

13585

32 
"greatest P po == @ x. x: pset po & P x &


33 
(\<forall>y \<in> pset po. P y > (y,x): order po)"

7112

34 


35 
lub :: "['a set, 'a potype] => 'a"

13585

36 
"lub S po == least (%x. \<forall>y\<in>S. (y,x): order po) po"

7112

37 


38 
glb :: "['a set, 'a potype] => 'a"

13585

39 
"glb S po == greatest (%x. \<forall>y\<in>S. (x,y): order po) po"

7112

40 

13115

41 
isLub :: "['a set, 'a potype, 'a] => bool"

13585

42 
"isLub S po == %L. (L: pset po & (\<forall>y\<in>S. (y,L): order po) &


43 
(\<forall>z\<in>pset po. (\<forall>y\<in>S. (y,z): order po) > (L,z): order po))"

7112

44 

13115

45 
isGlb :: "['a set, 'a potype, 'a] => bool"

13585

46 
"isGlb S po == %G. (G: pset po & (\<forall>y\<in>S. (G,y): order po) &


47 
(\<forall>z \<in> pset po. (\<forall>y\<in>S. (z,y): order po) > (z,G): order po))"

7112

48 

13115

49 
"fix" :: "[('a => 'a), 'a set] => 'a set"

13383

50 
"fix f A == {x. x: A & f x = x}"

7112

51 


52 
interval :: "[('a*'a) set,'a, 'a ] => 'a set"

13383

53 
"interval r a b == {x. (a,x): r & (x,b): r}"

7112

54 


55 


56 
constdefs


57 
Bot :: "'a potype => 'a"

13383

58 
"Bot po == least (%x. True) po"

7112

59 


60 
Top :: "'a potype => 'a"

13383

61 
"Top po == greatest (%x. True) po"

7112

62 


63 
PartialOrder :: "('a potype) set"

13585

64 
"PartialOrder == {P. refl (pset P) (order P) & antisym (order P) &


65 
trans (order P)}"

7112

66 


67 
CompleteLattice :: "('a potype) set"

13383

68 
"CompleteLattice == {cl. cl: PartialOrder &

13585

69 
(\<forall>S. S <= pset cl > (\<exists>L. isLub S cl L)) &


70 
(\<forall>S. S <= pset cl > (\<exists>G. isGlb S cl G))}"

7112

71 


72 
CLF :: "('a potype * ('a => 'a)) set"

13383

73 
"CLF == SIGMA cl: CompleteLattice.

13585

74 
{f. f: pset cl > pset cl & monotone f (pset cl) (order cl)}"

13383

75 

7112

76 
induced :: "['a set, ('a * 'a) set] => ('a *'a)set"

13383

77 
"induced A r == {(a,b). a : A & b: A & (a,b): r}"

7112

78 


79 


80 
constdefs


81 
sublattice :: "('a potype * 'a set)set"

13383

82 
"sublattice ==

7112

83 
SIGMA cl: CompleteLattice.

13585

84 
{S. S <= pset cl &


85 
( pset = S, order = induced S (order cl) ): CompleteLattice }"

7112

86 


87 
syntax


88 
"@SL" :: "['a set, 'a potype] => bool" ("_ <<= _" [51,50]50)


89 


90 
translations

10834

91 
"S <<= cl" == "S : sublattice `` {cl}"

7112

92 


93 
constdefs


94 
dual :: "'a potype => 'a potype"

13585

95 
"dual po == ( pset = pset po, order = converse (order po) )"

7112

96 

13383

97 
locale (open) PO =

13115

98 
fixes cl :: "'a potype"


99 
and A :: "'a set"


100 
and r :: "('a * 'a) set"


101 
assumes cl_po: "cl : PartialOrder"

13585

102 
defines A_def: "A == pset cl"


103 
and r_def: "r == order cl"

7112

104 

13383

105 
locale (open) CL = PO +

13115

106 
assumes cl_co: "cl : CompleteLattice"

7112

107 

13383

108 
locale (open) CLF = CL +

13115

109 
fixes f :: "'a => 'a"


110 
and P :: "'a set"


111 
assumes f_cl: "(cl,f) : CLF" (*was the equivalent "f : CLF``{cl}"*)


112 
defines P_def: "P == fix f A"

7112

113 


114 

13383

115 
locale (open) Tarski = CLF +

13115

116 
fixes Y :: "'a set"


117 
and intY1 :: "'a set"


118 
and v :: "'a"


119 
assumes


120 
Y_ss: "Y <= P"


121 
defines


122 
intY1_def: "intY1 == interval r (lub Y cl) (Top cl)"

13383

123 
and v_def: "v == glb {x. ((%x: intY1. f x) x, x): induced intY1 r &

13115

124 
x: intY1}

13383

125 
( pset=intY1, order=induced intY1 r)"

13115

126 


127 

13383

128 
subsubsection {* Partial Order *}

13115

129 


130 
lemma (in PO) PO_imp_refl: "refl A r"

13383

131 
apply (insert cl_po)

13115

132 
apply (simp add: PartialOrder_def A_def r_def)


133 
done


134 


135 
lemma (in PO) PO_imp_sym: "antisym r"

13383

136 
apply (insert cl_po)

13115

137 
apply (simp add: PartialOrder_def A_def r_def)


138 
done


139 


140 
lemma (in PO) PO_imp_trans: "trans r"

13383

141 
apply (insert cl_po)

13115

142 
apply (simp add: PartialOrder_def A_def r_def)


143 
done


144 


145 
lemma (in PO) reflE: "[ refl A r; x \<in> A] ==> (x, x) \<in> r"

13383

146 
apply (insert cl_po)

13115

147 
apply (simp add: PartialOrder_def refl_def)


148 
done


149 


150 
lemma (in PO) antisymE: "[ antisym r; (a, b) \<in> r; (b, a) \<in> r ] ==> a = b"

13383

151 
apply (insert cl_po)

13115

152 
apply (simp add: PartialOrder_def antisym_def)


153 
done


154 


155 
lemma (in PO) transE: "[ trans r; (a, b) \<in> r; (b, c) \<in> r] ==> (a,c) \<in> r"

13383

156 
apply (insert cl_po)

13115

157 
apply (simp add: PartialOrder_def)


158 
apply (unfold trans_def, fast)


159 
done


160 


161 
lemma (in PO) monotoneE:


162 
"[ monotone f A r; x \<in> A; y \<in> A; (x, y) \<in> r ] ==> (f x, f y) \<in> r"


163 
by (simp add: monotone_def)


164 


165 
lemma (in PO) po_subset_po:


166 
"S <= A ==> ( pset = S, order = induced S r ) \<in> PartialOrder"


167 
apply (simp (no_asm) add: PartialOrder_def)


168 
apply auto

13383

169 
 {* refl *}

13115

170 
apply (simp add: refl_def induced_def)


171 
apply (blast intro: PO_imp_refl [THEN reflE])

13383

172 
 {* antisym *}

13115

173 
apply (simp add: antisym_def induced_def)


174 
apply (blast intro: PO_imp_sym [THEN antisymE])

13383

175 
 {* trans *}

13115

176 
apply (simp add: trans_def induced_def)


177 
apply (blast intro: PO_imp_trans [THEN transE])


178 
done


179 


180 
lemma (in PO) indE: "[ (x, y) \<in> induced S r; S <= A ] ==> (x, y) \<in> r"


181 
by (simp add: add: induced_def)


182 


183 
lemma (in PO) indI: "[ (x, y) \<in> r; x \<in> S; y \<in> S ] ==> (x, y) \<in> induced S r"


184 
by (simp add: add: induced_def)


185 

13383

186 
lemma (in CL) CL_imp_ex_isLub: "S <= A ==> \<exists>L. isLub S cl L"


187 
apply (insert cl_co)

13115

188 
apply (simp add: CompleteLattice_def A_def)


189 
done


190 


191 
declare (in CL) cl_co [simp]


192 


193 
lemma isLub_lub: "(\<exists>L. isLub S cl L) = isLub S cl (lub S cl)"


194 
by (simp add: lub_def least_def isLub_def some_eq_ex [symmetric])


195 


196 
lemma isGlb_glb: "(\<exists>G. isGlb S cl G) = isGlb S cl (glb S cl)"


197 
by (simp add: glb_def greatest_def isGlb_def some_eq_ex [symmetric])


198 


199 
lemma isGlb_dual_isLub: "isGlb S cl = isLub S (dual cl)"


200 
by (simp add: isLub_def isGlb_def dual_def converse_def)


201 


202 
lemma isLub_dual_isGlb: "isLub S cl = isGlb S (dual cl)"


203 
by (simp add: isLub_def isGlb_def dual_def converse_def)


204 


205 
lemma (in PO) dualPO: "dual cl \<in> PartialOrder"

13383

206 
apply (insert cl_po)


207 
apply (simp add: PartialOrder_def dual_def refl_converse

13115

208 
trans_converse antisym_converse)


209 
done


210 


211 
lemma Rdual:

13383

212 
"\<forall>S. (S <= A >( \<exists>L. isLub S ( pset = A, order = r) L))

13115

213 
==> \<forall>S. (S <= A > (\<exists>G. isGlb S ( pset = A, order = r) G))"


214 
apply safe


215 
apply (rule_tac x = "lub {y. y \<in> A & (\<forall>k \<in> S. (y, k) \<in> r)}


216 
(pset = A, order = r) " in exI)


217 
apply (drule_tac x = "{y. y \<in> A & (\<forall>k \<in> S. (y,k) \<in> r) }" in spec)


218 
apply (drule mp, fast)


219 
apply (simp add: isLub_lub isGlb_def)


220 
apply (simp add: isLub_def, blast)


221 
done


222 


223 
lemma lub_dual_glb: "lub S cl = glb S (dual cl)"


224 
by (simp add: lub_def glb_def least_def greatest_def dual_def converse_def)


225 


226 
lemma glb_dual_lub: "glb S cl = lub S (dual cl)"


227 
by (simp add: lub_def glb_def least_def greatest_def dual_def converse_def)


228 


229 
lemma CL_subset_PO: "CompleteLattice <= PartialOrder"


230 
by (simp add: PartialOrder_def CompleteLattice_def, fast)


231 


232 
lemmas CL_imp_PO = CL_subset_PO [THEN subsetD]


233 


234 
declare CL_imp_PO [THEN Tarski.PO_imp_refl, simp]


235 
declare CL_imp_PO [THEN Tarski.PO_imp_sym, simp]


236 
declare CL_imp_PO [THEN Tarski.PO_imp_trans, simp]


237 


238 
lemma (in CL) CO_refl: "refl A r"


239 
by (rule PO_imp_refl)


240 


241 
lemma (in CL) CO_antisym: "antisym r"


242 
by (rule PO_imp_sym)


243 


244 
lemma (in CL) CO_trans: "trans r"


245 
by (rule PO_imp_trans)


246 


247 
lemma CompleteLatticeI:

13585

248 
"[ po \<in> PartialOrder; (\<forall>S. S <= pset po > (\<exists>L. isLub S po L));


249 
(\<forall>S. S <= pset po > (\<exists>G. isGlb S po G))]

13115

250 
==> po \<in> CompleteLattice"

13383

251 
apply (unfold CompleteLattice_def, blast)

13115

252 
done


253 


254 
lemma (in CL) CL_dualCL: "dual cl \<in> CompleteLattice"

13383

255 
apply (insert cl_co)

13115

256 
apply (simp add: CompleteLattice_def dual_def)

13383

257 
apply (fold dual_def)


258 
apply (simp add: isLub_dual_isGlb [symmetric] isGlb_dual_isLub [symmetric]

13115

259 
dualPO)


260 
done


261 

13585

262 
lemma (in PO) dualA_iff: "pset (dual cl) = pset cl"

13115

263 
by (simp add: dual_def)


264 

13585

265 
lemma (in PO) dualr_iff: "((x, y) \<in> (order(dual cl))) = ((y, x) \<in> order cl)"

13115

266 
by (simp add: dual_def)


267 


268 
lemma (in PO) monotone_dual:

13585

269 
"monotone f (pset cl) (order cl)


270 
==> monotone f (pset (dual cl)) (order(dual cl))"


271 
by (simp add: monotone_def dualA_iff dualr_iff)

13115

272 


273 
lemma (in PO) interval_dual:

13585

274 
"[ x \<in> A; y \<in> A] ==> interval r x y = interval (order(dual cl)) y x"

13115

275 
apply (simp add: interval_def dualr_iff)


276 
apply (fold r_def, fast)


277 
done


278 


279 
lemma (in PO) interval_not_empty:


280 
"[ trans r; interval r a b \<noteq> {} ] ==> (a, b) \<in> r"


281 
apply (simp add: interval_def)


282 
apply (unfold trans_def, blast)


283 
done


284 


285 
lemma (in PO) interval_imp_mem: "x \<in> interval r a b ==> (a, x) \<in> r"


286 
by (simp add: interval_def)


287 


288 
lemma (in PO) left_in_interval:


289 
"[ a \<in> A; b \<in> A; interval r a b \<noteq> {} ] ==> a \<in> interval r a b"


290 
apply (simp (no_asm_simp) add: interval_def)


291 
apply (simp add: PO_imp_trans interval_not_empty)


292 
apply (simp add: PO_imp_refl [THEN reflE])


293 
done


294 


295 
lemma (in PO) right_in_interval:


296 
"[ a \<in> A; b \<in> A; interval r a b \<noteq> {} ] ==> b \<in> interval r a b"


297 
apply (simp (no_asm_simp) add: interval_def)


298 
apply (simp add: PO_imp_trans interval_not_empty)


299 
apply (simp add: PO_imp_refl [THEN reflE])


300 
done


301 

13383

302 


303 
subsubsection {* sublattice *}


304 

13115

305 
lemma (in PO) sublattice_imp_CL:


306 
"S <<= cl ==> ( pset = S, order = induced S r ) \<in> CompleteLattice"


307 
by (simp add: sublattice_def CompleteLattice_def A_def r_def)


308 


309 
lemma (in CL) sublatticeI:

13383

310 
"[ S <= A; ( pset = S, order = induced S r ) \<in> CompleteLattice ]

13115

311 
==> S <<= cl"


312 
by (simp add: sublattice_def A_def r_def)


313 

13383

314 


315 
subsubsection {* lub *}


316 

13115

317 
lemma (in CL) lub_unique: "[ S <= A; isLub S cl x; isLub S cl L] ==> x = L"


318 
apply (rule antisymE)


319 
apply (rule CO_antisym)


320 
apply (auto simp add: isLub_def r_def)


321 
done


322 


323 
lemma (in CL) lub_upper: "[S <= A; x \<in> S] ==> (x, lub S cl) \<in> r"


324 
apply (rule CL_imp_ex_isLub [THEN exE], assumption)


325 
apply (unfold lub_def least_def)


326 
apply (rule some_equality [THEN ssubst])


327 
apply (simp add: isLub_def)

13383

328 
apply (simp add: lub_unique A_def isLub_def)

13115

329 
apply (simp add: isLub_def r_def)


330 
done


331 


332 
lemma (in CL) lub_least:


333 
"[ S <= A; L \<in> A; \<forall>x \<in> S. (x,L) \<in> r ] ==> (lub S cl, L) \<in> r"


334 
apply (rule CL_imp_ex_isLub [THEN exE], assumption)


335 
apply (unfold lub_def least_def)


336 
apply (rule_tac s=x in some_equality [THEN ssubst])


337 
apply (simp add: isLub_def)

13383

338 
apply (simp add: lub_unique A_def isLub_def)

13115

339 
apply (simp add: isLub_def r_def A_def)


340 
done


341 


342 
lemma (in CL) lub_in_lattice: "S <= A ==> lub S cl \<in> A"


343 
apply (rule CL_imp_ex_isLub [THEN exE], assumption)


344 
apply (unfold lub_def least_def)


345 
apply (subst some_equality)


346 
apply (simp add: isLub_def)


347 
prefer 2 apply (simp add: isLub_def A_def)

13383

348 
apply (simp add: lub_unique A_def isLub_def)

13115

349 
done


350 


351 
lemma (in CL) lubI:

13383

352 
"[ S <= A; L \<in> A; \<forall>x \<in> S. (x,L) \<in> r;

13115

353 
\<forall>z \<in> A. (\<forall>y \<in> S. (y,z) \<in> r) > (L,z) \<in> r ] ==> L = lub S cl"


354 
apply (rule lub_unique, assumption)


355 
apply (simp add: isLub_def A_def r_def)


356 
apply (unfold isLub_def)


357 
apply (rule conjI)


358 
apply (fold A_def r_def)


359 
apply (rule lub_in_lattice, assumption)


360 
apply (simp add: lub_upper lub_least)


361 
done


362 


363 
lemma (in CL) lubIa: "[ S <= A; isLub S cl L ] ==> L = lub S cl"


364 
by (simp add: lubI isLub_def A_def r_def)


365 


366 
lemma (in CL) isLub_in_lattice: "isLub S cl L ==> L \<in> A"


367 
by (simp add: isLub_def A_def)


368 


369 
lemma (in CL) isLub_upper: "[isLub S cl L; y \<in> S] ==> (y, L) \<in> r"


370 
by (simp add: isLub_def r_def)


371 


372 
lemma (in CL) isLub_least:


373 
"[ isLub S cl L; z \<in> A; \<forall>y \<in> S. (y, z) \<in> r] ==> (L, z) \<in> r"


374 
by (simp add: isLub_def A_def r_def)


375 


376 
lemma (in CL) isLubI:

13383

377 
"[ L \<in> A; \<forall>y \<in> S. (y, L) \<in> r;

13115

378 
(\<forall>z \<in> A. (\<forall>y \<in> S. (y, z):r) > (L, z) \<in> r)] ==> isLub S cl L"


379 
by (simp add: isLub_def A_def r_def)


380 

13383

381 


382 
subsubsection {* glb *}


383 

13115

384 
lemma (in CL) glb_in_lattice: "S <= A ==> glb S cl \<in> A"


385 
apply (subst glb_dual_lub)


386 
apply (simp add: A_def)


387 
apply (rule dualA_iff [THEN subst])


388 
apply (rule Tarski.lub_in_lattice)

13383

389 
apply (rule dualPO)

13115

390 
apply (rule CL_dualCL)


391 
apply (simp add: dualA_iff)


392 
done


393 


394 
lemma (in CL) glb_lower: "[S <= A; x \<in> S] ==> (glb S cl, x) \<in> r"


395 
apply (subst glb_dual_lub)


396 
apply (simp add: r_def)


397 
apply (rule dualr_iff [THEN subst])


398 
apply (rule Tarski.lub_upper [rule_format])

13383

399 
apply (rule dualPO)

13115

400 
apply (rule CL_dualCL)


401 
apply (simp add: dualA_iff A_def, assumption)


402 
done


403 

13383

404 
text {*


405 
Reduce the sublattice property by using substructural properties;


406 
abandoned see @{text "Tarski_4.ML"}.


407 
*}

13115

408 


409 
lemma (in CLF) [simp]:

13585

410 
"f: pset cl > pset cl & monotone f (pset cl) (order cl)"

13383

411 
apply (insert f_cl)


412 
apply (simp add: CLF_def)

13115

413 
done


414 


415 
declare (in CLF) f_cl [simp]


416 


417 

13585

418 
lemma (in CLF) f_in_funcset: "f \<in> A > A"

13115

419 
by (simp add: A_def)


420 


421 
lemma (in CLF) monotone_f: "monotone f A r"


422 
by (simp add: A_def r_def)


423 


424 
lemma (in CLF) CLF_dual: "(cl,f) \<in> CLF ==> (dual cl, f) \<in> CLF"


425 
apply (simp add: CLF_def CL_dualCL monotone_dual)


426 
apply (simp add: dualA_iff)


427 
done


428 

13383

429 


430 
subsubsection {* fixed points *}


431 

13115

432 
lemma fix_subset: "fix f A <= A"


433 
by (simp add: fix_def, fast)


434 


435 
lemma fix_imp_eq: "x \<in> fix f A ==> f x = x"


436 
by (simp add: fix_def)


437 


438 
lemma fixf_subset:


439 
"[ A <= B; x \<in> fix (%y: A. f y) A ] ==> x \<in> fix f B"

13383

440 
apply (simp add: fix_def, auto)

13115

441 
done


442 

13383

443 


444 
subsubsection {* lemmas for Tarski, lub *}

13115

445 
lemma (in CLF) lubH_le_flubH:


446 
"H = {x. (x, f x) \<in> r & x \<in> A} ==> (lub H cl, f (lub H cl)) \<in> r"


447 
apply (rule lub_least, fast)


448 
apply (rule f_in_funcset [THEN funcset_mem])


449 
apply (rule lub_in_lattice, fast)

13383

450 
 {* @{text "\<forall>x:H. (x, f (lub H r)) \<in> r"} *}

13115

451 
apply (rule ballI)


452 
apply (rule transE)


453 
apply (rule CO_trans)

13585

454 
 {* instantiates @{text "(x, ???z) \<in> order cl to (x, f x)"}, *}

13383

455 
 {* because of the def of @{text H} *}

13115

456 
apply fast

13383

457 
 {* so it remains to show @{text "(f x, f (lub H cl)) \<in> r"} *}

13115

458 
apply (rule_tac f = "f" in monotoneE)


459 
apply (rule monotone_f, fast)


460 
apply (rule lub_in_lattice, fast)


461 
apply (rule lub_upper, fast)


462 
apply assumption


463 
done


464 


465 
lemma (in CLF) flubH_le_lubH:


466 
"[ H = {x. (x, f x) \<in> r & x \<in> A} ] ==> (f (lub H cl), lub H cl) \<in> r"


467 
apply (rule lub_upper, fast)


468 
apply (rule_tac t = "H" in ssubst, assumption)


469 
apply (rule CollectI)


470 
apply (rule conjI)


471 
apply (rule_tac [2] f_in_funcset [THEN funcset_mem])


472 
apply (rule_tac [2] lub_in_lattice)


473 
prefer 2 apply fast


474 
apply (rule_tac f = "f" in monotoneE)


475 
apply (rule monotone_f)

13383

476 
apply (blast intro: lub_in_lattice)


477 
apply (blast intro: lub_in_lattice f_in_funcset [THEN funcset_mem])

13115

478 
apply (simp add: lubH_le_flubH)


479 
done


480 


481 
lemma (in CLF) lubH_is_fixp:


482 
"H = {x. (x, f x) \<in> r & x \<in> A} ==> lub H cl \<in> fix f A"


483 
apply (simp add: fix_def)


484 
apply (rule conjI)


485 
apply (rule lub_in_lattice, fast)


486 
apply (rule antisymE)


487 
apply (rule CO_antisym)


488 
apply (simp add: flubH_le_lubH)


489 
apply (simp add: lubH_le_flubH)


490 
done


491 


492 
lemma (in CLF) fix_in_H:


493 
"[ H = {x. (x, f x) \<in> r & x \<in> A}; x \<in> P ] ==> x \<in> H"

13383

494 
by (simp add: P_def fix_imp_eq [of _ f A] reflE CO_refl


495 
fix_subset [of f A, THEN subsetD])

13115

496 


497 
lemma (in CLF) fixf_le_lubH:


498 
"H = {x. (x, f x) \<in> r & x \<in> A} ==> \<forall>x \<in> fix f A. (x, lub H cl) \<in> r"


499 
apply (rule ballI)


500 
apply (rule lub_upper, fast)


501 
apply (rule fix_in_H)

13383

502 
apply (simp_all add: P_def)

13115

503 
done


504 


505 
lemma (in CLF) lubH_least_fixf:

13383

506 
"H = {x. (x, f x) \<in> r & x \<in> A}

13115

507 
==> \<forall>L. (\<forall>y \<in> fix f A. (y,L) \<in> r) > (lub H cl, L) \<in> r"


508 
apply (rule allI)


509 
apply (rule impI)


510 
apply (erule bspec)


511 
apply (rule lubH_is_fixp, assumption)


512 
done


513 

13383

514 
subsubsection {* Tarski fixpoint theorem 1, first part *}

13115

515 
lemma (in CLF) T_thm_1_lub: "lub P cl = lub {x. (x, f x) \<in> r & x \<in> A} cl"


516 
apply (rule sym)

13383

517 
apply (simp add: P_def)

13115

518 
apply (rule lubI)


519 
apply (rule fix_subset)


520 
apply (rule lub_in_lattice, fast)


521 
apply (simp add: fixf_le_lubH)


522 
apply (simp add: lubH_least_fixf)


523 
done


524 


525 
lemma (in CLF) glbH_is_fixp: "H = {x. (f x, x) \<in> r & x \<in> A} ==> glb H cl \<in> P"

13383

526 
 {* Tarski for glb *}

13115

527 
apply (simp add: glb_dual_lub P_def A_def r_def)


528 
apply (rule dualA_iff [THEN subst])


529 
apply (rule Tarski.lubH_is_fixp)

13383

530 
apply (rule dualPO)

13115

531 
apply (rule CL_dualCL)


532 
apply (rule f_cl [THEN CLF_dual])


533 
apply (simp add: dualr_iff dualA_iff)


534 
done


535 


536 
lemma (in CLF) T_thm_1_glb: "glb P cl = glb {x. (f x, x) \<in> r & x \<in> A} cl"


537 
apply (simp add: glb_dual_lub P_def A_def r_def)


538 
apply (rule dualA_iff [THEN subst])

13383

539 
apply (simp add: Tarski.T_thm_1_lub [of _ f, OF dualPO CL_dualCL]

13115

540 
dualPO CL_dualCL CLF_dual dualr_iff)


541 
done


542 

13383

543 
subsubsection {* interval *}


544 

13115

545 
lemma (in CLF) rel_imp_elem: "(x, y) \<in> r ==> x \<in> A"

13383

546 
apply (insert CO_refl)


547 
apply (simp add: refl_def, blast)

13115

548 
done


549 


550 
lemma (in CLF) interval_subset: "[ a \<in> A; b \<in> A ] ==> interval r a b <= A"


551 
apply (simp add: interval_def)


552 
apply (blast intro: rel_imp_elem)


553 
done


554 


555 
lemma (in CLF) intervalI:


556 
"[ (a, x) \<in> r; (x, b) \<in> r ] ==> x \<in> interval r a b"


557 
apply (simp add: interval_def)


558 
done


559 


560 
lemma (in CLF) interval_lemma1:


561 
"[ S <= interval r a b; x \<in> S ] ==> (a, x) \<in> r"


562 
apply (unfold interval_def, fast)


563 
done


564 


565 
lemma (in CLF) interval_lemma2:


566 
"[ S <= interval r a b; x \<in> S ] ==> (x, b) \<in> r"


567 
apply (unfold interval_def, fast)


568 
done


569 


570 
lemma (in CLF) a_less_lub:

13383

571 
"[ S <= A; S \<noteq> {};

13115

572 
\<forall>x \<in> S. (a,x) \<in> r; \<forall>y \<in> S. (y, L) \<in> r ] ==> (a,L) \<in> r"


573 
by (blast intro: transE PO_imp_trans)


574 


575 
lemma (in CLF) glb_less_b:

13383

576 
"[ S <= A; S \<noteq> {};

13115

577 
\<forall>x \<in> S. (x,b) \<in> r; \<forall>y \<in> S. (G, y) \<in> r ] ==> (G,b) \<in> r"


578 
by (blast intro: transE PO_imp_trans)


579 


580 
lemma (in CLF) S_intv_cl:


581 
"[ a \<in> A; b \<in> A; S <= interval r a b ]==> S <= A"


582 
by (simp add: subset_trans [OF _ interval_subset])


583 


584 
lemma (in CLF) L_in_interval:

13383

585 
"[ a \<in> A; b \<in> A; S <= interval r a b;

13115

586 
S \<noteq> {}; isLub S cl L; interval r a b \<noteq> {} ] ==> L \<in> interval r a b"


587 
apply (rule intervalI)


588 
apply (rule a_less_lub)


589 
prefer 2 apply assumption


590 
apply (simp add: S_intv_cl)


591 
apply (rule ballI)


592 
apply (simp add: interval_lemma1)


593 
apply (simp add: isLub_upper)

13383

594 
 {* @{text "(L, b) \<in> r"} *}

13115

595 
apply (simp add: isLub_least interval_lemma2)


596 
done


597 


598 
lemma (in CLF) G_in_interval:


599 
"[ a \<in> A; b \<in> A; interval r a b \<noteq> {}; S <= interval r a b; isGlb S cl G;


600 
S \<noteq> {} ] ==> G \<in> interval r a b"


601 
apply (simp add: interval_dual)

13383

602 
apply (simp add: Tarski.L_in_interval [of _ f]

13115

603 
dualA_iff A_def dualPO CL_dualCL CLF_dual isGlb_dual_isLub)


604 
done


605 


606 
lemma (in CLF) intervalPO:

13383

607 
"[ a \<in> A; b \<in> A; interval r a b \<noteq> {} ]

13115

608 
==> ( pset = interval r a b, order = induced (interval r a b) r )


609 
\<in> PartialOrder"


610 
apply (rule po_subset_po)


611 
apply (simp add: interval_subset)


612 
done


613 


614 
lemma (in CLF) intv_CL_lub:

13383

615 
"[ a \<in> A; b \<in> A; interval r a b \<noteq> {} ]


616 
==> \<forall>S. S <= interval r a b >


617 
(\<exists>L. isLub S ( pset = interval r a b,

13115

618 
order = induced (interval r a b) r ) L)"


619 
apply (intro strip)


620 
apply (frule S_intv_cl [THEN CL_imp_ex_isLub])


621 
prefer 2 apply assumption


622 
apply assumption


623 
apply (erule exE)

13383

624 
 {* define the lub for the interval as *}

13115

625 
apply (rule_tac x = "if S = {} then a else L" in exI)


626 
apply (simp (no_asm_simp) add: isLub_def split del: split_if)

13383

627 
apply (intro impI conjI)


628 
 {* @{text "(if S = {} then a else L) \<in> interval r a b"} *}

13115

629 
apply (simp add: CL_imp_PO L_in_interval)


630 
apply (simp add: left_in_interval)

13383

631 
 {* lub prop 1 *}

13115

632 
apply (case_tac "S = {}")

13383

633 
 {* @{text "S = {}, y \<in> S = False => everything"} *}

13115

634 
apply fast

13383

635 
 {* @{text "S \<noteq> {}"} *}

13115

636 
apply simp

13383

637 
 {* @{text "\<forall>y:S. (y, L) \<in> induced (interval r a b) r"} *}

13115

638 
apply (rule ballI)


639 
apply (simp add: induced_def L_in_interval)


640 
apply (rule conjI)


641 
apply (rule subsetD)


642 
apply (simp add: S_intv_cl, assumption)


643 
apply (simp add: isLub_upper)

13383

644 
 {* @{text "\<forall>z:interval r a b. (\<forall>y:S. (y, z) \<in> induced (interval r a b) r \<longrightarrow> (if S = {} then a else L, z) \<in> induced (interval r a b) r"} *}

13115

645 
apply (rule ballI)


646 
apply (rule impI)


647 
apply (case_tac "S = {}")

13383

648 
 {* @{text "S = {}"} *}

13115

649 
apply simp


650 
apply (simp add: induced_def interval_def)


651 
apply (rule conjI)


652 
apply (rule reflE)


653 
apply (rule CO_refl, assumption)


654 
apply (rule interval_not_empty)


655 
apply (rule CO_trans)


656 
apply (simp add: interval_def)

13383

657 
 {* @{text "S \<noteq> {}"} *}

13115

658 
apply simp


659 
apply (simp add: induced_def L_in_interval)


660 
apply (rule isLub_least, assumption)


661 
apply (rule subsetD)


662 
prefer 2 apply assumption


663 
apply (simp add: S_intv_cl, fast)


664 
done


665 


666 
lemmas (in CLF) intv_CL_glb = intv_CL_lub [THEN Rdual]


667 


668 
lemma (in CLF) interval_is_sublattice:

13383

669 
"[ a \<in> A; b \<in> A; interval r a b \<noteq> {} ]

13115

670 
==> interval r a b <<= cl"


671 
apply (rule sublatticeI)


672 
apply (simp add: interval_subset)


673 
apply (rule CompleteLatticeI)


674 
apply (simp add: intervalPO)


675 
apply (simp add: intv_CL_lub)


676 
apply (simp add: intv_CL_glb)


677 
done


678 

13383

679 
lemmas (in CLF) interv_is_compl_latt =

13115

680 
interval_is_sublattice [THEN sublattice_imp_CL]


681 

13383

682 


683 
subsubsection {* Top and Bottom *}

13115

684 
lemma (in CLF) Top_dual_Bot: "Top cl = Bot (dual cl)"


685 
by (simp add: Top_def Bot_def least_def greatest_def dualA_iff dualr_iff)


686 


687 
lemma (in CLF) Bot_dual_Top: "Bot cl = Top (dual cl)"


688 
by (simp add: Top_def Bot_def least_def greatest_def dualA_iff dualr_iff)


689 


690 
lemma (in CLF) Bot_in_lattice: "Bot cl \<in> A"


691 
apply (simp add: Bot_def least_def)


692 
apply (rule someI2)


693 
apply (fold A_def)


694 
apply (erule_tac [2] conjunct1)


695 
apply (rule conjI)


696 
apply (rule glb_in_lattice)


697 
apply (rule subset_refl)


698 
apply (fold r_def)


699 
apply (simp add: glb_lower)


700 
done


701 


702 
lemma (in CLF) Top_in_lattice: "Top cl \<in> A"


703 
apply (simp add: Top_dual_Bot A_def)

13383

704 
apply (rule dualA_iff [THEN subst])


705 
apply (blast intro!: Tarski.Bot_in_lattice dualPO CL_dualCL CLF_dual f_cl)

13115

706 
done


707 


708 
lemma (in CLF) Top_prop: "x \<in> A ==> (x, Top cl) \<in> r"


709 
apply (simp add: Top_def greatest_def)


710 
apply (rule someI2)


711 
apply (fold r_def A_def)


712 
prefer 2 apply fast


713 
apply (intro conjI ballI)


714 
apply (rule_tac [2] lub_upper)


715 
apply (auto simp add: lub_in_lattice)


716 
done


717 


718 
lemma (in CLF) Bot_prop: "x \<in> A ==> (Bot cl, x) \<in> r"


719 
apply (simp add: Bot_dual_Top r_def)


720 
apply (rule dualr_iff [THEN subst])

13383

721 
apply (simp add: Tarski.Top_prop [of _ f]

13115

722 
dualA_iff A_def dualPO CL_dualCL CLF_dual)


723 
done


724 


725 
lemma (in CLF) Top_intv_not_empty: "x \<in> A ==> interval r x (Top cl) \<noteq> {}"


726 
apply (rule notI)


727 
apply (drule_tac a = "Top cl" in equals0D)


728 
apply (simp add: interval_def)


729 
apply (simp add: refl_def Top_in_lattice Top_prop)


730 
done


731 


732 
lemma (in CLF) Bot_intv_not_empty: "x \<in> A ==> interval r (Bot cl) x \<noteq> {}"


733 
apply (simp add: Bot_dual_Top)


734 
apply (subst interval_dual)


735 
prefer 2 apply assumption


736 
apply (simp add: A_def)


737 
apply (rule dualA_iff [THEN subst])


738 
apply (blast intro!: Tarski.Top_in_lattice


739 
f_cl dualPO CL_dualCL CLF_dual)

13383

740 
apply (simp add: Tarski.Top_intv_not_empty [of _ f]

13115

741 
dualA_iff A_def dualPO CL_dualCL CLF_dual)


742 
done


743 

13383

744 
subsubsection {* fixed points form a partial order *}


745 

13115

746 
lemma (in CLF) fixf_po: "( pset = P, order = induced P r) \<in> PartialOrder"


747 
by (simp add: P_def fix_subset po_subset_po)


748 


749 
lemma (in Tarski) Y_subset_A: "Y <= A"


750 
apply (rule subset_trans [OF _ fix_subset])


751 
apply (rule Y_ss [simplified P_def])


752 
done


753 


754 
lemma (in Tarski) lubY_in_A: "lub Y cl \<in> A"


755 
by (simp add: Y_subset_A [THEN lub_in_lattice])


756 


757 
lemma (in Tarski) lubY_le_flubY: "(lub Y cl, f (lub Y cl)) \<in> r"


758 
apply (rule lub_least)


759 
apply (rule Y_subset_A)


760 
apply (rule f_in_funcset [THEN funcset_mem])


761 
apply (rule lubY_in_A)

13383

762 
 {* @{text "Y <= P ==> f x = x"} *}

13115

763 
apply (rule ballI)


764 
apply (rule_tac t = "x" in fix_imp_eq [THEN subst])


765 
apply (erule Y_ss [simplified P_def, THEN subsetD])

13383

766 
 {* @{text "reduce (f x, f (lub Y cl)) \<in> r to (x, lub Y cl) \<in> r"} by monotonicity *}

13115

767 
apply (rule_tac f = "f" in monotoneE)


768 
apply (rule monotone_f)


769 
apply (simp add: Y_subset_A [THEN subsetD])


770 
apply (rule lubY_in_A)


771 
apply (simp add: lub_upper Y_subset_A)


772 
done


773 


774 
lemma (in Tarski) intY1_subset: "intY1 <= A"


775 
apply (unfold intY1_def)


776 
apply (rule interval_subset)


777 
apply (rule lubY_in_A)


778 
apply (rule Top_in_lattice)


779 
done


780 


781 
lemmas (in Tarski) intY1_elem = intY1_subset [THEN subsetD]


782 


783 
lemma (in Tarski) intY1_f_closed: "x \<in> intY1 \<Longrightarrow> f x \<in> intY1"


784 
apply (simp add: intY1_def interval_def)


785 
apply (rule conjI)


786 
apply (rule transE)


787 
apply (rule CO_trans)


788 
apply (rule lubY_le_flubY)

13383

789 
 {* @{text "(f (lub Y cl), f x) \<in> r"} *}

13115

790 
apply (rule_tac f=f in monotoneE)


791 
apply (rule monotone_f)


792 
apply (rule lubY_in_A)


793 
apply (simp add: intY1_def interval_def intY1_elem)


794 
apply (simp add: intY1_def interval_def)

13383

795 
 {* @{text "(f x, Top cl) \<in> r"} *}

13115

796 
apply (rule Top_prop)


797 
apply (rule f_in_funcset [THEN funcset_mem])


798 
apply (simp add: intY1_def interval_def intY1_elem)


799 
done


800 

13585

801 
lemma (in Tarski) intY1_func: "(%x: intY1. f x) \<in> intY1 > intY1"

13115

802 
apply (rule restrictI)


803 
apply (erule intY1_f_closed)


804 
done


805 


806 
lemma (in Tarski) intY1_mono:


807 
"monotone (%x: intY1. f x) intY1 (induced intY1 r)"


808 
apply (auto simp add: monotone_def induced_def intY1_f_closed)


809 
apply (blast intro: intY1_elem monotone_f [THEN monotoneE])


810 
done


811 

13383

812 
lemma (in Tarski) intY1_is_cl:

13115

813 
"( pset = intY1, order = induced intY1 r ) \<in> CompleteLattice"


814 
apply (unfold intY1_def)


815 
apply (rule interv_is_compl_latt)


816 
apply (rule lubY_in_A)


817 
apply (rule Top_in_lattice)


818 
apply (rule Top_intv_not_empty)


819 
apply (rule lubY_in_A)


820 
done


821 


822 
lemma (in Tarski) v_in_P: "v \<in> P"


823 
apply (unfold P_def)


824 
apply (rule_tac A = "intY1" in fixf_subset)


825 
apply (rule intY1_subset)


826 
apply (simp add: Tarski.glbH_is_fixp [OF _ intY1_is_cl, simplified]


827 
v_def CL_imp_PO intY1_is_cl CLF_def intY1_func intY1_mono)


828 
done


829 

13383

830 
lemma (in Tarski) z_in_interval:

13115

831 
"[ z \<in> P; \<forall>y\<in>Y. (y, z) \<in> induced P r ] ==> z \<in> intY1"


832 
apply (unfold intY1_def P_def)


833 
apply (rule intervalI)

13383

834 
prefer 2

13115

835 
apply (erule fix_subset [THEN subsetD, THEN Top_prop])


836 
apply (rule lub_least)


837 
apply (rule Y_subset_A)


838 
apply (fast elim!: fix_subset [THEN subsetD])


839 
apply (simp add: induced_def)


840 
done


841 

13383

842 
lemma (in Tarski) f'z_in_int_rel: "[ z \<in> P; \<forall>y\<in>Y. (y, z) \<in> induced P r ]

13115

843 
==> ((%x: intY1. f x) z, z) \<in> induced intY1 r"


844 
apply (simp add: induced_def intY1_f_closed z_in_interval P_def)

13383

845 
apply (simp add: fix_imp_eq [of _ f A] fix_subset [of f A, THEN subsetD]

13115

846 
CO_refl [THEN reflE])


847 
done


848 


849 
lemma (in Tarski) tarski_full_lemma:


850 
"\<exists>L. isLub Y ( pset = P, order = induced P r ) L"


851 
apply (rule_tac x = "v" in exI)


852 
apply (simp add: isLub_def)

13383

853 
 {* @{text "v \<in> P"} *}

13115

854 
apply (simp add: v_in_P)


855 
apply (rule conjI)

13383

856 
 {* @{text v} is lub *}


857 
 {* @{text "1. \<forall>y:Y. (y, v) \<in> induced P r"} *}

13115

858 
apply (rule ballI)


859 
apply (simp add: induced_def subsetD v_in_P)


860 
apply (rule conjI)


861 
apply (erule Y_ss [THEN subsetD])


862 
apply (rule_tac b = "lub Y cl" in transE)


863 
apply (rule CO_trans)


864 
apply (rule lub_upper)


865 
apply (rule Y_subset_A, assumption)


866 
apply (rule_tac b = "Top cl" in interval_imp_mem)


867 
apply (simp add: v_def)


868 
apply (fold intY1_def)


869 
apply (rule Tarski.glb_in_lattice [OF _ intY1_is_cl, simplified])


870 
apply (simp add: CL_imp_PO intY1_is_cl, force)

13383

871 
 {* @{text v} is LEAST ub *}

13115

872 
apply clarify


873 
apply (rule indI)


874 
prefer 3 apply assumption


875 
prefer 2 apply (simp add: v_in_P)


876 
apply (unfold v_def)


877 
apply (rule indE)


878 
apply (rule_tac [2] intY1_subset)


879 
apply (rule Tarski.glb_lower [OF _ intY1_is_cl, simplified])

13383

880 
apply (simp add: CL_imp_PO intY1_is_cl)

13115

881 
apply force


882 
apply (simp add: induced_def intY1_f_closed z_in_interval)

13383

883 
apply (simp add: P_def fix_imp_eq [of _ f A]


884 
fix_subset [of f A, THEN subsetD]

13115

885 
CO_refl [THEN reflE])


886 
done


887 


888 
lemma CompleteLatticeI_simp:

13383

889 
"[ ( pset = A, order = r ) \<in> PartialOrder;


890 
\<forall>S. S <= A > (\<exists>L. isLub S ( pset = A, order = r ) L) ]

13115

891 
==> ( pset = A, order = r ) \<in> CompleteLattice"


892 
by (simp add: CompleteLatticeI Rdual)


893 


894 
theorem (in CLF) Tarski_full:


895 
"( pset = P, order = induced P r) \<in> CompleteLattice"


896 
apply (rule CompleteLatticeI_simp)


897 
apply (rule fixf_po, clarify)

13383

898 
apply (simp add: P_def A_def r_def)


899 
apply (blast intro!: Tarski.tarski_full_lemma cl_po cl_co f_cl)

13115

900 
done

7112

901 


902 
end
