summary |
shortlog |
changelog |
graph |
tags |
bookmarks |
branches |
files |
changeset |
raw | gz |
help

author | ballarin |

Mon, 16 Oct 2006 10:27:54 +0200 | |

changeset 21041 | 60e418260b4d |

parent 21040 | 983caf913a4c |

child 21042 | b96d37893dbb |

Order and lattice structures no longer based on records.

--- a/NEWS Sun Oct 15 12:16:20 2006 +0200 +++ b/NEWS Mon Oct 16 10:27:54 2006 +0200 @@ -610,13 +610,15 @@ *** HOL-Algebra *** +* Formalisation of ideals and the quotient construction over rings, contributed + by Stephan Hohe. + +* Order and lattice theory no longer based on records. INCOMPATIBILITY. + * Method algebra is now set up via an attribute. For examples see CRing.thy. INCOMPATIBILITY: the method is now weaker on combinations of algebraic structures. -* Formalisation of ideals and the quotient construction over rings, contributed - by Stephan Hohe. - * Renamed `CRing.thy' to `Ring.thy'. INCOMPATIBILITY.

--- a/src/HOL/Algebra/Group.thy Sun Oct 15 12:16:20 2006 +0200 +++ b/src/HOL/Algebra/Group.thy Mon Oct 16 10:27:54 2006 +0200 @@ -685,7 +685,7 @@ text_raw {* \label{sec:subgroup-lattice} *} theorem (in group) subgroups_partial_order: - "partial_order (| carrier = {H. subgroup H G}, le = op \<subseteq> |)" + "partial_order {H. subgroup H G} (op \<subseteq>)" by (rule partial_order.intro) simp_all lemma (in group) subgroup_self: @@ -730,22 +730,23 @@ qed theorem (in group) subgroups_complete_lattice: - "complete_lattice (| carrier = {H. subgroup H G}, le = op \<subseteq> |)" - (is "complete_lattice ?L") + "complete_lattice {H. subgroup H G} (op \<subseteq>)" + (is "complete_lattice ?car ?le") proof (rule partial_order.complete_lattice_criterion1) - show "partial_order ?L" by (rule subgroups_partial_order) + show "partial_order ?car ?le" by (rule subgroups_partial_order) next - have "greatest ?L (carrier G) (carrier ?L)" - by (unfold greatest_def) (simp add: subgroup.subset subgroup_self) - then show "\<exists>G. greatest ?L G (carrier ?L)" .. + have "order_syntax.greatest ?car ?le (carrier G) ?car" + by (unfold order_syntax.greatest_def) + (simp add: subgroup.subset subgroup_self) + then show "\<exists>G. order_syntax.greatest ?car ?le G ?car" .. next fix A - assume L: "A \<subseteq> carrier ?L" and non_empty: "A ~= {}" + assume L: "A \<subseteq> ?car" and non_empty: "A ~= {}" then have Int_subgroup: "subgroup (\<Inter>A) G" by (fastsimp intro: subgroups_Inter) - have "greatest ?L (\<Inter>A) (Lower ?L A)" - (is "greatest ?L ?Int _") - proof (rule greatest_LowerI) + have "order_syntax.greatest ?car ?le (\<Inter>A) (order_syntax.Lower ?car ?le A)" + (is "order_syntax.greatest _ _ ?Int _") + proof (rule order_syntax.greatest_LowerI) fix H assume H: "H \<in> A" with L have subgroupH: "subgroup H G" by auto @@ -754,17 +755,18 @@ from groupH have monoidH: "monoid ?H" by (rule group.is_monoid) from H have Int_subset: "?Int \<subseteq> H" by fastsimp - then show "le ?L ?Int H" by simp + then show "?le ?Int H" by simp next fix H - assume H: "H \<in> Lower ?L A" - with L Int_subgroup show "le ?L H ?Int" by (fastsimp intro: Inter_greatest) + assume H: "H \<in> order_syntax.Lower ?car ?le A" + with L Int_subgroup show "?le H ?Int" + by (fastsimp simp: order_syntax.Lower_def intro: Inter_greatest) next - show "A \<subseteq> carrier ?L" by (rule L) + show "A \<subseteq> ?car" by (rule L) next - show "?Int \<in> carrier ?L" by simp (rule Int_subgroup) + show "?Int \<in> ?car" by simp (rule Int_subgroup) qed - then show "\<exists>I. greatest ?L I (Lower ?L A)" .. + then show "\<exists>I. order_syntax.greatest ?car ?le I (order_syntax.Lower ?car ?le A)" .. qed end

--- a/src/HOL/Algebra/IntRing.thy Sun Oct 15 12:16:20 2006 +0200 +++ b/src/HOL/Algebra/IntRing.thy Mon Oct 16 10:27:54 2006 +0200 @@ -71,9 +71,6 @@ int_ring :: "int ring" ("\<Z>") "int_ring \<equiv> \<lparr>carrier = UNIV, mult = op *, one = 1, zero = 0, add = op +\<rparr>" - int_order :: "int order" - "int_order \<equiv> \<lparr>carrier = UNIV, le = op \<le>\<rparr>" - lemma int_Zcarr[simp,intro!]: "k \<in> carrier \<Z>" by (simp add: int_ring_def) @@ -99,14 +96,13 @@ interpretation "domain" ["\<Z>"] by (rule int_is_domain) lemma int_le_total_order: - "total_order int_order" -unfolding int_order_def + "total_order (UNIV::int set) (op \<le>)" apply (rule partial_order.total_orderI) apply (rule partial_order.intro, simp+) apply clarsimp done -interpretation total_order ["int_order"] by (rule int_le_total_order) +interpretation total_order ["UNIV::int set" "op \<le>"] by (rule int_le_total_order) subsubsection {* Generated Ideals of @{text "\<Z>"} *}

--- a/src/HOL/Algebra/Lattice.thy Sun Oct 15 12:16:20 2006 +0200 +++ b/src/HOL/Algebra/Lattice.thy Mon Oct 16 10:27:54 2006 +0200 @@ -18,157 +18,191 @@ subsection {* Partial Orders *} +(* record 'a order = "'a partial_object" + le :: "['a, 'a] => bool" (infixl "\<sqsubseteq>\<index>" 50) +*) -locale partial_order = - fixes L (structure) +text {* Locale @{text order_syntax} is required since we want to refer + to definitions (and their derived theorems) outside of @{text partial_order}. + *} + +locale order_syntax = + fixes carrier :: "'a set" and le :: "['a, 'a] => bool" (infix "\<sqsubseteq>" 50) + +text {* Note that the type constraints above are necessary, because the + definition command cannot specialise the types. *} + +definition (in order_syntax) + less (infixl "\<sqsubset>" 50) "x \<sqsubset> y == x \<sqsubseteq> y & x ~= y" + +text {* Upper and lower bounds of a set. *} + +definition (in order_syntax) + Upper where + "Upper A == {u. (ALL x. x \<in> A \<inter> carrier --> x \<sqsubseteq> u)} \<inter> + carrier" + +definition (in order_syntax) + Lower :: "'a set => 'a set" + "Lower A == {l. (ALL x. x \<in> A \<inter> carrier --> l \<sqsubseteq> x)} \<inter> + carrier" + +text {* Least and greatest, as predicate. *} + +definition (in order_syntax) + least :: "['a, 'a set] => bool" + "least l A == A \<subseteq> carrier & l \<in> A & (ALL x : A. l \<sqsubseteq> x)" + +definition (in order_syntax) + greatest :: "['a, 'a set] => bool" + "greatest g A == A \<subseteq> carrier & g \<in> A & (ALL x : A. x \<sqsubseteq> g)" + +text {* Supremum and infimum *} + +definition (in order_syntax) + sup :: "'a set => 'a" ("\<Squnion>") (* FIXME precedence [90] 90 *) + "\<Squnion>A == THE x. least x (Upper A)" + +definition (in order_syntax) + inf :: "'a set => 'a" ("\<Sqinter>") (* FIXME precedence *) + "\<Sqinter>A == THE x. greatest x (Lower A)" + +definition (in order_syntax) + join :: "['a, 'a] => 'a" (infixl "\<squnion>" 65) + "x \<squnion> y == sup {x, y}" + +definition (in order_syntax) + meet :: "['a, 'a] => 'a" (infixl "\<sqinter>" 70) + "x \<sqinter> y == inf {x, y}" + +locale partial_order = order_syntax + assumes refl [intro, simp]: - "x \<in> carrier L ==> x \<sqsubseteq> x" + "x \<in> carrier ==> x \<sqsubseteq> x" and anti_sym [intro]: - "[| x \<sqsubseteq> y; y \<sqsubseteq> x; x \<in> carrier L; y \<in> carrier L |] ==> x = y" + "[| x \<sqsubseteq> y; y \<sqsubseteq> x; x \<in> carrier; y \<in> carrier |] ==> x = y" and trans [trans]: "[| x \<sqsubseteq> y; y \<sqsubseteq> z; - x \<in> carrier L; y \<in> carrier L; z \<in> carrier L |] ==> x \<sqsubseteq> z" - -constdefs (structure L) - lless :: "[_, 'a, 'a] => bool" (infixl "\<sqsubset>\<index>" 50) - "x \<sqsubset> y == x \<sqsubseteq> y & x ~= y" - - -- {* Upper and lower bounds of a set. *} - Upper :: "[_, 'a set] => 'a set" - "Upper L A == {u. (ALL x. x \<in> A \<inter> carrier L --> x \<sqsubseteq> u)} \<inter> - carrier L" - - Lower :: "[_, 'a set] => 'a set" - "Lower L A == {l. (ALL x. x \<in> A \<inter> carrier L --> l \<sqsubseteq> x)} \<inter> - carrier L" + x \<in> carrier; y \<in> carrier; z \<in> carrier |] ==> x \<sqsubseteq> z" - -- {* Least and greatest, as predicate. *} - least :: "[_, 'a, 'a set] => bool" - "least L l A == A \<subseteq> carrier L & l \<in> A & (ALL x : A. l \<sqsubseteq> x)" - - greatest :: "[_, 'a, 'a set] => bool" - "greatest L g A == A \<subseteq> carrier L & g \<in> A & (ALL x : A. x \<sqsubseteq> g)" - - -- {* Supremum and infimum *} - sup :: "[_, 'a set] => 'a" ("\<Squnion>\<index>_" [90] 90) - "\<Squnion>A == THE x. least L x (Upper L A)" - - inf :: "[_, 'a set] => 'a" ("\<Sqinter>\<index>_" [90] 90) - "\<Sqinter>A == THE x. greatest L x (Lower L A)" - - join :: "[_, 'a, 'a] => 'a" (infixl "\<squnion>\<index>" 65) - "x \<squnion> y == sup L {x, y}" - - meet :: "[_, 'a, 'a] => 'a" (infixl "\<sqinter>\<index>" 70) - "x \<sqinter> y == inf L {x, y}" +abbreviation (in partial_order) + less (infixl "\<sqsubset>" 50) "less == order_syntax.less le" +abbreviation (in partial_order) + Upper where "Upper == order_syntax.Upper carrier le" +abbreviation (in partial_order) + Lower where "Lower == order_syntax.Lower carrier le" +abbreviation (in partial_order) + least where "least == order_syntax.least carrier le" +abbreviation (in partial_order) + greatest where "greatest == order_syntax.greatest carrier le" +abbreviation (in partial_order) + sup ("\<Squnion>") (* FIXME precedence *) "sup == order_syntax.sup carrier le" +abbreviation (in partial_order) + inf ("\<Sqinter>") (* FIXME precedence *) "inf == order_syntax.inf carrier le" +abbreviation (in partial_order) + join (infixl "\<squnion>" 65) "join == order_syntax.join carrier le" +abbreviation (in partial_order) + meet (infixl "\<sqinter>" 70) "meet == order_syntax.meet carrier le" subsubsection {* Upper *} -lemma Upper_closed [intro, simp]: - "Upper L A \<subseteq> carrier L" +lemma (in order_syntax) Upper_closed [intro, simp]: + "Upper A \<subseteq> carrier" by (unfold Upper_def) clarify -lemma UpperD [dest]: +lemma (in order_syntax) UpperD [dest]: fixes L (structure) - shows "[| u \<in> Upper L A; x \<in> A; A \<subseteq> carrier L |] ==> x \<sqsubseteq> u" + shows "[| u \<in> Upper A; x \<in> A; A \<subseteq> carrier |] ==> x \<sqsubseteq> u" by (unfold Upper_def) blast -lemma Upper_memI: +lemma (in order_syntax) Upper_memI: fixes L (structure) - shows "[| !! y. y \<in> A ==> y \<sqsubseteq> x; x \<in> carrier L |] ==> x \<in> Upper L A" + shows "[| !! y. y \<in> A ==> y \<sqsubseteq> x; x \<in> carrier |] ==> x \<in> Upper A" by (unfold Upper_def) blast -lemma Upper_antimono: - "A \<subseteq> B ==> Upper L B \<subseteq> Upper L A" +lemma (in order_syntax) Upper_antimono: + "A \<subseteq> B ==> Upper B \<subseteq> Upper A" by (unfold Upper_def) blast subsubsection {* Lower *} -lemma Lower_closed [intro, simp]: - "Lower L A \<subseteq> carrier L" +lemma (in order_syntax) Lower_closed [intro, simp]: + "Lower A \<subseteq> carrier" by (unfold Lower_def) clarify -lemma LowerD [dest]: - fixes L (structure) - shows "[| l \<in> Lower L A; x \<in> A; A \<subseteq> carrier L |] ==> l \<sqsubseteq> x" +lemma (in order_syntax) LowerD [dest]: + "[| l \<in> Lower A; x \<in> A; A \<subseteq> carrier |] ==> l \<sqsubseteq> x" by (unfold Lower_def) blast -lemma Lower_memI: - fixes L (structure) - shows "[| !! y. y \<in> A ==> x \<sqsubseteq> y; x \<in> carrier L |] ==> x \<in> Lower L A" +lemma (in order_syntax) Lower_memI: + "[| !! y. y \<in> A ==> x \<sqsubseteq> y; x \<in> carrier |] ==> x \<in> Lower A" by (unfold Lower_def) blast -lemma Lower_antimono: - "A \<subseteq> B ==> Lower L B \<subseteq> Lower L A" +lemma (in order_syntax) Lower_antimono: + "A \<subseteq> B ==> Lower B \<subseteq> Lower A" by (unfold Lower_def) blast subsubsection {* least *} -lemma least_carrier [intro, simp]: - shows "least L l A ==> l \<in> carrier L" +lemma (in order_syntax) least_carrier [intro, simp]: + "least l A ==> l \<in> carrier" by (unfold least_def) fast -lemma least_mem: - "least L l A ==> l \<in> A" +lemma (in order_syntax) least_mem: + "least l A ==> l \<in> A" by (unfold least_def) fast lemma (in partial_order) least_unique: - "[| least L x A; least L y A |] ==> x = y" + "[| least x A; least y A |] ==> x = y" by (unfold least_def) blast -lemma least_le: - fixes L (structure) - shows "[| least L x A; a \<in> A |] ==> x \<sqsubseteq> a" +lemma (in order_syntax) least_le: + "[| least x A; a \<in> A |] ==> x \<sqsubseteq> a" by (unfold least_def) fast -lemma least_UpperI: - fixes L (structure) +lemma (in order_syntax) least_UpperI: assumes above: "!! x. x \<in> A ==> x \<sqsubseteq> s" - and below: "!! y. y \<in> Upper L A ==> s \<sqsubseteq> y" - and L: "A \<subseteq> carrier L" "s \<in> carrier L" - shows "least L s (Upper L A)" + and below: "!! y. y \<in> Upper A ==> s \<sqsubseteq> y" + and L: "A \<subseteq> carrier" "s \<in> carrier" + shows "least s (Upper A)" proof - - have "Upper L A \<subseteq> carrier L" by simp - moreover from above L have "s \<in> Upper L A" by (simp add: Upper_def) - moreover from below have "ALL x : Upper L A. s \<sqsubseteq> x" by fast + have "Upper A \<subseteq> carrier" by simp + moreover from above L have "s \<in> Upper A" by (simp add: Upper_def) + moreover from below have "ALL x : Upper A. s \<sqsubseteq> x" by fast ultimately show ?thesis by (simp add: least_def) qed subsubsection {* greatest *} -lemma greatest_carrier [intro, simp]: - shows "greatest L l A ==> l \<in> carrier L" +lemma (in order_syntax) greatest_carrier [intro, simp]: + "greatest l A ==> l \<in> carrier" by (unfold greatest_def) fast -lemma greatest_mem: - "greatest L l A ==> l \<in> A" +lemma (in order_syntax) greatest_mem: + "greatest l A ==> l \<in> A" by (unfold greatest_def) fast lemma (in partial_order) greatest_unique: - "[| greatest L x A; greatest L y A |] ==> x = y" + "[| greatest x A; greatest y A |] ==> x = y" by (unfold greatest_def) blast -lemma greatest_le: - fixes L (structure) - shows "[| greatest L x A; a \<in> A |] ==> a \<sqsubseteq> x" +lemma (in order_syntax) greatest_le: + "[| greatest x A; a \<in> A |] ==> a \<sqsubseteq> x" by (unfold greatest_def) fast -lemma greatest_LowerI: - fixes L (structure) +lemma (in order_syntax) greatest_LowerI: assumes below: "!! x. x \<in> A ==> i \<sqsubseteq> x" - and above: "!! y. y \<in> Lower L A ==> y \<sqsubseteq> i" - and L: "A \<subseteq> carrier L" "i \<in> carrier L" - shows "greatest L i (Lower L A)" + and above: "!! y. y \<in> Lower A ==> y \<sqsubseteq> i" + and L: "A \<subseteq> carrier" "i \<in> carrier" + shows "greatest i (Lower A)" proof - - have "Lower L A \<subseteq> carrier L" by simp - moreover from below L have "i \<in> Lower L A" by (simp add: Lower_def) - moreover from above have "ALL x : Lower L A. x \<sqsubseteq> i" by fast + have "Lower A \<subseteq> carrier" by simp + moreover from below L have "i \<in> Lower A" by (simp add: Lower_def) + moreover from above have "ALL x : Lower A. x \<sqsubseteq> i" by fast ultimately show ?thesis by (simp add: greatest_def) qed @@ -177,63 +211,80 @@ locale lattice = partial_order + assumes sup_of_two_exists: - "[| x \<in> carrier L; y \<in> carrier L |] ==> EX s. least L s (Upper L {x, y})" + "[| x \<in> carrier; y \<in> carrier |] ==> EX s. order_syntax.least carrier le s (order_syntax.Upper carrier le {x, y})" and inf_of_two_exists: - "[| x \<in> carrier L; y \<in> carrier L |] ==> EX s. greatest L s (Lower L {x, y})" + "[| x \<in> carrier; y \<in> carrier |] ==> EX s. order_syntax.greatest carrier le s (order_syntax.Lower carrier le {x, y})" -lemma least_Upper_above: - fixes L (structure) - shows "[| least L s (Upper L A); x \<in> A; A \<subseteq> carrier L |] ==> x \<sqsubseteq> s" +abbreviation (in lattice) + less (infixl "\<sqsubset>" 50) "less == order_syntax.less le" +abbreviation (in lattice) + Upper where "Upper == order_syntax.Upper carrier le" +abbreviation (in lattice) + Lower where "Lower == order_syntax.Lower carrier le" +abbreviation (in lattice) + least where "least == order_syntax.least carrier le" +abbreviation (in lattice) + greatest where "greatest == order_syntax.greatest carrier le" +abbreviation (in lattice) + sup ("\<Squnion>") (* FIXME precedence *) "sup == order_syntax.sup carrier le" +abbreviation (in lattice) + inf ("\<Sqinter>") (* FIXME precedence *) "inf == order_syntax.inf carrier le" +abbreviation (in lattice) + join (infixl "\<squnion>" 65) "join == order_syntax.join carrier le" +abbreviation (in lattice) + meet (infixl "\<sqinter>" 70) "meet == order_syntax.meet carrier le" + +lemma (in order_syntax) least_Upper_above: + "[| least s (Upper A); x \<in> A; A \<subseteq> carrier |] ==> x \<sqsubseteq> s" by (unfold least_def) blast -lemma greatest_Lower_above: - fixes L (structure) - shows "[| greatest L i (Lower L A); x \<in> A; A \<subseteq> carrier L |] ==> i \<sqsubseteq> x" +lemma (in order_syntax) greatest_Lower_above: + "[| greatest i (Lower A); x \<in> A; A \<subseteq> carrier |] ==> i \<sqsubseteq> x" by (unfold greatest_def) blast subsubsection {* Supremum *} lemma (in lattice) joinI: - "[| !!l. least L l (Upper L {x, y}) ==> P l; x \<in> carrier L; y \<in> carrier L |] + "[| !!l. least l (Upper {x, y}) ==> P l; x \<in> carrier; y \<in> carrier |] ==> P (x \<squnion> y)" proof (unfold join_def sup_def) - assume L: "x \<in> carrier L" "y \<in> carrier L" - and P: "!!l. least L l (Upper L {x, y}) ==> P l" - with sup_of_two_exists obtain s where "least L s (Upper L {x, y})" by fast - with L show "P (THE l. least L l (Upper L {x, y}))" + assume L: "x \<in> carrier" "y \<in> carrier" + and P: "!!l. least l (Upper {x, y}) ==> P l" + with sup_of_two_exists obtain s where "least s (Upper {x, y})" by fast + with L show "P (THE l. least l (Upper {x, y}))" by (fast intro: theI2 least_unique P) qed lemma (in lattice) join_closed [simp]: - "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<squnion> y \<in> carrier L" + "[| x \<in> carrier; y \<in> carrier |] ==> x \<squnion> y \<in> carrier" by (rule joinI) (rule least_carrier) -lemma (in partial_order) sup_of_singletonI: (* only reflexivity needed ? *) - "x \<in> carrier L ==> least L x (Upper L {x})" +lemma (in partial_order) sup_of_singletonI: (* only reflexivity needed ? *) + "x \<in> carrier ==> least x (Upper {x})" by (rule least_UpperI) fast+ lemma (in partial_order) sup_of_singleton [simp]: - "x \<in> carrier L ==> \<Squnion>{x} = x" + "x \<in> carrier ==> \<Squnion>{x} = x" by (unfold sup_def) (blast intro: least_unique least_UpperI sup_of_singletonI) text {* Condition on @{text A}: supremum exists. *} lemma (in lattice) sup_insertI: - "[| !!s. least L s (Upper L (insert x A)) ==> P s; - least L a (Upper L A); x \<in> carrier L; A \<subseteq> carrier L |] + "[| !!s. least s (Upper (insert x A)) ==> P s; + least a (Upper A); x \<in> carrier; A \<subseteq> carrier |] ==> P (\<Squnion>(insert x A))" proof (unfold sup_def) - assume L: "x \<in> carrier L" "A \<subseteq> carrier L" - and P: "!!l. least L l (Upper L (insert x A)) ==> P l" - and least_a: "least L a (Upper L A)" - from L least_a have La: "a \<in> carrier L" by simp + assume L: "x \<in> carrier" "A \<subseteq> carrier" + and P: "!!l. least l (Upper (insert x A)) ==> P l" + and least_a: "least a (Upper A)" + from least_a have La: "a \<in> carrier" by simp from L sup_of_two_exists least_a - obtain s where least_s: "least L s (Upper L {a, x})" by blast - show "P (THE l. least L l (Upper L (insert x A)))" + obtain s where least_s: "least s (Upper {a, x})" by blast + show "P (THE l. least l (Upper (insert x A)))" proof (rule theI2) - show "least L s (Upper L (insert x A))" + show "least s (Upper (insert x A))" proof (rule least_UpperI) fix z assume "z \<in> insert x A" @@ -248,15 +299,15 @@ qed next fix y - assume y: "y \<in> Upper L (insert x A)" + assume y: "y \<in> Upper (insert x A)" show "s \<sqsubseteq> y" proof (rule least_le [OF least_s], rule Upper_memI) fix z assume z: "z \<in> {a, x}" then show "z \<sqsubseteq> y" proof - have y': "y \<in> Upper L A" - apply (rule subsetD [where A = "Upper L (insert x A)"]) + have y': "y \<in> Upper A" + apply (rule subsetD [where A = "Upper (insert x A)"]) apply (rule Upper_antimono) apply clarify apply assumption done assume "z = a" @@ -267,15 +318,15 @@ qed qed (rule Upper_closed [THEN subsetD]) next - from L show "insert x A \<subseteq> carrier L" by simp - from least_s show "s \<in> carrier L" by simp + from L show "insert x A \<subseteq> carrier" by simp + from least_s show "s \<in> carrier" by simp qed next fix l - assume least_l: "least L l (Upper L (insert x A))" + assume least_l: "least l (Upper (insert x A))" show "l = s" proof (rule least_unique) - show "least L s (Upper L (insert x A))" + show "least s (Upper (insert x A))" proof (rule least_UpperI) fix z assume "z \<in> insert x A" @@ -290,15 +341,15 @@ qed next fix y - assume y: "y \<in> Upper L (insert x A)" + assume y: "y \<in> Upper (insert x A)" show "s \<sqsubseteq> y" proof (rule least_le [OF least_s], rule Upper_memI) fix z assume z: "z \<in> {a, x}" then show "z \<sqsubseteq> y" proof - have y': "y \<in> Upper L A" - apply (rule subsetD [where A = "Upper L (insert x A)"]) + have y': "y \<in> Upper A" + apply (rule subsetD [where A = "Upper (insert x A)"]) apply (rule Upper_antimono) apply clarify apply assumption done assume "z = a" @@ -309,15 +360,15 @@ qed qed (rule Upper_closed [THEN subsetD]) next - from L show "insert x A \<subseteq> carrier L" by simp - from least_s show "s \<in> carrier L" by simp + from L show "insert x A \<subseteq> carrier" by simp + from least_s show "s \<in> carrier" by simp qed qed qed qed lemma (in lattice) finite_sup_least: - "[| finite A; A \<subseteq> carrier L; A ~= {} |] ==> least L (\<Squnion>A) (Upper L A)" + "[| finite A; A \<subseteq> carrier; A ~= {} |] ==> least (\<Squnion>A) (Upper A)" proof (induct set: Finites) case empty then show ?case by simp @@ -329,15 +380,15 @@ with insert show ?thesis by (simp add: sup_of_singletonI) next case False - with insert have "least L (\<Squnion>A) (Upper L A)" by simp + with insert have "least (\<Squnion>A) (Upper A)" by simp with _ show ?thesis by (rule sup_insertI) (simp_all add: insert [simplified]) qed qed lemma (in lattice) finite_sup_insertI: - assumes P: "!!l. least L l (Upper L (insert x A)) ==> P l" - and xA: "finite A" "x \<in> carrier L" "A \<subseteq> carrier L" + assumes P: "!!l. least l (Upper (insert x A)) ==> P l" + and xA: "finite A" "x \<in> carrier" "A \<subseteq> carrier" shows "P (\<Squnion> (insert x A))" proof (cases "A = {}") case True with P and xA show ?thesis @@ -348,7 +399,7 @@ qed lemma (in lattice) finite_sup_closed: - "[| finite A; A \<subseteq> carrier L; A ~= {} |] ==> \<Squnion>A \<in> carrier L" + "[| finite A; A \<subseteq> carrier; A ~= {} |] ==> \<Squnion>A \<in> carrier" proof (induct set: Finites) case empty then show ?case by simp next @@ -357,39 +408,39 @@ qed lemma (in lattice) join_left: - "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> x \<squnion> y" + "[| x \<in> carrier; y \<in> carrier |] ==> x \<sqsubseteq> x \<squnion> y" by (rule joinI [folded join_def]) (blast dest: least_mem) lemma (in lattice) join_right: - "[| x \<in> carrier L; y \<in> carrier L |] ==> y \<sqsubseteq> x \<squnion> y" + "[| x \<in> carrier; y \<in> carrier |] ==> y \<sqsubseteq> x \<squnion> y" by (rule joinI [folded join_def]) (blast dest: least_mem) lemma (in lattice) sup_of_two_least: - "[| x \<in> carrier L; y \<in> carrier L |] ==> least L (\<Squnion>{x, y}) (Upper L {x, y})" + "[| x \<in> carrier; y \<in> carrier |] ==> least (\<Squnion>{x, y}) (Upper {x, y})" proof (unfold sup_def) - assume L: "x \<in> carrier L" "y \<in> carrier L" - with sup_of_two_exists obtain s where "least L s (Upper L {x, y})" by fast - with L show "least L (THE xa. least L xa (Upper L {x, y})) (Upper L {x, y})" + assume L: "x \<in> carrier" "y \<in> carrier" + with sup_of_two_exists obtain s where "least s (Upper {x, y})" by fast + with L show "least (THE xa. least xa (Upper {x, y})) (Upper {x, y})" by (fast intro: theI2 least_unique) (* blast fails *) qed lemma (in lattice) join_le: assumes sub: "x \<sqsubseteq> z" "y \<sqsubseteq> z" - and L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" + and L: "x \<in> carrier" "y \<in> carrier" "z \<in> carrier" shows "x \<squnion> y \<sqsubseteq> z" proof (rule joinI) fix s - assume "least L s (Upper L {x, y})" + assume "least s (Upper {x, y})" with sub L show "s \<sqsubseteq> z" by (fast elim: least_le intro: Upper_memI) qed lemma (in lattice) join_assoc_lemma: - assumes L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" + assumes L: "x \<in> carrier" "y \<in> carrier" "z \<in> carrier" shows "x \<squnion> (y \<squnion> z) = \<Squnion>{x, y, z}" proof (rule finite_sup_insertI) -- {* The textbook argument in Jacobson I, p 457 *} fix s - assume sup: "least L s (Upper L {x, y, z})" + assume sup: "least s (Upper {x, y, z})" show "x \<squnion> (y \<squnion> z) = s" proof (rule anti_sym) from sup L show "x \<squnion> (y \<squnion> z) \<sqsubseteq> s" @@ -401,13 +452,12 @@ qed (simp_all add: L least_carrier [OF sup]) qed (simp_all add: L) -lemma join_comm: - fixes L (structure) - shows "x \<squnion> y = y \<squnion> x" +lemma (in order_syntax) join_comm: + "x \<squnion> y = y \<squnion> x" by (unfold join_def) (simp add: insert_commute) lemma (in lattice) join_assoc: - assumes L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" + assumes L: "x \<in> carrier" "y \<in> carrier" "z \<in> carrier" shows "(x \<squnion> y) \<squnion> z = x \<squnion> (y \<squnion> z)" proof - have "(x \<squnion> y) \<squnion> z = z \<squnion> (x \<squnion> y)" by (simp only: join_comm) @@ -421,45 +471,45 @@ subsubsection {* Infimum *} lemma (in lattice) meetI: - "[| !!i. greatest L i (Lower L {x, y}) ==> P i; - x \<in> carrier L; y \<in> carrier L |] + "[| !!i. greatest i (Lower {x, y}) ==> P i; + x \<in> carrier; y \<in> carrier |] ==> P (x \<sqinter> y)" proof (unfold meet_def inf_def) - assume L: "x \<in> carrier L" "y \<in> carrier L" - and P: "!!g. greatest L g (Lower L {x, y}) ==> P g" - with inf_of_two_exists obtain i where "greatest L i (Lower L {x, y})" by fast - with L show "P (THE g. greatest L g (Lower L {x, y}))" + assume L: "x \<in> carrier" "y \<in> carrier" + and P: "!!g. greatest g (Lower {x, y}) ==> P g" + with inf_of_two_exists obtain i where "greatest i (Lower {x, y})" by fast + with L show "P (THE g. greatest g (Lower {x, y}))" by (fast intro: theI2 greatest_unique P) qed lemma (in lattice) meet_closed [simp]: - "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqinter> y \<in> carrier L" + "[| x \<in> carrier; y \<in> carrier |] ==> x \<sqinter> y \<in> carrier" by (rule meetI) (rule greatest_carrier) lemma (in partial_order) inf_of_singletonI: (* only reflexivity needed ? *) - "x \<in> carrier L ==> greatest L x (Lower L {x})" + "x \<in> carrier ==> greatest x (Lower {x})" by (rule greatest_LowerI) fast+ lemma (in partial_order) inf_of_singleton [simp]: - "x \<in> carrier L ==> \<Sqinter> {x} = x" + "x \<in> carrier ==> \<Sqinter> {x} = x" by (unfold inf_def) (blast intro: greatest_unique greatest_LowerI inf_of_singletonI) text {* Condition on A: infimum exists. *} lemma (in lattice) inf_insertI: - "[| !!i. greatest L i (Lower L (insert x A)) ==> P i; - greatest L a (Lower L A); x \<in> carrier L; A \<subseteq> carrier L |] + "[| !!i. greatest i (Lower (insert x A)) ==> P i; + greatest a (Lower A); x \<in> carrier; A \<subseteq> carrier |] ==> P (\<Sqinter>(insert x A))" proof (unfold inf_def) - assume L: "x \<in> carrier L" "A \<subseteq> carrier L" - and P: "!!g. greatest L g (Lower L (insert x A)) ==> P g" - and greatest_a: "greatest L a (Lower L A)" - from L greatest_a have La: "a \<in> carrier L" by simp + assume L: "x \<in> carrier" "A \<subseteq> carrier" + and P: "!!g. greatest g (Lower (insert x A)) ==> P g" + and greatest_a: "greatest a (Lower A)" + from greatest_a have La: "a \<in> carrier" by simp from L inf_of_two_exists greatest_a - obtain i where greatest_i: "greatest L i (Lower L {a, x})" by blast - show "P (THE g. greatest L g (Lower L (insert x A)))" + obtain i where greatest_i: "greatest i (Lower {a, x})" by blast + show "P (THE g. greatest g (Lower (insert x A)))" proof (rule theI2) - show "greatest L i (Lower L (insert x A))" + show "greatest i (Lower (insert x A))" proof (rule greatest_LowerI) fix z assume "z \<in> insert x A" @@ -474,15 +524,15 @@ qed next fix y - assume y: "y \<in> Lower L (insert x A)" + assume y: "y \<in> Lower (insert x A)" show "y \<sqsubseteq> i" proof (rule greatest_le [OF greatest_i], rule Lower_memI) fix z assume z: "z \<in> {a, x}" then show "y \<sqsubseteq> z" proof - have y': "y \<in> Lower L A" - apply (rule subsetD [where A = "Lower L (insert x A)"]) + have y': "y \<in> Lower A" + apply (rule subsetD [where A = "Lower (insert x A)"]) apply (rule Lower_antimono) apply clarify apply assumption done assume "z = a" @@ -493,15 +543,15 @@ qed qed (rule Lower_closed [THEN subsetD]) next - from L show "insert x A \<subseteq> carrier L" by simp - from greatest_i show "i \<in> carrier L" by simp + from L show "insert x A \<subseteq> carrier" by simp + from greatest_i show "i \<in> carrier" by simp qed next fix g - assume greatest_g: "greatest L g (Lower L (insert x A))" + assume greatest_g: "greatest g (Lower (insert x A))" show "g = i" proof (rule greatest_unique) - show "greatest L i (Lower L (insert x A))" + show "greatest i (Lower (insert x A))" proof (rule greatest_LowerI) fix z assume "z \<in> insert x A" @@ -516,15 +566,15 @@ qed next fix y - assume y: "y \<in> Lower L (insert x A)" + assume y: "y \<in> Lower (insert x A)" show "y \<sqsubseteq> i" proof (rule greatest_le [OF greatest_i], rule Lower_memI) fix z assume z: "z \<in> {a, x}" then show "y \<sqsubseteq> z" proof - have y': "y \<in> Lower L A" - apply (rule subsetD [where A = "Lower L (insert x A)"]) + have y': "y \<in> Lower A" + apply (rule subsetD [where A = "Lower (insert x A)"]) apply (rule Lower_antimono) apply clarify apply assumption done assume "z = a" @@ -535,15 +585,15 @@ qed qed (rule Lower_closed [THEN subsetD]) next - from L show "insert x A \<subseteq> carrier L" by simp - from greatest_i show "i \<in> carrier L" by simp + from L show "insert x A \<subseteq> carrier" by simp + from greatest_i show "i \<in> carrier" by simp qed qed qed qed lemma (in lattice) finite_inf_greatest: - "[| finite A; A \<subseteq> carrier L; A ~= {} |] ==> greatest L (\<Sqinter>A) (Lower L A)" + "[| finite A; A \<subseteq> carrier; A ~= {} |] ==> greatest (\<Sqinter>A) (Lower A)" proof (induct set: Finites) case empty then show ?case by simp next @@ -556,14 +606,14 @@ case False from insert show ?thesis proof (rule_tac inf_insertI) - from False insert show "greatest L (\<Sqinter>A) (Lower L A)" by simp + from False insert show "greatest (\<Sqinter>A) (Lower A)" by simp qed simp_all qed qed lemma (in lattice) finite_inf_insertI: - assumes P: "!!i. greatest L i (Lower L (insert x A)) ==> P i" - and xA: "finite A" "x \<in> carrier L" "A \<subseteq> carrier L" + assumes P: "!!i. greatest i (Lower (insert x A)) ==> P i" + and xA: "finite A" "x \<in> carrier" "A \<subseteq> carrier" shows "P (\<Sqinter> (insert x A))" proof (cases "A = {}") case True with P and xA show ?thesis @@ -574,7 +624,7 @@ qed lemma (in lattice) finite_inf_closed: - "[| finite A; A \<subseteq> carrier L; A ~= {} |] ==> \<Sqinter>A \<in> carrier L" + "[| finite A; A \<subseteq> carrier; A ~= {} |] ==> \<Sqinter>A \<in> carrier" proof (induct set: Finites) case empty then show ?case by simp next @@ -583,41 +633,41 @@ qed lemma (in lattice) meet_left: - "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqinter> y \<sqsubseteq> x" + "[| x \<in> carrier; y \<in> carrier |] ==> x \<sqinter> y \<sqsubseteq> x" by (rule meetI [folded meet_def]) (blast dest: greatest_mem) lemma (in lattice) meet_right: - "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqinter> y \<sqsubseteq> y" + "[| x \<in> carrier; y \<in> carrier |] ==> x \<sqinter> y \<sqsubseteq> y" by (rule meetI [folded meet_def]) (blast dest: greatest_mem) lemma (in lattice) inf_of_two_greatest: - "[| x \<in> carrier L; y \<in> carrier L |] ==> - greatest L (\<Sqinter> {x, y}) (Lower L {x, y})" + "[| x \<in> carrier; y \<in> carrier |] ==> + greatest (\<Sqinter> {x, y}) (Lower {x, y})" proof (unfold inf_def) - assume L: "x \<in> carrier L" "y \<in> carrier L" - with inf_of_two_exists obtain s where "greatest L s (Lower L {x, y})" by fast + assume L: "x \<in> carrier" "y \<in> carrier" + with inf_of_two_exists obtain s where "greatest s (Lower {x, y})" by fast with L - show "greatest L (THE xa. greatest L xa (Lower L {x, y})) (Lower L {x, y})" + show "greatest (THE xa. greatest xa (Lower {x, y})) (Lower {x, y})" by (fast intro: theI2 greatest_unique) (* blast fails *) qed lemma (in lattice) meet_le: assumes sub: "z \<sqsubseteq> x" "z \<sqsubseteq> y" - and L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" + and L: "x \<in> carrier" "y \<in> carrier" "z \<in> carrier" shows "z \<sqsubseteq> x \<sqinter> y" proof (rule meetI) fix i - assume "greatest L i (Lower L {x, y})" + assume "greatest i (Lower {x, y})" with sub L show "z \<sqsubseteq> i" by (fast elim: greatest_le intro: Lower_memI) qed lemma (in lattice) meet_assoc_lemma: - assumes L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" + assumes L: "x \<in> carrier" "y \<in> carrier" "z \<in> carrier" shows "x \<sqinter> (y \<sqinter> z) = \<Sqinter>{x, y, z}" proof (rule finite_inf_insertI) txt {* The textbook argument in Jacobson I, p 457 *} fix i - assume inf: "greatest L i (Lower L {x, y, z})" + assume inf: "greatest i (Lower {x, y, z})" show "x \<sqinter> (y \<sqinter> z) = i" proof (rule anti_sym) from inf L show "i \<sqsubseteq> x \<sqinter> (y \<sqinter> z)" @@ -629,13 +679,12 @@ qed (simp_all add: L greatest_carrier [OF inf]) qed (simp_all add: L) -lemma meet_comm: - fixes L (structure) - shows "x \<sqinter> y = y \<sqinter> x" +lemma (in order_syntax) meet_comm: + "x \<sqinter> y = y \<sqinter> x" by (unfold meet_def) (simp add: insert_commute) lemma (in lattice) meet_assoc: - assumes L: "x \<in> carrier L" "y \<in> carrier L" "z \<in> carrier L" + assumes L: "x \<in> carrier" "y \<in> carrier" "z \<in> carrier" shows "(x \<sqinter> y) \<sqinter> z = x \<sqinter> (y \<sqinter> z)" proof - have "(x \<sqinter> y) \<sqinter> z = z \<sqinter> (x \<sqinter> y)" by (simp only: meet_comm) @@ -649,51 +698,70 @@ subsection {* Total Orders *} locale total_order = lattice + - assumes total: "[| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x" + assumes total: "[| x \<in> carrier; y \<in> carrier |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x" + +abbreviation (in total_order) + less (infixl "\<sqsubset>" 50) "less == order_syntax.less le" +abbreviation (in total_order) + Upper where "Upper == order_syntax.Upper carrier le" +abbreviation (in total_order) + Lower where "Lower == order_syntax.Lower carrier le" +abbreviation (in total_order) + least where "least == order_syntax.least carrier le" +abbreviation (in total_order) + greatest where "greatest == order_syntax.greatest carrier le" +abbreviation (in total_order) + sup ("\<Squnion>") (* FIXME precedence *) "sup == order_syntax.sup carrier le" +abbreviation (in total_order) + inf ("\<Sqinter>") (* FIXME precedence *) "inf == order_syntax.inf carrier le" +abbreviation (in total_order) + join (infixl "\<squnion>" 65) "join == order_syntax.join carrier le" +abbreviation (in total_order) + meet (infixl "\<sqinter>" 70) "meet == order_syntax.meet carrier le" text {* Introduction rule: the usual definition of total order *} lemma (in partial_order) total_orderI: - assumes total: "!!x y. [| x \<in> carrier L; y \<in> carrier L |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x" - shows "total_order L" + assumes total: "!!x y. [| x \<in> carrier; y \<in> carrier |] ==> x \<sqsubseteq> y | y \<sqsubseteq> x" + shows "total_order carrier le" proof intro_locales - show "lattice_axioms L" + show "lattice_axioms carrier le" proof (rule lattice_axioms.intro) fix x y - assume L: "x \<in> carrier L" "y \<in> carrier L" - show "EX s. least L s (Upper L {x, y})" + assume L: "x \<in> carrier" "y \<in> carrier" + show "EX s. least s (Upper {x, y})" proof - note total L moreover { assume "x \<sqsubseteq> y" - with L have "least L y (Upper L {x, y})" + with L have "least y (Upper {x, y})" by (rule_tac least_UpperI) auto } moreover { assume "y \<sqsubseteq> x" - with L have "least L x (Upper L {x, y})" + with L have "least x (Upper {x, y})" by (rule_tac least_UpperI) auto } ultimately show ?thesis by blast qed next fix x y - assume L: "x \<in> carrier L" "y \<in> carrier L" - show "EX i. greatest L i (Lower L {x, y})" + assume L: "x \<in> carrier" "y \<in> carrier" + show "EX i. greatest i (Lower {x, y})" proof - note total L moreover { assume "y \<sqsubseteq> x" - with L have "greatest L y (Lower L {x, y})" + with L have "greatest y (Lower {x, y})" by (rule_tac greatest_LowerI) auto } moreover { assume "x \<sqsubseteq> y" - with L have "greatest L x (Lower L {x, y})" + with L have "greatest x (Lower {x, y})" by (rule_tac greatest_LowerI) auto } ultimately show ?thesis by blast @@ -706,97 +774,134 @@ locale complete_lattice = lattice + assumes sup_exists: - "[| A \<subseteq> carrier L |] ==> EX s. least L s (Upper L A)" + "[| A \<subseteq> carrier |] ==> EX s. order_syntax.least carrier le s (order_syntax.Upper carrier le A)" and inf_exists: - "[| A \<subseteq> carrier L |] ==> EX i. greatest L i (Lower L A)" + "[| A \<subseteq> carrier |] ==> EX i. order_syntax.greatest carrier le i (order_syntax.Lower carrier le A)" + +abbreviation (in complete_lattice) + less (infixl "\<sqsubset>" 50) "less == order_syntax.less le" +abbreviation (in complete_lattice) + Upper where "Upper == order_syntax.Upper carrier le" +abbreviation (in complete_lattice) + Lower where "Lower == order_syntax.Lower carrier le" +abbreviation (in complete_lattice) + least where "least == order_syntax.least carrier le" +abbreviation (in complete_lattice) + greatest where "greatest == order_syntax.greatest carrier le" +abbreviation (in complete_lattice) + sup ("\<Squnion>") (* FIXME precedence *) "sup == order_syntax.sup carrier le" +abbreviation (in complete_lattice) + inf ("\<Sqinter>") (* FIXME precedence *) "inf == order_syntax.inf carrier le" +abbreviation (in complete_lattice) + join (infixl "\<squnion>" 65) "join == order_syntax.join carrier le" +abbreviation (in complete_lattice) + meet (infixl "\<sqinter>" 70) "meet == order_syntax.meet carrier le" text {* Introduction rule: the usual definition of complete lattice *} lemma (in partial_order) complete_latticeI: assumes sup_exists: - "!!A. [| A \<subseteq> carrier L |] ==> EX s. least L s (Upper L A)" + "!!A. [| A \<subseteq> carrier |] ==> EX s. least s (Upper A)" and inf_exists: - "!!A. [| A \<subseteq> carrier L |] ==> EX i. greatest L i (Lower L A)" - shows "complete_lattice L" + "!!A. [| A \<subseteq> carrier |] ==> EX i. greatest i (Lower A)" + shows "complete_lattice carrier le" proof intro_locales - show "lattice_axioms L" + show "lattice_axioms carrier le" by (rule lattice_axioms.intro) (blast intro: sup_exists inf_exists)+ qed (assumption | rule complete_lattice_axioms.intro)+ -constdefs (structure L) - top :: "_ => 'a" ("\<top>\<index>") - "\<top> == sup L (carrier L)" +definition (in order_syntax) + top ("\<top>") + "\<top> == sup carrier" + +definition (in order_syntax) + bottom ("\<bottom>") + "\<bottom> == inf carrier" - bottom :: "_ => 'a" ("\<bottom>\<index>") - "\<bottom> == inf L (carrier L)" +abbreviation (in partial_order) + top ("\<top>") "top == order_syntax.top carrier le" +abbreviation (in partial_order) + bottom ("\<bottom>") "bottom == order_syntax.bottom carrier le" +abbreviation (in lattice) + top ("\<top>") "top == order_syntax.top carrier le" +abbreviation (in lattice) + bottom ("\<bottom>") "bottom == order_syntax.bottom carrier le" +abbreviation (in total_order) + top ("\<top>") "top == order_syntax.top carrier le" +abbreviation (in total_order) + bottom ("\<bottom>") "bottom == order_syntax.bottom carrier le" +abbreviation (in complete_lattice) + top ("\<top>") "top == order_syntax.top carrier le" +abbreviation (in complete_lattice) + bottom ("\<bottom>") "bottom == order_syntax.bottom carrier le" lemma (in complete_lattice) supI: - "[| !!l. least L l (Upper L A) ==> P l; A \<subseteq> carrier L |] + "[| !!l. least l (Upper A) ==> P l; A \<subseteq> carrier |] ==> P (\<Squnion>A)" proof (unfold sup_def) - assume L: "A \<subseteq> carrier L" - and P: "!!l. least L l (Upper L A) ==> P l" - with sup_exists obtain s where "least L s (Upper L A)" by blast - with L show "P (THE l. least L l (Upper L A))" + assume L: "A \<subseteq> carrier" + and P: "!!l. least l (Upper A) ==> P l" + with sup_exists obtain s where "least s (Upper A)" by blast + with L show "P (THE l. least l (Upper A))" by (fast intro: theI2 least_unique P) qed lemma (in complete_lattice) sup_closed [simp]: - "A \<subseteq> carrier L ==> \<Squnion>A \<in> carrier L" + "A \<subseteq> carrier ==> \<Squnion>A \<in> carrier" by (rule supI) simp_all lemma (in complete_lattice) top_closed [simp, intro]: - "\<top> \<in> carrier L" + "\<top> \<in> carrier" by (unfold top_def) simp lemma (in complete_lattice) infI: - "[| !!i. greatest L i (Lower L A) ==> P i; A \<subseteq> carrier L |] + "[| !!i. greatest i (Lower A) ==> P i; A \<subseteq> carrier |] ==> P (\<Sqinter>A)" proof (unfold inf_def) - assume L: "A \<subseteq> carrier L" - and P: "!!l. greatest L l (Lower L A) ==> P l" - with inf_exists obtain s where "greatest L s (Lower L A)" by blast - with L show "P (THE l. greatest L l (Lower L A))" + assume L: "A \<subseteq> carrier" + and P: "!!l. greatest l (Lower A) ==> P l" + with inf_exists obtain s where "greatest s (Lower A)" by blast + with L show "P (THE l. greatest l (Lower A))" by (fast intro: theI2 greatest_unique P) qed lemma (in complete_lattice) inf_closed [simp]: - "A \<subseteq> carrier L ==> \<Sqinter>A \<in> carrier L" + "A \<subseteq> carrier ==> \<Sqinter>A \<in> carrier" by (rule infI) simp_all lemma (in complete_lattice) bottom_closed [simp, intro]: - "\<bottom> \<in> carrier L" + "\<bottom> \<in> carrier" by (unfold bottom_def) simp text {* Jacobson: Theorem 8.1 *} -lemma Lower_empty [simp]: - "Lower L {} = carrier L" +lemma (in order_syntax) Lower_empty [simp]: + "Lower {} = carrier" by (unfold Lower_def) simp -lemma Upper_empty [simp]: - "Upper L {} = carrier L" +lemma (in order_syntax) Upper_empty [simp]: + "Upper {} = carrier" by (unfold Upper_def) simp theorem (in partial_order) complete_lattice_criterion1: - assumes top_exists: "EX g. greatest L g (carrier L)" + assumes top_exists: "EX g. greatest g (carrier)" and inf_exists: - "!!A. [| A \<subseteq> carrier L; A ~= {} |] ==> EX i. greatest L i (Lower L A)" - shows "complete_lattice L" + "!!A. [| A \<subseteq> carrier; A ~= {} |] ==> EX i. greatest i (Lower A)" + shows "complete_lattice carrier le" proof (rule complete_latticeI) - from top_exists obtain top where top: "greatest L top (carrier L)" .. + from top_exists obtain top where top: "greatest top (carrier)" .. fix A - assume L: "A \<subseteq> carrier L" - let ?B = "Upper L A" + assume L: "A \<subseteq> carrier" + let ?B = "Upper A" from L top have "top \<in> ?B" by (fast intro!: Upper_memI intro: greatest_le) then have B_non_empty: "?B ~= {}" by fast - have B_L: "?B \<subseteq> carrier L" by simp + have B_L: "?B \<subseteq> carrier" by simp from inf_exists [OF B_L B_non_empty] - obtain b where b_inf_B: "greatest L b (Lower L ?B)" .. - have "least L b (Upper L A)" + obtain b where b_inf_B: "greatest b (Lower ?B)" .. + have "least b (Upper A)" apply (rule least_UpperI) - apply (rule greatest_le [where A = "Lower L ?B"]) + apply (rule greatest_le [where A = "Lower ?B"]) apply (rule b_inf_B) apply (rule Lower_memI) apply (erule UpperD) @@ -808,11 +913,11 @@ apply (rule L) apply (rule greatest_carrier [OF b_inf_B]) (* rename rule: _closed *) done - then show "EX s. least L s (Upper L A)" .. + then show "EX s. least s (Upper A)" .. next fix A - assume L: "A \<subseteq> carrier L" - show "EX i. greatest L i (Lower L A)" + assume L: "A \<subseteq> carrier" + show "EX i. greatest i (Lower A)" proof (cases "A = {}") case True then show ?thesis by (simp add: top_exists) @@ -830,25 +935,25 @@ subsubsection {* Powerset of a Set is a Complete Lattice *} theorem powerset_is_complete_lattice: - "complete_lattice (| carrier = Pow A, le = op \<subseteq> |)" - (is "complete_lattice ?L") + "complete_lattice (Pow A) (op \<subseteq>)" + (is "complete_lattice ?car ?le") proof (rule partial_order.complete_latticeI) - show "partial_order ?L" + show "partial_order ?car ?le" by (rule partial_order.intro) auto next fix B - assume "B \<subseteq> carrier ?L" - then have "least ?L (\<Union> B) (Upper ?L B)" - by (fastsimp intro!: least_UpperI simp: Upper_def) - then show "EX s. least ?L s (Upper ?L B)" .. + assume "B \<subseteq> ?car" + then have "order_syntax.least ?car ?le (\<Union> B) (order_syntax.Upper ?car ?le B)" + by (fastsimp intro!: order_syntax.least_UpperI simp: order_syntax.Upper_def) + then show "EX s. order_syntax.least ?car ?le s (order_syntax.Upper ?car ?le B)" .. next fix B - assume "B \<subseteq> carrier ?L" - then have "greatest ?L (\<Inter> B \<inter> A) (Lower ?L B)" + assume "B \<subseteq> ?car" + then have "order_syntax.greatest ?car ?le (\<Inter> B \<inter> A) (order_syntax.Lower ?car ?le B)" txt {* @{term "\<Inter> B"} is not the infimum of @{term B}: @{term "\<Inter> {} = UNIV"} which is in general bigger than @{term "A"}! *} - by (fastsimp intro!: greatest_LowerI simp: Lower_def) - then show "EX i. greatest ?L i (Lower ?L B)" .. + by (fastsimp intro!: order_syntax.greatest_LowerI simp: order_syntax.Lower_def) + then show "EX i. order_syntax.greatest ?car ?le i (order_syntax.Lower ?car ?le B)" .. qed text {* An other example, that of the lattice of subgroups of a group,