text‹A non-empty finite lattice is a complete lattice.
types are never empty in Isabelle/HOL,
type of classes 🍋‹finite› and 🍋‹lattice›
also have class 🍋‹complete_lattice›.
type class is defined
extends classes 🍋‹finite› and 🍋‹lattice›
the operators const‹bot›, const‹top›, const‹Inf›, and const‹Sup›,
with assumptions that define these operators
terms of the ones of classes 🍋‹finite› and 🍋‹lattice›.
resulting class is a subclass of 🍋‹complete_lattice›.›
class finite_lattice_complete = finite + lattice + bot + top + Inf + Sup + assumes bot_def: "bot = Inf_fin UNIV" assumes top_def: "top = Sup_fin UNIV" assumes Inf_def: "Inf A = Finite_Set.fold inf top A" assumes Sup_def: "Sup A = Finite_Set.fold sup bot A"
text‹The definitional assumptions
the operators const‹bot› and const‹top›
class 🍋‹finite_lattice_complete›
that they yield bottom and top.›
lemma finite_lattice_complete_Inf_insert: fixes A :: "'a::finite_lattice_complete set" shows"Inf (insert x A) = inf x (Inf A)" proof - interpret comp_fun_idem "inf :: 'a ==> _" by (fact comp_fun_idem_inf) show ?thesis by (simp add: Inf_def) qed
lemma finite_lattice_complete_Sup_insert: fixes A :: "'a::finite_lattice_complete set" shows"Sup (insert x A) = sup x (Sup A)" proof - interpret comp_fun_idem "sup :: 'a ==> _" by (fact comp_fun_idem_sup) show ?thesis by (simp add: Sup_def) qed
lemma finite_lattice_complete_Inf_lower: "(x::'a::finite_lattice_complete) ∈ A ==> Inf A ≤ x" using finite [of A] by (induct A) (auto simp add: finite_lattice_complete_Inf_insert intro: le_infI2)
lemma finite_lattice_complete_Inf_greatest: "∀x::'a::finite_lattice_complete ∈ A. z ≤ x ==> z ≤ Inf A" using finite [of A] by (induct A) (auto simp add: finite_lattice_complete_Inf_empty finite_lattice_complete_Inf_insert)
lemma finite_lattice_complete_Sup_upper: "(x::'a::finite_lattice_complete) ∈ A ==> Sup A ≥ x" using finite [of A] by (induct A) (auto simp add: finite_lattice_complete_Sup_insert intro: le_supI2)
lemma finite_lattice_complete_Sup_least: "∀x::'a::finite_lattice_complete ∈ A. z ≥ x ==> z ≥ Sup A" using finite [of A] by (induct A) (auto simp add: finite_lattice_complete_Sup_empty finite_lattice_complete_Sup_insert)
instance"fun" :: (finite, finite_lattice_complete) finite_lattice_complete by standard (auto simp: finite_bot_fun finite_top_fun finite_Inf_fun finite_Sup_fun)
subsection‹Finite Distributive Lattices›
text‹A finite distributive lattice is a complete lattice const‹inf› and const‹sup› operators
over const‹Sup› and const‹Inf›.›
class finite_distrib_lattice_complete =
distrib_lattice + finite_lattice_complete
lemma finite_distrib_lattice_complete_sup_Inf: "sup (x::'a::finite_distrib_lattice_complete) (Inf A) = (INF y∈A. sup x y)" using finite by (induct A rule: finite_induct) (simp_all add: sup_inf_distrib1)
lemma finite_distrib_lattice_complete_inf_Sup: "inf (x::'a::finite_distrib_lattice_complete) (Sup A) = (SUP y∈A. inf x y)" using finite [of A] by induct (simp_all add: inf_sup_distrib1)
context finite_distrib_lattice_complete begin subclass finite_distrib_lattice proof - show"class.finite_distrib_lattice Inf Sup inf (≤) (<) sup bot top" proof show"bot = Inf UNIV" unfolding bot_def top_def Inf_def using Inf_fin.eq_fold Inf_fin.insert inf.absorb2 by force next show"top = Sup UNIV" unfolding bot_def top_def Sup_def using Sup_fin.eq_fold Sup_fin.insert by force next show"Inf {} = Sup UNIV" unfolding Inf_def Sup_def bot_def top_def using Sup_fin.eq_fold Sup_fin.insert by force next show"Sup {} = Inf UNIV" unfolding Inf_def Sup_def bot_def top_def using Inf_fin.eq_fold Inf_fin.insert inf.absorb2 by force next interpret comp_fun_idem_inf: comp_fun_idem inf by (fact comp_fun_idem_inf) show"Inf (insert a A) = inf a (Inf A)"for a A using comp_fun_idem_inf.fold_insert_idem Inf_def finite by simp next interpret comp_fun_idem_sup: comp_fun_idem sup by (fact comp_fun_idem_sup) show"Sup (insert a A) = sup a (Sup A)"for a A using comp_fun_idem_sup.fold_insert_idem Sup_def finite by simp qed qed end
text‹A linear order is a distributive lattice.
type class is defined
extends class 🍋‹linorder›
the operators const‹inf› and const‹sup›,
with assumptions that define these operators
terms of the ones of class 🍋‹linorder›.
resulting class is a subclass of 🍋‹distrib_lattice›.›
class linorder_lattice = linorder + inf + sup + assumes inf_def: "inf x y = (if x ≤ y then x else y)" assumes sup_def: "sup x y = (if x ≥ y then x else y)"
text‹The definitional assumptions
the operators const‹inf› and const‹sup›
class 🍋‹linorder_lattice›
that they yield infimum and supremum
that they distribute over each other.›
lemma linorder_lattice_inf_le1: "inf (x::'a::linorder_lattice) y ≤ x" unfolding inf_def by (metis (full_types) linorder_linear)
lemma linorder_lattice_inf_le2: "inf (x::'a::linorder_lattice) y ≤ y" unfolding inf_def by (metis (full_types) linorder_linear)
lemma linorder_lattice_inf_greatest: "(x::'a::linorder_lattice) ≤ y ==> x ≤ z ==> x ≤ inf y z" unfolding inf_def by (metis (full_types))
lemma linorder_lattice_sup_ge1: "sup (x::'a::linorder_lattice) y ≥ x" unfolding sup_def by (metis (full_types) linorder_linear)
lemma linorder_lattice_sup_ge2: "sup (x::'a::linorder_lattice) y ≥ y" unfolding sup_def by (metis (full_types) linorder_linear)
lemma linorder_lattice_sup_least: "(x::'a::linorder_lattice) ≥ y ==> x ≥ z ==> x ≥ sup y z" by (auto simp: sup_def)
lemma linorder_lattice_sup_inf_distrib1: "sup (x::'a::linorder_lattice) (inf y z) = inf (sup x y) (sup x z)" by (auto simp: inf_def sup_def)
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 und die Messung sind noch experimentell.