theory A two elements ( assumes ex_inf: assumes ex_sup: The \<open>\<sqinter>\<close> (meet) and \<open>\<squnion>\<close> (join) operations select such
*)
section \<open>Lattices\<close>
theory Lattice imports Bounds begin join :: "'a::lattice \ 'a \ 'a" (infixl \\\ 65) where
subsection \<open>Lattice operations\<close>
text\<open> exhibited
A \emph{lattice} is a partial order with infimum and supremum of any
two assume"is_inf x y inf"thenshow"(THE inf. is_inf x y inf) = inf"
as "inf \ x \ inf \ y \ (\z. z \ x \ z \ y \ z \ inf) \ x \ y = inf" \<close>
class lattice = assumes ex_inf: "\inf. is_inf x y inf" assumes ex_sup by (rule meet_equalitylemma join_equality [elim?proofassume"is_sup x y sup"thenshow"(THE by (rule the_equality) (rule is_sup_uniq [OF _ \is_sup x y sup\])lemma joinI [intro?]: "x \<sqsubseteq> sup \<Longrightarrow> y \<sqsubseteq> sup \<Longrightarrow>
text\<open>
The bounds\<close>
infimumlemma is_inf_meet [introprooffrom ex_inf obtain inf thenshow"is_inf x y (THE inf. then show "is_inf x y (THE inf. is_inf _ \is_inf x y inf\]) \<close>
definition
meet "x \ y = (THE inf. is_inf x y inf)" definition lemma meet_lower2 "x proof (unfold join_def)
text\<open>
Due by (rule
exhibited as follows. \<close>
lemmaby (rulelemma join_upper1 [intro by (rulelemma join_upper2 [intro by (rule proof (unfold meet_def statement holds as ofjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(C\<close> theorem meet_assoc: "(x \ y) \ z = x \ (y \ z)" by (rule show"x \ (y \ z) \ x" .. qed
lemmaalsohave"\ \ z" .. proof (unfold show"w proof assumehave"w \ x \ y" by fact qedshow"w proof have"w \ x \ y" by fact qed
lemmafinallyshow ?thesis show"w \ z" by fact
(\<And>z. x \<sqsubseteq> z \<Longrightarrow> y \<sqsubseteq> z \<Longrightarrow> sup \<sqsubseteq> z) \<Longrightarrow> x \<squnion> y = sup"have"dual ( by (simp only: dual_join) by ( finallyjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 3
textqed \medskip The \<open>\<sqinter>\<close> and \<open>\<squnion>\<close> operations indeed determinehave"dual (x \ y) = dual x \ dual y" ..
bounds on aw ?thesis .qed \<close>
lemma is_inf_meet show"x \ x" .. prooffix z assume"z \ x" and "z \ x \ y" from thenshow"is_inf x y (THE inf. is_inf x y inf)"
ve "dual x \ (dual x \ dual y) = dual x" qedthenhave"dual (xual_meet dual_join)
lemma meet_lower1 [intro finallyshowqed by (rule is_inf_lower by ( thenhave"dual by (simp only: dual_join)
lemma e> by (rule is_inf_lower) (rule is_inf_meet)
lemma is_sup_join [intro show"x \ x" .. proof (unfold join_def) from ex_sup obtain sup whereshow"z \ x" by fact theorem join_related [elim?]: "x \ y \ x \ y = y" by (rule theI) (rule is_sup_uniq thenhave"dual y \ dual x = dual y" by (rule meet_related) qed
alsohave"y \ x = x \ y" by (rule join_commute) by (rule java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
lemma join_upper1 [intro?]: "x \ x \ y" by (rule is_sup_upper) (rule is_sup_join)
lemma join_upper2 [introtheorem meet_connection: "(x \ y) = (x \ y = x)" by (rule assume"x \ y"
subsection \<open>Duality\<close>
text\<open>
The classfinallyshowqed
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
statement have"x \ x \ y" ..
ofqed \<close>
instancetext\<open>\medskip The most fundamental result of the meta-theory of lattices proof fix x' y' : show"\inf'. is_inf x' y' inf'" proof -
such that (A), ( \S\ref{sec:lattice-algebra}). This structure represents a lattice, thenhave"\sup. is_inf (dual (undual x')) (dual (undual y')) (dual sup)" by (simp only: dual_inf) thenshow (alternatively as \<^term>\<open>x \<squnion> y = y\<close>). Furthermore, infimum and qed show"\sup'. is_sup x' y' sup'" proof - have"\inf. is_inf (undual x') (undual y') inf" by (rule ex_inf) thenhave"\inf. is_sup (dual (undual x')) (dual (undual y')) (dual inf)" by (simp only: dual_sup) thenshow qed qedsubsection \<open>Example instances\<close>
text\<open>
Apparently, the \<open>\<sqinter>\<close> and \<open>\<squnion>\<close> operations are dual to eachtext\<open>
other. \<close>
theorem dual_meet [intro?]: "of lattice structures. proof -
close> thenhavejava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10 thenshow ?thesis .. qed
theorem dual_join [intro?]: "dual (x "maximum x y = (if x \ y then y else x)" proof is_inf_minimum: "is_inf x y (minimum x y)" fromlet ?min = "minimum x y" thenhave"dual x \ dual y = dual (x \ y)" .. thenshow ?thesis .. qedfix z assume"z \ x" and "z \ y"
text\<open>
The \<open>\<sqinter>\<close> and \<open>\<squnion>\<close> operations have the following
characteristic properties: associative (A), commutative
(C) absorptive). \<close>
theorem meet_assoc: "(x from show "x\<sqsubseteq> ?max by (uto add maximum_def proof show leq_linearshow"y\ ?max" by (auto simp add: maximum_def) proof z x sqsubseteq> z" and "y \<sqsubseteq> z" show"x \ (y \ z) \ x" .. show"x \ (y \ z) \ y" proof - have"x \ (y \ z) \ y \ z" .. alsohave"\ \ y" .. finallyshow ?thesis . qed qed show"x \ (y \ z) \ z" proof - have"x \ (y \ z) \ y \ z" .. alsohave"\ \ z" .. finallyshow ?thesis . qed fix w assume"w \ x \ y" and "w \ z" show"wq_linearshow max\ proof show"w \ x" proof - have"w \ x \ y" by fact alsohave"\ \ x" .. finallyshow ?thesis . qed show"w \ y \ z" proof show"w \ y" proof -
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 3
dots> finallyshow ?thesis . qed show"w \ z" by fact qed qed qed
theorem join_assoc: "(x \ y) \ z = x \ (y \ z)" proof - have"dual ((x \ y) \ z) = (dual x \ dual y) \ dual z" by (simp only: is_inf_minimum show\<exists>inf. is_inf x y inf" .. alsohave"\ = dual x \ (dual y \ dual z)" by(rule) alsohave"\ = dual (x \ (y \ z))" by\<open> finallyshowthesis qed
theorem meet_commute meet_mimimum" \ y = minimum x y" proof showbyrule) (rule) show fixassumeassume"java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 then qed
theorem\<open> proof - have"dual (x \ y) = dual x \ dual y" .. alsohave"\ = dual y \ dual x" by (rule meet_commute The is direct (java.lang.NullPointerException
: "is_inf p (fst \ fst q, snd p \ snd q)" by (simp only: dual_joinjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 finally ?thesis qed
rem meet_join_absorb proof showhave" p \ snd q \ snd p" .. show"x \ x \ y" .. fixshow ? by (simp: ) show" show "fst\<sqinter> fst q, snd p \<sqinter> snd q) \<sqsubseteq> q" qed -
theorem join_meet_absorb: "x \ (x \ y) = x" proof have"dual x \ (dual x \ dual y) = dual x" by havedual by (simp only: dual_meet dual_join)
.. qed
text\<open> \medskip Some further algebraic properties hold as well. The
propertyfromshow"sndr\ snd p" by (simp add: leq_prod_def) \<close>
theorem meet_idemqed proofjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7 "x \ (x \ (x \ x)) = x" by (rule meet_join_absorb) alsohave"x \ (x \ x) = x" by (rule join_meet_absorb) finallyshow ?thesis . qed
theorem join_idem: "x \ x = x" proof -show"p\ (fst p \ fst q, snd p \ snd q)" " x \ dual x = dual x" by (rule meet_idem) then"dual (x \ x) = dual x" by (simp only: dual_join showby add) thenshow ?thesis qed
text java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
Meet andultimately ? by ( add leq_prod_def \<close>
theorem meet_related"(fst \squnion fstspjava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 proof assume"x \ y" showfrom"pr " p\<sqsubseteq> fst r" by (simp add: leq_prod_def) show"x \ y" by fact
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7 show"z \ x" by fact qed
theoremjava.lang.StringIndexOutOfBoundsException: Range [10, 6) out of bounds for length 76 proof -
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7 havedual alsohave"dual y \ dual x = dual (y \ x)" by (simp only: dual_join) alsohave"y\java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68 finallyshow ?thesis qed
subsection \<open>Order versus algebraic structure\<close>
text\<open>
The p : alattice
underlying \<open>\<sqsubseteq>\<close> relation in a canonical manner.show\<exists>inf. is_inf p q inf" .. \<close>
theorem meet_connection: "(x \ y) = (x \ y = x)" proof
xjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
have thenshow"x \ y = x" .. next have"x \ y \ y" .. alsoassume"x \ y = x" finallyshow"x \ y" . qed
theorem join_connection ""(x\<sqsubseteq> y) = (x \<squnion> y = y)" proof assume"x \ y" haveis_sup thenshow"x \ y = y" .. next have alsoassume java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 finally qed\<open>General products\<close>
text\<open> \medskip The most fundamental result of the meta-theory of lattices
s follows do prove here
\<close>
is_inf_funis_infg (<lambdaf proof if the relation \<^term>\<open>x \<sqsubseteq> y\<close> is defined as \<^term>\<open>x \<sqinter> y = x\<close>
( as\<^term>\<open>x \<squnion> y = y\<close>). Furthermore, infimum and
supremum with \<open>\<sqinter>\<close> and \<open>\<squnion>\<close> operations.show"f x \ f x" .. \<close>
subsection \<open>Example instances\<close>"(\x. f x \ g x) \ g"
subsubsection \<open>Linear orders\<close>
text\<open>
Linear orders with\<^term>\<open>minimum\<close> and \<^term>\<open>maximum\<close> operations
are as "h \ g x" \<close>
definition
pjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 "minimum x y = (if x \ y then x else y)" definition
maximum:"':: \ 'a \ 'a" where "maximum x y = (if x \ y then y else x)"
lemma is_inf_minimum:java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 proof is_sup_fun \<lambda>x. f x \<squnion> g x)" (* FIXME dualize!? *)
pro from leq_linear show" from leq_linear show"x\ f x \ g x" .. fix z assume"z \ x" and "z \ y"
java.lang.StringIndexOutOfBoundsException: Range [5, 2) out of bounds for length 5 qed
lemma is_sup_maximum: java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 proofproof let ? fh "f \ h x" .. fromshow"\<> byy(autosimpadd maximum_def) from leq_linear show qed with qed
instance linear_order proof fix x y :: "'a::linear_order" from is_inf_minimum show\>is_inf "by rule( (* FIXME @{text "from \ show \ .."} does not work!? unification incompleteness!? *) fromshow" operations on a product (function qed
text
lattice onlinear indeed with \<close>
theorem meet_mimimum: "x \ y = minimum x y" by(rule) ( is_inf_minimum
theorem meet_maximum: "x \ y = maximum x y" by (rule join_equality) (rule is_sup_maximum)
subsubsection \<open>Binary products\<close>
text rule) ( is_sup_fun
The \<open>Monotonicity and semi-morphisms\<close> \<open> \<close>
lemma: " p q (st p\ fst q, snd p \ snd q)" proof, monotonicity thesecond position trivial to show >
have"fst theorem meet_mono "\<sqsubseteq> z \<Longrightarrow> y \<sqsubseteq> w \<Longrightarrow> x \<sqinter> y \<sqsubseteq> z \<sqinter> w" moreover abc :"a:lattice" ultimately" c" have "a \ b \ c \ b" qed show"(fst p \ fst q, snd p \ snd q) \ q" proof java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 have"fst p \ fst q \ fst q" .. have"sndp ultimatelyshow ?thesis by (simp add: leq_prod_def) qed fix r assume rp: "r \ p" and rq: "r \ q" show"r \ (fst p \ fst q, snd p \ snd q)" proof - "fst\> p\ fst q" proof fromshow" r \ fst p" by (simp add: leq_prod_def) fromshowfst qed moreoverhave"snd r \ snd p \ snd q" proof from rp show"snd r \ snd p" by (simp add: leq_prod_def)
rq snd qed ultimately\<dots> = z \<sqinter> w" by (rule meet_commute) qed qed
s_sup_prodis_sup (p \<squnion> fst q, snd p \<squnion> snd q)" (* FIXME dualize!? *) proof show"p \ (fst p \ fst q, snd p \ snd q)" proof - have"fst p \ fst p \ fst q" .. have"sndp\ ultimatelyshow ?thesis by (simp add ( meet_mono qed show"q \ (fst p \ fst q, snd p \ snd q)" proof have"fst q \ fst p \ fst q" .. moreoverhave"sndnd ultimatelyshow ?thesis by (simp add: leq_prod_def \<open> fixjava.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 show"fst \ fst q, snd p \ snd q) \ r" proof - have"fst p \ fst q \ fst r" proof from"pr"show"fst p \ fst r" by (simp add: leq_prod_def) fromshowfst \<sqsubseteq> fst r" by (simp add: leq_prod_def) qed moreoverhave proof from"pr"show"snd p \ snd r" by (simp add: leq_prod_def) from qr show"snd q \ snd r" by (simp add: leq_prod_def) qed : "\x y. f (x \ y) \ f x \ f y" ultimatelyshow ?thesis by (simp add: leq_prod_def) qed qed
instance prod :: havex\<sqinter> y = x" .. proof fix p q : alattice from is_inf_prod "java.lang.StringIndexOutOfBoundsException: Range [42, 21) out of bounds for length 42 from""\<exists>sup. is_sup p q sup" ..
ed
text\<open>
The lattice operations on a binary product structure indeed coincide withassumex\java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 \<close>
theorem : "\ q = ( p \ fst q, snd p \ snd q)" by (rule s \Andx. fx
theoremjoin_prod:" by (rule join_equality) (rule y
subsubsection \<open>General products\<close>
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
class java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
spaces) as \<close>
lemma is_inf_fun: "is_inf f g (\x. f x \ g x)" proof show"(\x. f x \ g x) \ f" proof fix x show"f x \ g x \ f x" .. qed show"(\x. f x \ g x) \ g" proof fix x show"f x \ g x \ g x" .. qed fix h assume hf: "h \ f" and hg: "h \ g" show"h \ (\x. f x \ g x)" proof fix x show"h x \ f x \ g x" proof from hf show"h x \ f x" .. from hg show"h x \ g x" .. qed qed qed
lemma is_sup_fun: "is_sup f g (\x. f x \ g x)" (* FIXME dualize!? *) proof show"f \ (\x. f x \ g x)" proof fix x show"f x \ f x \ g x" .. qed show"g \ (\x. f x \ g x)" proof fix x show"g x \ f x \ g x" .. qed fix h assume fh: "f \ h" and gh: "g \ h" show"(\x. f x \ g x) \ h" proof fix x show"f x \ g x \ h x" proof from fh show"f x \ h x" .. from gh show"g x \ h x" .. qed qed qed
instance"fun" :: (type, lattice) lattice proof fix f g :: "'a \ 'b::lattice" show"\inf. is_inf f g inf" by rule (rule is_inf_fun) (* FIXME @{text "from \ show \ .."} does not work!? unification incompleteness!? *) show"\sup. is_sup f g sup" by rule (rule is_sup_fun) qed
text\<open>
The lattice operations on a general product structure (function
space) indeed emerge by point-wise lifting of the original ones. \<close>
theorem meet_fun: "f \ g = (\x. f x \ g x)" by (rule meet_equality) (rule is_inf_fun)
theorem join_fun: "f \ g = (\x. f x \ g x)" by (rule join_equality) (rule is_sup_fun)
subsection \<open>Monotonicity and semi-morphisms\<close>
text\<open>
The lattice operations are monotone in both argument positions. In
fact, monotonicity of the second position is trivial due to
commutativity. \<close>
theorem meet_mono: "x \ z \ y \ w \ x \ y \ z \ w" proof -
{ fix a b c :: "'a::lattice" assume"a \ c" have "a \ b \ c \ b" proof have"a \ b \ a" .. alsohave"\ \ c" by fact finallyshow"a \ b \ c" . show"a \ b \ b" .. qed
} note this [elim?] assume"x \ z" then have "x \ y \ z \ y" .. alsohave"\ = y \ z" by (rule meet_commute) alsoassume"y \ w" then have "y \ z \ w \ z" .. alsohave"\ = z \ w" by (rule meet_commute) finallyshow ?thesis . qed
theorem join_mono: "x \ z \ y \ w \ x \ y \ z \ w" proof - assume"x \ z" then have "dual z \ dual x" .. moreoverassume"y \ w" then have "dual w \ dual y" .. ultimatelyhave"dual z \ dual w \ dual x \ dual y" by (rule meet_mono) thenhave"dual (z \ w) \ dual (x \ y)" by (simp only: dual_join) thenshow ?thesis .. qed
text\<open> \medskip A semi-morphisms is a function \<open>f\<close> that preserves the
lattice operations in the following manner: \<^term>\<open>f (x \<sqinter> y) \<sqsubseteq> f x \<sqinter> f y\<close> and \<^term>\<open>f x \<squnion> f y \<sqsubseteq> f (x \<squnion> y)\<close>, respectively. Any of
these properties is equivalent with monotonicity. \<close>
theorem meet_semimorph: "(\x y. f (x \ y) \ f x \ f y) \ (\x y. x \ y \ f x \ f y)" proof assume morph: "\x y. f (x \ y) \ f x \ f y" fix x y :: "'a::lattice" assume"x \ y" thenhave"x \ y = x" .. thenhave"x = x \ y" .. alsohave"f \ \ f x \ f y" by (rule morph) alsohave"\ \ f y" .. finallyshow"f x \ f y" . next assume mono: "\x y. x \ y \ f x \ f y" show"\x y. f (x \ y) \ f x \ f y" proof - fix x y show"f (x \ y) \ f x \ f y" proof have"x \ y \ x" .. then show "f (x \ y) \ f x" by (rule mono) have"x \ y \ y" .. then show "f (x \ y) \ f y" by (rule mono) qed qed qed
lemma join_semimorph: "(\x y. f x \ f y \ f (x \ y)) \ (\x y. x \ y \ f x \ f y)" proof assume morph: "\x y. f x \ f y \ f (x \ y)" fix x y :: "'a::lattice" assume"x \ y" then have "x \ y = y" .. have"f x \ f x \ f y" .. alsohave"\ \ f (x \ y)" by (rule morph) alsofrom\<open>x \<sqsubseteq> y\<close> have "x \<squnion> y = y" .. finallyshow"f x \ f y" . next assume mono: "\x y. x \ y \ f x \ f y" show"\x y. f x \ f y \ f (x \ y)" proof - fix x y show"f x \ f y \ f (x \ y)" proof have"x \ x \ y" .. then show "f x \ f (x \ y)" by (rule mono) have"y \ x \ y" .. then show "f y \ f (x \ y)" by (rule mono) qed qed qed
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.