23 and le_trans [trans]: |
23 and le_trans [trans]: |
24 "[| x \<sqsubseteq> y; y \<sqsubseteq> z; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L |] ==> x \<sqsubseteq> z" |
24 "[| x \<sqsubseteq> y; y \<sqsubseteq> z; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L |] ==> x \<sqsubseteq> z" |
25 and le_cong: |
25 and le_cong: |
26 "\<lbrakk> x .= y; z .= w; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L; w \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> z \<longleftrightarrow> y \<sqsubseteq> w" |
26 "\<lbrakk> x .= y; z .= w; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L; w \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> z \<longleftrightarrow> y \<sqsubseteq> w" |
27 |
27 |
28 constdefs (structure L) |
28 definition |
29 lless :: "[_, 'a, 'a] => bool" (infixl "\<sqsubset>\<index>" 50) |
29 lless :: "[_, 'a, 'a] => bool" (infixl "\<sqsubset>\<index>" 50) |
30 "x \<sqsubset> y == x \<sqsubseteq> y & x .\<noteq> y" |
30 where "x \<sqsubset>\<^bsub>L\<^esub> y == x \<sqsubseteq>\<^bsub>L\<^esub> y & x .\<noteq>\<^bsub>L\<^esub> y" |
31 |
31 |
32 |
32 |
33 subsubsection {* The order relation *} |
33 subsubsection {* The order relation *} |
34 |
34 |
35 context weak_partial_order begin |
35 context weak_partial_order begin |
100 using assms unfolding lless_def by (blast dest: le_trans intro: sym) |
100 using assms unfolding lless_def by (blast dest: le_trans intro: sym) |
101 |
101 |
102 |
102 |
103 subsubsection {* Upper and lower bounds of a set *} |
103 subsubsection {* Upper and lower bounds of a set *} |
104 |
104 |
105 constdefs (structure L) |
105 definition |
106 Upper :: "[_, 'a set] => 'a set" |
106 Upper :: "[_, 'a set] => 'a set" |
107 "Upper L A == {u. (ALL x. x \<in> A \<inter> carrier L --> x \<sqsubseteq> u)} \<inter> carrier L" |
107 where "Upper L A == {u. (ALL x. x \<in> A \<inter> carrier L --> x \<sqsubseteq>\<^bsub>L\<^esub> u)} \<inter> carrier L" |
108 |
108 |
|
109 definition |
109 Lower :: "[_, 'a set] => 'a set" |
110 Lower :: "[_, 'a set] => 'a set" |
110 "Lower L A == {l. (ALL x. x \<in> A \<inter> carrier L --> l \<sqsubseteq> x)} \<inter> carrier L" |
111 where "Lower L A == {l. (ALL x. x \<in> A \<inter> carrier L --> l \<sqsubseteq>\<^bsub>L\<^esub> x)} \<inter> carrier L" |
111 |
112 |
112 lemma Upper_closed [intro!, simp]: |
113 lemma Upper_closed [intro!, simp]: |
113 "Upper L A \<subseteq> carrier L" |
114 "Upper L A \<subseteq> carrier L" |
114 by (unfold Upper_def) clarify |
115 by (unfold Upper_def) clarify |
115 |
116 |
273 qed |
274 qed |
274 |
275 |
275 |
276 |
276 subsubsection {* Least and greatest, as predicate *} |
277 subsubsection {* Least and greatest, as predicate *} |
277 |
278 |
278 constdefs (structure L) |
279 definition |
279 least :: "[_, 'a, 'a set] => bool" |
280 least :: "[_, 'a, 'a set] => bool" |
280 "least L l A == A \<subseteq> carrier L & l \<in> A & (ALL x : A. l \<sqsubseteq> x)" |
281 where "least L l A == A \<subseteq> carrier L & l \<in> A & (ALL x : A. l \<sqsubseteq>\<^bsub>L\<^esub> x)" |
281 |
282 |
|
283 definition |
282 greatest :: "[_, 'a, 'a set] => bool" |
284 greatest :: "[_, 'a, 'a set] => bool" |
283 "greatest L g A == A \<subseteq> carrier L & g \<in> A & (ALL x : A. x \<sqsubseteq> g)" |
285 where "greatest L g A == A \<subseteq> carrier L & g \<in> A & (ALL x : A. x \<sqsubseteq>\<^bsub>L\<^esub> g)" |
284 |
286 |
285 text (in weak_partial_order) {* Could weaken these to @{term "l \<in> carrier L \<and> l |
287 text (in weak_partial_order) {* Could weaken these to @{term "l \<in> carrier L \<and> l |
286 .\<in> A"} and @{term "g \<in> carrier L \<and> g .\<in> A"}. *} |
288 .\<in> A"} and @{term "g \<in> carrier L \<and> g .\<in> A"}. *} |
287 |
289 |
288 lemma least_closed [intro, simp]: |
290 lemma least_closed [intro, simp]: |
398 shows "[| greatest L i (Lower L A); x \<in> A; A \<subseteq> carrier L |] ==> i \<sqsubseteq> x" |
400 shows "[| greatest L i (Lower L A); x \<in> A; A \<subseteq> carrier L |] ==> i \<sqsubseteq> x" |
399 by (unfold greatest_def) blast |
401 by (unfold greatest_def) blast |
400 |
402 |
401 text {* Supremum and infimum *} |
403 text {* Supremum and infimum *} |
402 |
404 |
403 constdefs (structure L) |
405 definition |
404 sup :: "[_, 'a set] => 'a" ("\<Squnion>\<index>_" [90] 90) |
406 sup :: "[_, 'a set] => 'a" ("\<Squnion>\<index>_" [90] 90) |
405 "\<Squnion>A == SOME x. least L x (Upper L A)" |
407 where "\<Squnion>\<^bsub>L\<^esub>A == SOME x. least L x (Upper L A)" |
406 |
408 |
|
409 definition |
407 inf :: "[_, 'a set] => 'a" ("\<Sqinter>\<index>_" [90] 90) |
410 inf :: "[_, 'a set] => 'a" ("\<Sqinter>\<index>_" [90] 90) |
408 "\<Sqinter>A == SOME x. greatest L x (Lower L A)" |
411 where "\<Sqinter>\<^bsub>L\<^esub>A == SOME x. greatest L x (Lower L A)" |
409 |
412 |
|
413 definition |
410 join :: "[_, 'a, 'a] => 'a" (infixl "\<squnion>\<index>" 65) |
414 join :: "[_, 'a, 'a] => 'a" (infixl "\<squnion>\<index>" 65) |
411 "x \<squnion> y == \<Squnion> {x, y}" |
415 where "x \<squnion>\<^bsub>L\<^esub> y == \<Squnion>\<^bsub>L\<^esub>{x, y}" |
412 |
416 |
|
417 definition |
413 meet :: "[_, 'a, 'a] => 'a" (infixl "\<sqinter>\<index>" 70) |
418 meet :: "[_, 'a, 'a] => 'a" (infixl "\<sqinter>\<index>" 70) |
414 "x \<sqinter> y == \<Sqinter> {x, y}" |
419 where "x \<sqinter>\<^bsub>L\<^esub> y == \<Sqinter>\<^bsub>L\<^esub>{x, y}" |
415 |
420 |
416 |
421 |
417 subsection {* Lattices *} |
422 subsection {* Lattices *} |
418 |
423 |
419 locale weak_upper_semilattice = weak_partial_order + |
424 locale weak_upper_semilattice = weak_partial_order + |
979 and inf_exists: |
984 and inf_exists: |
980 "!!A. [| A \<subseteq> carrier L |] ==> EX i. greatest L i (Lower L A)" |
985 "!!A. [| A \<subseteq> carrier L |] ==> EX i. greatest L i (Lower L A)" |
981 shows "weak_complete_lattice L" |
986 shows "weak_complete_lattice L" |
982 proof qed (auto intro: sup_exists inf_exists) |
987 proof qed (auto intro: sup_exists inf_exists) |
983 |
988 |
984 constdefs (structure L) |
989 definition |
985 top :: "_ => 'a" ("\<top>\<index>") |
990 top :: "_ => 'a" ("\<top>\<index>") |
986 "\<top> == sup L (carrier L)" |
991 where "\<top>\<^bsub>L\<^esub> == sup L (carrier L)" |
987 |
992 |
|
993 definition |
988 bottom :: "_ => 'a" ("\<bottom>\<index>") |
994 bottom :: "_ => 'a" ("\<bottom>\<index>") |
989 "\<bottom> == inf L (carrier L)" |
995 where "\<bottom>\<^bsub>L\<^esub> == inf L (carrier L)" |
990 |
996 |
991 |
997 |
992 lemma (in weak_complete_lattice) supI: |
998 lemma (in weak_complete_lattice) supI: |
993 "[| !!l. least L l (Upper L A) ==> P l; A \<subseteq> carrier L |] |
999 "[| !!l. least L l (Upper L A) ==> P l; A \<subseteq> carrier L |] |
994 ==> P (\<Squnion>A)" |
1000 ==> P (\<Squnion>A)" |