locale abstract_boolean_algebra = conj: abel_semigroup \<open>(\<^bold>\<sqinter>)\<close> + disj: abel_semigroup \<open>(\<^bold>\<squnion>)\<close> for conj :: \<open>'a \<Rightarrow> 'a \<Rightarrow> 'a\<close> (infixr \<open>\<^bold>\<sqinter>\<close> 70) and disj :: \<open>'a \<Rightarrow> 'a \<Rightarrow> 'a\<close> (infixr \<open>\<^bold>\<squnion>\<close> 65) + fixes compl :: \<open>'a \<Rightarrow> 'a\<close> (\<open>(\<open>open_block notation=\<open>prefix \<^bold>-\<close>\<close>\<^bold>- _)\<close> [81] 80) and zero :: \<open>'a\<close> (\<open>\<^bold>0\<close>) and one :: \<open>'a\<close> (\<open>\<^bold>1\<close>) assumes conj_disj_distrib: \<open>x \<^bold>\<sqinter> (y \<^bold>\<squnion> z) = (x \<^bold>\<sqinter> y) \<^bold>\<squnion> (x \<^bold>\<sqinter> z)\<close> and disj_conj_distrib: \<open>x \<^bold>\<squnion> (y \<^bold>\<sqinter> z) = (x \<^bold>\<squnion> y) \<^bold>\<sqinter> (x \<^bold>\<squnion> z)\<close> and conj_one_right: \<open>x \<^bold>\<sqinter> \<^bold>1 = x\<close> and disj_zero_right: \<open>x \<^bold>\<squnion> \<^bold>0 = x\<close> and conj_cancel_right [simp]: \<open>x \<^bold>\<sqinter> \<^bold>- x = \<^bold>0\<close> and disj_cancel_right [simp]: \<open>x \<^bold>\<squnion> \<^bold>- x = \<^bold>1\<close> begin
sublocale conj: semilattice_neutr \<open>(\<^bold>\<sqinter>)\<close> \<open>\<^bold>1\<close> proof show"x \<^bold>\ \<^bold>1 = x" for x by (fact conj_one_right) show"x \<^bold>\ x = x" for x proof - have"x \<^bold>\ x = (x \<^bold>\ x) \<^bold>\ \<^bold>0" by (simp add: disj_zero_right) alsohave"\ = (x \<^bold>\ x) \<^bold>\ (x \<^bold>\ \<^bold>- x)" by simp alsohave"\ = x \<^bold>\ (x \<^bold>\ \<^bold>- x)" by (simp only: conj_disj_distrib) alsohave"\ = x \<^bold>\ \<^bold>1" by simp alsohave"\ = x" by (simp add: conj_one_right) finallyshow ?thesis . qed qed
sublocale disj: semilattice_neutr \<open>(\<^bold>\<squnion>)\<close> \<open>\<^bold>0\<close> proof show"x \<^bold>\ \<^bold>0 = x" for x by (fact disj_zero_right) show"x \<^bold>\ x = x" for x proof - have"x \<^bold>\ x = (x \<^bold>\ x) \<^bold>\ \<^bold>1" by simp alsohave"\ = (x \<^bold>\ x) \<^bold>\ (x \<^bold>\ \<^bold>- x)" by simp alsohave"\ = x \<^bold>\ (x \<^bold>\ \<^bold>- x)" by (simp only: disj_conj_distrib) alsohave"\ = x \<^bold>\ \<^bold>0" by simp alsohave"\ = x" by (simp add: disj_zero_right) finallyshow ?thesis . qed qed
subsubsection \<open>Complement\<close>
lemma complement_unique: assumes 1: "a \<^bold>\ x = \<^bold>0" assumes 2: "a \<^bold>\ x = \<^bold>1" assumes 3: "a \<^bold>\ y = \<^bold>0" assumes 4: "a \<^bold>\ y = \<^bold>1" shows"x = y" proof - from 1 3 have"(a \<^bold>\ x) \<^bold>\ (x \<^bold>\ y) = (a \<^bold>\ y) \<^bold>\ (x \<^bold>\ y)" by simp thenhave"(x \<^bold>\ a) \<^bold>\ (x \<^bold>\ y) = (y \<^bold>\ a) \<^bold>\ (y \<^bold>\ x)" by (simp add: ac_simps) thenhave"x \<^bold>\ (a \<^bold>\ y) = y \<^bold>\ (a \<^bold>\ x)" by (simp add: conj_disj_distrib) with 2 4 have"x \<^bold>\ \<^bold>1 = y \<^bold>\ \<^bold>1" by simp thenshow"x = y" by simp qed
lemma compl_unique: "x \<^bold>\ y = \<^bold>0 \ x \<^bold>\ y = \<^bold>1 \ \<^bold>- x = y" by (rule complement_unique [OF conj_cancel_right disj_cancel_right])
lemma double_compl [simp]: "\<^bold>- (\<^bold>- x) = x" proof (rule compl_unique) show"\<^bold>- x \<^bold>\ x = \<^bold>0" by (simp only: conj_cancel_right conj.commute) show"\<^bold>- x \<^bold>\ x = \<^bold>1" by (simp only: disj_cancel_right disj.commute) qed
lemma compl_eq_compl_iff [simp]: \<open>\<^bold>- x = \<^bold>- y \<longleftrightarrow> x = y\<close> (is \<open>?P \<longleftrightarrow> ?Q\<close>) proof assume\<open>?Q\<close> thenshow ?P by simp next assume\<open>?P\<close> thenhave\<open>\<^bold>- (\<^bold>- x) = \<^bold>- (\<^bold>- y)\<close> by simp thenshow ?Q by simp qed
subsubsection \<open>Conjunction\<close>
lemma conj_zero_right [simp]: "x \<^bold>\ \<^bold>0 = \<^bold>0" using conj.left_idem conj_cancel_right by fastforce
lemma de_Morgan_disj [simp]: "\<^bold>- (x \<^bold>\ y) = \<^bold>- x \<^bold>\ \<^bold>- y" by (fact dual.de_Morgan_conj)
end
end
subsection \<open>Symmetric Difference\<close>
locale abstract_boolean_algebra_sym_diff = abstract_boolean_algebra + fixes xor :: \<open>'a \<Rightarrow> 'a \<Rightarrow> 'a\<close> (infixr \<open>\<^bold>\<ominus>\<close> 65) assumes xor_def : \<open>x \<^bold>\<ominus> y = (x \<^bold>\<sqinter> \<^bold>- y) \<^bold>\<squnion> (\<^bold>- x \<^bold>\<sqinter> y)\<close> begin
sublocale xor: comm_monoid xor \<open>\<^bold>0\<close> proof fix x y z :: 'a let ?t = "(x \<^bold>\ y \<^bold>\ z) \<^bold>\ (x \<^bold>\ \<^bold>- y \<^bold>\ \<^bold>- z) \<^bold>\ (\<^bold>- x \<^bold>\ y \<^bold>\ \<^bold>- z) \<^bold>\ (\<^bold>- x \<^bold>\ \<^bold>- y \<^bold>\ z)" have"?t \<^bold>\ (z \<^bold>\ x \<^bold>\ \<^bold>- x) \<^bold>\ (z \<^bold>\ y \<^bold>\ \<^bold>- y) = ?t \<^bold>\ (x \<^bold>\ y \<^bold>\ \<^bold>- y) \<^bold>\ (x \<^bold>\ z \<^bold>\ \<^bold>- z)" by (simp only: conj_cancel_right conj_zero_right) thenshow"(x \<^bold>\ y) \<^bold>\ z = x \<^bold>\ (y \<^bold>\ z)" by (simp only: xor_def de_Morgan_disj de_Morgan_conj double_compl)
(simp only: conj_disj_distribs conj_ac ac_simps) show"x \<^bold>\ y = y \<^bold>\ x" by (simp only: xor_def ac_simps) show"x \<^bold>\ \<^bold>0 = x" by (simp add: xor_def) qed
lemma xor_def2: \<open>x \<^bold>\<ominus> y = (x \<^bold>\<squnion> y) \<^bold>\<sqinter> (\<^bold>- x \<^bold>\<squnion> \<^bold>- y)\<close> proof - note xor_def [of x y] alsohave\<open>x \<^bold>\<sqinter> \<^bold>- y \<^bold>\<squnion> \<^bold>- x \<^bold>\<sqinter> y = ((x \<^bold>\<squnion> \<^bold>- x) \<^bold>\<sqinter> (\<^bold>- y \<^bold>\<squnion> \<^bold>- x)) \<^bold>\<sqinter> (x \<^bold>\<squnion> y) \<^bold>\<sqinter> (\<^bold>- y \<^bold>\<squnion> y)\<close> by (simp add: ac_simps disj_conj_distribs) alsohave\<open>\<dots> = (x \<^bold>\<squnion> y) \<^bold>\<sqinter> (\<^bold>- x \<^bold>\<squnion> \<^bold>- y)\<close> by (simp add: ac_simps) finallyshow ?thesis . qed
class boolean_algebra = distrib_lattice + bounded_lattice + minus + uminus + assumes inf_compl_bot: \<open>x \<sqinter> - x = \<bottom>\<close> and sup_compl_top: \<open>x \<squnion> - x = \<top>\<close> assumes diff_eq: \<open>x - y = x \<sqinter> - y\<close> begin
lemma compl_inf_bot: "- x \ x = \" by (fact boolean_algebra.conj_cancel_left)
lemma compl_sup_top: "- x \ x = \" by (fact boolean_algebra.disj_cancel_left)
lemma compl_unique: assumes"x \ y = \" and"x \ y = \" shows"- x = y" using assms by (rule boolean_algebra.compl_unique)
lemma double_compl: "- (- x) = x" by (fact boolean_algebra.double_compl)
lemma compl_eq_compl_iff: "- x = - y \ x = y" by (fact boolean_algebra.compl_eq_compl_iff)
lemma compl_bot_eq: "- \ = \" by (fact boolean_algebra.compl_zero)
lemma compl_top_eq: "- \ = \" by (fact boolean_algebra.compl_one)
lemma compl_inf: "- (x \ y) = - x \ - y" by (fact boolean_algebra.de_Morgan_conj)
lemma compl_sup: "- (x \ y) = - x \ - y" by (fact boolean_algebra.de_Morgan_disj)
lemma compl_mono: assumes"x \ y" shows"- y \ - x" proof - from assms have"x \ y = y" by (simp only: le_iff_sup) thenhave"- (x \ y) = - y" by simp thenhave"- x \ - y = - y" by simp thenhave"- y \ - x = - y" by (simp only: inf_commute) thenshow ?thesis by (simp only: le_iff_inf) qed
lemma compl_le_compl_iff [simp]: "- x \ - y \ y \ x" by (auto dest: compl_mono)
lemma compl_le_swap1: assumes"y \ - x" shows"x \ -y" proof - from assms have"- (- x) \ - y" by (simp only: compl_le_compl_iff) thenshow ?thesis by simp qed
lemma compl_le_swap2: assumes"- y \ x" shows"- x \ y" proof - from assms have"- x \ - (- y)" by (simp only: compl_le_compl_iff) thenshow ?thesis by simp qed
lemma compl_less_compl_iff [simp]: "- x < - y \ y < x" by (auto simp add: less_le)
lemma compl_less_swap1: assumes"y < - x" shows"x < - y" proof - from assms have"- (- x) < - y"by (simp only: compl_less_compl_iff) thenshow ?thesis by simp qed
lemma compl_less_swap2: assumes"- y < x" shows"- x < y" proof - from assms have"- x < - (- y)" by (simp only: compl_less_compl_iff) thenshow ?thesis by simp qed
lemma sup_cancel_left1: \<open>x \<squnion> a \<squnion> (- x \<squnion> b) = \<top>\<close> by (simp add: ac_simps)
lemma sup_cancel_left2: \<open>- x \<squnion> a \<squnion> (x \<squnion> b) = \<top>\<close> by (simp add: ac_simps)
lemma inf_cancel_left1: \<open>x \<sqinter> a \<sqinter> (- x \<sqinter> b) = \<bottom>\<close> by (simp add: ac_simps)
lemma inf_cancel_left2: \<open>- x \<sqinter> a \<sqinter> (x \<sqinter> b) = \<bottom>\<close> by (simp add: ac_simps)
lemma sup_compl_top_left1 [simp]: \<open>- x \<squnion> (x \<squnion> y) = \<top>\<close> by (simp add: sup_assoc [symmetric])
lemma sup_compl_top_left2 [simp]: \<open>x \<squnion> (- x \<squnion> y) = \<top>\<close> using sup_compl_top_left1 [of "- x" y] by simp
lemma inf_compl_bot_left1 [simp]: \<open>- x \<sqinter> (x \<sqinter> y) = \<bottom>\<close> by (simp add: inf_assoc [symmetric])
lemma inf_compl_bot_left2 [simp]: \<open>x \<sqinter> (- x \<sqinter> y) = \<bottom>\<close> using inf_compl_bot_left1 [of "- x" y] by simp
simproc_setup boolean_algebra_cancel_sup ("sup a b::'a::boolean_algebra") = \<open>K (K (try Boolean_Algebra_Cancel.cancel_sup_conv))\<close>
simproc_setup boolean_algebra_cancel_inf ("inf a b::'a::boolean_algebra") = \<open>K (K (try Boolean_Algebra_Cancel.cancel_inf_conv))\<close>
context boolean_algebra begin
lemma shunt1: "(x \ y \ z) \ (x \ -y \ z)" proof assume"x \ y \ z" hence"-y \ (x \ y) \ -y \ z" using sup.mono by blast hence"-y \ x \ -y \ z" by (simp add: sup_inf_distrib1) thus"x \ -y \ z" by simp next assume"x \ -y \ z" hence"x \ y \ (-y \ z) \ y" using inf_mono by auto thus"x \ y \ z" using inf.boundedE inf_sup_distrib2 by auto qed
lemma shunt2: "(x \ -y \ z) \ (x \ y \ z)" by (simp add: shunt1)
lemma inf_shunt: "(x \ y = \) \ (x \ - y)" by (simp add: order.eq_iff shunt1)
lemma sup_shunt: "(x \ y = \) \ (- x \ y)" using inf_shunt [of \<open>- x\<close> \<open>- y\<close>, symmetric] by (simp flip: compl_sup compl_top_eq)
lemma diff_shunt_var[simp]: "(x - y = \) \ (x \ y)" by (simp add: diff_eq inf_shunt)
lemma diff_shunt[simp]: "(\ = x - y) \ (x \ y)" by (auto simp flip: diff_shunt_var)
lemma sup_neg_inf: \<open>p \<le> q \<squnion> r \<longleftrightarrow> p \<sqinter> -q \<le> r\<close> (is \<open>?P \<longleftrightarrow> ?Q\<close>) proof assume ?P thenhave\<open>p \<sqinter> - q \<le> (q \<squnion> r) \<sqinter> - q\<close> by (rule inf_mono) simp thenshow ?Q by (simp add: inf_sup_distrib2) next assume ?Q thenhave\<open>p \<sqinter> - q \<squnion> q \<le> r \<squnion> q\<close> by (rule sup_mono) simp thenshow ?P by (simp add: sup_inf_distrib ac_simps) qed
end
end
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
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.