author | ballarin |
Wed, 18 Oct 2006 10:07:36 +0200 | |
changeset 21049 | 379542c9d951 |
parent 21041 | 60e418260b4d |
child 21404 | eb85850d3eb7 |
permissions | -rw-r--r-- |
14551 | 1 |
(* |
14706 | 2 |
Title: HOL/Algebra/Lattice.thy |
14551 | 3 |
Id: $Id$ |
4 |
Author: Clemens Ballarin, started 7 November 2003 |
|
5 |
Copyright: Clemens Ballarin |
|
6 |
*) |
|
7 |
||
20318
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
19984
diff
changeset
|
8 |
theory Lattice imports Main begin |
14551 | 9 |
|
20318
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
19984
diff
changeset
|
10 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
19984
diff
changeset
|
11 |
section {* Orders and Lattices *} |
14751
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents:
14706
diff
changeset
|
12 |
|
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents:
14706
diff
changeset
|
13 |
text {* Object with a carrier set. *} |
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents:
14706
diff
changeset
|
14 |
|
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents:
14706
diff
changeset
|
15 |
record 'a partial_object = |
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents:
14706
diff
changeset
|
16 |
carrier :: "'a set" |
14551 | 17 |
|
20318
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
19984
diff
changeset
|
18 |
|
14551 | 19 |
subsection {* Partial Orders *} |
20 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
21 |
text {* Locale @{text order_syntax} is required since we want to refer |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
22 |
to definitions (and their derived theorems) outside of @{text partial_order}. |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
23 |
*} |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
24 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
25 |
locale order_syntax = |
21049 | 26 |
fixes L :: "'a set" and le :: "['a, 'a] => bool" (infix "\<sqsubseteq>" 50) |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
27 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
28 |
text {* Note that the type constraints above are necessary, because the |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
29 |
definition command cannot specialise the types. *} |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
30 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
31 |
definition (in order_syntax) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
32 |
less (infixl "\<sqsubset>" 50) "x \<sqsubset> y == x \<sqsubseteq> y & x ~= y" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
33 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
34 |
text {* Upper and lower bounds of a set. *} |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
35 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
36 |
definition (in order_syntax) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
37 |
Upper where |
21049 | 38 |
"Upper A == {u. (ALL x. x \<in> A \<inter> L --> x \<sqsubseteq> u)} \<inter> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
39 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
40 |
definition (in order_syntax) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
41 |
Lower :: "'a set => 'a set" |
21049 | 42 |
"Lower A == {l. (ALL x. x \<in> A \<inter> L --> l \<sqsubseteq> x)} \<inter> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
43 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
44 |
text {* Least and greatest, as predicate. *} |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
45 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
46 |
definition (in order_syntax) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
47 |
least :: "['a, 'a set] => bool" |
21049 | 48 |
"least l A == A \<subseteq> L & l \<in> A & (ALL x : A. l \<sqsubseteq> x)" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
49 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
50 |
definition (in order_syntax) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
51 |
greatest :: "['a, 'a set] => bool" |
21049 | 52 |
"greatest g A == A \<subseteq> L & g \<in> A & (ALL x : A. x \<sqsubseteq> g)" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
53 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
54 |
text {* Supremum and infimum *} |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
55 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
56 |
definition (in order_syntax) |
21049 | 57 |
sup :: "'a set => 'a" ("\<Squnion>_" [90] 90) |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
58 |
"\<Squnion>A == THE x. least x (Upper A)" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
59 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
60 |
definition (in order_syntax) |
21049 | 61 |
inf :: "'a set => 'a" ("\<Sqinter>_" [90] 90) |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
62 |
"\<Sqinter>A == THE x. greatest x (Lower A)" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
63 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
64 |
definition (in order_syntax) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
65 |
join :: "['a, 'a] => 'a" (infixl "\<squnion>" 65) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
66 |
"x \<squnion> y == sup {x, y}" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
67 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
68 |
definition (in order_syntax) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
69 |
meet :: "['a, 'a] => 'a" (infixl "\<sqinter>" 70) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
70 |
"x \<sqinter> y == inf {x, y}" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
71 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
72 |
locale partial_order = order_syntax + |
14551 | 73 |
assumes refl [intro, simp]: |
21049 | 74 |
"x \<in> L ==> x \<sqsubseteq> x" |
14551 | 75 |
and anti_sym [intro]: |
21049 | 76 |
"[| x \<sqsubseteq> y; y \<sqsubseteq> x; x \<in> L; y \<in> L |] ==> x = y" |
14551 | 77 |
and trans [trans]: |
78 |
"[| x \<sqsubseteq> y; y \<sqsubseteq> z; |
|
21049 | 79 |
x \<in> L; y \<in> L; z \<in> L |] ==> x \<sqsubseteq> z" |
14551 | 80 |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
81 |
abbreviation (in partial_order) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
82 |
less (infixl "\<sqsubset>" 50) "less == order_syntax.less le" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
83 |
abbreviation (in partial_order) |
21049 | 84 |
Upper where "Upper == order_syntax.Upper L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
85 |
abbreviation (in partial_order) |
21049 | 86 |
Lower where "Lower == order_syntax.Lower L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
87 |
abbreviation (in partial_order) |
21049 | 88 |
least where "least == order_syntax.least L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
89 |
abbreviation (in partial_order) |
21049 | 90 |
greatest where "greatest == order_syntax.greatest L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
91 |
abbreviation (in partial_order) |
21049 | 92 |
sup ("\<Squnion>_" [90] 90) "sup == order_syntax.sup L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
93 |
abbreviation (in partial_order) |
21049 | 94 |
inf ("\<Sqinter>_" [90] 90) "inf == order_syntax.inf L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
95 |
abbreviation (in partial_order) |
21049 | 96 |
join (infixl "\<squnion>" 65) "join == order_syntax.join L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
97 |
abbreviation (in partial_order) |
21049 | 98 |
meet (infixl "\<sqinter>" 70) "meet == order_syntax.meet L le" |
14551 | 99 |
|
14651 | 100 |
|
101 |
subsubsection {* Upper *} |
|
14551 | 102 |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
103 |
lemma (in order_syntax) Upper_closed [intro, simp]: |
21049 | 104 |
"Upper A \<subseteq> L" |
14551 | 105 |
by (unfold Upper_def) clarify |
106 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
107 |
lemma (in order_syntax) UpperD [dest]: |
21049 | 108 |
"[| u \<in> Upper A; x \<in> A; A \<subseteq> L |] ==> x \<sqsubseteq> u" |
14693 | 109 |
by (unfold Upper_def) blast |
14551 | 110 |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
111 |
lemma (in order_syntax) Upper_memI: |
21049 | 112 |
"[| !! y. y \<in> A ==> y \<sqsubseteq> x; x \<in> L |] ==> x \<in> Upper A" |
14693 | 113 |
by (unfold Upper_def) blast |
14551 | 114 |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
115 |
lemma (in order_syntax) Upper_antimono: |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
116 |
"A \<subseteq> B ==> Upper B \<subseteq> Upper A" |
14551 | 117 |
by (unfold Upper_def) blast |
118 |
||
14651 | 119 |
|
120 |
subsubsection {* Lower *} |
|
14551 | 121 |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
122 |
lemma (in order_syntax) Lower_closed [intro, simp]: |
21049 | 123 |
"Lower A \<subseteq> L" |
14551 | 124 |
by (unfold Lower_def) clarify |
125 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
126 |
lemma (in order_syntax) LowerD [dest]: |
21049 | 127 |
"[| l \<in> Lower A; x \<in> A; A \<subseteq> L |] ==> l \<sqsubseteq> x" |
14693 | 128 |
by (unfold Lower_def) blast |
14551 | 129 |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
130 |
lemma (in order_syntax) Lower_memI: |
21049 | 131 |
"[| !! y. y \<in> A ==> x \<sqsubseteq> y; x \<in> L |] ==> x \<in> Lower A" |
14693 | 132 |
by (unfold Lower_def) blast |
14551 | 133 |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
134 |
lemma (in order_syntax) Lower_antimono: |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
135 |
"A \<subseteq> B ==> Lower B \<subseteq> Lower A" |
14551 | 136 |
by (unfold Lower_def) blast |
137 |
||
14651 | 138 |
|
139 |
subsubsection {* least *} |
|
14551 | 140 |
|
21049 | 141 |
lemma (in order_syntax) least_closed [intro, simp]: |
142 |
"least l A ==> l \<in> L" |
|
14551 | 143 |
by (unfold least_def) fast |
144 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
145 |
lemma (in order_syntax) least_mem: |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
146 |
"least l A ==> l \<in> A" |
14551 | 147 |
by (unfold least_def) fast |
148 |
||
149 |
lemma (in partial_order) least_unique: |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
150 |
"[| least x A; least y A |] ==> x = y" |
14551 | 151 |
by (unfold least_def) blast |
152 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
153 |
lemma (in order_syntax) least_le: |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
154 |
"[| least x A; a \<in> A |] ==> x \<sqsubseteq> a" |
14551 | 155 |
by (unfold least_def) fast |
156 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
157 |
lemma (in order_syntax) least_UpperI: |
14551 | 158 |
assumes above: "!! x. x \<in> A ==> x \<sqsubseteq> s" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
159 |
and below: "!! y. y \<in> Upper A ==> s \<sqsubseteq> y" |
21049 | 160 |
and L: "A \<subseteq> L" "s \<in> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
161 |
shows "least s (Upper A)" |
14693 | 162 |
proof - |
21049 | 163 |
have "Upper A \<subseteq> L" by simp |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
164 |
moreover from above L have "s \<in> Upper A" by (simp add: Upper_def) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
165 |
moreover from below have "ALL x : Upper A. s \<sqsubseteq> x" by fast |
14693 | 166 |
ultimately show ?thesis by (simp add: least_def) |
14551 | 167 |
qed |
168 |
||
14651 | 169 |
|
170 |
subsubsection {* greatest *} |
|
14551 | 171 |
|
21049 | 172 |
lemma (in order_syntax) greatest_closed [intro, simp]: |
173 |
"greatest l A ==> l \<in> L" |
|
14551 | 174 |
by (unfold greatest_def) fast |
175 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
176 |
lemma (in order_syntax) greatest_mem: |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
177 |
"greatest l A ==> l \<in> A" |
14551 | 178 |
by (unfold greatest_def) fast |
179 |
||
180 |
lemma (in partial_order) greatest_unique: |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
181 |
"[| greatest x A; greatest y A |] ==> x = y" |
14551 | 182 |
by (unfold greatest_def) blast |
183 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
184 |
lemma (in order_syntax) greatest_le: |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
185 |
"[| greatest x A; a \<in> A |] ==> a \<sqsubseteq> x" |
14551 | 186 |
by (unfold greatest_def) fast |
187 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
188 |
lemma (in order_syntax) greatest_LowerI: |
14551 | 189 |
assumes below: "!! x. x \<in> A ==> i \<sqsubseteq> x" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
190 |
and above: "!! y. y \<in> Lower A ==> y \<sqsubseteq> i" |
21049 | 191 |
and L: "A \<subseteq> L" "i \<in> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
192 |
shows "greatest i (Lower A)" |
14693 | 193 |
proof - |
21049 | 194 |
have "Lower A \<subseteq> L" by simp |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
195 |
moreover from below L have "i \<in> Lower A" by (simp add: Lower_def) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
196 |
moreover from above have "ALL x : Lower A. x \<sqsubseteq> i" by fast |
14693 | 197 |
ultimately show ?thesis by (simp add: greatest_def) |
14551 | 198 |
qed |
199 |
||
14693 | 200 |
|
14551 | 201 |
subsection {* Lattices *} |
202 |
||
203 |
locale lattice = partial_order + |
|
204 |
assumes sup_of_two_exists: |
|
21049 | 205 |
"[| x \<in> L; y \<in> L |] ==> EX s. order_syntax.least L le s (order_syntax.Upper L le {x, y})" |
14551 | 206 |
and inf_of_two_exists: |
21049 | 207 |
"[| x \<in> L; y \<in> L |] ==> EX s. order_syntax.greatest L le s (order_syntax.Lower L le {x, y})" |
14551 | 208 |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
209 |
abbreviation (in lattice) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
210 |
less (infixl "\<sqsubset>" 50) "less == order_syntax.less le" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
211 |
abbreviation (in lattice) |
21049 | 212 |
Upper where "Upper == order_syntax.Upper L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
213 |
abbreviation (in lattice) |
21049 | 214 |
Lower where "Lower == order_syntax.Lower L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
215 |
abbreviation (in lattice) |
21049 | 216 |
least where "least == order_syntax.least L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
217 |
abbreviation (in lattice) |
21049 | 218 |
greatest where "greatest == order_syntax.greatest L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
219 |
abbreviation (in lattice) |
21049 | 220 |
sup ("\<Squnion>_" [90] 90) "sup == order_syntax.sup L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
221 |
abbreviation (in lattice) |
21049 | 222 |
inf ("\<Sqinter>_" [90] 90) "inf == order_syntax.inf L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
223 |
abbreviation (in lattice) |
21049 | 224 |
join (infixl "\<squnion>" 65) "join == order_syntax.join L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
225 |
abbreviation (in lattice) |
21049 | 226 |
meet (infixl "\<sqinter>" 70) "meet == order_syntax.meet L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
227 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
228 |
lemma (in order_syntax) least_Upper_above: |
21049 | 229 |
"[| least s (Upper A); x \<in> A; A \<subseteq> L |] ==> x \<sqsubseteq> s" |
14551 | 230 |
by (unfold least_def) blast |
231 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
232 |
lemma (in order_syntax) greatest_Lower_above: |
21049 | 233 |
"[| greatest i (Lower A); x \<in> A; A \<subseteq> L |] ==> i \<sqsubseteq> x" |
14551 | 234 |
by (unfold greatest_def) blast |
235 |
||
14666 | 236 |
|
14551 | 237 |
subsubsection {* Supremum *} |
238 |
||
239 |
lemma (in lattice) joinI: |
|
21049 | 240 |
"[| !!l. least l (Upper {x, y}) ==> P l; x \<in> L; y \<in> L |] |
14551 | 241 |
==> P (x \<squnion> y)" |
242 |
proof (unfold join_def sup_def) |
|
21049 | 243 |
assume L: "x \<in> L" "y \<in> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
244 |
and P: "!!l. least l (Upper {x, y}) ==> P l" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
245 |
with sup_of_two_exists obtain s where "least s (Upper {x, y})" by fast |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
246 |
with L show "P (THE l. least l (Upper {x, y}))" |
14693 | 247 |
by (fast intro: theI2 least_unique P) |
14551 | 248 |
qed |
249 |
||
250 |
lemma (in lattice) join_closed [simp]: |
|
21049 | 251 |
"[| x \<in> L; y \<in> L |] ==> x \<squnion> y \<in> L" |
252 |
by (rule joinI) (rule least_closed) |
|
14551 | 253 |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
254 |
lemma (in partial_order) sup_of_singletonI: (* only reflexivity needed ? *) |
21049 | 255 |
"x \<in> L ==> least x (Upper {x})" |
14551 | 256 |
by (rule least_UpperI) fast+ |
257 |
||
258 |
lemma (in partial_order) sup_of_singleton [simp]: |
|
21049 | 259 |
"x \<in> L ==> \<Squnion>{x} = x" |
14551 | 260 |
by (unfold sup_def) (blast intro: least_unique least_UpperI sup_of_singletonI) |
261 |
||
14666 | 262 |
|
263 |
text {* Condition on @{text A}: supremum exists. *} |
|
14551 | 264 |
|
265 |
lemma (in lattice) sup_insertI: |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
266 |
"[| !!s. least s (Upper (insert x A)) ==> P s; |
21049 | 267 |
least a (Upper A); x \<in> L; A \<subseteq> L |] |
14693 | 268 |
==> P (\<Squnion>(insert x A))" |
14551 | 269 |
proof (unfold sup_def) |
21049 | 270 |
assume L: "x \<in> L" "A \<subseteq> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
271 |
and P: "!!l. least l (Upper (insert x A)) ==> P l" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
272 |
and least_a: "least a (Upper A)" |
21049 | 273 |
from least_a have La: "a \<in> L" by simp |
14551 | 274 |
from L sup_of_two_exists least_a |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
275 |
obtain s where least_s: "least s (Upper {a, x})" by blast |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
276 |
show "P (THE l. least l (Upper (insert x A)))" |
14693 | 277 |
proof (rule theI2) |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
278 |
show "least s (Upper (insert x A))" |
14551 | 279 |
proof (rule least_UpperI) |
280 |
fix z |
|
14693 | 281 |
assume "z \<in> insert x A" |
282 |
then show "z \<sqsubseteq> s" |
|
283 |
proof |
|
284 |
assume "z = x" then show ?thesis |
|
285 |
by (simp add: least_Upper_above [OF least_s] L La) |
|
286 |
next |
|
287 |
assume "z \<in> A" |
|
288 |
with L least_s least_a show ?thesis |
|
289 |
by (rule_tac trans [where y = a]) (auto dest: least_Upper_above) |
|
290 |
qed |
|
291 |
next |
|
292 |
fix y |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
293 |
assume y: "y \<in> Upper (insert x A)" |
14693 | 294 |
show "s \<sqsubseteq> y" |
295 |
proof (rule least_le [OF least_s], rule Upper_memI) |
|
296 |
fix z |
|
297 |
assume z: "z \<in> {a, x}" |
|
298 |
then show "z \<sqsubseteq> y" |
|
299 |
proof |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
300 |
have y': "y \<in> Upper A" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
301 |
apply (rule subsetD [where A = "Upper (insert x A)"]) |
14693 | 302 |
apply (rule Upper_antimono) apply clarify apply assumption |
303 |
done |
|
304 |
assume "z = a" |
|
305 |
with y' least_a show ?thesis by (fast dest: least_le) |
|
306 |
next |
|
307 |
assume "z \<in> {x}" (* FIXME "z = x"; declare specific elim rule for "insert x {}" (!?) *) |
|
308 |
with y L show ?thesis by blast |
|
309 |
qed |
|
310 |
qed (rule Upper_closed [THEN subsetD]) |
|
311 |
next |
|
21049 | 312 |
from L show "insert x A \<subseteq> L" by simp |
313 |
from least_s show "s \<in> L" by simp |
|
14551 | 314 |
qed |
315 |
next |
|
316 |
fix l |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
317 |
assume least_l: "least l (Upper (insert x A))" |
14551 | 318 |
show "l = s" |
319 |
proof (rule least_unique) |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
320 |
show "least s (Upper (insert x A))" |
14551 | 321 |
proof (rule least_UpperI) |
14693 | 322 |
fix z |
323 |
assume "z \<in> insert x A" |
|
324 |
then show "z \<sqsubseteq> s" |
|
325 |
proof |
|
326 |
assume "z = x" then show ?thesis |
|
327 |
by (simp add: least_Upper_above [OF least_s] L La) |
|
328 |
next |
|
329 |
assume "z \<in> A" |
|
330 |
with L least_s least_a show ?thesis |
|
331 |
by (rule_tac trans [where y = a]) (auto dest: least_Upper_above) |
|
14551 | 332 |
qed |
333 |
next |
|
14693 | 334 |
fix y |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
335 |
assume y: "y \<in> Upper (insert x A)" |
14693 | 336 |
show "s \<sqsubseteq> y" |
337 |
proof (rule least_le [OF least_s], rule Upper_memI) |
|
338 |
fix z |
|
339 |
assume z: "z \<in> {a, x}" |
|
340 |
then show "z \<sqsubseteq> y" |
|
341 |
proof |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
342 |
have y': "y \<in> Upper A" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
343 |
apply (rule subsetD [where A = "Upper (insert x A)"]) |
14693 | 344 |
apply (rule Upper_antimono) apply clarify apply assumption |
345 |
done |
|
346 |
assume "z = a" |
|
347 |
with y' least_a show ?thesis by (fast dest: least_le) |
|
348 |
next |
|
349 |
assume "z \<in> {x}" |
|
350 |
with y L show ?thesis by blast |
|
351 |
qed |
|
352 |
qed (rule Upper_closed [THEN subsetD]) |
|
14551 | 353 |
next |
21049 | 354 |
from L show "insert x A \<subseteq> L" by simp |
355 |
from least_s show "s \<in> L" by simp |
|
14551 | 356 |
qed |
357 |
qed |
|
358 |
qed |
|
359 |
qed |
|
360 |
||
361 |
lemma (in lattice) finite_sup_least: |
|
21049 | 362 |
"[| finite A; A \<subseteq> L; A ~= {} |] ==> least (\<Squnion>A) (Upper A)" |
14551 | 363 |
proof (induct set: Finites) |
14693 | 364 |
case empty |
365 |
then show ?case by simp |
|
14551 | 366 |
next |
15328 | 367 |
case (insert x A) |
14551 | 368 |
show ?case |
369 |
proof (cases "A = {}") |
|
370 |
case True |
|
371 |
with insert show ?thesis by (simp add: sup_of_singletonI) |
|
372 |
next |
|
373 |
case False |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
374 |
with insert have "least (\<Squnion>A) (Upper A)" by simp |
14693 | 375 |
with _ show ?thesis |
376 |
by (rule sup_insertI) (simp_all add: insert [simplified]) |
|
14551 | 377 |
qed |
378 |
qed |
|
379 |
||
380 |
lemma (in lattice) finite_sup_insertI: |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
381 |
assumes P: "!!l. least l (Upper (insert x A)) ==> P l" |
21049 | 382 |
and xA: "finite A" "x \<in> L" "A \<subseteq> L" |
14551 | 383 |
shows "P (\<Squnion> (insert x A))" |
384 |
proof (cases "A = {}") |
|
385 |
case True with P and xA show ?thesis |
|
386 |
by (simp add: sup_of_singletonI) |
|
387 |
next |
|
388 |
case False with P and xA show ?thesis |
|
389 |
by (simp add: sup_insertI finite_sup_least) |
|
390 |
qed |
|
391 |
||
392 |
lemma (in lattice) finite_sup_closed: |
|
21049 | 393 |
"[| finite A; A \<subseteq> L; A ~= {} |] ==> \<Squnion>A \<in> L" |
14551 | 394 |
proof (induct set: Finites) |
395 |
case empty then show ?case by simp |
|
396 |
next |
|
15328 | 397 |
case insert then show ?case |
14693 | 398 |
by - (rule finite_sup_insertI, simp_all) |
14551 | 399 |
qed |
400 |
||
401 |
lemma (in lattice) join_left: |
|
21049 | 402 |
"[| x \<in> L; y \<in> L |] ==> x \<sqsubseteq> x \<squnion> y" |
14693 | 403 |
by (rule joinI [folded join_def]) (blast dest: least_mem) |
14551 | 404 |
|
405 |
lemma (in lattice) join_right: |
|
21049 | 406 |
"[| x \<in> L; y \<in> L |] ==> y \<sqsubseteq> x \<squnion> y" |
14693 | 407 |
by (rule joinI [folded join_def]) (blast dest: least_mem) |
14551 | 408 |
|
409 |
lemma (in lattice) sup_of_two_least: |
|
21049 | 410 |
"[| x \<in> L; y \<in> L |] ==> least (\<Squnion>{x, y}) (Upper {x, y})" |
14551 | 411 |
proof (unfold sup_def) |
21049 | 412 |
assume L: "x \<in> L" "y \<in> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
413 |
with sup_of_two_exists obtain s where "least s (Upper {x, y})" by fast |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
414 |
with L show "least (THE xa. least xa (Upper {x, y})) (Upper {x, y})" |
14551 | 415 |
by (fast intro: theI2 least_unique) (* blast fails *) |
416 |
qed |
|
417 |
||
418 |
lemma (in lattice) join_le: |
|
14693 | 419 |
assumes sub: "x \<sqsubseteq> z" "y \<sqsubseteq> z" |
21049 | 420 |
and L: "x \<in> L" "y \<in> L" "z \<in> L" |
14551 | 421 |
shows "x \<squnion> y \<sqsubseteq> z" |
422 |
proof (rule joinI) |
|
423 |
fix s |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
424 |
assume "least s (Upper {x, y})" |
14551 | 425 |
with sub L show "s \<sqsubseteq> z" by (fast elim: least_le intro: Upper_memI) |
426 |
qed |
|
14693 | 427 |
|
14551 | 428 |
lemma (in lattice) join_assoc_lemma: |
21049 | 429 |
assumes L: "x \<in> L" "y \<in> L" "z \<in> L" |
14693 | 430 |
shows "x \<squnion> (y \<squnion> z) = \<Squnion>{x, y, z}" |
14551 | 431 |
proof (rule finite_sup_insertI) |
14651 | 432 |
-- {* The textbook argument in Jacobson I, p 457 *} |
14551 | 433 |
fix s |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
434 |
assume sup: "least s (Upper {x, y, z})" |
14551 | 435 |
show "x \<squnion> (y \<squnion> z) = s" |
436 |
proof (rule anti_sym) |
|
437 |
from sup L show "x \<squnion> (y \<squnion> z) \<sqsubseteq> s" |
|
438 |
by (fastsimp intro!: join_le elim: least_Upper_above) |
|
439 |
next |
|
440 |
from sup L show "s \<sqsubseteq> x \<squnion> (y \<squnion> z)" |
|
441 |
by (erule_tac least_le) |
|
442 |
(blast intro!: Upper_memI intro: trans join_left join_right join_closed) |
|
21049 | 443 |
qed (simp_all add: L least_closed [OF sup]) |
14551 | 444 |
qed (simp_all add: L) |
445 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
446 |
lemma (in order_syntax) join_comm: |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
447 |
"x \<squnion> y = y \<squnion> x" |
14551 | 448 |
by (unfold join_def) (simp add: insert_commute) |
449 |
||
450 |
lemma (in lattice) join_assoc: |
|
21049 | 451 |
assumes L: "x \<in> L" "y \<in> L" "z \<in> L" |
14551 | 452 |
shows "(x \<squnion> y) \<squnion> z = x \<squnion> (y \<squnion> z)" |
453 |
proof - |
|
454 |
have "(x \<squnion> y) \<squnion> z = z \<squnion> (x \<squnion> y)" by (simp only: join_comm) |
|
14693 | 455 |
also from L have "... = \<Squnion>{z, x, y}" by (simp add: join_assoc_lemma) |
456 |
also from L have "... = \<Squnion>{x, y, z}" by (simp add: insert_commute) |
|
14551 | 457 |
also from L have "... = x \<squnion> (y \<squnion> z)" by (simp add: join_assoc_lemma) |
458 |
finally show ?thesis . |
|
459 |
qed |
|
460 |
||
14693 | 461 |
|
14551 | 462 |
subsubsection {* Infimum *} |
463 |
||
464 |
lemma (in lattice) meetI: |
|
21049 | 465 |
"[| !!i. greatest i (Lower {x, y}) ==> P i; x \<in> L; y \<in> L |] |
14551 | 466 |
==> P (x \<sqinter> y)" |
467 |
proof (unfold meet_def inf_def) |
|
21049 | 468 |
assume L: "x \<in> L" "y \<in> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
469 |
and P: "!!g. greatest g (Lower {x, y}) ==> P g" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
470 |
with inf_of_two_exists obtain i where "greatest i (Lower {x, y})" by fast |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
471 |
with L show "P (THE g. greatest g (Lower {x, y}))" |
14551 | 472 |
by (fast intro: theI2 greatest_unique P) |
473 |
qed |
|
474 |
||
475 |
lemma (in lattice) meet_closed [simp]: |
|
21049 | 476 |
"[| x \<in> L; y \<in> L |] ==> x \<sqinter> y \<in> L" |
477 |
by (rule meetI) (rule greatest_closed) |
|
14551 | 478 |
|
14651 | 479 |
lemma (in partial_order) inf_of_singletonI: (* only reflexivity needed ? *) |
21049 | 480 |
"x \<in> L ==> greatest x (Lower {x})" |
14551 | 481 |
by (rule greatest_LowerI) fast+ |
482 |
||
483 |
lemma (in partial_order) inf_of_singleton [simp]: |
|
21049 | 484 |
"x \<in> L ==> \<Sqinter> {x} = x" |
14551 | 485 |
by (unfold inf_def) (blast intro: greatest_unique greatest_LowerI inf_of_singletonI) |
486 |
||
487 |
text {* Condition on A: infimum exists. *} |
|
488 |
||
489 |
lemma (in lattice) inf_insertI: |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
490 |
"[| !!i. greatest i (Lower (insert x A)) ==> P i; |
21049 | 491 |
greatest a (Lower A); x \<in> L; A \<subseteq> L |] |
14693 | 492 |
==> P (\<Sqinter>(insert x A))" |
14551 | 493 |
proof (unfold inf_def) |
21049 | 494 |
assume L: "x \<in> L" "A \<subseteq> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
495 |
and P: "!!g. greatest g (Lower (insert x A)) ==> P g" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
496 |
and greatest_a: "greatest a (Lower A)" |
21049 | 497 |
from greatest_a have La: "a \<in> L" by simp |
14551 | 498 |
from L inf_of_two_exists greatest_a |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
499 |
obtain i where greatest_i: "greatest i (Lower {a, x})" by blast |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
500 |
show "P (THE g. greatest g (Lower (insert x A)))" |
14693 | 501 |
proof (rule theI2) |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
502 |
show "greatest i (Lower (insert x A))" |
14551 | 503 |
proof (rule greatest_LowerI) |
504 |
fix z |
|
14693 | 505 |
assume "z \<in> insert x A" |
506 |
then show "i \<sqsubseteq> z" |
|
507 |
proof |
|
508 |
assume "z = x" then show ?thesis |
|
509 |
by (simp add: greatest_Lower_above [OF greatest_i] L La) |
|
510 |
next |
|
511 |
assume "z \<in> A" |
|
512 |
with L greatest_i greatest_a show ?thesis |
|
513 |
by (rule_tac trans [where y = a]) (auto dest: greatest_Lower_above) |
|
514 |
qed |
|
515 |
next |
|
516 |
fix y |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
517 |
assume y: "y \<in> Lower (insert x A)" |
14693 | 518 |
show "y \<sqsubseteq> i" |
519 |
proof (rule greatest_le [OF greatest_i], rule Lower_memI) |
|
520 |
fix z |
|
521 |
assume z: "z \<in> {a, x}" |
|
522 |
then show "y \<sqsubseteq> z" |
|
523 |
proof |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
524 |
have y': "y \<in> Lower A" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
525 |
apply (rule subsetD [where A = "Lower (insert x A)"]) |
14693 | 526 |
apply (rule Lower_antimono) apply clarify apply assumption |
527 |
done |
|
528 |
assume "z = a" |
|
529 |
with y' greatest_a show ?thesis by (fast dest: greatest_le) |
|
530 |
next |
|
531 |
assume "z \<in> {x}" |
|
532 |
with y L show ?thesis by blast |
|
533 |
qed |
|
534 |
qed (rule Lower_closed [THEN subsetD]) |
|
535 |
next |
|
21049 | 536 |
from L show "insert x A \<subseteq> L" by simp |
537 |
from greatest_i show "i \<in> L" by simp |
|
14551 | 538 |
qed |
539 |
next |
|
540 |
fix g |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
541 |
assume greatest_g: "greatest g (Lower (insert x A))" |
14551 | 542 |
show "g = i" |
543 |
proof (rule greatest_unique) |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
544 |
show "greatest i (Lower (insert x A))" |
14551 | 545 |
proof (rule greatest_LowerI) |
14693 | 546 |
fix z |
547 |
assume "z \<in> insert x A" |
|
548 |
then show "i \<sqsubseteq> z" |
|
549 |
proof |
|
550 |
assume "z = x" then show ?thesis |
|
551 |
by (simp add: greatest_Lower_above [OF greatest_i] L La) |
|
552 |
next |
|
553 |
assume "z \<in> A" |
|
554 |
with L greatest_i greatest_a show ?thesis |
|
555 |
by (rule_tac trans [where y = a]) (auto dest: greatest_Lower_above) |
|
556 |
qed |
|
14551 | 557 |
next |
14693 | 558 |
fix y |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
559 |
assume y: "y \<in> Lower (insert x A)" |
14693 | 560 |
show "y \<sqsubseteq> i" |
561 |
proof (rule greatest_le [OF greatest_i], rule Lower_memI) |
|
562 |
fix z |
|
563 |
assume z: "z \<in> {a, x}" |
|
564 |
then show "y \<sqsubseteq> z" |
|
565 |
proof |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
566 |
have y': "y \<in> Lower A" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
567 |
apply (rule subsetD [where A = "Lower (insert x A)"]) |
14693 | 568 |
apply (rule Lower_antimono) apply clarify apply assumption |
569 |
done |
|
570 |
assume "z = a" |
|
571 |
with y' greatest_a show ?thesis by (fast dest: greatest_le) |
|
572 |
next |
|
573 |
assume "z \<in> {x}" |
|
574 |
with y L show ?thesis by blast |
|
14551 | 575 |
qed |
14693 | 576 |
qed (rule Lower_closed [THEN subsetD]) |
14551 | 577 |
next |
21049 | 578 |
from L show "insert x A \<subseteq> L" by simp |
579 |
from greatest_i show "i \<in> L" by simp |
|
14551 | 580 |
qed |
581 |
qed |
|
582 |
qed |
|
583 |
qed |
|
584 |
||
585 |
lemma (in lattice) finite_inf_greatest: |
|
21049 | 586 |
"[| finite A; A \<subseteq> L; A ~= {} |] ==> greatest (\<Sqinter>A) (Lower A)" |
14551 | 587 |
proof (induct set: Finites) |
588 |
case empty then show ?case by simp |
|
589 |
next |
|
15328 | 590 |
case (insert x A) |
14551 | 591 |
show ?case |
592 |
proof (cases "A = {}") |
|
593 |
case True |
|
594 |
with insert show ?thesis by (simp add: inf_of_singletonI) |
|
595 |
next |
|
596 |
case False |
|
597 |
from insert show ?thesis |
|
598 |
proof (rule_tac inf_insertI) |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
599 |
from False insert show "greatest (\<Sqinter>A) (Lower A)" by simp |
14551 | 600 |
qed simp_all |
601 |
qed |
|
602 |
qed |
|
603 |
||
604 |
lemma (in lattice) finite_inf_insertI: |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
605 |
assumes P: "!!i. greatest i (Lower (insert x A)) ==> P i" |
21049 | 606 |
and xA: "finite A" "x \<in> L" "A \<subseteq> L" |
14551 | 607 |
shows "P (\<Sqinter> (insert x A))" |
608 |
proof (cases "A = {}") |
|
609 |
case True with P and xA show ?thesis |
|
610 |
by (simp add: inf_of_singletonI) |
|
611 |
next |
|
612 |
case False with P and xA show ?thesis |
|
613 |
by (simp add: inf_insertI finite_inf_greatest) |
|
614 |
qed |
|
615 |
||
616 |
lemma (in lattice) finite_inf_closed: |
|
21049 | 617 |
"[| finite A; A \<subseteq> L; A ~= {} |] ==> \<Sqinter>A \<in> L" |
14551 | 618 |
proof (induct set: Finites) |
619 |
case empty then show ?case by simp |
|
620 |
next |
|
15328 | 621 |
case insert then show ?case |
14551 | 622 |
by (rule_tac finite_inf_insertI) (simp_all) |
623 |
qed |
|
624 |
||
625 |
lemma (in lattice) meet_left: |
|
21049 | 626 |
"[| x \<in> L; y \<in> L |] ==> x \<sqinter> y \<sqsubseteq> x" |
14693 | 627 |
by (rule meetI [folded meet_def]) (blast dest: greatest_mem) |
14551 | 628 |
|
629 |
lemma (in lattice) meet_right: |
|
21049 | 630 |
"[| x \<in> L; y \<in> L |] ==> x \<sqinter> y \<sqsubseteq> y" |
14693 | 631 |
by (rule meetI [folded meet_def]) (blast dest: greatest_mem) |
14551 | 632 |
|
633 |
lemma (in lattice) inf_of_two_greatest: |
|
21049 | 634 |
"[| x \<in> L; y \<in> L |] ==> greatest (\<Sqinter> {x, y}) (Lower {x, y})" |
14551 | 635 |
proof (unfold inf_def) |
21049 | 636 |
assume L: "x \<in> L" "y \<in> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
637 |
with inf_of_two_exists obtain s where "greatest s (Lower {x, y})" by fast |
14551 | 638 |
with L |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
639 |
show "greatest (THE xa. greatest xa (Lower {x, y})) (Lower {x, y})" |
14551 | 640 |
by (fast intro: theI2 greatest_unique) (* blast fails *) |
641 |
qed |
|
642 |
||
643 |
lemma (in lattice) meet_le: |
|
14693 | 644 |
assumes sub: "z \<sqsubseteq> x" "z \<sqsubseteq> y" |
21049 | 645 |
and L: "x \<in> L" "y \<in> L" "z \<in> L" |
14551 | 646 |
shows "z \<sqsubseteq> x \<sqinter> y" |
647 |
proof (rule meetI) |
|
648 |
fix i |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
649 |
assume "greatest i (Lower {x, y})" |
14551 | 650 |
with sub L show "z \<sqsubseteq> i" by (fast elim: greatest_le intro: Lower_memI) |
651 |
qed |
|
14693 | 652 |
|
14551 | 653 |
lemma (in lattice) meet_assoc_lemma: |
21049 | 654 |
assumes L: "x \<in> L" "y \<in> L" "z \<in> L" |
14693 | 655 |
shows "x \<sqinter> (y \<sqinter> z) = \<Sqinter>{x, y, z}" |
14551 | 656 |
proof (rule finite_inf_insertI) |
657 |
txt {* The textbook argument in Jacobson I, p 457 *} |
|
658 |
fix i |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
659 |
assume inf: "greatest i (Lower {x, y, z})" |
14551 | 660 |
show "x \<sqinter> (y \<sqinter> z) = i" |
661 |
proof (rule anti_sym) |
|
662 |
from inf L show "i \<sqsubseteq> x \<sqinter> (y \<sqinter> z)" |
|
663 |
by (fastsimp intro!: meet_le elim: greatest_Lower_above) |
|
664 |
next |
|
665 |
from inf L show "x \<sqinter> (y \<sqinter> z) \<sqsubseteq> i" |
|
666 |
by (erule_tac greatest_le) |
|
667 |
(blast intro!: Lower_memI intro: trans meet_left meet_right meet_closed) |
|
21049 | 668 |
qed (simp_all add: L greatest_closed [OF inf]) |
14551 | 669 |
qed (simp_all add: L) |
670 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
671 |
lemma (in order_syntax) meet_comm: |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
672 |
"x \<sqinter> y = y \<sqinter> x" |
14551 | 673 |
by (unfold meet_def) (simp add: insert_commute) |
674 |
||
675 |
lemma (in lattice) meet_assoc: |
|
21049 | 676 |
assumes L: "x \<in> L" "y \<in> L" "z \<in> L" |
14551 | 677 |
shows "(x \<sqinter> y) \<sqinter> z = x \<sqinter> (y \<sqinter> z)" |
678 |
proof - |
|
679 |
have "(x \<sqinter> y) \<sqinter> z = z \<sqinter> (x \<sqinter> y)" by (simp only: meet_comm) |
|
680 |
also from L have "... = \<Sqinter> {z, x, y}" by (simp add: meet_assoc_lemma) |
|
681 |
also from L have "... = \<Sqinter> {x, y, z}" by (simp add: insert_commute) |
|
682 |
also from L have "... = x \<sqinter> (y \<sqinter> z)" by (simp add: meet_assoc_lemma) |
|
683 |
finally show ?thesis . |
|
684 |
qed |
|
685 |
||
14693 | 686 |
|
14551 | 687 |
subsection {* Total Orders *} |
688 |
||
689 |
locale total_order = lattice + |
|
21049 | 690 |
assumes total: "[| x \<in> L; y \<in> L |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
691 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
692 |
abbreviation (in total_order) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
693 |
less (infixl "\<sqsubset>" 50) "less == order_syntax.less le" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
694 |
abbreviation (in total_order) |
21049 | 695 |
Upper where "Upper == order_syntax.Upper L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
696 |
abbreviation (in total_order) |
21049 | 697 |
Lower where "Lower == order_syntax.Lower L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
698 |
abbreviation (in total_order) |
21049 | 699 |
least where "least == order_syntax.least L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
700 |
abbreviation (in total_order) |
21049 | 701 |
greatest where "greatest == order_syntax.greatest L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
702 |
abbreviation (in total_order) |
21049 | 703 |
sup ("\<Squnion>_" [90] 90) "sup == order_syntax.sup L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
704 |
abbreviation (in total_order) |
21049 | 705 |
inf ("\<Sqinter>_" [90] 90) "inf == order_syntax.inf L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
706 |
abbreviation (in total_order) |
21049 | 707 |
join (infixl "\<squnion>" 65) "join == order_syntax.join L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
708 |
abbreviation (in total_order) |
21049 | 709 |
meet (infixl "\<sqinter>" 70) "meet == order_syntax.meet L le" |
14551 | 710 |
|
711 |
text {* Introduction rule: the usual definition of total order *} |
|
712 |
||
713 |
lemma (in partial_order) total_orderI: |
|
21049 | 714 |
assumes total: "!!x y. [| x \<in> L; y \<in> L |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x" |
715 |
shows "total_order L le" |
|
19984
29bb4659f80a
Method intro_locales replaced by intro_locales and unfold_locales.
ballarin
parents:
19931
diff
changeset
|
716 |
proof intro_locales |
21049 | 717 |
show "lattice_axioms L le" |
14551 | 718 |
proof (rule lattice_axioms.intro) |
719 |
fix x y |
|
21049 | 720 |
assume L: "x \<in> L" "y \<in> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
721 |
show "EX s. least s (Upper {x, y})" |
14551 | 722 |
proof - |
723 |
note total L |
|
724 |
moreover |
|
725 |
{ |
|
14693 | 726 |
assume "x \<sqsubseteq> y" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
727 |
with L have "least y (Upper {x, y})" |
14693 | 728 |
by (rule_tac least_UpperI) auto |
14551 | 729 |
} |
730 |
moreover |
|
731 |
{ |
|
14693 | 732 |
assume "y \<sqsubseteq> x" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
733 |
with L have "least x (Upper {x, y})" |
14693 | 734 |
by (rule_tac least_UpperI) auto |
14551 | 735 |
} |
736 |
ultimately show ?thesis by blast |
|
737 |
qed |
|
738 |
next |
|
739 |
fix x y |
|
21049 | 740 |
assume L: "x \<in> L" "y \<in> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
741 |
show "EX i. greatest i (Lower {x, y})" |
14551 | 742 |
proof - |
743 |
note total L |
|
744 |
moreover |
|
745 |
{ |
|
14693 | 746 |
assume "y \<sqsubseteq> x" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
747 |
with L have "greatest y (Lower {x, y})" |
14693 | 748 |
by (rule_tac greatest_LowerI) auto |
14551 | 749 |
} |
750 |
moreover |
|
751 |
{ |
|
14693 | 752 |
assume "x \<sqsubseteq> y" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
753 |
with L have "greatest x (Lower {x, y})" |
14693 | 754 |
by (rule_tac greatest_LowerI) auto |
14551 | 755 |
} |
756 |
ultimately show ?thesis by blast |
|
757 |
qed |
|
758 |
qed |
|
759 |
qed (assumption | rule total_order_axioms.intro)+ |
|
760 |
||
14693 | 761 |
|
14551 | 762 |
subsection {* Complete lattices *} |
763 |
||
764 |
locale complete_lattice = lattice + |
|
765 |
assumes sup_exists: |
|
21049 | 766 |
"[| A \<subseteq> L |] ==> EX s. order_syntax.least L le s (order_syntax.Upper L le A)" |
14551 | 767 |
and inf_exists: |
21049 | 768 |
"[| A \<subseteq> L |] ==> EX i. order_syntax.greatest L le i (order_syntax.Lower L le A)" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
769 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
770 |
abbreviation (in complete_lattice) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
771 |
less (infixl "\<sqsubset>" 50) "less == order_syntax.less le" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
772 |
abbreviation (in complete_lattice) |
21049 | 773 |
Upper where "Upper == order_syntax.Upper L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
774 |
abbreviation (in complete_lattice) |
21049 | 775 |
Lower where "Lower == order_syntax.Lower L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
776 |
abbreviation (in complete_lattice) |
21049 | 777 |
least where "least == order_syntax.least L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
778 |
abbreviation (in complete_lattice) |
21049 | 779 |
greatest where "greatest == order_syntax.greatest L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
780 |
abbreviation (in complete_lattice) |
21049 | 781 |
sup ("\<Squnion>_" [90] 90) "sup == order_syntax.sup L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
782 |
abbreviation (in complete_lattice) |
21049 | 783 |
inf ("\<Sqinter>_" [90] 90) "inf == order_syntax.inf L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
784 |
abbreviation (in complete_lattice) |
21049 | 785 |
join (infixl "\<squnion>" 65) "join == order_syntax.join L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
786 |
abbreviation (in complete_lattice) |
21049 | 787 |
meet (infixl "\<sqinter>" 70) "meet == order_syntax.meet L le" |
14551 | 788 |
|
789 |
text {* Introduction rule: the usual definition of complete lattice *} |
|
790 |
||
791 |
lemma (in partial_order) complete_latticeI: |
|
792 |
assumes sup_exists: |
|
21049 | 793 |
"!!A. [| A \<subseteq> L |] ==> EX s. least s (Upper A)" |
14551 | 794 |
and inf_exists: |
21049 | 795 |
"!!A. [| A \<subseteq> L |] ==> EX i. greatest i (Lower A)" |
796 |
shows "complete_lattice L le" |
|
19984
29bb4659f80a
Method intro_locales replaced by intro_locales and unfold_locales.
ballarin
parents:
19931
diff
changeset
|
797 |
proof intro_locales |
21049 | 798 |
show "lattice_axioms L le" |
14693 | 799 |
by (rule lattice_axioms.intro) (blast intro: sup_exists inf_exists)+ |
14551 | 800 |
qed (assumption | rule complete_lattice_axioms.intro)+ |
801 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
802 |
definition (in order_syntax) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
803 |
top ("\<top>") |
21049 | 804 |
"\<top> == sup L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
805 |
|
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
806 |
definition (in order_syntax) |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
807 |
bottom ("\<bottom>") |
21049 | 808 |
"\<bottom> == inf L" |
14551 | 809 |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
810 |
abbreviation (in partial_order) |
21049 | 811 |
top ("\<top>") "top == order_syntax.top L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
812 |
abbreviation (in partial_order) |
21049 | 813 |
bottom ("\<bottom>") "bottom == order_syntax.bottom L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
814 |
abbreviation (in lattice) |
21049 | 815 |
top ("\<top>") "top == order_syntax.top L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
816 |
abbreviation (in lattice) |
21049 | 817 |
bottom ("\<bottom>") "bottom == order_syntax.bottom L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
818 |
abbreviation (in total_order) |
21049 | 819 |
top ("\<top>") "top == order_syntax.top L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
820 |
abbreviation (in total_order) |
21049 | 821 |
bottom ("\<bottom>") "bottom == order_syntax.bottom L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
822 |
abbreviation (in complete_lattice) |
21049 | 823 |
top ("\<top>") "top == order_syntax.top L le" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
824 |
abbreviation (in complete_lattice) |
21049 | 825 |
bottom ("\<bottom>") "bottom == order_syntax.bottom L le" |
14551 | 826 |
|
827 |
||
828 |
lemma (in complete_lattice) supI: |
|
21049 | 829 |
"[| !!l. least l (Upper A) ==> P l; A \<subseteq> L |] |
14651 | 830 |
==> P (\<Squnion>A)" |
14551 | 831 |
proof (unfold sup_def) |
21049 | 832 |
assume L: "A \<subseteq> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
833 |
and P: "!!l. least l (Upper A) ==> P l" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
834 |
with sup_exists obtain s where "least s (Upper A)" by blast |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
835 |
with L show "P (THE l. least l (Upper A))" |
14551 | 836 |
by (fast intro: theI2 least_unique P) |
837 |
qed |
|
838 |
||
839 |
lemma (in complete_lattice) sup_closed [simp]: |
|
21049 | 840 |
"A \<subseteq> L ==> \<Squnion>A \<in> L" |
14551 | 841 |
by (rule supI) simp_all |
842 |
||
843 |
lemma (in complete_lattice) top_closed [simp, intro]: |
|
21049 | 844 |
"\<top> \<in> L" |
14551 | 845 |
by (unfold top_def) simp |
846 |
||
847 |
lemma (in complete_lattice) infI: |
|
21049 | 848 |
"[| !!i. greatest i (Lower A) ==> P i; A \<subseteq> L |] |
14693 | 849 |
==> P (\<Sqinter>A)" |
14551 | 850 |
proof (unfold inf_def) |
21049 | 851 |
assume L: "A \<subseteq> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
852 |
and P: "!!l. greatest l (Lower A) ==> P l" |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
853 |
with inf_exists obtain s where "greatest s (Lower A)" by blast |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
854 |
with L show "P (THE l. greatest l (Lower A))" |
14551 | 855 |
by (fast intro: theI2 greatest_unique P) |
856 |
qed |
|
857 |
||
858 |
lemma (in complete_lattice) inf_closed [simp]: |
|
21049 | 859 |
"A \<subseteq> L ==> \<Sqinter>A \<in> L" |
14551 | 860 |
by (rule infI) simp_all |
861 |
||
862 |
lemma (in complete_lattice) bottom_closed [simp, intro]: |
|
21049 | 863 |
"\<bottom> \<in> L" |
14551 | 864 |
by (unfold bottom_def) simp |
865 |
||
866 |
text {* Jacobson: Theorem 8.1 *} |
|
867 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
868 |
lemma (in order_syntax) Lower_empty [simp]: |
21049 | 869 |
"Lower {} = L" |
14551 | 870 |
by (unfold Lower_def) simp |
871 |
||
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
872 |
lemma (in order_syntax) Upper_empty [simp]: |
21049 | 873 |
"Upper {} = L" |
14551 | 874 |
by (unfold Upper_def) simp |
875 |
||
876 |
theorem (in partial_order) complete_lattice_criterion1: |
|
21049 | 877 |
assumes top_exists: "EX g. greatest g L" |
14551 | 878 |
and inf_exists: |
21049 | 879 |
"!!A. [| A \<subseteq> L; A ~= {} |] ==> EX i. greatest i (Lower A)" |
880 |
shows "complete_lattice L le" |
|
14551 | 881 |
proof (rule complete_latticeI) |
21049 | 882 |
from top_exists obtain top where top: "greatest top L" .. |
14551 | 883 |
fix A |
21049 | 884 |
assume L: "A \<subseteq> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
885 |
let ?B = "Upper A" |
14551 | 886 |
from L top have "top \<in> ?B" by (fast intro!: Upper_memI intro: greatest_le) |
887 |
then have B_non_empty: "?B ~= {}" by fast |
|
21049 | 888 |
have B_L: "?B \<subseteq> L" by simp |
14551 | 889 |
from inf_exists [OF B_L B_non_empty] |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
890 |
obtain b where b_inf_B: "greatest b (Lower ?B)" .. |
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
891 |
have "least b (Upper A)" |
14551 | 892 |
apply (rule least_UpperI) |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
893 |
apply (rule greatest_le [where A = "Lower ?B"]) |
14551 | 894 |
apply (rule b_inf_B) |
895 |
apply (rule Lower_memI) |
|
896 |
apply (erule UpperD) |
|
897 |
apply assumption |
|
898 |
apply (rule L) |
|
899 |
apply (fast intro: L [THEN subsetD]) |
|
900 |
apply (erule greatest_Lower_above [OF b_inf_B]) |
|
901 |
apply simp |
|
902 |
apply (rule L) |
|
21049 | 903 |
apply (rule greatest_closed [OF b_inf_B]) (* rename rule: _closed *) |
14551 | 904 |
done |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
905 |
then show "EX s. least s (Upper A)" .. |
14551 | 906 |
next |
907 |
fix A |
|
21049 | 908 |
assume L: "A \<subseteq> L" |
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
909 |
show "EX i. greatest i (Lower A)" |
14551 | 910 |
proof (cases "A = {}") |
911 |
case True then show ?thesis |
|
912 |
by (simp add: top_exists) |
|
913 |
next |
|
914 |
case False with L show ?thesis |
|
915 |
by (rule inf_exists) |
|
916 |
qed |
|
917 |
qed |
|
918 |
||
919 |
(* TODO: prove dual version *) |
|
920 |
||
20318
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
19984
diff
changeset
|
921 |
|
14551 | 922 |
subsection {* Examples *} |
923 |
||
20318
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
19984
diff
changeset
|
924 |
subsubsection {* Powerset of a Set is a Complete Lattice *} |
14551 | 925 |
|
926 |
theorem powerset_is_complete_lattice: |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
927 |
"complete_lattice (Pow A) (op \<subseteq>)" |
21049 | 928 |
(is "complete_lattice ?L ?le") |
14551 | 929 |
proof (rule partial_order.complete_latticeI) |
21049 | 930 |
show "partial_order ?L ?le" |
14551 | 931 |
by (rule partial_order.intro) auto |
932 |
next |
|
933 |
fix B |
|
21049 | 934 |
assume "B \<subseteq> ?L" |
935 |
then have "order_syntax.least ?L ?le (\<Union> B) (order_syntax.Upper ?L ?le B)" |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
936 |
by (fastsimp intro!: order_syntax.least_UpperI simp: order_syntax.Upper_def) |
21049 | 937 |
then show "EX s. order_syntax.least ?L ?le s (order_syntax.Upper ?L ?le B)" .. |
14551 | 938 |
next |
939 |
fix B |
|
21049 | 940 |
assume "B \<subseteq> ?L" |
941 |
then have "order_syntax.greatest ?L ?le (\<Inter> B \<inter> A) (order_syntax.Lower ?L ?le B)" |
|
14551 | 942 |
txt {* @{term "\<Inter> B"} is not the infimum of @{term B}: |
943 |
@{term "\<Inter> {} = UNIV"} which is in general bigger than @{term "A"}! *} |
|
21041
60e418260b4d
Order and lattice structures no longer based on records.
ballarin
parents:
20318
diff
changeset
|
944 |
by (fastsimp intro!: order_syntax.greatest_LowerI simp: order_syntax.Lower_def) |
21049 | 945 |
then show "EX i. order_syntax.greatest ?L ?le i (order_syntax.Lower ?L ?le B)" .. |
14551 | 946 |
qed |
947 |
||
14751
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents:
14706
diff
changeset
|
948 |
text {* An other example, that of the lattice of subgroups of a group, |
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
ballarin
parents:
14706
diff
changeset
|
949 |
can be found in Group theory (Section~\ref{sec:subgroup-lattice}). *} |
14551 | 950 |
|
14693 | 951 |
end |