| author | Fabian Huch <huch@in.tum.de> | 
| Tue, 21 Jun 2022 18:24:22 +0200 | |
| changeset 75628 | 6a5e4f17f285 | 
| parent 74123 | 7c5842b06114 | 
| child 76054 | a4b47c684445 | 
| permissions | -rw-r--r-- | 
| 21249 | 1 | (* Title: HOL/Lattices.thy | 
| 2 | Author: Tobias Nipkow | |
| 3 | *) | |
| 4 | ||
| 60758 | 5 | section \<open>Abstract lattices\<close> | 
| 21249 | 6 | |
| 7 | theory Lattices | |
| 54555 | 8 | imports Groups | 
| 21249 | 9 | begin | 
| 10 | ||
| 60758 | 11 | subsection \<open>Abstract semilattice\<close> | 
| 35301 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 12 | |
| 60758 | 13 | text \<open> | 
| 51487 | 14 | These locales provide a basic structure for interpretation into | 
| 35301 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 15 | bigger structures; extensions require careful thinking, otherwise | 
| 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 16 | undesired effects may occur due to interpretation. | 
| 60758 | 17 | \<close> | 
| 35301 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 18 | |
| 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 19 | locale semilattice = abel_semigroup + | 
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 20 | assumes idem [simp]: "a \<^bold>* a = a" | 
| 35301 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 21 | begin | 
| 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 22 | |
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 23 | lemma left_idem [simp]: "a \<^bold>* (a \<^bold>* b) = a \<^bold>* b" | 
| 63322 | 24 | by (simp add: assoc [symmetric]) | 
| 50615 | 25 | |
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 26 | lemma right_idem [simp]: "(a \<^bold>* b) \<^bold>* b = a \<^bold>* b" | 
| 63322 | 27 | by (simp add: assoc) | 
| 35301 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 28 | |
| 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 29 | end | 
| 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 30 | |
| 51487 | 31 | locale semilattice_neutr = semilattice + comm_monoid | 
| 35301 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 32 | |
| 51487 | 33 | locale semilattice_order = semilattice + | 
| 63322 | 34 | fixes less_eq :: "'a \<Rightarrow> 'a \<Rightarrow> bool" (infix "\<^bold>\<le>" 50) | 
| 35 | and less :: "'a \<Rightarrow> 'a \<Rightarrow> bool" (infix "\<^bold><" 50) | |
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 36 | assumes order_iff: "a \<^bold>\<le> b \<longleftrightarrow> a = a \<^bold>* b" | 
| 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 37 | and strict_order_iff: "a \<^bold>< b \<longleftrightarrow> a = a \<^bold>* b \<and> a \<noteq> b" | 
| 51487 | 38 | begin | 
| 39 | ||
| 63322 | 40 | lemma orderI: "a = a \<^bold>* b \<Longrightarrow> a \<^bold>\<le> b" | 
| 51487 | 41 | by (simp add: order_iff) | 
| 42 | ||
| 43 | lemma orderE: | |
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 44 | assumes "a \<^bold>\<le> b" | 
| 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 45 | obtains "a = a \<^bold>* b" | 
| 51487 | 46 | using assms by (unfold order_iff) | 
| 47 | ||
| 52152 | 48 | sublocale ordering less_eq less | 
| 51487 | 49 | proof | 
| 63322 | 50 | show "a \<^bold>< b \<longleftrightarrow> a \<^bold>\<le> b \<and> a \<noteq> b" for a b | 
| 59545 
12a6088ed195
explicit equivalence for strict order on lattices
 haftmann parents: 
58889diff
changeset | 51 | by (simp add: order_iff strict_order_iff) | 
| 51487 | 52 | next | 
| 63588 | 53 | show "a \<^bold>\<le> a" for a | 
| 51487 | 54 | by (simp add: order_iff) | 
| 55 | next | |
| 56 | fix a b | |
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 57 | assume "a \<^bold>\<le> b" "b \<^bold>\<le> a" | 
| 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 58 | then have "a = a \<^bold>* b" "a \<^bold>* b = b" | 
| 51487 | 59 | by (simp_all add: order_iff commute) | 
| 60 | then show "a = b" by simp | |
| 61 | next | |
| 62 | fix a b c | |
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 63 | assume "a \<^bold>\<le> b" "b \<^bold>\<le> c" | 
| 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 64 | then have "a = a \<^bold>* b" "b = b \<^bold>* c" | 
| 51487 | 65 | by (simp_all add: order_iff commute) | 
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 66 | then have "a = a \<^bold>* (b \<^bold>* c)" | 
| 51487 | 67 | by simp | 
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 68 | then have "a = (a \<^bold>* b) \<^bold>* c" | 
| 51487 | 69 | by (simp add: assoc) | 
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 70 | with \<open>a = a \<^bold>* b\<close> [symmetric] have "a = a \<^bold>* c" by simp | 
| 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 71 | then show "a \<^bold>\<le> c" by (rule orderI) | 
| 51487 | 72 | qed | 
| 35301 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 73 | |
| 63322 | 74 | lemma cobounded1 [simp]: "a \<^bold>* b \<^bold>\<le> a" | 
| 75 | by (simp add: order_iff commute) | |
| 51487 | 76 | |
| 63322 | 77 | lemma cobounded2 [simp]: "a \<^bold>* b \<^bold>\<le> b" | 
| 51487 | 78 | by (simp add: order_iff) | 
| 79 | ||
| 80 | lemma boundedI: | |
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 81 | assumes "a \<^bold>\<le> b" and "a \<^bold>\<le> c" | 
| 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 82 | shows "a \<^bold>\<le> b \<^bold>* c" | 
| 51487 | 83 | proof (rule orderI) | 
| 63588 | 84 | from assms obtain "a \<^bold>* b = a" and "a \<^bold>* c = a" | 
| 85 | by (auto elim!: orderE) | |
| 86 | then show "a = a \<^bold>* (b \<^bold>* c)" | |
| 87 | by (simp add: assoc [symmetric]) | |
| 51487 | 88 | qed | 
| 89 | ||
| 90 | lemma boundedE: | |
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 91 | assumes "a \<^bold>\<le> b \<^bold>* c" | 
| 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 92 | obtains "a \<^bold>\<le> b" and "a \<^bold>\<le> c" | 
| 51487 | 93 | using assms by (blast intro: trans cobounded1 cobounded2) | 
| 94 | ||
| 63322 | 95 | lemma bounded_iff [simp]: "a \<^bold>\<le> b \<^bold>* c \<longleftrightarrow> a \<^bold>\<le> b \<and> a \<^bold>\<le> c" | 
| 51487 | 96 | by (blast intro: boundedI elim: boundedE) | 
| 97 | ||
| 98 | lemma strict_boundedE: | |
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 99 | assumes "a \<^bold>< b \<^bold>* c" | 
| 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 100 | obtains "a \<^bold>< b" and "a \<^bold>< c" | 
| 54859 | 101 | using assms by (auto simp add: commute strict_iff_order elim: orderE intro!: that)+ | 
| 51487 | 102 | |
| 63322 | 103 | lemma coboundedI1: "a \<^bold>\<le> c \<Longrightarrow> a \<^bold>* b \<^bold>\<le> c" | 
| 51487 | 104 | by (rule trans) auto | 
| 105 | ||
| 63322 | 106 | lemma coboundedI2: "b \<^bold>\<le> c \<Longrightarrow> a \<^bold>* b \<^bold>\<le> c" | 
| 51487 | 107 | by (rule trans) auto | 
| 108 | ||
| 63322 | 109 | lemma strict_coboundedI1: "a \<^bold>< c \<Longrightarrow> a \<^bold>* b \<^bold>< c" | 
| 54858 | 110 | using irrefl | 
| 63588 | 111 | by (auto intro: not_eq_order_implies_strict coboundedI1 strict_implies_order | 
| 112 | elim: strict_boundedE) | |
| 54858 | 113 | |
| 63322 | 114 | lemma strict_coboundedI2: "b \<^bold>< c \<Longrightarrow> a \<^bold>* b \<^bold>< c" | 
| 54858 | 115 | using strict_coboundedI1 [of b c a] by (simp add: commute) | 
| 116 | ||
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 117 | lemma mono: "a \<^bold>\<le> c \<Longrightarrow> b \<^bold>\<le> d \<Longrightarrow> a \<^bold>* b \<^bold>\<le> c \<^bold>* d" | 
| 51487 | 118 | by (blast intro: boundedI coboundedI1 coboundedI2) | 
| 119 | ||
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 120 | lemma absorb1: "a \<^bold>\<le> b \<Longrightarrow> a \<^bold>* b = a" | 
| 63588 | 121 | by (rule antisym) (auto simp: refl) | 
| 51487 | 122 | |
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 123 | lemma absorb2: "b \<^bold>\<le> a \<Longrightarrow> a \<^bold>* b = b" | 
| 63588 | 124 | by (rule antisym) (auto simp: refl) | 
| 54858 | 125 | |
| 73869 | 126 | lemma absorb3: "a \<^bold>< b \<Longrightarrow> a \<^bold>* b = a" | 
| 127 | by (rule absorb1) (rule strict_implies_order) | |
| 128 | ||
| 129 | lemma absorb4: "b \<^bold>< a \<Longrightarrow> a \<^bold>* b = b" | |
| 130 | by (rule absorb2) (rule strict_implies_order) | |
| 131 | ||
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 132 | lemma absorb_iff1: "a \<^bold>\<le> b \<longleftrightarrow> a \<^bold>* b = a" | 
| 54858 | 133 | using order_iff by auto | 
| 134 | ||
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 135 | lemma absorb_iff2: "b \<^bold>\<le> a \<longleftrightarrow> a \<^bold>* b = b" | 
| 54858 | 136 | using order_iff by (auto simp add: commute) | 
| 35301 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 137 | |
| 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 138 | end | 
| 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 139 | |
| 51487 | 140 | locale semilattice_neutr_order = semilattice_neutr + semilattice_order | 
| 52152 | 141 | begin | 
| 51487 | 142 | |
| 63290 
9ac558ab0906
boldify syntax in abstract algebraic structures, to avoid clashes with concrete syntax in corresponding type classes
 haftmann parents: 
61799diff
changeset | 143 | sublocale ordering_top less_eq less "\<^bold>1" | 
| 61169 | 144 | by standard (simp add: order_iff) | 
| 51487 | 145 | |
| 71851 | 146 | lemma eq_neutr_iff [simp]: \<open>a \<^bold>* b = \<^bold>1 \<longleftrightarrow> a = \<^bold>1 \<and> b = \<^bold>1\<close> | 
| 147 | by (simp add: eq_iff) | |
| 148 | ||
| 149 | lemma neutr_eq_iff [simp]: \<open>\<^bold>1 = a \<^bold>* b \<longleftrightarrow> a = \<^bold>1 \<and> b = \<^bold>1\<close> | |
| 150 | by (simp add: eq_iff) | |
| 151 | ||
| 52152 | 152 | end | 
| 153 | ||
| 71938 | 154 | text \<open>Interpretations for boolean operators\<close> | 
| 63661 
92e037803666
formal passive interpretation proofs for conj and disj
 haftmann parents: 
63588diff
changeset | 155 | |
| 71938 | 156 | interpretation conj: semilattice_neutr \<open>(\<and>)\<close> True | 
| 63661 
92e037803666
formal passive interpretation proofs for conj and disj
 haftmann parents: 
63588diff
changeset | 157 | by standard auto | 
| 
92e037803666
formal passive interpretation proofs for conj and disj
 haftmann parents: 
63588diff
changeset | 158 | |
| 71938 | 159 | interpretation disj: semilattice_neutr \<open>(\<or>)\<close> False | 
| 63661 
92e037803666
formal passive interpretation proofs for conj and disj
 haftmann parents: 
63588diff
changeset | 160 | by standard auto | 
| 
92e037803666
formal passive interpretation proofs for conj and disj
 haftmann parents: 
63588diff
changeset | 161 | |
| 71938 | 162 | declare conj_assoc [ac_simps del] disj_assoc [ac_simps del] \<comment> \<open>already simp by default\<close> | 
| 163 | ||
| 35301 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35121diff
changeset | 164 | |
| 60758 | 165 | subsection \<open>Syntactic infimum and supremum operations\<close> | 
| 41082 | 166 | |
| 44845 | 167 | class inf = | 
| 168 | fixes inf :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<sqinter>" 70) | |
| 25206 | 169 | |
| 63322 | 170 | class sup = | 
| 44845 | 171 | fixes sup :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "\<squnion>" 65) | 
| 172 | ||
| 46691 | 173 | |
| 60758 | 174 | subsection \<open>Concrete lattices\<close> | 
| 46691 | 175 | |
| 71013 | 176 | class semilattice_inf = order + inf + | 
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 177 | assumes inf_le1 [simp]: "x \<sqinter> y \<le> x" | 
| 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 178 | and inf_le2 [simp]: "x \<sqinter> y \<le> y" | 
| 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 179 | and inf_greatest: "x \<le> y \<Longrightarrow> x \<le> z \<Longrightarrow> x \<le> y \<sqinter> z" | 
| 21249 | 180 | |
| 44845 | 181 | class semilattice_sup = order + sup + | 
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 182 | assumes sup_ge1 [simp]: "x \<le> x \<squnion> y" | 
| 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 183 | and sup_ge2 [simp]: "y \<le> x \<squnion> y" | 
| 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 184 | and sup_least: "y \<le> x \<Longrightarrow> z \<le> x \<Longrightarrow> y \<squnion> z \<le> x" | 
| 26014 | 185 | begin | 
| 186 | ||
| 63588 | 187 | text \<open>Dual lattice.\<close> | 
| 63322 | 188 | lemma dual_semilattice: "class.semilattice_inf sup greater_eq greater" | 
| 189 | by (rule class.semilattice_inf.intro, rule dual_order) | |
| 190 | (unfold_locales, simp_all add: sup_least) | |
| 26014 | 191 | |
| 192 | end | |
| 21249 | 193 | |
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34973diff
changeset | 194 | class lattice = semilattice_inf + semilattice_sup | 
| 21249 | 195 | |
| 25382 | 196 | |
| 60758 | 197 | subsubsection \<open>Intro and elim rules\<close> | 
| 21733 | 198 | |
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34973diff
changeset | 199 | context semilattice_inf | 
| 21733 | 200 | begin | 
| 21249 | 201 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 202 | lemma le_infI1: "a \<le> x \<Longrightarrow> a \<sqinter> b \<le> x" | 
| 32064 | 203 | by (rule order_trans) auto | 
| 21249 | 204 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 205 | lemma le_infI2: "b \<le> x \<Longrightarrow> a \<sqinter> b \<le> x" | 
| 32064 | 206 | by (rule order_trans) auto | 
| 21733 | 207 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 208 | lemma le_infI: "x \<le> a \<Longrightarrow> x \<le> b \<Longrightarrow> x \<le> a \<sqinter> b" | 
| 54857 | 209 | by (fact inf_greatest) (* FIXME: duplicate lemma *) | 
| 21249 | 210 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 211 | lemma le_infE: "x \<le> a \<sqinter> b \<Longrightarrow> (x \<le> a \<Longrightarrow> x \<le> b \<Longrightarrow> P) \<Longrightarrow> P" | 
| 36008 | 212 | by (blast intro: order_trans inf_le1 inf_le2) | 
| 21249 | 213 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 214 | lemma le_inf_iff: "x \<le> y \<sqinter> z \<longleftrightarrow> x \<le> y \<and> x \<le> z" | 
| 32064 | 215 | by (blast intro: le_infI elim: le_infE) | 
| 21733 | 216 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 217 | lemma le_iff_inf: "x \<le> y \<longleftrightarrow> x \<sqinter> y = x" | 
| 73411 | 218 | by (auto intro: le_infI1 order.antisym dest: order.eq_iff [THEN iffD1] simp add: le_inf_iff) | 
| 21249 | 219 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 220 | lemma inf_mono: "a \<le> c \<Longrightarrow> b \<le> d \<Longrightarrow> a \<sqinter> b \<le> c \<sqinter> d" | 
| 36008 | 221 | by (fast intro: inf_greatest le_infI1 le_infI2) | 
| 222 | ||
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 223 | lemma mono_inf: "mono f \<Longrightarrow> f (A \<sqinter> B) \<le> f A \<sqinter> f B" for f :: "'a \<Rightarrow> 'b::semilattice_inf" | 
| 25206 | 224 | by (auto simp add: mono_def intro: Lattices.inf_greatest) | 
| 21733 | 225 | |
| 25206 | 226 | end | 
| 21733 | 227 | |
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34973diff
changeset | 228 | context semilattice_sup | 
| 21733 | 229 | begin | 
| 21249 | 230 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 231 | lemma le_supI1: "x \<le> a \<Longrightarrow> x \<le> a \<squnion> b" | 
| 63322 | 232 | by (rule order_trans) auto | 
| 233 | ||
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 234 | lemma le_supI2: "x \<le> b \<Longrightarrow> x \<le> a \<squnion> b" | 
| 25062 | 235 | by (rule order_trans) auto | 
| 21249 | 236 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 237 | lemma le_supI: "a \<le> x \<Longrightarrow> b \<le> x \<Longrightarrow> a \<squnion> b \<le> x" | 
| 54857 | 238 | by (fact sup_least) (* FIXME: duplicate lemma *) | 
| 21249 | 239 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 240 | lemma le_supE: "a \<squnion> b \<le> x \<Longrightarrow> (a \<le> x \<Longrightarrow> b \<le> x \<Longrightarrow> P) \<Longrightarrow> P" | 
| 36008 | 241 | by (blast intro: order_trans sup_ge1 sup_ge2) | 
| 22422 
ee19cdb07528
stepping towards uniform lattice theory development in HOL
 haftmann parents: 
22384diff
changeset | 242 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 243 | lemma le_sup_iff: "x \<squnion> y \<le> z \<longleftrightarrow> x \<le> z \<and> y \<le> z" | 
| 32064 | 244 | by (blast intro: le_supI elim: le_supE) | 
| 21733 | 245 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 246 | lemma le_iff_sup: "x \<le> y \<longleftrightarrow> x \<squnion> y = y" | 
| 73411 | 247 | by (auto intro: le_supI2 order.antisym dest: order.eq_iff [THEN iffD1] simp add: le_sup_iff) | 
| 21734 | 248 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 249 | lemma sup_mono: "a \<le> c \<Longrightarrow> b \<le> d \<Longrightarrow> a \<squnion> b \<le> c \<squnion> d" | 
| 36008 | 250 | by (fast intro: sup_least le_supI1 le_supI2) | 
| 251 | ||
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 252 | lemma mono_sup: "mono f \<Longrightarrow> f A \<squnion> f B \<le> f (A \<squnion> B)" for f :: "'a \<Rightarrow> 'b::semilattice_sup" | 
| 25206 | 253 | by (auto simp add: mono_def intro: Lattices.sup_least) | 
| 21733 | 254 | |
| 25206 | 255 | end | 
| 23878 | 256 | |
| 21733 | 257 | |
| 60758 | 258 | subsubsection \<open>Equational laws\<close> | 
| 21249 | 259 | |
| 52152 | 260 | context semilattice_inf | 
| 261 | begin | |
| 262 | ||
| 61605 | 263 | sublocale inf: semilattice inf | 
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 264 | proof | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 265 | fix a b c | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 266 | show "(a \<sqinter> b) \<sqinter> c = a \<sqinter> (b \<sqinter> c)" | 
| 73411 | 267 | by (rule order.antisym) (auto intro: le_infI1 le_infI2 simp add: le_inf_iff) | 
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 268 | show "a \<sqinter> b = b \<sqinter> a" | 
| 73411 | 269 | by (rule order.antisym) (auto simp add: le_inf_iff) | 
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 270 | show "a \<sqinter> a = a" | 
| 73411 | 271 | by (rule order.antisym) (auto simp add: le_inf_iff) | 
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 272 | qed | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 273 | |
| 61605 | 274 | sublocale inf: semilattice_order inf less_eq less | 
| 61169 | 275 | by standard (auto simp add: le_iff_inf less_le) | 
| 51487 | 276 | |
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 277 | lemma inf_assoc: "(x \<sqinter> y) \<sqinter> z = x \<sqinter> (y \<sqinter> z)" | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 278 | by (fact inf.assoc) | 
| 21733 | 279 | |
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 280 | lemma inf_commute: "(x \<sqinter> y) = (y \<sqinter> x)" | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 281 | by (fact inf.commute) | 
| 21733 | 282 | |
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 283 | lemma inf_left_commute: "x \<sqinter> (y \<sqinter> z) = y \<sqinter> (x \<sqinter> z)" | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 284 | by (fact inf.left_commute) | 
| 21733 | 285 | |
| 44921 | 286 | lemma inf_idem: "x \<sqinter> x = x" | 
| 287 | by (fact inf.idem) (* already simp *) | |
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 288 | |
| 50615 | 289 | lemma inf_left_idem: "x \<sqinter> (x \<sqinter> y) = x \<sqinter> y" | 
| 290 | by (fact inf.left_idem) (* already simp *) | |
| 291 | ||
| 292 | lemma inf_right_idem: "(x \<sqinter> y) \<sqinter> y = x \<sqinter> y" | |
| 293 | by (fact inf.right_idem) (* already simp *) | |
| 21733 | 294 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 295 | lemma inf_absorb1: "x \<le> y \<Longrightarrow> x \<sqinter> y = x" | 
| 73411 | 296 | by (rule order.antisym) auto | 
| 21733 | 297 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 298 | lemma inf_absorb2: "y \<le> x \<Longrightarrow> x \<sqinter> y = y" | 
| 73411 | 299 | by (rule order.antisym) auto | 
| 63322 | 300 | |
| 32064 | 301 | lemmas inf_aci = inf_commute inf_assoc inf_left_commute inf_left_idem | 
| 21733 | 302 | |
| 303 | end | |
| 304 | ||
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34973diff
changeset | 305 | context semilattice_sup | 
| 21733 | 306 | begin | 
| 21249 | 307 | |
| 61605 | 308 | sublocale sup: semilattice sup | 
| 52152 | 309 | proof | 
| 310 | fix a b c | |
| 311 | show "(a \<squnion> b) \<squnion> c = a \<squnion> (b \<squnion> c)" | |
| 73411 | 312 | by (rule order.antisym) (auto intro: le_supI1 le_supI2 simp add: le_sup_iff) | 
| 52152 | 313 | show "a \<squnion> b = b \<squnion> a" | 
| 73411 | 314 | by (rule order.antisym) (auto simp add: le_sup_iff) | 
| 52152 | 315 | show "a \<squnion> a = a" | 
| 73411 | 316 | by (rule order.antisym) (auto simp add: le_sup_iff) | 
| 52152 | 317 | qed | 
| 318 | ||
| 61605 | 319 | sublocale sup: semilattice_order sup greater_eq greater | 
| 61169 | 320 | by standard (auto simp add: le_iff_sup sup.commute less_le) | 
| 52152 | 321 | |
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 322 | lemma sup_assoc: "(x \<squnion> y) \<squnion> z = x \<squnion> (y \<squnion> z)" | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 323 | by (fact sup.assoc) | 
| 21733 | 324 | |
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 325 | lemma sup_commute: "(x \<squnion> y) = (y \<squnion> x)" | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 326 | by (fact sup.commute) | 
| 21733 | 327 | |
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 328 | lemma sup_left_commute: "x \<squnion> (y \<squnion> z) = y \<squnion> (x \<squnion> z)" | 
| 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 329 | by (fact sup.left_commute) | 
| 21733 | 330 | |
| 44921 | 331 | lemma sup_idem: "x \<squnion> x = x" | 
| 332 | by (fact sup.idem) (* already simp *) | |
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 333 | |
| 44918 | 334 | lemma sup_left_idem [simp]: "x \<squnion> (x \<squnion> y) = x \<squnion> y" | 
| 34973 
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
 haftmann parents: 
34209diff
changeset | 335 | by (fact sup.left_idem) | 
| 21733 | 336 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 337 | lemma sup_absorb1: "y \<le> x \<Longrightarrow> x \<squnion> y = x" | 
| 73411 | 338 | by (rule order.antisym) auto | 
| 21733 | 339 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 340 | lemma sup_absorb2: "x \<le> y \<Longrightarrow> x \<squnion> y = y" | 
| 73411 | 341 | by (rule order.antisym) auto | 
| 21249 | 342 | |
| 32064 | 343 | lemmas sup_aci = sup_commute sup_assoc sup_left_commute sup_left_idem | 
| 21733 | 344 | |
| 345 | end | |
| 21249 | 346 | |
| 21733 | 347 | context lattice | 
| 348 | begin | |
| 349 | ||
| 67399 | 350 | lemma dual_lattice: "class.lattice sup (\<ge>) (>) inf" | 
| 63588 | 351 | by (rule class.lattice.intro, | 
| 352 | rule dual_semilattice, | |
| 353 | rule class.semilattice_sup.intro, | |
| 354 | rule dual_order) | |
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 355 | (unfold_locales, auto) | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 356 | |
| 44918 | 357 | lemma inf_sup_absorb [simp]: "x \<sqinter> (x \<squnion> y) = x" | 
| 73411 | 358 | by (blast intro: order.antisym inf_le1 inf_greatest sup_ge1) | 
| 21733 | 359 | |
| 44918 | 360 | lemma sup_inf_absorb [simp]: "x \<squnion> (x \<sqinter> y) = x" | 
| 73411 | 361 | by (blast intro: order.antisym sup_ge1 sup_least inf_le1) | 
| 21733 | 362 | |
| 32064 | 363 | lemmas inf_sup_aci = inf_aci sup_aci | 
| 21734 | 364 | |
| 22454 | 365 | lemmas inf_sup_ord = inf_le1 inf_le2 sup_ge1 sup_ge2 | 
| 366 | ||
| 63588 | 367 | text \<open>Towards distributivity.\<close> | 
| 21249 | 368 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 369 | lemma distrib_sup_le: "x \<squnion> (y \<sqinter> z) \<le> (x \<squnion> y) \<sqinter> (x \<squnion> z)" | 
| 32064 | 370 | by (auto intro: le_infI1 le_infI2 le_supI1 le_supI2) | 
| 21734 | 371 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 372 | lemma distrib_inf_le: "(x \<sqinter> y) \<squnion> (x \<sqinter> z) \<le> x \<sqinter> (y \<squnion> z)" | 
| 32064 | 373 | by (auto intro: le_infI1 le_infI2 le_supI1 le_supI2) | 
| 21734 | 374 | |
| 63322 | 375 | text \<open>If you have one of them, you have them all.\<close> | 
| 21249 | 376 | |
| 21733 | 377 | lemma distrib_imp1: | 
| 63322 | 378 | assumes distrib: "\<And>x y z. x \<sqinter> (y \<squnion> z) = (x \<sqinter> y) \<squnion> (x \<sqinter> z)" | 
| 379 | shows "x \<squnion> (y \<sqinter> z) = (x \<squnion> y) \<sqinter> (x \<squnion> z)" | |
| 21249 | 380 | proof- | 
| 63322 | 381 | have "x \<squnion> (y \<sqinter> z) = (x \<squnion> (x \<sqinter> z)) \<squnion> (y \<sqinter> z)" | 
| 382 | by simp | |
| 44918 | 383 | also have "\<dots> = x \<squnion> (z \<sqinter> (x \<squnion> y))" | 
| 63322 | 384 | by (simp add: distrib inf_commute sup_assoc del: sup_inf_absorb) | 
| 21249 | 385 | also have "\<dots> = ((x \<squnion> y) \<sqinter> x) \<squnion> ((x \<squnion> y) \<sqinter> z)" | 
| 63322 | 386 | by (simp add: inf_commute) | 
| 387 | also have "\<dots> = (x \<squnion> y) \<sqinter> (x \<squnion> z)" by(simp add:distrib) | |
| 21249 | 388 | finally show ?thesis . | 
| 389 | qed | |
| 390 | ||
| 21733 | 391 | lemma distrib_imp2: | 
| 63322 | 392 | assumes distrib: "\<And>x y z. x \<squnion> (y \<sqinter> z) = (x \<squnion> y) \<sqinter> (x \<squnion> z)" | 
| 393 | shows "x \<sqinter> (y \<squnion> z) = (x \<sqinter> y) \<squnion> (x \<sqinter> z)" | |
| 21249 | 394 | proof- | 
| 63322 | 395 | have "x \<sqinter> (y \<squnion> z) = (x \<sqinter> (x \<squnion> z)) \<sqinter> (y \<squnion> z)" | 
| 396 | by simp | |
| 44918 | 397 | also have "\<dots> = x \<sqinter> (z \<squnion> (x \<sqinter> y))" | 
| 63322 | 398 | by (simp add: distrib sup_commute inf_assoc del: inf_sup_absorb) | 
| 21249 | 399 | also have "\<dots> = ((x \<sqinter> y) \<squnion> x) \<sqinter> ((x \<sqinter> y) \<squnion> z)" | 
| 63322 | 400 | by (simp add: sup_commute) | 
| 401 | also have "\<dots> = (x \<sqinter> y) \<squnion> (x \<sqinter> z)" by (simp add:distrib) | |
| 21249 | 402 | finally show ?thesis . | 
| 403 | qed | |
| 404 | ||
| 21733 | 405 | end | 
| 21249 | 406 | |
| 63322 | 407 | |
| 60758 | 408 | subsubsection \<open>Strict order\<close> | 
| 32568 | 409 | |
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34973diff
changeset | 410 | context semilattice_inf | 
| 32568 | 411 | begin | 
| 412 | ||
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 413 | lemma less_infI1: "a < x \<Longrightarrow> a \<sqinter> b < x" | 
| 32642 
026e7c6a6d08
be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
 haftmann parents: 
32568diff
changeset | 414 | by (auto simp add: less_le inf_absorb1 intro: le_infI1) | 
| 32568 | 415 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 416 | lemma less_infI2: "b < x \<Longrightarrow> a \<sqinter> b < x" | 
| 32642 
026e7c6a6d08
be more cautious wrt. simp rules: inf_absorb1, inf_absorb2, sup_absorb1, sup_absorb2 are no simp rules by default any longer
 haftmann parents: 
32568diff
changeset | 417 | by (auto simp add: less_le inf_absorb2 intro: le_infI2) | 
| 32568 | 418 | |
| 419 | end | |
| 420 | ||
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34973diff
changeset | 421 | context semilattice_sup | 
| 32568 | 422 | begin | 
| 423 | ||
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 424 | lemma less_supI1: "x < a \<Longrightarrow> x < a \<squnion> b" | 
| 44921 | 425 | using dual_semilattice | 
| 426 | by (rule semilattice_inf.less_infI1) | |
| 32568 | 427 | |
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 428 | lemma less_supI2: "x < b \<Longrightarrow> x < a \<squnion> b" | 
| 44921 | 429 | using dual_semilattice | 
| 430 | by (rule semilattice_inf.less_infI2) | |
| 32568 | 431 | |
| 432 | end | |
| 433 | ||
| 21249 | 434 | |
| 60758 | 435 | subsection \<open>Distributive lattices\<close> | 
| 21249 | 436 | |
| 22454 | 437 | class distrib_lattice = lattice + | 
| 21249 | 438 | assumes sup_inf_distrib1: "x \<squnion> (y \<sqinter> z) = (x \<squnion> y) \<sqinter> (x \<squnion> z)" | 
| 439 | ||
| 21733 | 440 | context distrib_lattice | 
| 441 | begin | |
| 442 | ||
| 63322 | 443 | lemma sup_inf_distrib2: "(y \<sqinter> z) \<squnion> x = (y \<squnion> x) \<sqinter> (z \<squnion> x)" | 
| 44921 | 444 | by (simp add: sup_commute sup_inf_distrib1) | 
| 21249 | 445 | |
| 63322 | 446 | lemma inf_sup_distrib1: "x \<sqinter> (y \<squnion> z) = (x \<sqinter> y) \<squnion> (x \<sqinter> z)" | 
| 44921 | 447 | by (rule distrib_imp2 [OF sup_inf_distrib1]) | 
| 21249 | 448 | |
| 63322 | 449 | lemma inf_sup_distrib2: "(y \<squnion> z) \<sqinter> x = (y \<sqinter> x) \<squnion> (z \<sqinter> x)" | 
| 44921 | 450 | by (simp add: inf_commute inf_sup_distrib1) | 
| 21249 | 451 | |
| 67399 | 452 | lemma dual_distrib_lattice: "class.distrib_lattice sup (\<ge>) (>) inf" | 
| 36635 
080b755377c0
locale predicates of classes carry a mandatory "class" prefix
 haftmann parents: 
36352diff
changeset | 453 | by (rule class.distrib_lattice.intro, rule dual_lattice) | 
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 454 | (unfold_locales, fact inf_sup_distrib1) | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 455 | |
| 63322 | 456 | lemmas sup_inf_distrib = sup_inf_distrib1 sup_inf_distrib2 | 
| 36008 | 457 | |
| 63322 | 458 | lemmas inf_sup_distrib = inf_sup_distrib1 inf_sup_distrib2 | 
| 36008 | 459 | |
| 63322 | 460 | lemmas distrib = sup_inf_distrib1 sup_inf_distrib2 inf_sup_distrib1 inf_sup_distrib2 | 
| 21249 | 461 | |
| 21733 | 462 | end | 
| 463 | ||
| 21249 | 464 | |
| 74123 
7c5842b06114
clarified abstract and concrete boolean algebras
 haftmann parents: 
73869diff
changeset | 465 | subsection \<open>Bounded lattices\<close> | 
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 466 | |
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52152diff
changeset | 467 | class bounded_semilattice_inf_top = semilattice_inf + order_top | 
| 52152 | 468 | begin | 
| 51487 | 469 | |
| 61605 | 470 | sublocale inf_top: semilattice_neutr inf top | 
| 471 | + inf_top: semilattice_neutr_order inf top less_eq less | |
| 51487 | 472 | proof | 
| 63322 | 473 | show "x \<sqinter> \<top> = x" for x | 
| 51487 | 474 | by (rule inf_absorb1) simp | 
| 475 | qed | |
| 476 | ||
| 71851 | 477 | lemma inf_top_left: "\<top> \<sqinter> x = x" | 
| 478 | by (fact inf_top.left_neutral) | |
| 479 | ||
| 480 | lemma inf_top_right: "x \<sqinter> \<top> = x" | |
| 481 | by (fact inf_top.right_neutral) | |
| 482 | ||
| 483 | lemma inf_eq_top_iff: "x \<sqinter> y = \<top> \<longleftrightarrow> x = \<top> \<and> y = \<top>" | |
| 484 | by (fact inf_top.eq_neutr_iff) | |
| 485 | ||
| 486 | lemma top_eq_inf_iff: "\<top> = x \<sqinter> y \<longleftrightarrow> x = \<top> \<and> y = \<top>" | |
| 487 | by (fact inf_top.neutr_eq_iff) | |
| 488 | ||
| 52152 | 489 | end | 
| 51487 | 490 | |
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52152diff
changeset | 491 | class bounded_semilattice_sup_bot = semilattice_sup + order_bot | 
| 52152 | 492 | begin | 
| 493 | ||
| 61605 | 494 | sublocale sup_bot: semilattice_neutr sup bot | 
| 495 | + sup_bot: semilattice_neutr_order sup bot greater_eq greater | |
| 51487 | 496 | proof | 
| 63322 | 497 | show "x \<squnion> \<bottom> = x" for x | 
| 51487 | 498 | by (rule sup_absorb1) simp | 
| 499 | qed | |
| 500 | ||
| 71851 | 501 | lemma sup_bot_left: "\<bottom> \<squnion> x = x" | 
| 502 | by (fact sup_bot.left_neutral) | |
| 503 | ||
| 504 | lemma sup_bot_right: "x \<squnion> \<bottom> = x" | |
| 505 | by (fact sup_bot.right_neutral) | |
| 506 | ||
| 507 | lemma sup_eq_bot_iff: "x \<squnion> y = \<bottom> \<longleftrightarrow> x = \<bottom> \<and> y = \<bottom>" | |
| 508 | by (fact sup_bot.eq_neutr_iff) | |
| 509 | ||
| 510 | lemma bot_eq_sup_iff: "\<bottom> = x \<squnion> y \<longleftrightarrow> x = \<bottom> \<and> y = \<bottom>" | |
| 511 | by (fact sup_bot.neutr_eq_iff) | |
| 512 | ||
| 52152 | 513 | end | 
| 514 | ||
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52152diff
changeset | 515 | class bounded_lattice_bot = lattice + order_bot | 
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 516 | begin | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 517 | |
| 51487 | 518 | subclass bounded_semilattice_sup_bot .. | 
| 519 | ||
| 63322 | 520 | lemma inf_bot_left [simp]: "\<bottom> \<sqinter> x = \<bottom>" | 
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 521 | by (rule inf_absorb1) simp | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 522 | |
| 63322 | 523 | lemma inf_bot_right [simp]: "x \<sqinter> \<bottom> = \<bottom>" | 
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 524 | by (rule inf_absorb2) simp | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 525 | |
| 36352 
f71978e47cd5
add bounded_lattice_bot and bounded_lattice_top type classes
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
36096diff
changeset | 526 | end | 
| 
f71978e47cd5
add bounded_lattice_bot and bounded_lattice_top type classes
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
36096diff
changeset | 527 | |
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52152diff
changeset | 528 | class bounded_lattice_top = lattice + order_top | 
| 36352 
f71978e47cd5
add bounded_lattice_bot and bounded_lattice_top type classes
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
36096diff
changeset | 529 | begin | 
| 
f71978e47cd5
add bounded_lattice_bot and bounded_lattice_top type classes
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
36096diff
changeset | 530 | |
| 51487 | 531 | subclass bounded_semilattice_inf_top .. | 
| 532 | ||
| 63322 | 533 | lemma sup_top_left [simp]: "\<top> \<squnion> x = \<top>" | 
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 534 | by (rule sup_absorb1) simp | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 535 | |
| 63322 | 536 | lemma sup_top_right [simp]: "x \<squnion> \<top> = \<top>" | 
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 537 | by (rule sup_absorb2) simp | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 538 | |
| 36352 
f71978e47cd5
add bounded_lattice_bot and bounded_lattice_top type classes
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
36096diff
changeset | 539 | end | 
| 
f71978e47cd5
add bounded_lattice_bot and bounded_lattice_top type classes
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
36096diff
changeset | 540 | |
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52152diff
changeset | 541 | class bounded_lattice = lattice + order_bot + order_top | 
| 36352 
f71978e47cd5
add bounded_lattice_bot and bounded_lattice_top type classes
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
36096diff
changeset | 542 | begin | 
| 
f71978e47cd5
add bounded_lattice_bot and bounded_lattice_top type classes
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
36096diff
changeset | 543 | |
| 51487 | 544 | subclass bounded_lattice_bot .. | 
| 545 | subclass bounded_lattice_top .. | |
| 546 | ||
| 63322 | 547 | lemma dual_bounded_lattice: "class.bounded_lattice sup greater_eq greater inf \<top> \<bottom>" | 
| 36352 
f71978e47cd5
add bounded_lattice_bot and bounded_lattice_top type classes
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
36096diff
changeset | 548 | by unfold_locales (auto simp add: less_le_not_le) | 
| 32568 | 549 | |
| 34007 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32781diff
changeset | 550 | end | 
| 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32781diff
changeset | 551 | |
| 63322 | 552 | |
| 61799 | 553 | subsection \<open>\<open>min/max\<close> as special case of lattice\<close> | 
| 51540 
eea5c4ca4a0e
explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
 haftmann parents: 
51489diff
changeset | 554 | |
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 555 | context linorder | 
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 556 | begin | 
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 557 | |
| 61605 | 558 | sublocale min: semilattice_order min less_eq less | 
| 559 | + max: semilattice_order max greater_eq greater | |
| 61169 | 560 | by standard (auto simp add: min_def max_def) | 
| 51540 
eea5c4ca4a0e
explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
 haftmann parents: 
51489diff
changeset | 561 | |
| 73869 | 562 | declare min.absorb1 [simp] min.absorb2 [simp] | 
| 563 | min.absorb3 [simp] min.absorb4 [simp] | |
| 564 | max.absorb1 [simp] max.absorb2 [simp] | |
| 565 | max.absorb3 [simp] max.absorb4 [simp] | |
| 566 | ||
| 63322 | 567 | lemma min_le_iff_disj: "min x y \<le> z \<longleftrightarrow> x \<le> z \<or> y \<le> z" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 568 | unfolding min_def using linear by (auto intro: order_trans) | 
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 569 | |
| 63322 | 570 | lemma le_max_iff_disj: "z \<le> max x y \<longleftrightarrow> z \<le> x \<or> z \<le> y" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 571 | unfolding max_def using linear by (auto intro: order_trans) | 
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 572 | |
| 63322 | 573 | lemma min_less_iff_disj: "min x y < z \<longleftrightarrow> x < z \<or> y < z" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 574 | unfolding min_def le_less using less_linear by (auto intro: less_trans) | 
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 575 | |
| 63322 | 576 | lemma less_max_iff_disj: "z < max x y \<longleftrightarrow> z < x \<or> z < y" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 577 | unfolding max_def le_less using less_linear by (auto intro: less_trans) | 
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 578 | |
| 63322 | 579 | lemma min_less_iff_conj [simp]: "z < min x y \<longleftrightarrow> z < x \<and> z < y" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 580 | unfolding min_def le_less using less_linear by (auto intro: less_trans) | 
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 581 | |
| 63322 | 582 | lemma max_less_iff_conj [simp]: "max x y < z \<longleftrightarrow> x < z \<and> y < z" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 583 | unfolding max_def le_less using less_linear by (auto intro: less_trans) | 
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 584 | |
| 63322 | 585 | lemma min_max_distrib1: "min (max b c) a = max (min b a) (min c a)" | 
| 54862 | 586 | by (auto simp add: min_def max_def not_le dest: le_less_trans less_trans intro: antisym) | 
| 587 | ||
| 63322 | 588 | lemma min_max_distrib2: "min a (max b c) = max (min a b) (min a c)" | 
| 54862 | 589 | by (auto simp add: min_def max_def not_le dest: le_less_trans less_trans intro: antisym) | 
| 590 | ||
| 63322 | 591 | lemma max_min_distrib1: "max (min b c) a = min (max b a) (max c a)" | 
| 54862 | 592 | by (auto simp add: min_def max_def not_le dest: le_less_trans less_trans intro: antisym) | 
| 593 | ||
| 63322 | 594 | lemma max_min_distrib2: "max a (min b c) = min (max a b) (max a c)" | 
| 54862 | 595 | by (auto simp add: min_def max_def not_le dest: le_less_trans less_trans intro: antisym) | 
| 596 | ||
| 597 | lemmas min_max_distribs = min_max_distrib1 min_max_distrib2 max_min_distrib1 max_min_distrib2 | |
| 598 | ||
| 63322 | 599 | lemma split_min [no_atp]: "P (min i j) \<longleftrightarrow> (i \<le> j \<longrightarrow> P i) \<and> (\<not> i \<le> j \<longrightarrow> P j)" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 600 | by (simp add: min_def) | 
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 601 | |
| 63322 | 602 | lemma split_max [no_atp]: "P (max i j) \<longleftrightarrow> (i \<le> j \<longrightarrow> P j) \<and> (\<not> i \<le> j \<longrightarrow> P i)" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 603 | by (simp add: max_def) | 
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 604 | |
| 71138 | 605 | lemma split_min_lin [no_atp]: | 
| 606 | \<open>P (min a b) \<longleftrightarrow> (b = a \<longrightarrow> P a) \<and> (a < b \<longrightarrow> P a) \<and> (b < a \<longrightarrow> P b)\<close> | |
| 73869 | 607 | by (cases a b rule: linorder_cases) auto | 
| 71138 | 608 | |
| 609 | lemma split_max_lin [no_atp]: | |
| 610 | \<open>P (max a b) \<longleftrightarrow> (b = a \<longrightarrow> P a) \<and> (a < b \<longrightarrow> P b) \<and> (b < a \<longrightarrow> P a)\<close> | |
| 73869 | 611 | by (cases a b rule: linorder_cases) auto | 
| 71138 | 612 | |
| 63322 | 613 | lemma min_of_mono: "mono f \<Longrightarrow> min (f m) (f n) = f (min m n)" for f :: "'a \<Rightarrow> 'b::linorder" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 614 | by (auto simp: mono_def Orderings.min_def min_def intro: Orderings.antisym) | 
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 615 | |
| 63322 | 616 | lemma max_of_mono: "mono f \<Longrightarrow> max (f m) (f n) = f (max m n)" for f :: "'a \<Rightarrow> 'b::linorder" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 617 | by (auto simp: mono_def Orderings.max_def max_def intro: Orderings.antisym) | 
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 618 | |
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 619 | end | 
| 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54859diff
changeset | 620 | |
| 67727 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67399diff
changeset | 621 | lemma max_of_antimono: "antimono f \<Longrightarrow> max (f x) (f y) = f (min x y)" | 
| 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67399diff
changeset | 622 | and min_of_antimono: "antimono f \<Longrightarrow> min (f x) (f y) = f (max x y)" | 
| 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67399diff
changeset | 623 | for f::"'a::linorder \<Rightarrow> 'b::linorder" | 
| 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67399diff
changeset | 624 | by (auto simp: antimono_def Orderings.max_def min_def intro!: antisym) | 
| 
ce3e87a51488
moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
 immler parents: 
67399diff
changeset | 625 | |
| 61076 | 626 | lemma inf_min: "inf = (min :: 'a::{semilattice_inf,linorder} \<Rightarrow> 'a \<Rightarrow> 'a)"
 | 
| 51540 
eea5c4ca4a0e
explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
 haftmann parents: 
51489diff
changeset | 627 | by (auto intro: antisym simp add: min_def fun_eq_iff) | 
| 
eea5c4ca4a0e
explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
 haftmann parents: 
51489diff
changeset | 628 | |
| 61076 | 629 | lemma sup_max: "sup = (max :: 'a::{semilattice_sup,linorder} \<Rightarrow> 'a \<Rightarrow> 'a)"
 | 
| 51540 
eea5c4ca4a0e
explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
 haftmann parents: 
51489diff
changeset | 630 | by (auto intro: antisym simp add: max_def fun_eq_iff) | 
| 
eea5c4ca4a0e
explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
 haftmann parents: 
51489diff
changeset | 631 | |
| 
eea5c4ca4a0e
explicit sublocale dependency for Min/Max yields more appropriate Min/Max prefix for a couple of facts
 haftmann parents: 
51489diff
changeset | 632 | |
| 60758 | 633 | subsection \<open>Uniqueness of inf and sup\<close> | 
| 22454 | 634 | |
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34973diff
changeset | 635 | lemma (in semilattice_inf) inf_unique: | 
| 63322 | 636 | fixes f (infixl "\<triangle>" 70) | 
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 637 | assumes le1: "\<And>x y. x \<triangle> y \<le> x" | 
| 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 638 | and le2: "\<And>x y. x \<triangle> y \<le> y" | 
| 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 639 | and greatest: "\<And>x y z. x \<le> y \<Longrightarrow> x \<le> z \<Longrightarrow> x \<le> y \<triangle> z" | 
| 22737 | 640 | shows "x \<sqinter> y = x \<triangle> y" | 
| 73411 | 641 | proof (rule order.antisym) | 
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 642 | show "x \<triangle> y \<le> x \<sqinter> y" | 
| 63322 | 643 | by (rule le_infI) (rule le1, rule le2) | 
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 644 | have leI: "\<And>x y z. x \<le> y \<Longrightarrow> x \<le> z \<Longrightarrow> x \<le> y \<triangle> z" | 
| 63322 | 645 | by (blast intro: greatest) | 
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 646 | show "x \<sqinter> y \<le> x \<triangle> y" | 
| 63322 | 647 | by (rule leI) simp_all | 
| 22454 | 648 | qed | 
| 649 | ||
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34973diff
changeset | 650 | lemma (in semilattice_sup) sup_unique: | 
| 63322 | 651 | fixes f (infixl "\<nabla>" 70) | 
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 652 | assumes ge1 [simp]: "\<And>x y. x \<le> x \<nabla> y" | 
| 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 653 | and ge2: "\<And>x y. y \<le> x \<nabla> y" | 
| 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 654 | and least: "\<And>x y z. y \<le> x \<Longrightarrow> z \<le> x \<Longrightarrow> y \<nabla> z \<le> x" | 
| 22737 | 655 | shows "x \<squnion> y = x \<nabla> y" | 
| 73411 | 656 | proof (rule order.antisym) | 
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 657 | show "x \<squnion> y \<le> x \<nabla> y" | 
| 63322 | 658 | by (rule le_supI) (rule ge1, rule ge2) | 
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 659 | have leI: "\<And>x y z. x \<le> z \<Longrightarrow> y \<le> z \<Longrightarrow> x \<nabla> y \<le> z" | 
| 63322 | 660 | by (blast intro: least) | 
| 63820 
9f004fbf9d5c
discontinued theory-local special syntax for lattice orderings
 haftmann parents: 
63661diff
changeset | 661 | show "x \<nabla> y \<le> x \<squnion> y" | 
| 63322 | 662 | by (rule leI) simp_all | 
| 22454 | 663 | qed | 
| 36008 | 664 | |
| 22454 | 665 | |
| 69593 | 666 | subsection \<open>Lattice on \<^typ>\<open>_ \<Rightarrow> _\<close>\<close> | 
| 23878 | 667 | |
| 51387 | 668 | instantiation "fun" :: (type, semilattice_sup) semilattice_sup | 
| 25510 | 669 | begin | 
| 670 | ||
| 63322 | 671 | definition "f \<squnion> g = (\<lambda>x. f x \<squnion> g x)" | 
| 41080 | 672 | |
| 63322 | 673 | lemma sup_apply [simp, code]: "(f \<squnion> g) x = f x \<squnion> g x" | 
| 41080 | 674 | by (simp add: sup_fun_def) | 
| 25510 | 675 | |
| 63588 | 676 | instance | 
| 677 | by standard (simp_all add: le_fun_def) | |
| 23878 | 678 | |
| 25510 | 679 | end | 
| 23878 | 680 | |
| 51387 | 681 | instantiation "fun" :: (type, semilattice_inf) semilattice_inf | 
| 682 | begin | |
| 683 | ||
| 63322 | 684 | definition "f \<sqinter> g = (\<lambda>x. f x \<sqinter> g x)" | 
| 51387 | 685 | |
| 63322 | 686 | lemma inf_apply [simp, code]: "(f \<sqinter> g) x = f x \<sqinter> g x" | 
| 51387 | 687 | by (simp add: inf_fun_def) | 
| 688 | ||
| 63322 | 689 | instance by standard (simp_all add: le_fun_def) | 
| 51387 | 690 | |
| 691 | end | |
| 692 | ||
| 693 | instance "fun" :: (type, lattice) lattice .. | |
| 694 | ||
| 63322 | 695 | instance "fun" :: (type, distrib_lattice) distrib_lattice | 
| 696 | by standard (rule ext, simp add: sup_inf_distrib1) | |
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 697 | |
| 34007 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32781diff
changeset | 698 | instance "fun" :: (type, bounded_lattice) bounded_lattice .. | 
| 
aea892559fc5
tuned lattices theory fragements; generlized some lemmas from sets to lattices
 haftmann parents: 
32781diff
changeset | 699 | |
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 700 | instantiation "fun" :: (type, uminus) uminus | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 701 | begin | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 702 | |
| 63322 | 703 | definition fun_Compl_def: "- A = (\<lambda>x. - A x)" | 
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 704 | |
| 63322 | 705 | lemma uminus_apply [simp, code]: "(- A) x = - (A x)" | 
| 41080 | 706 | by (simp add: fun_Compl_def) | 
| 707 | ||
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 708 | instance .. | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 709 | |
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 710 | end | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 711 | |
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 712 | instantiation "fun" :: (type, minus) minus | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 713 | begin | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 714 | |
| 63322 | 715 | definition fun_diff_def: "A - B = (\<lambda>x. A x - B x)" | 
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 716 | |
| 63322 | 717 | lemma minus_apply [simp, code]: "(A - B) x = A x - B x" | 
| 41080 | 718 | by (simp add: fun_diff_def) | 
| 719 | ||
| 31991 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 720 | instance .. | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 721 | |
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 722 | end | 
| 
37390299214a
added boolean_algebra type class; tuned lattice duals
 haftmann parents: 
30729diff
changeset | 723 | |
| 21249 | 724 | end |