| author | wenzelm | 
| Mon, 08 Nov 2010 11:28:22 +0100 | |
| changeset 40407 | 2ff10e613689 | 
| parent 40293 | cd932ab8cb59 | 
| child 44472 | 6f2943e34d60 | 
| permissions | -rw-r--r-- | 
| 35849 | 1 | (* Title: HOL/Algebra/Lattice.thy | 
| 2 | Author: Clemens Ballarin, started 7 November 2003 | |
| 3 | Copyright: Clemens Ballarin | |
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 4 | |
| 27717 
21bbd410ba04
Generalised polynomial lemmas from cring to ring.
 ballarin parents: 
27714diff
changeset | 5 | Most congruence rules by Stephan Hohe. | 
| 14551 | 6 | *) | 
| 7 | ||
| 35849 | 8 | theory Lattice | 
| 9 | imports Congruence | |
| 10 | begin | |
| 14551 | 11 | |
| 20318 
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
 ballarin parents: 
19984diff
changeset | 12 | section {* Orders and Lattices *}
 | 
| 14751 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 13 | |
| 14551 | 14 | subsection {* Partial Orders *}
 | 
| 15 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 16 | record 'a gorder = "'a eq_object" + | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 17 | le :: "['a, 'a] => bool" (infixl "\<sqsubseteq>\<index>" 50) | 
| 21041 
60e418260b4d
Order and lattice structures no longer based on records.
 ballarin parents: 
20318diff
changeset | 18 | |
| 29237 | 19 | locale weak_partial_order = equivalence L for L (structure) + | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 20 | assumes le_refl [intro, simp]: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 21 | "x \<in> carrier L ==> x \<sqsubseteq> x" | 
| 33657 | 22 | and weak_le_antisym [intro]: | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 23 | "[| x \<sqsubseteq> y; y \<sqsubseteq> x; x \<in> carrier L; y \<in> carrier L |] ==> x .= y" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 24 | and le_trans [trans]: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 25 | "[| x \<sqsubseteq> y; y \<sqsubseteq> z; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L |] ==> x \<sqsubseteq> z" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 26 | and le_cong: | 
| 40293 | 27 | "\<lbrakk> x .= y; z .= w; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L; w \<in> carrier L \<rbrakk> \<Longrightarrow> | 
| 28 | x \<sqsubseteq> z \<longleftrightarrow> y \<sqsubseteq> w" | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 29 | |
| 35847 | 30 | definition | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 31 | lless :: "[_, 'a, 'a] => bool" (infixl "\<sqsubset>\<index>" 50) | 
| 35848 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 wenzelm parents: 
35847diff
changeset | 32 | where "x \<sqsubset>\<^bsub>L\<^esub> y \<longleftrightarrow> x \<sqsubseteq>\<^bsub>L\<^esub> y & x .\<noteq>\<^bsub>L\<^esub> y" | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 33 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 34 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 35 | subsubsection {* The order relation *}
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 36 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 37 | context weak_partial_order begin | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 38 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 39 | lemma le_cong_l [intro, trans]: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 40 | "\<lbrakk> x .= y; y \<sqsubseteq> z; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> z" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 41 | by (auto intro: le_cong [THEN iffD2]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 42 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 43 | lemma le_cong_r [intro, trans]: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 44 | "\<lbrakk> x \<sqsubseteq> y; y .= z; x \<in> carrier L; y \<in> carrier L; z \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> z" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 45 | by (auto intro: le_cong [THEN iffD1]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 46 | |
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 47 | lemma weak_refl [intro, simp]: "\<lbrakk> x .= y; x \<in> carrier L; y \<in> carrier L \<rbrakk> \<Longrightarrow> x \<sqsubseteq> y" | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 48 | by (simp add: le_cong_l) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 49 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 50 | end | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 51 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 52 | lemma weak_llessI: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 53 | fixes R (structure) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 54 | assumes "x \<sqsubseteq> y" and "~(x .= y)" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 55 | shows "x \<sqsubset> y" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 56 | using assms unfolding lless_def by simp | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 57 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 58 | lemma lless_imp_le: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 59 | fixes R (structure) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 60 | assumes "x \<sqsubset> y" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 61 | shows "x \<sqsubseteq> y" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 62 | using assms unfolding lless_def by simp | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 63 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 64 | lemma weak_lless_imp_not_eq: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 65 | fixes R (structure) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 66 | assumes "x \<sqsubset> y" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 67 | shows "\<not> (x .= y)" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 68 | using assms unfolding lless_def by simp | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 69 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 70 | lemma weak_llessE: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 71 | fixes R (structure) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 72 | assumes p: "x \<sqsubset> y" and e: "\<lbrakk>x \<sqsubseteq> y; \<not> (x .= y)\<rbrakk> \<Longrightarrow> P" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 73 | shows "P" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 74 | using p by (blast dest: lless_imp_le weak_lless_imp_not_eq e) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 75 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 76 | lemma (in weak_partial_order) lless_cong_l [trans]: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 77 | assumes xx': "x .= x'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 78 | and xy: "x' \<sqsubset> y" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 79 | and carr: "x \<in> carrier L" "x' \<in> carrier L" "y \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 80 | shows "x \<sqsubset> y" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 81 | using assms unfolding lless_def by (auto intro: trans sym) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 82 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 83 | lemma (in weak_partial_order) lless_cong_r [trans]: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 84 | assumes xy: "x \<sqsubset> y" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 85 | and yy': "y .= y'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 86 | and carr: "x \<in> carrier L" "y \<in> carrier L" "y' \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 87 | shows "x \<sqsubset> y'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 88 | using assms unfolding lless_def by (auto intro: trans sym) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 89 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 90 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 91 | lemma (in weak_partial_order) lless_antisym: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 92 | assumes "a \<in> carrier L" "b \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 93 | and "a \<sqsubset> b" "b \<sqsubset> a" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 94 | shows "P" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 95 | using assms | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 96 | by (elim weak_llessE) auto | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 97 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 98 | lemma (in weak_partial_order) lless_trans [trans]: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 99 | assumes "a \<sqsubset> b" "b \<sqsubset> c" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 100 | and carr[simp]: "a \<in> carrier L" "b \<in> carrier L" "c \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 101 | shows "a \<sqsubset> c" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 102 | using assms unfolding lless_def by (blast dest: le_trans intro: sym) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 103 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 104 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 105 | subsubsection {* Upper and lower bounds of a set *}
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 106 | |
| 35847 | 107 | definition | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 108 | Upper :: "[_, 'a set] => 'a set" | 
| 35848 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 wenzelm parents: 
35847diff
changeset | 109 |   where "Upper L A = {u. (ALL x. x \<in> A \<inter> carrier L --> x \<sqsubseteq>\<^bsub>L\<^esub> u)} \<inter> carrier L"
 | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 110 | |
| 35847 | 111 | definition | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 112 | Lower :: "[_, 'a set] => 'a set" | 
| 35848 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 wenzelm parents: 
35847diff
changeset | 113 |   where "Lower L A = {l. (ALL x. x \<in> A \<inter> carrier L --> l \<sqsubseteq>\<^bsub>L\<^esub> x)} \<inter> carrier L"
 | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 114 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 115 | lemma Upper_closed [intro!, simp]: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 116 | "Upper L A \<subseteq> carrier L" | 
| 14551 | 117 | by (unfold Upper_def) clarify | 
| 118 | ||
| 27700 | 119 | lemma Upper_memD [dest]: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 120 | fixes L (structure) | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 121 | shows "[| u \<in> Upper L A; x \<in> A; A \<subseteq> carrier L |] ==> x \<sqsubseteq> u \<and> u \<in> carrier L" | 
| 14693 | 122 | by (unfold Upper_def) blast | 
| 14551 | 123 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 124 | lemma (in weak_partial_order) Upper_elemD [dest]: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 125 | "[| u .\<in> Upper L A; u \<in> carrier L; x \<in> A; A \<subseteq> carrier L |] ==> x \<sqsubseteq> u" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 126 | unfolding Upper_def elem_def | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 127 | by (blast dest: sym) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 128 | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 129 | lemma Upper_memI: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 130 | fixes L (structure) | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 131 | shows "[| !! y. y \<in> A ==> y \<sqsubseteq> x; x \<in> carrier L |] ==> x \<in> Upper L A" | 
| 14693 | 132 | by (unfold Upper_def) blast | 
| 14551 | 133 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 134 | lemma (in weak_partial_order) Upper_elemI: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 135 | "[| !! y. y \<in> A ==> y \<sqsubseteq> x; x \<in> carrier L |] ==> x .\<in> Upper L A" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 136 | unfolding Upper_def by blast | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 137 | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 138 | lemma Upper_antimono: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 139 | "A \<subseteq> B ==> Upper L B \<subseteq> Upper L A" | 
| 14551 | 140 | by (unfold Upper_def) blast | 
| 141 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 142 | lemma (in weak_partial_order) Upper_is_closed [simp]: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 143 | "A \<subseteq> carrier L ==> is_closed (Upper L A)" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 144 | by (rule is_closedI) (blast intro: Upper_memI)+ | 
| 14651 | 145 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 146 | lemma (in weak_partial_order) Upper_mem_cong: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 147 | assumes a'carr: "a' \<in> carrier L" and Acarr: "A \<subseteq> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 148 | and aa': "a .= a'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 149 | and aelem: "a \<in> Upper L A" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 150 | shows "a' \<in> Upper L A" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 151 | proof (rule Upper_memI[OF _ a'carr]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 152 | fix y | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 153 | assume yA: "y \<in> A" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 154 | hence "y \<sqsubseteq> a" by (intro Upper_memD[OF aelem, THEN conjunct1] Acarr) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 155 | also note aa' | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 156 | finally | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 157 | show "y \<sqsubseteq> a'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 158 | by (simp add: a'carr subsetD[OF Acarr yA] subsetD[OF Upper_closed aelem]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 159 | qed | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 160 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 161 | lemma (in weak_partial_order) Upper_cong: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 162 | assumes Acarr: "A \<subseteq> carrier L" and A'carr: "A' \<subseteq> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 163 |     and AA': "A {.=} A'"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 164 | shows "Upper L A = Upper L A'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 165 | unfolding Upper_def | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 166 | apply rule | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 167 | apply (rule, clarsimp) defer 1 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 168 | apply (rule, clarsimp) defer 1 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 169 | proof - | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 170 | fix x a' | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 171 | assume carr: "x \<in> carrier L" "a' \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 172 | and a'A': "a' \<in> A'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 173 | assume aLxCond[rule_format]: "\<forall>a. a \<in> A \<and> a \<in> carrier L \<longrightarrow> a \<sqsubseteq> x" | 
| 14551 | 174 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 175 | from AA' and a'A' have "\<exists>a\<in>A. a' .= a" by (rule set_eqD2) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 176 | from this obtain a | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 177 | where aA: "a \<in> A" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 178 | and a'a: "a' .= a" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 179 | by auto | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 180 | note [simp] = subsetD[OF Acarr aA] carr | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 181 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 182 | note a'a | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 183 | also have "a \<sqsubseteq> x" by (simp add: aLxCond aA) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 184 | finally show "a' \<sqsubseteq> x" by simp | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 185 | next | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 186 | fix x a | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 187 | assume carr: "x \<in> carrier L" "a \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 188 | and aA: "a \<in> A" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 189 | assume a'LxCond[rule_format]: "\<forall>a'. a' \<in> A' \<and> a' \<in> carrier L \<longrightarrow> a' \<sqsubseteq> x" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 190 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 191 | from AA' and aA have "\<exists>a'\<in>A'. a .= a'" by (rule set_eqD1) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 192 | from this obtain a' | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 193 | where a'A': "a' \<in> A'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 194 | and aa': "a .= a'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 195 | by auto | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 196 | note [simp] = subsetD[OF A'carr a'A'] carr | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 197 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 198 | note aa' | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 199 | also have "a' \<sqsubseteq> x" by (simp add: a'LxCond a'A') | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 200 | finally show "a \<sqsubseteq> x" by simp | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 201 | qed | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 202 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 203 | lemma Lower_closed [intro!, simp]: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 204 | "Lower L A \<subseteq> carrier L" | 
| 14551 | 205 | by (unfold Lower_def) clarify | 
| 206 | ||
| 27700 | 207 | lemma Lower_memD [dest]: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 208 | fixes L (structure) | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 209 | shows "[| l \<in> Lower L A; x \<in> A; A \<subseteq> carrier L |] ==> l \<sqsubseteq> x \<and> l \<in> carrier L" | 
| 14693 | 210 | by (unfold Lower_def) blast | 
| 14551 | 211 | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 212 | lemma Lower_memI: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 213 | fixes L (structure) | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 214 | shows "[| !! y. y \<in> A ==> x \<sqsubseteq> y; x \<in> carrier L |] ==> x \<in> Lower L A" | 
| 14693 | 215 | by (unfold Lower_def) blast | 
| 14551 | 216 | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 217 | lemma Lower_antimono: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 218 | "A \<subseteq> B ==> Lower L B \<subseteq> Lower L A" | 
| 14551 | 219 | by (unfold Lower_def) blast | 
| 220 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 221 | lemma (in weak_partial_order) Lower_is_closed [simp]: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 222 | "A \<subseteq> carrier L \<Longrightarrow> is_closed (Lower L A)" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 223 | by (rule is_closedI) (blast intro: Lower_memI dest: sym)+ | 
| 14651 | 224 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 225 | lemma (in weak_partial_order) Lower_mem_cong: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 226 | assumes a'carr: "a' \<in> carrier L" and Acarr: "A \<subseteq> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 227 | and aa': "a .= a'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 228 | and aelem: "a \<in> Lower L A" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 229 | shows "a' \<in> Lower L A" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 230 | using assms Lower_closed[of L A] | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 231 | by (intro Lower_memI) (blast intro: le_cong_l[OF aa'[symmetric]]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 232 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 233 | lemma (in weak_partial_order) Lower_cong: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 234 | assumes Acarr: "A \<subseteq> carrier L" and A'carr: "A' \<subseteq> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 235 |     and AA': "A {.=} A'"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 236 | shows "Lower L A = Lower L A'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 237 | unfolding Lower_def | 
| 39990 | 238 | apply rule | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 239 | apply clarsimp defer 1 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 240 | apply clarsimp defer 1 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 241 | proof - | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 242 | fix x a' | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 243 | assume carr: "x \<in> carrier L" "a' \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 244 | and a'A': "a' \<in> A'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 245 | assume "\<forall>a. a \<in> A \<and> a \<in> carrier L \<longrightarrow> x \<sqsubseteq> a" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 246 | hence aLxCond: "\<And>a. \<lbrakk>a \<in> A; a \<in> carrier L\<rbrakk> \<Longrightarrow> x \<sqsubseteq> a" by fast | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 247 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 248 | from AA' and a'A' have "\<exists>a\<in>A. a' .= a" by (rule set_eqD2) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 249 | from this obtain a | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 250 | where aA: "a \<in> A" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 251 | and a'a: "a' .= a" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 252 | by auto | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 253 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 254 | from aA and subsetD[OF Acarr aA] | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 255 | have "x \<sqsubseteq> a" by (rule aLxCond) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 256 | also note a'a[symmetric] | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 257 | finally | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 258 | show "x \<sqsubseteq> a'" by (simp add: carr subsetD[OF Acarr aA]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 259 | next | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 260 | fix x a | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 261 | assume carr: "x \<in> carrier L" "a \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 262 | and aA: "a \<in> A" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 263 | assume "\<forall>a'. a' \<in> A' \<and> a' \<in> carrier L \<longrightarrow> x \<sqsubseteq> a'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 264 | hence a'LxCond: "\<And>a'. \<lbrakk>a' \<in> A'; a' \<in> carrier L\<rbrakk> \<Longrightarrow> x \<sqsubseteq> a'" by fast+ | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 265 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 266 | from AA' and aA have "\<exists>a'\<in>A'. a .= a'" by (rule set_eqD1) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 267 | from this obtain a' | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 268 | where a'A': "a' \<in> A'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 269 | and aa': "a .= a'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 270 | by auto | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 271 | from a'A' and subsetD[OF A'carr a'A'] | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 272 | have "x \<sqsubseteq> a'" by (rule a'LxCond) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 273 | also note aa'[symmetric] | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 274 | finally show "x \<sqsubseteq> a" by (simp add: carr subsetD[OF A'carr a'A']) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 275 | qed | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 276 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 277 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 278 | subsubsection {* Least and greatest, as predicate *}
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 279 | |
| 35847 | 280 | definition | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 281 | least :: "[_, 'a, 'a set] => bool" | 
| 35848 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 wenzelm parents: 
35847diff
changeset | 282 | where "least L l A \<longleftrightarrow> A \<subseteq> carrier L & l \<in> A & (ALL x : A. l \<sqsubseteq>\<^bsub>L\<^esub> x)" | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 283 | |
| 35847 | 284 | definition | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 285 | greatest :: "[_, 'a, 'a set] => bool" | 
| 35848 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 wenzelm parents: 
35847diff
changeset | 286 | where "greatest L g A \<longleftrightarrow> A \<subseteq> carrier L & g \<in> A & (ALL x : A. x \<sqsubseteq>\<^bsub>L\<^esub> g)" | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 287 | |
| 30363 
9b8d9b6ef803
proper local context for text with antiquotations;
 wenzelm parents: 
29242diff
changeset | 288 | text (in weak_partial_order) {* Could weaken these to @{term "l \<in> carrier L \<and> l
 | 
| 
9b8d9b6ef803
proper local context for text with antiquotations;
 wenzelm parents: 
29242diff
changeset | 289 |   .\<in> A"} and @{term "g \<in> carrier L \<and> g .\<in> A"}. *}
 | 
| 14551 | 290 | |
| 27700 | 291 | lemma least_closed [intro, simp]: | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 292 | "least L l A ==> l \<in> carrier L" | 
| 14551 | 293 | by (unfold least_def) fast | 
| 294 | ||
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 295 | lemma least_mem: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 296 | "least L l A ==> l \<in> A" | 
| 14551 | 297 | by (unfold least_def) fast | 
| 298 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 299 | lemma (in weak_partial_order) weak_least_unique: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 300 | "[| least L x A; least L y A |] ==> x .= y" | 
| 14551 | 301 | by (unfold least_def) blast | 
| 302 | ||
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 303 | lemma least_le: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 304 | fixes L (structure) | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 305 | shows "[| least L x A; a \<in> A |] ==> x \<sqsubseteq> a" | 
| 14551 | 306 | by (unfold least_def) fast | 
| 307 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 308 | lemma (in weak_partial_order) least_cong: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 309 | "[| x .= x'; x \<in> carrier L; x' \<in> carrier L; is_closed A |] ==> least L x A = least L x' A" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 310 | by (unfold least_def) (auto dest: sym) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 311 | |
| 30363 
9b8d9b6ef803
proper local context for text with antiquotations;
 wenzelm parents: 
29242diff
changeset | 312 | text (in weak_partial_order) {* @{const least} is not congruent in the second parameter for 
 | 
| 
9b8d9b6ef803
proper local context for text with antiquotations;
 wenzelm parents: 
29242diff
changeset | 313 |   @{term "A {.=} A'"} *}
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 314 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 315 | lemma (in weak_partial_order) least_Upper_cong_l: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 316 | assumes "x .= x'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 317 | and "x \<in> carrier L" "x' \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 318 | and "A \<subseteq> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 319 | shows "least L x (Upper L A) = least L x' (Upper L A)" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 320 | apply (rule least_cong) using assms by auto | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 321 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 322 | lemma (in weak_partial_order) least_Upper_cong_r: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 323 | assumes Acarrs: "A \<subseteq> carrier L" "A' \<subseteq> carrier L" (* unneccessary with current Upper? *) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 324 |     and AA': "A {.=} A'"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 325 | shows "least L x (Upper L A) = least L x (Upper L A')" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 326 | apply (subgoal_tac "Upper L A = Upper L A'", simp) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 327 | by (rule Upper_cong) fact+ | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 328 | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 329 | lemma least_UpperI: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 330 | fixes L (structure) | 
| 14551 | 331 | assumes above: "!! x. x \<in> A ==> x \<sqsubseteq> s" | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 332 | and below: "!! y. y \<in> Upper L A ==> s \<sqsubseteq> y" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 333 | and L: "A \<subseteq> carrier L" "s \<in> carrier L" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 334 | shows "least L s (Upper L A)" | 
| 14693 | 335 | proof - | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 336 | have "Upper L A \<subseteq> carrier L" by simp | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 337 | moreover from above L have "s \<in> Upper L A" by (simp add: Upper_def) | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 338 | moreover from below have "ALL x : Upper L A. s \<sqsubseteq> x" by fast | 
| 14693 | 339 | ultimately show ?thesis by (simp add: least_def) | 
| 14551 | 340 | qed | 
| 341 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 342 | lemma least_Upper_above: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 343 | fixes L (structure) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 344 | shows "[| least L s (Upper L A); x \<in> A; A \<subseteq> carrier L |] ==> x \<sqsubseteq> s" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 345 | by (unfold least_def) blast | 
| 14551 | 346 | |
| 27700 | 347 | lemma greatest_closed [intro, simp]: | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 348 | "greatest L l A ==> l \<in> carrier L" | 
| 14551 | 349 | by (unfold greatest_def) fast | 
| 350 | ||
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 351 | lemma greatest_mem: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 352 | "greatest L l A ==> l \<in> A" | 
| 14551 | 353 | by (unfold greatest_def) fast | 
| 354 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 355 | lemma (in weak_partial_order) weak_greatest_unique: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 356 | "[| greatest L x A; greatest L y A |] ==> x .= y" | 
| 14551 | 357 | by (unfold greatest_def) blast | 
| 358 | ||
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 359 | lemma greatest_le: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 360 | fixes L (structure) | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 361 | shows "[| greatest L x A; a \<in> A |] ==> a \<sqsubseteq> x" | 
| 14551 | 362 | by (unfold greatest_def) fast | 
| 363 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 364 | lemma (in weak_partial_order) greatest_cong: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 365 | "[| x .= x'; x \<in> carrier L; x' \<in> carrier L; is_closed A |] ==> | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 366 | greatest L x A = greatest L x' A" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 367 | by (unfold greatest_def) (auto dest: sym) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 368 | |
| 30363 
9b8d9b6ef803
proper local context for text with antiquotations;
 wenzelm parents: 
29242diff
changeset | 369 | text (in weak_partial_order) {* @{const greatest} is not congruent in the second parameter for 
 | 
| 
9b8d9b6ef803
proper local context for text with antiquotations;
 wenzelm parents: 
29242diff
changeset | 370 |   @{term "A {.=} A'"} *}
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 371 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 372 | lemma (in weak_partial_order) greatest_Lower_cong_l: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 373 | assumes "x .= x'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 374 | and "x \<in> carrier L" "x' \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 375 | and "A \<subseteq> carrier L" (* unneccessary with current Lower *) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 376 | shows "greatest L x (Lower L A) = greatest L x' (Lower L A)" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 377 | apply (rule greatest_cong) using assms by auto | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 378 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 379 | lemma (in weak_partial_order) greatest_Lower_cong_r: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 380 | assumes Acarrs: "A \<subseteq> carrier L" "A' \<subseteq> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 381 |     and AA': "A {.=} A'"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 382 | shows "greatest L x (Lower L A) = greatest L x (Lower L A')" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 383 | apply (subgoal_tac "Lower L A = Lower L A'", simp) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 384 | by (rule Lower_cong) fact+ | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 385 | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 386 | lemma greatest_LowerI: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 387 | fixes L (structure) | 
| 14551 | 388 | assumes below: "!! x. x \<in> A ==> i \<sqsubseteq> x" | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 389 | and above: "!! y. y \<in> Lower L A ==> y \<sqsubseteq> i" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 390 | and L: "A \<subseteq> carrier L" "i \<in> carrier L" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 391 | shows "greatest L i (Lower L A)" | 
| 14693 | 392 | proof - | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 393 | have "Lower L A \<subseteq> carrier L" by simp | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 394 | moreover from below L have "i \<in> Lower L A" by (simp add: Lower_def) | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 395 | moreover from above have "ALL x : Lower L A. x \<sqsubseteq> i" by fast | 
| 14693 | 396 | ultimately show ?thesis by (simp add: greatest_def) | 
| 14551 | 397 | qed | 
| 398 | ||
| 27700 | 399 | lemma greatest_Lower_below: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 400 | fixes L (structure) | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 401 | shows "[| greatest L i (Lower L A); x \<in> A; A \<subseteq> carrier L |] ==> i \<sqsubseteq> x" | 
| 14551 | 402 | by (unfold greatest_def) blast | 
| 403 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 404 | text {* Supremum and infimum *}
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 405 | |
| 35847 | 406 | definition | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 407 |   sup :: "[_, 'a set] => 'a" ("\<Squnion>\<index>_" [90] 90)
 | 
| 35848 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 wenzelm parents: 
35847diff
changeset | 408 | where "\<Squnion>\<^bsub>L\<^esub>A = (SOME x. least L x (Upper L A))" | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 409 | |
| 35847 | 410 | definition | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 411 |   inf :: "[_, 'a set] => 'a" ("\<Sqinter>\<index>_" [90] 90)
 | 
| 35848 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 wenzelm parents: 
35847diff
changeset | 412 | where "\<Sqinter>\<^bsub>L\<^esub>A = (SOME x. greatest L x (Lower L A))" | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 413 | |
| 35847 | 414 | definition | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 415 | join :: "[_, 'a, 'a] => 'a" (infixl "\<squnion>\<index>" 65) | 
| 35848 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 wenzelm parents: 
35847diff
changeset | 416 |   where "x \<squnion>\<^bsub>L\<^esub> y = \<Squnion>\<^bsub>L\<^esub>{x, y}"
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 417 | |
| 35847 | 418 | definition | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 419 | meet :: "[_, 'a, 'a] => 'a" (infixl "\<sqinter>\<index>" 70) | 
| 35848 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 wenzelm parents: 
35847diff
changeset | 420 |   where "x \<sqinter>\<^bsub>L\<^esub> y = \<Sqinter>\<^bsub>L\<^esub>{x, y}"
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 421 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 422 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 423 | subsection {* Lattices *}
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 424 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 425 | locale weak_upper_semilattice = weak_partial_order + | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 426 | assumes sup_of_two_exists: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 427 |     "[| x \<in> carrier L; y \<in> carrier L |] ==> EX s. least L s (Upper L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 428 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 429 | locale weak_lower_semilattice = weak_partial_order + | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 430 | assumes inf_of_two_exists: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 431 |     "[| x \<in> carrier L; y \<in> carrier L |] ==> EX s. greatest L s (Lower L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 432 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 433 | locale weak_lattice = weak_upper_semilattice + weak_lower_semilattice | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 434 | |
| 14666 | 435 | |
| 14551 | 436 | subsubsection {* Supremum *}
 | 
| 437 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 438 | lemma (in weak_upper_semilattice) joinI: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 439 |   "[| !!l. least L l (Upper L {x, y}) ==> P l; x \<in> carrier L; y \<in> carrier L |]
 | 
| 14551 | 440 | ==> P (x \<squnion> y)" | 
| 441 | proof (unfold join_def sup_def) | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 442 | assume L: "x \<in> carrier L" "y \<in> carrier L" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 443 |     and P: "!!l. least L l (Upper L {x, y}) ==> P l"
 | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 444 |   with sup_of_two_exists obtain s where "least L s (Upper L {x, y})" by fast
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 445 |   with L show "P (SOME l. least L l (Upper L {x, y}))"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 446 | by (fast intro: someI2 P) | 
| 14551 | 447 | qed | 
| 448 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 449 | lemma (in weak_upper_semilattice) join_closed [simp]: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 450 | "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<squnion> y \<in> carrier L" | 
| 27700 | 451 | by (rule joinI) (rule least_closed) | 
| 14551 | 452 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 453 | lemma (in weak_upper_semilattice) join_cong_l: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 454 | assumes carr: "x \<in> carrier L" "x' \<in> carrier L" "y \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 455 | and xx': "x .= x'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 456 | shows "x \<squnion> y .= x' \<squnion> y" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 457 | proof (rule joinI, rule joinI) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 458 | fix a b | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 459 | from xx' carr | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 460 |       have seq: "{x, y} {.=} {x', y}" by (rule set_eq_pairI)
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 461 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 462 |   assume leasta: "least L a (Upper L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 463 |   assume "least L b (Upper L {x', y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 464 | with carr | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 465 |       have leastb: "least L b (Upper L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 466 | by (simp add: least_Upper_cong_r[OF _ _ seq]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 467 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 468 | from leasta leastb | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 469 | show "a .= b" by (rule weak_least_unique) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 470 | qed (rule carr)+ | 
| 14551 | 471 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 472 | lemma (in weak_upper_semilattice) join_cong_r: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 473 | assumes carr: "x \<in> carrier L" "y \<in> carrier L" "y' \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 474 | and yy': "y .= y'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 475 | shows "x \<squnion> y .= x \<squnion> y'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 476 | proof (rule joinI, rule joinI) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 477 | fix a b | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 478 |   have "{x, y} = {y, x}" by fast
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 479 | also from carr yy' | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 480 |       have "{y, x} {.=} {y', x}" by (intro set_eq_pairI)
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 481 |   also have "{y', x} = {x, y'}" by fast
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 482 | finally | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 483 |       have seq: "{x, y} {.=} {x, y'}" .
 | 
| 14551 | 484 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 485 |   assume leasta: "least L a (Upper L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 486 |   assume "least L b (Upper L {x, y'})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 487 | with carr | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 488 |       have leastb: "least L b (Upper L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 489 | by (simp add: least_Upper_cong_r[OF _ _ seq]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 490 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 491 | from leasta leastb | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 492 | show "a .= b" by (rule weak_least_unique) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 493 | qed (rule carr)+ | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 494 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 495 | lemma (in weak_partial_order) sup_of_singletonI: (* only reflexivity needed ? *) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 496 |   "x \<in> carrier L ==> least L x (Upper L {x})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 497 | by (rule least_UpperI) auto | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 498 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 499 | lemma (in weak_partial_order) weak_sup_of_singleton [simp]: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 500 |   "x \<in> carrier L ==> \<Squnion>{x} .= x"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 501 | unfolding sup_def | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 502 | by (rule someI2) (auto intro: weak_least_unique sup_of_singletonI) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 503 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 504 | lemma (in weak_partial_order) sup_of_singleton_closed [simp]: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 505 |   "x \<in> carrier L \<Longrightarrow> \<Squnion>{x} \<in> carrier L"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 506 | unfolding sup_def | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 507 | by (rule someI2) (auto intro: sup_of_singletonI) | 
| 14666 | 508 | |
| 509 | text {* Condition on @{text A}: supremum exists. *}
 | |
| 14551 | 510 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 511 | lemma (in weak_upper_semilattice) sup_insertI: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 512 | "[| !!s. least L s (Upper L (insert x A)) ==> P s; | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 513 | least L a (Upper L A); x \<in> carrier L; A \<subseteq> carrier L |] | 
| 14693 | 514 | ==> P (\<Squnion>(insert x A))" | 
| 14551 | 515 | proof (unfold sup_def) | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 516 | assume L: "x \<in> carrier L" "A \<subseteq> carrier L" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 517 | and P: "!!l. least L l (Upper L (insert x A)) ==> P l" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 518 | and least_a: "least L a (Upper L A)" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 519 | from L least_a have La: "a \<in> carrier L" by simp | 
| 14551 | 520 | from L sup_of_two_exists least_a | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 521 |   obtain s where least_s: "least L s (Upper L {a, x})" by blast
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 522 | show "P (SOME l. least L l (Upper L (insert x A)))" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 523 | proof (rule someI2) | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 524 | show "least L s (Upper L (insert x A))" | 
| 14551 | 525 | proof (rule least_UpperI) | 
| 526 | fix z | |
| 14693 | 527 | assume "z \<in> insert x A" | 
| 528 | then show "z \<sqsubseteq> s" | |
| 529 | proof | |
| 530 | assume "z = x" then show ?thesis | |
| 531 | by (simp add: least_Upper_above [OF least_s] L La) | |
| 532 | next | |
| 533 | assume "z \<in> A" | |
| 534 | with L least_s least_a show ?thesis | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 535 | by (rule_tac le_trans [where y = a]) (auto dest: least_Upper_above) | 
| 14693 | 536 | qed | 
| 537 | next | |
| 538 | fix y | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 539 | assume y: "y \<in> Upper L (insert x A)" | 
| 14693 | 540 | show "s \<sqsubseteq> y" | 
| 541 | proof (rule least_le [OF least_s], rule Upper_memI) | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 542 | fix z | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 543 |         assume z: "z \<in> {a, x}"
 | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 544 | then show "z \<sqsubseteq> y" | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 545 | proof | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 546 | have y': "y \<in> Upper L A" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 547 | apply (rule subsetD [where A = "Upper L (insert x A)"]) | 
| 23463 | 548 | apply (rule Upper_antimono) | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 549 | apply blast | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 550 | apply (rule y) | 
| 14693 | 551 | done | 
| 552 | assume "z = a" | |
| 553 | with y' least_a show ?thesis by (fast dest: least_le) | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 554 | next | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 555 |           assume "z \<in> {x}"  (* FIXME "z = x"; declare specific elim rule for "insert x {}" (!?) *)
 | 
| 14693 | 556 | with y L show ?thesis by blast | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 557 | qed | 
| 23350 | 558 | qed (rule Upper_closed [THEN subsetD, OF y]) | 
| 14693 | 559 | next | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 560 | from L show "insert x A \<subseteq> carrier L" by simp | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 561 | from least_s show "s \<in> carrier L" by simp | 
| 14551 | 562 | qed | 
| 23350 | 563 | qed (rule P) | 
| 14551 | 564 | qed | 
| 565 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 566 | lemma (in weak_upper_semilattice) finite_sup_least: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 567 |   "[| finite A; A \<subseteq> carrier L; A ~= {} |] ==> least L (\<Squnion>A) (Upper L A)"
 | 
| 22265 | 568 | proof (induct set: finite) | 
| 14693 | 569 | case empty | 
| 570 | then show ?case by simp | |
| 14551 | 571 | next | 
| 15328 | 572 | case (insert x A) | 
| 14551 | 573 | show ?case | 
| 574 |   proof (cases "A = {}")
 | |
| 575 | case True | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 576 | with insert show ?thesis | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 577 | by simp (simp add: least_cong [OF weak_sup_of_singleton] | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 578 | sup_of_singleton_closed sup_of_singletonI) | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 579 | (* The above step is hairy; least_cong can make simp loop. | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 580 | Would want special version of simp to apply least_cong. *) | 
| 14551 | 581 | next | 
| 582 | case False | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 583 | with insert have "least L (\<Squnion>A) (Upper L A)" by simp | 
| 14693 | 584 | with _ show ?thesis | 
| 585 | by (rule sup_insertI) (simp_all add: insert [simplified]) | |
| 14551 | 586 | qed | 
| 587 | qed | |
| 588 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 589 | lemma (in weak_upper_semilattice) finite_sup_insertI: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 590 | assumes P: "!!l. least L l (Upper L (insert x A)) ==> P l" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 591 | and xA: "finite A" "x \<in> carrier L" "A \<subseteq> carrier L" | 
| 14551 | 592 | shows "P (\<Squnion> (insert x A))" | 
| 593 | proof (cases "A = {}")
 | |
| 594 | case True with P and xA show ?thesis | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 595 | by (simp add: finite_sup_least) | 
| 14551 | 596 | next | 
| 597 | case False with P and xA show ?thesis | |
| 598 | by (simp add: sup_insertI finite_sup_least) | |
| 599 | qed | |
| 600 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 601 | lemma (in weak_upper_semilattice) finite_sup_closed [simp]: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 602 |   "[| finite A; A \<subseteq> carrier L; A ~= {} |] ==> \<Squnion>A \<in> carrier L"
 | 
| 22265 | 603 | proof (induct set: finite) | 
| 14551 | 604 | case empty then show ?case by simp | 
| 605 | next | |
| 15328 | 606 | case insert then show ?case | 
| 14693 | 607 | by - (rule finite_sup_insertI, simp_all) | 
| 14551 | 608 | qed | 
| 609 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 610 | lemma (in weak_upper_semilattice) join_left: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 611 | "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> x \<squnion> y" | 
| 14693 | 612 | by (rule joinI [folded join_def]) (blast dest: least_mem) | 
| 14551 | 613 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 614 | lemma (in weak_upper_semilattice) join_right: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 615 | "[| x \<in> carrier L; y \<in> carrier L |] ==> y \<sqsubseteq> x \<squnion> y" | 
| 14693 | 616 | by (rule joinI [folded join_def]) (blast dest: least_mem) | 
| 14551 | 617 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 618 | lemma (in weak_upper_semilattice) sup_of_two_least: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 619 |   "[| x \<in> carrier L; y \<in> carrier L |] ==> least L (\<Squnion>{x, y}) (Upper L {x, y})"
 | 
| 14551 | 620 | proof (unfold sup_def) | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 621 | assume L: "x \<in> carrier L" "y \<in> carrier L" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 622 |   with sup_of_two_exists obtain s where "least L s (Upper L {x, y})" by fast
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 623 |   with L show "least L (SOME z. least L z (Upper L {x, y})) (Upper L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 624 | by (fast intro: someI2 weak_least_unique) (* blast fails *) | 
| 14551 | 625 | qed | 
| 626 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 627 | lemma (in weak_upper_semilattice) join_le: | 
| 14693 | 628 | assumes sub: "x \<sqsubseteq> z" "y \<sqsubseteq> z" | 
| 23350 | 629 | and x: "x \<in> carrier L" and y: "y \<in> carrier L" and z: "z \<in> carrier L" | 
| 14551 | 630 | shows "x \<squnion> y \<sqsubseteq> z" | 
| 23350 | 631 | proof (rule joinI [OF _ x y]) | 
| 14551 | 632 | fix s | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 633 |   assume "least L s (Upper L {x, y})"
 | 
| 23350 | 634 | with sub z show "s \<sqsubseteq> z" by (fast elim: least_le intro: Upper_memI) | 
| 14551 | 635 | qed | 
| 14693 | 636 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 637 | lemma (in weak_upper_semilattice) weak_join_assoc_lemma: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 638 | assumes L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 639 |   shows "x \<squnion> (y \<squnion> z) .= \<Squnion>{x, y, z}"
 | 
| 14551 | 640 | proof (rule finite_sup_insertI) | 
| 14651 | 641 |   -- {* The textbook argument in Jacobson I, p 457 *}
 | 
| 14551 | 642 | fix s | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 643 |   assume sup: "least L s (Upper L {x, y, z})"
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 644 | show "x \<squnion> (y \<squnion> z) .= s" | 
| 33657 | 645 | proof (rule weak_le_antisym) | 
| 14551 | 646 | from sup L show "x \<squnion> (y \<squnion> z) \<sqsubseteq> s" | 
| 647 | by (fastsimp intro!: join_le elim: least_Upper_above) | |
| 648 | next | |
| 649 | from sup L show "s \<sqsubseteq> x \<squnion> (y \<squnion> z)" | |
| 650 | by (erule_tac least_le) | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 651 | (blast intro!: Upper_memI intro: le_trans join_left join_right join_closed) | 
| 27700 | 652 | qed (simp_all add: L least_closed [OF sup]) | 
| 14551 | 653 | qed (simp_all add: L) | 
| 654 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 655 | text {* Commutativity holds for @{text "="}. *}
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 656 | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 657 | lemma join_comm: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 658 | fixes L (structure) | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 659 | shows "x \<squnion> y = y \<squnion> x" | 
| 14551 | 660 | by (unfold join_def) (simp add: insert_commute) | 
| 661 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 662 | lemma (in weak_upper_semilattice) weak_join_assoc: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 663 | assumes L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 664 | shows "(x \<squnion> y) \<squnion> z .= x \<squnion> (y \<squnion> z)" | 
| 14551 | 665 | proof - | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 666 | (* FIXME: could be simplified by improved simp: uniform use of .=, | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 667 | omit [symmetric] in last step. *) | 
| 14551 | 668 | have "(x \<squnion> y) \<squnion> z = z \<squnion> (x \<squnion> y)" by (simp only: join_comm) | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 669 |   also from L have "... .= \<Squnion>{z, x, y}" by (simp add: weak_join_assoc_lemma)
 | 
| 14693 | 670 |   also from L have "... = \<Squnion>{x, y, z}" by (simp add: insert_commute)
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 671 | also from L have "... .= x \<squnion> (y \<squnion> z)" by (simp add: weak_join_assoc_lemma [symmetric]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 672 | finally show ?thesis by (simp add: L) | 
| 14551 | 673 | qed | 
| 674 | ||
| 14693 | 675 | |
| 14551 | 676 | subsubsection {* Infimum *}
 | 
| 677 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 678 | lemma (in weak_lower_semilattice) meetI: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 679 |   "[| !!i. greatest L i (Lower L {x, y}) ==> P i;
 | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 680 | x \<in> carrier L; y \<in> carrier L |] | 
| 14551 | 681 | ==> P (x \<sqinter> y)" | 
| 682 | proof (unfold meet_def inf_def) | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 683 | assume L: "x \<in> carrier L" "y \<in> carrier L" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 684 |     and P: "!!g. greatest L g (Lower L {x, y}) ==> P g"
 | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 685 |   with inf_of_two_exists obtain i where "greatest L i (Lower L {x, y})" by fast
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 686 |   with L show "P (SOME g. greatest L g (Lower L {x, y}))"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 687 | by (fast intro: someI2 weak_greatest_unique P) | 
| 14551 | 688 | qed | 
| 689 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 690 | lemma (in weak_lower_semilattice) meet_closed [simp]: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 691 | "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqinter> y \<in> carrier L" | 
| 27700 | 692 | by (rule meetI) (rule greatest_closed) | 
| 14551 | 693 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 694 | lemma (in weak_lower_semilattice) meet_cong_l: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 695 | assumes carr: "x \<in> carrier L" "x' \<in> carrier L" "y \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 696 | and xx': "x .= x'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 697 | shows "x \<sqinter> y .= x' \<sqinter> y" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 698 | proof (rule meetI, rule meetI) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 699 | fix a b | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 700 | from xx' carr | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 701 |       have seq: "{x, y} {.=} {x', y}" by (rule set_eq_pairI)
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 702 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 703 |   assume greatesta: "greatest L a (Lower L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 704 |   assume "greatest L b (Lower L {x', y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 705 | with carr | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 706 |       have greatestb: "greatest L b (Lower L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 707 | by (simp add: greatest_Lower_cong_r[OF _ _ seq]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 708 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 709 | from greatesta greatestb | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 710 | show "a .= b" by (rule weak_greatest_unique) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 711 | qed (rule carr)+ | 
| 14551 | 712 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 713 | lemma (in weak_lower_semilattice) meet_cong_r: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 714 | assumes carr: "x \<in> carrier L" "y \<in> carrier L" "y' \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 715 | and yy': "y .= y'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 716 | shows "x \<sqinter> y .= x \<sqinter> y'" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 717 | proof (rule meetI, rule meetI) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 718 | fix a b | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 719 |   have "{x, y} = {y, x}" by fast
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 720 | also from carr yy' | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 721 |       have "{y, x} {.=} {y', x}" by (intro set_eq_pairI)
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 722 |   also have "{y', x} = {x, y'}" by fast
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 723 | finally | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 724 |       have seq: "{x, y} {.=} {x, y'}" .
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 725 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 726 |   assume greatesta: "greatest L a (Lower L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 727 |   assume "greatest L b (Lower L {x, y'})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 728 | with carr | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 729 |       have greatestb: "greatest L b (Lower L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 730 | by (simp add: greatest_Lower_cong_r[OF _ _ seq]) | 
| 14551 | 731 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 732 | from greatesta greatestb | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 733 | show "a .= b" by (rule weak_greatest_unique) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 734 | qed (rule carr)+ | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 735 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 736 | lemma (in weak_partial_order) inf_of_singletonI: (* only reflexivity needed ? *) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 737 |   "x \<in> carrier L ==> greatest L x (Lower L {x})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 738 | by (rule greatest_LowerI) auto | 
| 14551 | 739 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 740 | lemma (in weak_partial_order) weak_inf_of_singleton [simp]: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 741 |   "x \<in> carrier L ==> \<Sqinter>{x} .= x"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 742 | unfolding inf_def | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 743 | by (rule someI2) (auto intro: weak_greatest_unique inf_of_singletonI) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 744 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 745 | lemma (in weak_partial_order) inf_of_singleton_closed: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 746 |   "x \<in> carrier L ==> \<Sqinter>{x} \<in> carrier L"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 747 | unfolding inf_def | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 748 | by (rule someI2) (auto intro: inf_of_singletonI) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 749 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 750 | text {* Condition on @{text A}: infimum exists. *}
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 751 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 752 | lemma (in weak_lower_semilattice) inf_insertI: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 753 | "[| !!i. greatest L i (Lower L (insert x A)) ==> P i; | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 754 | greatest L a (Lower L A); x \<in> carrier L; A \<subseteq> carrier L |] | 
| 14693 | 755 | ==> P (\<Sqinter>(insert x A))" | 
| 14551 | 756 | proof (unfold inf_def) | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 757 | assume L: "x \<in> carrier L" "A \<subseteq> carrier L" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 758 | and P: "!!g. greatest L g (Lower L (insert x A)) ==> P g" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 759 | and greatest_a: "greatest L a (Lower L A)" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 760 | from L greatest_a have La: "a \<in> carrier L" by simp | 
| 14551 | 761 | from L inf_of_two_exists greatest_a | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 762 |   obtain i where greatest_i: "greatest L i (Lower L {a, x})" by blast
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 763 | show "P (SOME g. greatest L g (Lower L (insert x A)))" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 764 | proof (rule someI2) | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 765 | show "greatest L i (Lower L (insert x A))" | 
| 14551 | 766 | proof (rule greatest_LowerI) | 
| 767 | fix z | |
| 14693 | 768 | assume "z \<in> insert x A" | 
| 769 | then show "i \<sqsubseteq> z" | |
| 770 | proof | |
| 771 | assume "z = x" then show ?thesis | |
| 27700 | 772 | by (simp add: greatest_Lower_below [OF greatest_i] L La) | 
| 14693 | 773 | next | 
| 774 | assume "z \<in> A" | |
| 775 | with L greatest_i greatest_a show ?thesis | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 776 | by (rule_tac le_trans [where y = a]) (auto dest: greatest_Lower_below) | 
| 14693 | 777 | qed | 
| 778 | next | |
| 779 | fix y | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 780 | assume y: "y \<in> Lower L (insert x A)" | 
| 14693 | 781 | show "y \<sqsubseteq> i" | 
| 782 | proof (rule greatest_le [OF greatest_i], rule Lower_memI) | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 783 | fix z | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 784 |         assume z: "z \<in> {a, x}"
 | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 785 | then show "y \<sqsubseteq> z" | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 786 | proof | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 787 | have y': "y \<in> Lower L A" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 788 | apply (rule subsetD [where A = "Lower L (insert x A)"]) | 
| 23463 | 789 | apply (rule Lower_antimono) | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 790 | apply blast | 
| 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 791 | apply (rule y) | 
| 14693 | 792 | done | 
| 793 | assume "z = a" | |
| 794 | with y' greatest_a show ?thesis by (fast dest: greatest_le) | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 795 | next | 
| 14693 | 796 |           assume "z \<in> {x}"
 | 
| 797 | with y L show ?thesis by blast | |
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 798 | qed | 
| 23350 | 799 | qed (rule Lower_closed [THEN subsetD, OF y]) | 
| 14693 | 800 | next | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 801 | from L show "insert x A \<subseteq> carrier L" by simp | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 802 | from greatest_i show "i \<in> carrier L" by simp | 
| 14551 | 803 | qed | 
| 23350 | 804 | qed (rule P) | 
| 14551 | 805 | qed | 
| 806 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 807 | lemma (in weak_lower_semilattice) finite_inf_greatest: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 808 |   "[| finite A; A \<subseteq> carrier L; A ~= {} |] ==> greatest L (\<Sqinter>A) (Lower L A)"
 | 
| 22265 | 809 | proof (induct set: finite) | 
| 14551 | 810 | case empty then show ?case by simp | 
| 811 | next | |
| 15328 | 812 | case (insert x A) | 
| 14551 | 813 | show ?case | 
| 814 |   proof (cases "A = {}")
 | |
| 815 | case True | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 816 | with insert show ?thesis | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 817 | by simp (simp add: greatest_cong [OF weak_inf_of_singleton] | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 818 | inf_of_singleton_closed inf_of_singletonI) | 
| 14551 | 819 | next | 
| 820 | case False | |
| 821 | from insert show ?thesis | |
| 822 | proof (rule_tac inf_insertI) | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 823 | from False insert show "greatest L (\<Sqinter>A) (Lower L A)" by simp | 
| 14551 | 824 | qed simp_all | 
| 825 | qed | |
| 826 | qed | |
| 827 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 828 | lemma (in weak_lower_semilattice) finite_inf_insertI: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 829 | assumes P: "!!i. greatest L i (Lower L (insert x A)) ==> P i" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 830 | and xA: "finite A" "x \<in> carrier L" "A \<subseteq> carrier L" | 
| 14551 | 831 | shows "P (\<Sqinter> (insert x A))" | 
| 832 | proof (cases "A = {}")
 | |
| 833 | case True with P and xA show ?thesis | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 834 | by (simp add: finite_inf_greatest) | 
| 14551 | 835 | next | 
| 836 | case False with P and xA show ?thesis | |
| 837 | by (simp add: inf_insertI finite_inf_greatest) | |
| 838 | qed | |
| 839 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 840 | lemma (in weak_lower_semilattice) finite_inf_closed [simp]: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 841 |   "[| finite A; A \<subseteq> carrier L; A ~= {} |] ==> \<Sqinter>A \<in> carrier L"
 | 
| 22265 | 842 | proof (induct set: finite) | 
| 14551 | 843 | case empty then show ?case by simp | 
| 844 | next | |
| 15328 | 845 | case insert then show ?case | 
| 14551 | 846 | by (rule_tac finite_inf_insertI) (simp_all) | 
| 847 | qed | |
| 848 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 849 | lemma (in weak_lower_semilattice) meet_left: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 850 | "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqinter> y \<sqsubseteq> x" | 
| 14693 | 851 | by (rule meetI [folded meet_def]) (blast dest: greatest_mem) | 
| 14551 | 852 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 853 | lemma (in weak_lower_semilattice) meet_right: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 854 | "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqinter> y \<sqsubseteq> y" | 
| 14693 | 855 | by (rule meetI [folded meet_def]) (blast dest: greatest_mem) | 
| 14551 | 856 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 857 | lemma (in weak_lower_semilattice) inf_of_two_greatest: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 858 | "[| x \<in> carrier L; y \<in> carrier L |] ==> | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 859 |   greatest L (\<Sqinter> {x, y}) (Lower L {x, y})"
 | 
| 14551 | 860 | proof (unfold inf_def) | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 861 | assume L: "x \<in> carrier L" "y \<in> carrier L" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 862 |   with inf_of_two_exists obtain s where "greatest L s (Lower L {x, y})" by fast
 | 
| 14551 | 863 | with L | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 864 |   show "greatest L (SOME z. greatest L z (Lower L {x, y})) (Lower L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 865 | by (fast intro: someI2 weak_greatest_unique) (* blast fails *) | 
| 14551 | 866 | qed | 
| 867 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 868 | lemma (in weak_lower_semilattice) meet_le: | 
| 14693 | 869 | assumes sub: "z \<sqsubseteq> x" "z \<sqsubseteq> y" | 
| 23350 | 870 | and x: "x \<in> carrier L" and y: "y \<in> carrier L" and z: "z \<in> carrier L" | 
| 14551 | 871 | shows "z \<sqsubseteq> x \<sqinter> y" | 
| 23350 | 872 | proof (rule meetI [OF _ x y]) | 
| 14551 | 873 | fix i | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 874 |   assume "greatest L i (Lower L {x, y})"
 | 
| 23350 | 875 | with sub z show "z \<sqsubseteq> i" by (fast elim: greatest_le intro: Lower_memI) | 
| 14551 | 876 | qed | 
| 14693 | 877 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 878 | lemma (in weak_lower_semilattice) weak_meet_assoc_lemma: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 879 | assumes L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 880 |   shows "x \<sqinter> (y \<sqinter> z) .= \<Sqinter>{x, y, z}"
 | 
| 14551 | 881 | proof (rule finite_inf_insertI) | 
| 882 |   txt {* The textbook argument in Jacobson I, p 457 *}
 | |
| 883 | fix i | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 884 |   assume inf: "greatest L i (Lower L {x, y, z})"
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 885 | show "x \<sqinter> (y \<sqinter> z) .= i" | 
| 33657 | 886 | proof (rule weak_le_antisym) | 
| 14551 | 887 | from inf L show "i \<sqsubseteq> x \<sqinter> (y \<sqinter> z)" | 
| 27700 | 888 | by (fastsimp intro!: meet_le elim: greatest_Lower_below) | 
| 14551 | 889 | next | 
| 890 | from inf L show "x \<sqinter> (y \<sqinter> z) \<sqsubseteq> i" | |
| 891 | by (erule_tac greatest_le) | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 892 | (blast intro!: Lower_memI intro: le_trans meet_left meet_right meet_closed) | 
| 27700 | 893 | qed (simp_all add: L greatest_closed [OF inf]) | 
| 14551 | 894 | qed (simp_all add: L) | 
| 895 | ||
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 896 | lemma meet_comm: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 897 | fixes L (structure) | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 898 | shows "x \<sqinter> y = y \<sqinter> x" | 
| 14551 | 899 | by (unfold meet_def) (simp add: insert_commute) | 
| 900 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 901 | lemma (in weak_lower_semilattice) weak_meet_assoc: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 902 | assumes L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 903 | shows "(x \<sqinter> y) \<sqinter> z .= x \<sqinter> (y \<sqinter> z)" | 
| 14551 | 904 | proof - | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 905 | (* FIXME: improved simp, see weak_join_assoc above *) | 
| 14551 | 906 | have "(x \<sqinter> y) \<sqinter> z = z \<sqinter> (x \<sqinter> y)" by (simp only: meet_comm) | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 907 |   also from L have "... .= \<Sqinter> {z, x, y}" by (simp add: weak_meet_assoc_lemma)
 | 
| 14551 | 908 |   also from L have "... = \<Sqinter> {x, y, z}" by (simp add: insert_commute)
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 909 | also from L have "... .= x \<sqinter> (y \<sqinter> z)" by (simp add: weak_meet_assoc_lemma [symmetric]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 910 | finally show ?thesis by (simp add: L) | 
| 14551 | 911 | qed | 
| 912 | ||
| 14693 | 913 | |
| 14551 | 914 | subsection {* Total Orders *}
 | 
| 915 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 916 | locale weak_total_order = weak_partial_order + | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 917 | assumes total: "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x" | 
| 14551 | 918 | |
| 919 | text {* Introduction rule: the usual definition of total order *}
 | |
| 920 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 921 | lemma (in weak_partial_order) weak_total_orderI: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 922 | assumes total: "!!x y. [| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x" | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 923 | shows "weak_total_order L" | 
| 28823 | 924 | proof qed (rule total) | 
| 24087 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 925 | |
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 926 | text {* Total orders are lattices. *}
 | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 927 | |
| 29242 | 928 | sublocale weak_total_order < weak: weak_lattice | 
| 28823 | 929 | proof | 
| 24087 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 930 | fix x y | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 931 | assume L: "x \<in> carrier L" "y \<in> carrier L" | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 932 |   show "EX s. least L s (Upper L {x, y})"
 | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 933 | proof - | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 934 | note total L | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 935 | moreover | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 936 |     {
 | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 937 | assume "x \<sqsubseteq> y" | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 938 |       with L have "least L y (Upper L {x, y})"
 | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 939 | by (rule_tac least_UpperI) auto | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 940 | } | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 941 | moreover | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 942 |     {
 | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 943 | assume "y \<sqsubseteq> x" | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 944 |       with L have "least L x (Upper L {x, y})"
 | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 945 | by (rule_tac least_UpperI) auto | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 946 | } | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 947 | ultimately show ?thesis by blast | 
| 14551 | 948 | qed | 
| 24087 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 949 | next | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 950 | fix x y | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 951 | assume L: "x \<in> carrier L" "y \<in> carrier L" | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 952 |   show "EX i. greatest L i (Lower L {x, y})"
 | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 953 | proof - | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 954 | note total L | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 955 | moreover | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 956 |     {
 | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 957 | assume "y \<sqsubseteq> x" | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 958 |       with L have "greatest L y (Lower L {x, y})"
 | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 959 | by (rule_tac greatest_LowerI) auto | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 960 | } | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 961 | moreover | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 962 |     {
 | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 963 | assume "x \<sqsubseteq> y" | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 964 |       with L have "greatest L x (Lower L {x, y})"
 | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 965 | by (rule_tac greatest_LowerI) auto | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 966 | } | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 967 | ultimately show ?thesis by blast | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 968 | qed | 
| 
eb025d149a34
Proper interpretation of total orders in lattices.
 ballarin parents: 
23463diff
changeset | 969 | qed | 
| 14551 | 970 | |
| 14693 | 971 | |
| 27717 
21bbd410ba04
Generalised polynomial lemmas from cring to ring.
 ballarin parents: 
27714diff
changeset | 972 | subsection {* Complete Lattices *}
 | 
| 14551 | 973 | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 974 | locale weak_complete_lattice = weak_lattice + | 
| 14551 | 975 | assumes sup_exists: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 976 | "[| A \<subseteq> carrier L |] ==> EX s. least L s (Upper L A)" | 
| 14551 | 977 | and inf_exists: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 978 | "[| A \<subseteq> carrier L |] ==> EX i. greatest L i (Lower L A)" | 
| 21041 
60e418260b4d
Order and lattice structures no longer based on records.
 ballarin parents: 
20318diff
changeset | 979 | |
| 14551 | 980 | text {* Introduction rule: the usual definition of complete lattice *}
 | 
| 981 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 982 | lemma (in weak_partial_order) weak_complete_latticeI: | 
| 14551 | 983 | assumes sup_exists: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 984 | "!!A. [| A \<subseteq> carrier L |] ==> EX s. least L s (Upper L A)" | 
| 14551 | 985 | and inf_exists: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 986 | "!!A. [| A \<subseteq> carrier L |] ==> EX i. greatest L i (Lower L A)" | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 987 | shows "weak_complete_lattice L" | 
| 28823 | 988 | proof qed (auto intro: sup_exists inf_exists) | 
| 14551 | 989 | |
| 35847 | 990 | definition | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 991 |   top :: "_ => 'a" ("\<top>\<index>")
 | 
| 35848 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 wenzelm parents: 
35847diff
changeset | 992 | where "\<top>\<^bsub>L\<^esub> = sup L (carrier L)" | 
| 21041 
60e418260b4d
Order and lattice structures no longer based on records.
 ballarin parents: 
20318diff
changeset | 993 | |
| 35847 | 994 | definition | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 995 |   bottom :: "_ => 'a" ("\<bottom>\<index>")
 | 
| 35848 
5443079512ea
slightly more uniform definitions -- eliminated old-style meta-equality;
 wenzelm parents: 
35847diff
changeset | 996 | where "\<bottom>\<^bsub>L\<^esub> = inf L (carrier L)" | 
| 14551 | 997 | |
| 998 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 999 | lemma (in weak_complete_lattice) supI: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1000 | "[| !!l. least L l (Upper L A) ==> P l; A \<subseteq> carrier L |] | 
| 14651 | 1001 | ==> P (\<Squnion>A)" | 
| 14551 | 1002 | proof (unfold sup_def) | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1003 | assume L: "A \<subseteq> carrier L" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1004 | and P: "!!l. least L l (Upper L A) ==> P l" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1005 | with sup_exists obtain s where "least L s (Upper L A)" by blast | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1006 | with L show "P (SOME l. least L l (Upper L A))" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1007 | by (fast intro: someI2 weak_least_unique P) | 
| 14551 | 1008 | qed | 
| 1009 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1010 | lemma (in weak_complete_lattice) sup_closed [simp]: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1011 | "A \<subseteq> carrier L ==> \<Squnion>A \<in> carrier L" | 
| 14551 | 1012 | by (rule supI) simp_all | 
| 1013 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1014 | lemma (in weak_complete_lattice) top_closed [simp, intro]: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1015 | "\<top> \<in> carrier L" | 
| 14551 | 1016 | by (unfold top_def) simp | 
| 1017 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1018 | lemma (in weak_complete_lattice) infI: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1019 | "[| !!i. greatest L i (Lower L A) ==> P i; A \<subseteq> carrier L |] | 
| 14693 | 1020 | ==> P (\<Sqinter>A)" | 
| 14551 | 1021 | proof (unfold inf_def) | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1022 | assume L: "A \<subseteq> carrier L" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1023 | and P: "!!l. greatest L l (Lower L A) ==> P l" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1024 | with inf_exists obtain s where "greatest L s (Lower L A)" by blast | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1025 | with L show "P (SOME l. greatest L l (Lower L A))" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1026 | by (fast intro: someI2 weak_greatest_unique P) | 
| 14551 | 1027 | qed | 
| 1028 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1029 | lemma (in weak_complete_lattice) inf_closed [simp]: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1030 | "A \<subseteq> carrier L ==> \<Sqinter>A \<in> carrier L" | 
| 14551 | 1031 | by (rule infI) simp_all | 
| 1032 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1033 | lemma (in weak_complete_lattice) bottom_closed [simp, intro]: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1034 | "\<bottom> \<in> carrier L" | 
| 14551 | 1035 | by (unfold bottom_def) simp | 
| 1036 | ||
| 1037 | text {* Jacobson: Theorem 8.1 *}
 | |
| 1038 | ||
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1039 | lemma Lower_empty [simp]: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1040 |   "Lower L {} = carrier L"
 | 
| 14551 | 1041 | by (unfold Lower_def) simp | 
| 1042 | ||
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1043 | lemma Upper_empty [simp]: | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1044 |   "Upper L {} = carrier L"
 | 
| 14551 | 1045 | by (unfold Upper_def) simp | 
| 1046 | ||
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1047 | theorem (in weak_partial_order) weak_complete_lattice_criterion1: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1048 | assumes top_exists: "EX g. greatest L g (carrier L)" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1049 | and inf_exists: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1050 |       "!!A. [| A \<subseteq> carrier L; A ~= {} |] ==> EX i. greatest L i (Lower L A)"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1051 | shows "weak_complete_lattice L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1052 | proof (rule weak_complete_latticeI) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1053 | from top_exists obtain top where top: "greatest L top (carrier L)" .. | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1054 | fix A | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1055 | assume L: "A \<subseteq> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1056 | let ?B = "Upper L A" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1057 | from L top have "top \<in> ?B" by (fast intro!: Upper_memI intro: greatest_le) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1058 |   then have B_non_empty: "?B ~= {}" by fast
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1059 | have B_L: "?B \<subseteq> carrier L" by simp | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1060 | from inf_exists [OF B_L B_non_empty] | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1061 | obtain b where b_inf_B: "greatest L b (Lower L ?B)" .. | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1062 | have "least L b (Upper L A)" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1063 | apply (rule least_UpperI) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1064 | apply (rule greatest_le [where A = "Lower L ?B"]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1065 | apply (rule b_inf_B) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1066 | apply (rule Lower_memI) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1067 | apply (erule Upper_memD [THEN conjunct1]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1068 | apply assumption | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1069 | apply (rule L) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1070 | apply (fast intro: L [THEN subsetD]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1071 | apply (erule greatest_Lower_below [OF b_inf_B]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1072 | apply simp | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1073 | apply (rule L) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1074 | apply (rule greatest_closed [OF b_inf_B]) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1075 | done | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1076 | then show "EX s. least L s (Upper L A)" .. | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1077 | next | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1078 | fix A | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1079 | assume L: "A \<subseteq> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1080 | show "EX i. greatest L i (Lower L A)" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1081 |   proof (cases "A = {}")
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1082 | case True then show ?thesis | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1083 | by (simp add: top_exists) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1084 | next | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1085 | case False with L show ?thesis | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1086 | by (rule inf_exists) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1087 | qed | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1088 | qed | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1089 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1090 | (* TODO: prove dual version *) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1091 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1092 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1093 | subsection {* Orders and Lattices where @{text eq} is the Equality *}
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1094 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1095 | locale partial_order = weak_partial_order + | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1096 | assumes eq_is_equal: "op .= = op =" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1097 | begin | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1098 | |
| 33657 | 1099 | declare weak_le_antisym [rule del] | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1100 | |
| 33657 | 1101 | lemma le_antisym [intro]: | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1102 | "[| x \<sqsubseteq> y; y \<sqsubseteq> x; x \<in> carrier L; y \<in> carrier L |] ==> x = y" | 
| 33657 | 1103 | using weak_le_antisym unfolding eq_is_equal . | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1104 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1105 | lemma lless_eq: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1106 | "x \<sqsubset> y \<longleftrightarrow> x \<sqsubseteq> y & x \<noteq> y" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1107 | unfolding lless_def by (simp add: eq_is_equal) | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1108 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1109 | lemma lless_asym: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1110 | assumes "a \<in> carrier L" "b \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1111 | and "a \<sqsubset> b" "b \<sqsubset> a" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1112 | shows "P" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1113 | using assms unfolding lless_eq by auto | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1114 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1115 | end | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1116 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1117 | |
| 27717 
21bbd410ba04
Generalised polynomial lemmas from cring to ring.
 ballarin parents: 
27714diff
changeset | 1118 | text {* Least and greatest, as predicate *}
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1119 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1120 | lemma (in partial_order) least_unique: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1121 | "[| least L x A; least L y A |] ==> x = y" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1122 | using weak_least_unique unfolding eq_is_equal . | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1123 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1124 | lemma (in partial_order) greatest_unique: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1125 | "[| greatest L x A; greatest L y A |] ==> x = y" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1126 | using weak_greatest_unique unfolding eq_is_equal . | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1127 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1128 | |
| 27717 
21bbd410ba04
Generalised polynomial lemmas from cring to ring.
 ballarin parents: 
27714diff
changeset | 1129 | text {* Lattices *}
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1130 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1131 | locale upper_semilattice = partial_order + | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1132 | assumes sup_of_two_exists: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1133 |     "[| x \<in> carrier L; y \<in> carrier L |] ==> EX s. least L s (Upper L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1134 | |
| 29242 | 1135 | sublocale upper_semilattice < weak: weak_upper_semilattice | 
| 28823 | 1136 | proof qed (rule sup_of_two_exists) | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1137 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1138 | locale lower_semilattice = partial_order + | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1139 | assumes inf_of_two_exists: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1140 |     "[| x \<in> carrier L; y \<in> carrier L |] ==> EX s. greatest L s (Lower L {x, y})"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1141 | |
| 29242 | 1142 | sublocale lower_semilattice < weak: weak_lower_semilattice | 
| 28823 | 1143 | proof qed (rule inf_of_two_exists) | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1144 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1145 | locale lattice = upper_semilattice + lower_semilattice | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1146 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1147 | |
| 27717 
21bbd410ba04
Generalised polynomial lemmas from cring to ring.
 ballarin parents: 
27714diff
changeset | 1148 | text {* Supremum *}
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1149 | |
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 1150 | declare (in partial_order) weak_sup_of_singleton [simp del] | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1151 | |
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 1152 | lemma (in partial_order) sup_of_singleton [simp]: | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1153 |   "x \<in> carrier L ==> \<Squnion>{x} = x"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1154 | using weak_sup_of_singleton unfolding eq_is_equal . | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1155 | |
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 1156 | lemma (in upper_semilattice) join_assoc_lemma: | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1157 | assumes L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1158 |   shows "x \<squnion> (y \<squnion> z) = \<Squnion>{x, y, z}"
 | 
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 1159 | using weak_join_assoc_lemma L unfolding eq_is_equal . | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1160 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1161 | lemma (in upper_semilattice) join_assoc: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1162 | assumes L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1163 | shows "(x \<squnion> y) \<squnion> z = x \<squnion> (y \<squnion> z)" | 
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 1164 | using weak_join_assoc L unfolding eq_is_equal . | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1165 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1166 | |
| 27717 
21bbd410ba04
Generalised polynomial lemmas from cring to ring.
 ballarin parents: 
27714diff
changeset | 1167 | text {* Infimum *}
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1168 | |
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 1169 | declare (in partial_order) weak_inf_of_singleton [simp del] | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1170 | |
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 1171 | lemma (in partial_order) inf_of_singleton [simp]: | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1172 |   "x \<in> carrier L ==> \<Sqinter>{x} = x"
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1173 | using weak_inf_of_singleton unfolding eq_is_equal . | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1174 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1175 | text {* Condition on @{text A}: infimum exists. *}
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1176 | |
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 1177 | lemma (in lower_semilattice) meet_assoc_lemma: | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1178 | assumes L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1179 |   shows "x \<sqinter> (y \<sqinter> z) = \<Sqinter>{x, y, z}"
 | 
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 1180 | using weak_meet_assoc_lemma L unfolding eq_is_equal . | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1181 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1182 | lemma (in lower_semilattice) meet_assoc: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1183 | assumes L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1184 | shows "(x \<sqinter> y) \<sqinter> z = x \<sqinter> (y \<sqinter> z)" | 
| 27714 
27b4d7c01f8b
Tuned (for the sake of a meaningless log entry).
 ballarin parents: 
27713diff
changeset | 1185 | using weak_meet_assoc L unfolding eq_is_equal . | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1186 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1187 | |
| 27717 
21bbd410ba04
Generalised polynomial lemmas from cring to ring.
 ballarin parents: 
27714diff
changeset | 1188 | text {* Total Orders *}
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1189 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1190 | locale total_order = partial_order + | 
| 28823 | 1191 | assumes total_order_total: "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x" | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1192 | |
| 29242 | 1193 | sublocale total_order < weak: weak_total_order | 
| 28823 | 1194 | proof qed (rule total_order_total) | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1195 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1196 | text {* Introduction rule: the usual definition of total order *}
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1197 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1198 | lemma (in partial_order) total_orderI: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1199 | assumes total: "!!x y. [| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1200 | shows "total_order L" | 
| 28823 | 1201 | proof qed (rule total) | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1202 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1203 | text {* Total orders are lattices. *}
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1204 | |
| 29242 | 1205 | sublocale total_order < weak: lattice | 
| 28823 | 1206 | proof qed (auto intro: sup_of_two_exists inf_of_two_exists) | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1207 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1208 | |
| 27717 
21bbd410ba04
Generalised polynomial lemmas from cring to ring.
 ballarin parents: 
27714diff
changeset | 1209 | text {* Complete lattices *}
 | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1210 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1211 | locale complete_lattice = lattice + | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1212 | assumes sup_exists: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1213 | "[| A \<subseteq> carrier L |] ==> EX s. least L s (Upper L A)" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1214 | and inf_exists: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1215 | "[| A \<subseteq> carrier L |] ==> EX i. greatest L i (Lower L A)" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1216 | |
| 29242 | 1217 | sublocale complete_lattice < weak: weak_complete_lattice | 
| 28823 | 1218 | proof qed (auto intro: sup_exists inf_exists) | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1219 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1220 | text {* Introduction rule: the usual definition of complete lattice *}
 | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1221 | |
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1222 | lemma (in partial_order) complete_latticeI: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1223 | assumes sup_exists: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1224 | "!!A. [| A \<subseteq> carrier L |] ==> EX s. least L s (Upper L A)" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1225 | and inf_exists: | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1226 | "!!A. [| A \<subseteq> carrier L |] ==> EX i. greatest L i (Lower L A)" | 
| 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1227 | shows "complete_lattice L" | 
| 28823 | 1228 | proof qed (auto intro: sup_exists inf_exists) | 
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1229 | |
| 14551 | 1230 | theorem (in partial_order) complete_lattice_criterion1: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1231 | assumes top_exists: "EX g. greatest L g (carrier L)" | 
| 14551 | 1232 | and inf_exists: | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1233 |       "!!A. [| A \<subseteq> carrier L; A ~= {} |] ==> EX i. greatest L i (Lower L A)"
 | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1234 | shows "complete_lattice L" | 
| 14551 | 1235 | proof (rule complete_latticeI) | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1236 | from top_exists obtain top where top: "greatest L top (carrier L)" .. | 
| 14551 | 1237 | fix A | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1238 | assume L: "A \<subseteq> carrier L" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1239 | let ?B = "Upper L A" | 
| 14551 | 1240 | from L top have "top \<in> ?B" by (fast intro!: Upper_memI intro: greatest_le) | 
| 1241 |   then have B_non_empty: "?B ~= {}" by fast
 | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1242 | have B_L: "?B \<subseteq> carrier L" by simp | 
| 14551 | 1243 | from inf_exists [OF B_L B_non_empty] | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1244 | obtain b where b_inf_B: "greatest L b (Lower L ?B)" .. | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1245 | have "least L b (Upper L A)" | 
| 14551 | 1246 | apply (rule least_UpperI) | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1247 | apply (rule greatest_le [where A = "Lower L ?B"]) | 
| 14551 | 1248 | apply (rule b_inf_B) | 
| 1249 | apply (rule Lower_memI) | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1250 | apply (erule Upper_memD [THEN conjunct1]) | 
| 14551 | 1251 | apply assumption | 
| 1252 | apply (rule L) | |
| 1253 | apply (fast intro: L [THEN subsetD]) | |
| 27700 | 1254 | apply (erule greatest_Lower_below [OF b_inf_B]) | 
| 14551 | 1255 | apply simp | 
| 1256 | apply (rule L) | |
| 27700 | 1257 | apply (rule greatest_closed [OF b_inf_B]) | 
| 14551 | 1258 | done | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1259 | then show "EX s. least L s (Upper L A)" .. | 
| 14551 | 1260 | next | 
| 1261 | fix A | |
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1262 | assume L: "A \<subseteq> carrier L" | 
| 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1263 | show "EX i. greatest L i (Lower L A)" | 
| 14551 | 1264 |   proof (cases "A = {}")
 | 
| 1265 | case True then show ?thesis | |
| 1266 | by (simp add: top_exists) | |
| 1267 | next | |
| 1268 | case False with L show ?thesis | |
| 1269 | by (rule inf_exists) | |
| 1270 | qed | |
| 1271 | qed | |
| 1272 | ||
| 1273 | (* TODO: prove dual version *) | |
| 1274 | ||
| 20318 
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
 ballarin parents: 
19984diff
changeset | 1275 | |
| 14551 | 1276 | subsection {* Examples *}
 | 
| 1277 | ||
| 27717 
21bbd410ba04
Generalised polynomial lemmas from cring to ring.
 ballarin parents: 
27714diff
changeset | 1278 | subsubsection {* The Powerset of a Set is a Complete Lattice *}
 | 
| 14551 | 1279 | |
| 1280 | theorem powerset_is_complete_lattice: | |
| 27713 
95b36bfe7fc4
New locales for orders and lattices where the equivalence relation is not restricted to equality.
 ballarin parents: 
27700diff
changeset | 1281 | "complete_lattice (| carrier = Pow A, eq = op =, le = op \<subseteq> |)" | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1282 | (is "complete_lattice ?L") | 
| 14551 | 1283 | proof (rule partial_order.complete_latticeI) | 
| 22063 
717425609192
Reverted to structure representation with records.
 ballarin parents: 
21896diff
changeset | 1284 | show "partial_order ?L" | 
| 28823 | 1285 | proof qed auto | 
| 14551 | 1286 | next | 
| 1287 | fix B | |
| 26805 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
24087diff
changeset | 1288 | assume B: "B \<subseteq> carrier ?L" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
24087diff
changeset | 1289 | show "EX s. least ?L s (Upper ?L B)" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
24087diff
changeset | 1290 | proof | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
24087diff
changeset | 1291 | from B show "least ?L (\<Union> B) (Upper ?L B)" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
24087diff
changeset | 1292 | by (fastsimp intro!: least_UpperI simp: Upper_def) | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
24087diff
changeset | 1293 | qed | 
| 14551 | 1294 | next | 
| 1295 | fix B | |
| 26805 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
24087diff
changeset | 1296 | assume B: "B \<subseteq> carrier ?L" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
24087diff
changeset | 1297 | show "EX i. greatest ?L i (Lower ?L B)" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
24087diff
changeset | 1298 | proof | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
24087diff
changeset | 1299 | from B show "greatest ?L (\<Inter> B \<inter> A) (Lower ?L B)" | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
24087diff
changeset | 1300 |       txt {* @{term "\<Inter> B"} is not the infimum of @{term B}:
 | 
| 32960 
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
 wenzelm parents: 
30363diff
changeset | 1301 |         @{term "\<Inter> {} = UNIV"} which is in general bigger than @{term "A"}! *}
 | 
| 26805 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
24087diff
changeset | 1302 | by (fastsimp intro!: greatest_LowerI simp: Lower_def) | 
| 
27941d7d9a11
Replaced forward proofs of existential statements by backward proofs
 berghofe parents: 
24087diff
changeset | 1303 | qed | 
| 14551 | 1304 | qed | 
| 1305 | ||
| 14751 
0d7850e27fed
Change of theory hierarchy: Group is now based in Lattice.
 ballarin parents: 
14706diff
changeset | 1306 | 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: 
14706diff
changeset | 1307 |   can be found in Group theory (Section~\ref{sec:subgroup-lattice}). *}
 | 
| 14551 | 1308 | |
| 14693 | 1309 | end |