author | paulson <lp15@cam.ac.uk> |
Thu, 19 Sep 2019 17:24:08 +0100 | |
changeset 70737 | e4825ec20468 |
parent 70189 | 6d2effbbf8d4 |
child 71042 | 400e9512f1d3 |
permissions | -rw-r--r-- |
29629 | 1 |
(* Title: HOL/Library/Boolean_Algebra.thy |
2 |
Author: Brian Huffman |
|
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
3 |
*) |
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
4 |
|
60500 | 5 |
section \<open>Boolean Algebras\<close> |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
6 |
|
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
7 |
theory Boolean_Algebra |
63462 | 8 |
imports Main |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
9 |
begin |
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
10 |
|
70189 | 11 |
locale boolean_algebra = conj: abel_semigroup "(\<^bold>\<sqinter>)" + disj: abel_semigroup "(\<^bold>\<squnion>)" |
12 |
for conj :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixr "\<^bold>\<sqinter>" 70) |
|
13 |
and disj :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixr "\<^bold>\<squnion>" 65) + |
|
70188 | 14 |
fixes compl :: "'a \<Rightarrow> 'a" ("\<sim> _" [81] 80) |
65343 | 15 |
and zero :: "'a" ("\<zero>") |
16 |
and one :: "'a" ("\<one>") |
|
70189 | 17 |
assumes conj_disj_distrib: "x \<^bold>\<sqinter> (y \<^bold>\<squnion> z) = (x \<^bold>\<sqinter> y) \<^bold>\<squnion> (x \<^bold>\<sqinter> z)" |
18 |
and disj_conj_distrib: "x \<^bold>\<squnion> (y \<^bold>\<sqinter> z) = (x \<^bold>\<squnion> y) \<^bold>\<sqinter> (x \<^bold>\<squnion> z)" |
|
19 |
and conj_one_right: "x \<^bold>\<sqinter> \<one> = x" |
|
20 |
and disj_zero_right: "x \<^bold>\<squnion> \<zero> = x" |
|
21 |
and conj_cancel_right [simp]: "x \<^bold>\<sqinter> \<sim> x = \<zero>" |
|
22 |
and disj_cancel_right [simp]: "x \<^bold>\<squnion> \<sim> x = \<one>" |
|
54868 | 23 |
begin |
34973
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents:
30663
diff
changeset
|
24 |
|
70189 | 25 |
sublocale conj: semilattice_neutr "(\<^bold>\<sqinter>)" "\<one>" |
70188 | 26 |
proof |
70189 | 27 |
show "x \<^bold>\<sqinter> \<one> = x" for x |
70188 | 28 |
by (fact conj_one_right) |
70189 | 29 |
show "x \<^bold>\<sqinter> x = x" for x |
70188 | 30 |
proof - |
70189 | 31 |
have "x \<^bold>\<sqinter> x = (x \<^bold>\<sqinter> x) \<^bold>\<squnion> \<zero>" |
70188 | 32 |
by (simp add: disj_zero_right) |
70189 | 33 |
also have "\<dots> = (x \<^bold>\<sqinter> x) \<^bold>\<squnion> (x \<^bold>\<sqinter> \<sim> x)" |
70188 | 34 |
by simp |
70189 | 35 |
also have "\<dots> = x \<^bold>\<sqinter> (x \<^bold>\<squnion> \<sim> x)" |
70188 | 36 |
by (simp only: conj_disj_distrib) |
70189 | 37 |
also have "\<dots> = x \<^bold>\<sqinter> \<one>" |
70188 | 38 |
by simp |
39 |
also have "\<dots> = x" |
|
40 |
by (simp add: conj_one_right) |
|
41 |
finally show ?thesis . |
|
42 |
qed |
|
43 |
qed |
|
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
44 |
|
70189 | 45 |
sublocale disj: semilattice_neutr "(\<^bold>\<squnion>)" "\<zero>" |
70188 | 46 |
proof |
70189 | 47 |
show "x \<^bold>\<squnion> \<zero> = x" for x |
70188 | 48 |
by (fact disj_zero_right) |
70189 | 49 |
show "x \<^bold>\<squnion> x = x" for x |
70188 | 50 |
proof - |
70189 | 51 |
have "x \<^bold>\<squnion> x = (x \<^bold>\<squnion> x) \<^bold>\<sqinter> \<one>" |
70188 | 52 |
by simp |
70189 | 53 |
also have "\<dots> = (x \<^bold>\<squnion> x) \<^bold>\<sqinter> (x \<^bold>\<squnion> \<sim> x)" |
70188 | 54 |
by simp |
70189 | 55 |
also have "\<dots> = x \<^bold>\<squnion> (x \<^bold>\<sqinter> \<sim> x)" |
70188 | 56 |
by (simp only: disj_conj_distrib) |
70189 | 57 |
also have "\<dots> = x \<^bold>\<squnion> \<zero>" |
70188 | 58 |
by simp |
59 |
also have "\<dots> = x" |
|
60 |
by (simp add: disj_zero_right) |
|
61 |
finally show ?thesis . |
|
62 |
qed |
|
63 |
qed |
|
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
64 |
|
60855 | 65 |
|
60500 | 66 |
subsection \<open>Complement\<close> |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
67 |
|
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
68 |
lemma complement_unique: |
70189 | 69 |
assumes 1: "a \<^bold>\<sqinter> x = \<zero>" |
70 |
assumes 2: "a \<^bold>\<squnion> x = \<one>" |
|
71 |
assumes 3: "a \<^bold>\<sqinter> y = \<zero>" |
|
72 |
assumes 4: "a \<^bold>\<squnion> y = \<one>" |
|
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
73 |
shows "x = y" |
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
74 |
proof - |
70189 | 75 |
from 1 3 have "(a \<^bold>\<sqinter> x) \<^bold>\<squnion> (x \<^bold>\<sqinter> y) = (a \<^bold>\<sqinter> y) \<^bold>\<squnion> (x \<^bold>\<sqinter> y)" |
65343 | 76 |
by simp |
70189 | 77 |
then have "(x \<^bold>\<sqinter> a) \<^bold>\<squnion> (x \<^bold>\<sqinter> y) = (y \<^bold>\<sqinter> a) \<^bold>\<squnion> (y \<^bold>\<sqinter> x)" |
70188 | 78 |
by (simp add: ac_simps) |
70189 | 79 |
then have "x \<^bold>\<sqinter> (a \<^bold>\<squnion> y) = y \<^bold>\<sqinter> (a \<^bold>\<squnion> x)" |
65343 | 80 |
by (simp add: conj_disj_distrib) |
70189 | 81 |
with 2 4 have "x \<^bold>\<sqinter> \<one> = y \<^bold>\<sqinter> \<one>" |
65343 | 82 |
by simp |
63462 | 83 |
then show "x = y" |
65343 | 84 |
by simp |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
85 |
qed |
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
86 |
|
70189 | 87 |
lemma compl_unique: "x \<^bold>\<sqinter> y = \<zero> \<Longrightarrow> x \<^bold>\<squnion> y = \<one> \<Longrightarrow> \<sim> x = y" |
63462 | 88 |
by (rule complement_unique [OF conj_cancel_right disj_cancel_right]) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
89 |
|
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
90 |
lemma double_compl [simp]: "\<sim> (\<sim> x) = x" |
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
91 |
proof (rule compl_unique) |
70189 | 92 |
show "\<sim> x \<^bold>\<sqinter> x = \<zero>" |
70188 | 93 |
by (simp only: conj_cancel_right conj.commute) |
70189 | 94 |
show "\<sim> x \<^bold>\<squnion> x = \<one>" |
70188 | 95 |
by (simp only: disj_cancel_right disj.commute) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
96 |
qed |
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
97 |
|
63462 | 98 |
lemma compl_eq_compl_iff [simp]: "\<sim> x = \<sim> y \<longleftrightarrow> x = y" |
99 |
by (rule inj_eq [OF inj_on_inverseI]) (rule double_compl) |
|
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
100 |
|
60855 | 101 |
|
60500 | 102 |
subsection \<open>Conjunction\<close> |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
103 |
|
70189 | 104 |
lemma conj_zero_right [simp]: "x \<^bold>\<sqinter> \<zero> = \<zero>" |
70737 | 105 |
using conj.left_idem conj_cancel_right by fastforce |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
106 |
|
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
107 |
lemma compl_one [simp]: "\<sim> \<one> = \<zero>" |
63462 | 108 |
by (rule compl_unique [OF conj_zero_right disj_zero_right]) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
109 |
|
70189 | 110 |
lemma conj_zero_left [simp]: "\<zero> \<^bold>\<sqinter> x = \<zero>" |
70188 | 111 |
by (subst conj.commute) (rule conj_zero_right) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
112 |
|
70189 | 113 |
lemma conj_cancel_left [simp]: "\<sim> x \<^bold>\<sqinter> x = \<zero>" |
70188 | 114 |
by (subst conj.commute) (rule conj_cancel_right) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
115 |
|
70189 | 116 |
lemma conj_disj_distrib2: "(y \<^bold>\<squnion> z) \<^bold>\<sqinter> x = (y \<^bold>\<sqinter> x) \<^bold>\<squnion> (z \<^bold>\<sqinter> x)" |
70188 | 117 |
by (simp only: conj.commute conj_disj_distrib) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
118 |
|
63462 | 119 |
lemmas conj_disj_distribs = conj_disj_distrib conj_disj_distrib2 |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
120 |
|
70189 | 121 |
lemma conj_assoc: "(x \<^bold>\<sqinter> y) \<^bold>\<sqinter> z = x \<^bold>\<sqinter> (y \<^bold>\<sqinter> z)" |
70188 | 122 |
by (fact ac_simps) |
123 |
||
70189 | 124 |
lemma conj_commute: "x \<^bold>\<sqinter> y = y \<^bold>\<sqinter> x" |
70188 | 125 |
by (fact ac_simps) |
126 |
||
127 |
lemmas conj_left_commute = conj.left_commute |
|
128 |
lemmas conj_ac = conj.assoc conj.commute conj.left_commute |
|
129 |
||
70189 | 130 |
lemma conj_one_left: "\<one> \<^bold>\<sqinter> x = x" |
70188 | 131 |
by (fact conj.left_neutral) |
132 |
||
70189 | 133 |
lemma conj_left_absorb: "x \<^bold>\<sqinter> (x \<^bold>\<sqinter> y) = x \<^bold>\<sqinter> y" |
70188 | 134 |
by (fact conj.left_idem) |
135 |
||
70189 | 136 |
lemma conj_absorb: "x \<^bold>\<sqinter> x = x" |
70188 | 137 |
by (fact conj.idem) |
138 |
||
60855 | 139 |
|
60500 | 140 |
subsection \<open>Disjunction\<close> |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
141 |
|
70189 | 142 |
interpretation dual: boolean_algebra "(\<^bold>\<squnion>)" "(\<^bold>\<sqinter>)" compl \<one> \<zero> |
70188 | 143 |
apply standard |
144 |
apply (rule disj_conj_distrib) |
|
145 |
apply (rule conj_disj_distrib) |
|
146 |
apply simp_all |
|
147 |
done |
|
148 |
||
149 |
lemma compl_zero [simp]: "\<sim> \<zero> = \<one>" |
|
150 |
by (fact dual.compl_one) |
|
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
151 |
|
70189 | 152 |
lemma disj_one_right [simp]: "x \<^bold>\<squnion> \<one> = \<one>" |
70188 | 153 |
by (fact dual.conj_zero_right) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
154 |
|
70189 | 155 |
lemma disj_one_left [simp]: "\<one> \<^bold>\<squnion> x = \<one>" |
70188 | 156 |
by (fact dual.conj_zero_left) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
157 |
|
70189 | 158 |
lemma disj_cancel_left [simp]: "\<sim> x \<^bold>\<squnion> x = \<one>" |
70188 | 159 |
by (rule dual.conj_cancel_left) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
160 |
|
70189 | 161 |
lemma disj_conj_distrib2: "(y \<^bold>\<sqinter> z) \<^bold>\<squnion> x = (y \<^bold>\<squnion> x) \<^bold>\<sqinter> (z \<^bold>\<squnion> x)" |
70188 | 162 |
by (rule dual.conj_disj_distrib2) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
163 |
|
63462 | 164 |
lemmas disj_conj_distribs = disj_conj_distrib disj_conj_distrib2 |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
165 |
|
70189 | 166 |
lemma disj_assoc: "(x \<^bold>\<squnion> y) \<^bold>\<squnion> z = x \<^bold>\<squnion> (y \<^bold>\<squnion> z)" |
70188 | 167 |
by (fact ac_simps) |
168 |
||
70189 | 169 |
lemma disj_commute: "x \<^bold>\<squnion> y = y \<^bold>\<squnion> x" |
70188 | 170 |
by (fact ac_simps) |
171 |
||
172 |
lemmas disj_left_commute = disj.left_commute |
|
173 |
||
174 |
lemmas disj_ac = disj.assoc disj.commute disj.left_commute |
|
175 |
||
70189 | 176 |
lemma disj_zero_left: "\<zero> \<^bold>\<squnion> x = x" |
70188 | 177 |
by (fact disj.left_neutral) |
178 |
||
70189 | 179 |
lemma disj_left_absorb: "x \<^bold>\<squnion> (x \<^bold>\<squnion> y) = x \<^bold>\<squnion> y" |
70188 | 180 |
by (fact disj.left_idem) |
181 |
||
70189 | 182 |
lemma disj_absorb: "x \<^bold>\<squnion> x = x" |
70188 | 183 |
by (fact disj.idem) |
184 |
||
60855 | 185 |
|
60500 | 186 |
subsection \<open>De Morgan's Laws\<close> |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
187 |
|
70189 | 188 |
lemma de_Morgan_conj [simp]: "\<sim> (x \<^bold>\<sqinter> y) = \<sim> x \<^bold>\<squnion> \<sim> y" |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
189 |
proof (rule compl_unique) |
70189 | 190 |
have "(x \<^bold>\<sqinter> y) \<^bold>\<sqinter> (\<sim> x \<^bold>\<squnion> \<sim> y) = ((x \<^bold>\<sqinter> y) \<^bold>\<sqinter> \<sim> x) \<^bold>\<squnion> ((x \<^bold>\<sqinter> y) \<^bold>\<sqinter> \<sim> y)" |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
191 |
by (rule conj_disj_distrib) |
70189 | 192 |
also have "\<dots> = (y \<^bold>\<sqinter> (x \<^bold>\<sqinter> \<sim> x)) \<^bold>\<squnion> (x \<^bold>\<sqinter> (y \<^bold>\<sqinter> \<sim> y))" |
24357 | 193 |
by (simp only: conj_ac) |
70189 | 194 |
finally show "(x \<^bold>\<sqinter> y) \<^bold>\<sqinter> (\<sim> x \<^bold>\<squnion> \<sim> y) = \<zero>" |
24357 | 195 |
by (simp only: conj_cancel_right conj_zero_right disj_zero_right) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
196 |
next |
70189 | 197 |
have "(x \<^bold>\<sqinter> y) \<^bold>\<squnion> (\<sim> x \<^bold>\<squnion> \<sim> y) = (x \<^bold>\<squnion> (\<sim> x \<^bold>\<squnion> \<sim> y)) \<^bold>\<sqinter> (y \<^bold>\<squnion> (\<sim> x \<^bold>\<squnion> \<sim> y))" |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
198 |
by (rule disj_conj_distrib2) |
70189 | 199 |
also have "\<dots> = (\<sim> y \<^bold>\<squnion> (x \<^bold>\<squnion> \<sim> x)) \<^bold>\<sqinter> (\<sim> x \<^bold>\<squnion> (y \<^bold>\<squnion> \<sim> y))" |
24357 | 200 |
by (simp only: disj_ac) |
70189 | 201 |
finally show "(x \<^bold>\<sqinter> y) \<^bold>\<squnion> (\<sim> x \<^bold>\<squnion> \<sim> y) = \<one>" |
24357 | 202 |
by (simp only: disj_cancel_right disj_one_right conj_one_right) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
203 |
qed |
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
204 |
|
70189 | 205 |
lemma de_Morgan_disj [simp]: "\<sim> (x \<^bold>\<squnion> y) = \<sim> x \<^bold>\<sqinter> \<sim> y" |
70188 | 206 |
using dual.boolean_algebra_axioms by (rule boolean_algebra.de_Morgan_conj) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
207 |
|
60855 | 208 |
|
60500 | 209 |
subsection \<open>Symmetric Difference\<close> |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
210 |
|
70187
2082287357e6
avoid separate type class for mere definitional extension
haftmann
parents:
70186
diff
changeset
|
211 |
definition xor :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixr "\<oplus>" 65) |
70189 | 212 |
where "x \<oplus> y = (x \<^bold>\<sqinter> \<sim> y) \<^bold>\<squnion> (\<sim> x \<^bold>\<sqinter> y)" |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
213 |
|
61605 | 214 |
sublocale xor: abel_semigroup xor |
60855 | 215 |
proof |
34973
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents:
30663
diff
changeset
|
216 |
fix x y z :: 'a |
70189 | 217 |
let ?t = "(x \<^bold>\<sqinter> y \<^bold>\<sqinter> z) \<^bold>\<squnion> (x \<^bold>\<sqinter> \<sim> y \<^bold>\<sqinter> \<sim> z) \<^bold>\<squnion> (\<sim> x \<^bold>\<sqinter> y \<^bold>\<sqinter> \<sim> z) \<^bold>\<squnion> (\<sim> x \<^bold>\<sqinter> \<sim> y \<^bold>\<sqinter> z)" |
218 |
have "?t \<^bold>\<squnion> (z \<^bold>\<sqinter> x \<^bold>\<sqinter> \<sim> x) \<^bold>\<squnion> (z \<^bold>\<sqinter> y \<^bold>\<sqinter> \<sim> y) = ?t \<^bold>\<squnion> (x \<^bold>\<sqinter> y \<^bold>\<sqinter> \<sim> y) \<^bold>\<squnion> (x \<^bold>\<sqinter> z \<^bold>\<sqinter> \<sim> z)" |
|
24357 | 219 |
by (simp only: conj_cancel_right conj_zero_right) |
63462 | 220 |
then show "(x \<oplus> y) \<oplus> z = x \<oplus> (y \<oplus> z)" |
65343 | 221 |
by (simp only: xor_def de_Morgan_disj de_Morgan_conj double_compl) |
222 |
(simp only: conj_disj_distribs conj_ac disj_ac) |
|
34973
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents:
30663
diff
changeset
|
223 |
show "x \<oplus> y = y \<oplus> x" |
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents:
30663
diff
changeset
|
224 |
by (simp only: xor_def conj_commute disj_commute) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
225 |
qed |
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
226 |
|
34973
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents:
30663
diff
changeset
|
227 |
lemmas xor_assoc = xor.assoc |
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents:
30663
diff
changeset
|
228 |
lemmas xor_commute = xor.commute |
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents:
30663
diff
changeset
|
229 |
lemmas xor_left_commute = xor.left_commute |
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents:
30663
diff
changeset
|
230 |
|
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents:
30663
diff
changeset
|
231 |
lemmas xor_ac = xor.assoc xor.commute xor.left_commute |
ae634fad947e
dropped mk_left_commute; use interpretation of locale abel_semigroup instead
haftmann
parents:
30663
diff
changeset
|
232 |
|
70189 | 233 |
lemma xor_def2: "x \<oplus> y = (x \<^bold>\<squnion> y) \<^bold>\<sqinter> (\<sim> x \<^bold>\<squnion> \<sim> y)" |
70737 | 234 |
using conj.commute conj_disj_distrib2 disj.commute xor_def by auto |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
235 |
|
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
236 |
lemma xor_zero_right [simp]: "x \<oplus> \<zero> = x" |
63462 | 237 |
by (simp only: xor_def compl_zero conj_one_right conj_zero_right disj_zero_right) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
238 |
|
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
239 |
lemma xor_zero_left [simp]: "\<zero> \<oplus> x = x" |
63462 | 240 |
by (subst xor_commute) (rule xor_zero_right) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
241 |
|
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
242 |
lemma xor_one_right [simp]: "x \<oplus> \<one> = \<sim> x" |
63462 | 243 |
by (simp only: xor_def compl_one conj_zero_right conj_one_right disj_zero_left) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
244 |
|
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
245 |
lemma xor_one_left [simp]: "\<one> \<oplus> x = \<sim> x" |
63462 | 246 |
by (subst xor_commute) (rule xor_one_right) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
247 |
|
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
248 |
lemma xor_self [simp]: "x \<oplus> x = \<zero>" |
63462 | 249 |
by (simp only: xor_def conj_cancel_right conj_cancel_left disj_zero_right) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
250 |
|
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
251 |
lemma xor_left_self [simp]: "x \<oplus> (x \<oplus> y) = y" |
63462 | 252 |
by (simp only: xor_assoc [symmetric] xor_self xor_zero_left) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
253 |
|
29996 | 254 |
lemma xor_compl_left [simp]: "\<sim> x \<oplus> y = \<sim> (x \<oplus> y)" |
70737 | 255 |
by (metis xor_assoc xor_one_left) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
256 |
|
29996 | 257 |
lemma xor_compl_right [simp]: "x \<oplus> \<sim> y = \<sim> (x \<oplus> y)" |
70737 | 258 |
using xor_commute xor_compl_left by auto |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
259 |
|
29996 | 260 |
lemma xor_cancel_right: "x \<oplus> \<sim> x = \<one>" |
63462 | 261 |
by (simp only: xor_compl_right xor_self compl_zero) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
262 |
|
29996 | 263 |
lemma xor_cancel_left: "\<sim> x \<oplus> x = \<one>" |
63462 | 264 |
by (simp only: xor_compl_left xor_self compl_zero) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
265 |
|
70189 | 266 |
lemma conj_xor_distrib: "x \<^bold>\<sqinter> (y \<oplus> z) = (x \<^bold>\<sqinter> y) \<oplus> (x \<^bold>\<sqinter> z)" |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
267 |
proof - |
70189 | 268 |
have *: "(x \<^bold>\<sqinter> y \<^bold>\<sqinter> \<sim> z) \<^bold>\<squnion> (x \<^bold>\<sqinter> \<sim> y \<^bold>\<sqinter> z) = |
269 |
(y \<^bold>\<sqinter> x \<^bold>\<sqinter> \<sim> x) \<^bold>\<squnion> (z \<^bold>\<sqinter> x \<^bold>\<sqinter> \<sim> x) \<^bold>\<squnion> (x \<^bold>\<sqinter> y \<^bold>\<sqinter> \<sim> z) \<^bold>\<squnion> (x \<^bold>\<sqinter> \<sim> y \<^bold>\<sqinter> z)" |
|
24357 | 270 |
by (simp only: conj_cancel_right conj_zero_right disj_zero_left) |
70189 | 271 |
then show "x \<^bold>\<sqinter> (y \<oplus> z) = (x \<^bold>\<sqinter> y) \<oplus> (x \<^bold>\<sqinter> z)" |
24357 | 272 |
by (simp (no_asm_use) only: |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
273 |
xor_def de_Morgan_disj de_Morgan_conj double_compl |
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
274 |
conj_disj_distribs conj_ac disj_ac) |
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
275 |
qed |
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
276 |
|
70189 | 277 |
lemma conj_xor_distrib2: "(y \<oplus> z) \<^bold>\<sqinter> x = (y \<^bold>\<sqinter> x) \<oplus> (z \<^bold>\<sqinter> x)" |
70737 | 278 |
by (simp add: conj.commute conj_xor_distrib) |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
279 |
|
60855 | 280 |
lemmas conj_xor_distribs = conj_xor_distrib conj_xor_distrib2 |
24332
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
281 |
|
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
282 |
end |
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
283 |
|
e3a2b75b1cf9
boolean algebras as locales and numbers as types by Brian Huffman
kleing
parents:
diff
changeset
|
284 |
end |