src/HOL/Bit_Operations.thy
changeset 74123 7c5842b06114
parent 74108 3146646a43a7
child 74163 afe3c8ae1624
equal deleted inserted replaced
74122:7d3e818fe21f 74123:7c5842b06114
  1324   by (simp add: bit_eq_iff bit_not_iff) (simp add: bit_1_iff)
  1324   by (simp add: bit_eq_iff bit_not_iff) (simp add: bit_1_iff)
  1325 
  1325 
  1326 sublocale "and": semilattice_neutr \<open>(AND)\<close> \<open>- 1\<close>
  1326 sublocale "and": semilattice_neutr \<open>(AND)\<close> \<open>- 1\<close>
  1327   by standard (rule bit_eqI, simp add: bit_and_iff)
  1327   by standard (rule bit_eqI, simp add: bit_and_iff)
  1328 
  1328 
  1329 sublocale bit: boolean_algebra \<open>(AND)\<close> \<open>(OR)\<close> NOT 0 \<open>- 1\<close>
  1329 sublocale bit: abstract_boolean_algebra \<open>(AND)\<close> \<open>(OR)\<close> NOT 0 \<open>- 1\<close>
  1330   rewrites \<open>bit.xor = (XOR)\<close>
  1330   by standard (auto simp add: bit_and_iff bit_or_iff bit_not_iff intro: bit_eqI)
  1331 proof -
  1331 
  1332   interpret bit: boolean_algebra \<open>(AND)\<close> \<open>(OR)\<close> NOT 0 \<open>- 1\<close>
  1332 sublocale bit: abstract_boolean_algebra_sym_diff \<open>(AND)\<close> \<open>(OR)\<close> NOT 0 \<open>- 1\<close> \<open>(XOR)\<close>
  1333     by standard (auto simp add: bit_and_iff bit_or_iff bit_not_iff intro: bit_eqI)
  1333   apply standard
  1334   show \<open>boolean_algebra (AND) (OR) NOT 0 (- 1)\<close>
  1334   apply (rule bit_eqI)
  1335     by standard
  1335   apply (auto simp add: bit_simps)
  1336   show \<open>boolean_algebra.xor (AND) (OR) NOT = (XOR)\<close>
  1336   done
  1337     by (rule ext, rule ext, rule bit_eqI)
       
  1338       (auto simp add: bit.xor_def bit_and_iff bit_or_iff bit_xor_iff bit_not_iff)
       
  1339 qed
       
  1340 
  1337 
  1341 lemma and_eq_not_not_or:
  1338 lemma and_eq_not_not_or:
  1342   \<open>a AND b = NOT (NOT a OR NOT b)\<close>
  1339   \<open>a AND b = NOT (NOT a OR NOT b)\<close>
  1343   by simp
  1340   by simp
  1344 
  1341 
  3563       \<^item> Bit concatenation: @{thm concat_bit_def [no_vars]}
  3560       \<^item> Bit concatenation: @{thm concat_bit_def [no_vars]}
  3564 
  3561 
  3565       \<^item> (Bounded) conversion from and to a list of bits: @{thm horner_sum_bit_eq_take_bit [where ?'a = int, no_vars]}
  3562       \<^item> (Bounded) conversion from and to a list of bits: @{thm horner_sum_bit_eq_take_bit [where ?'a = int, no_vars]}
  3566 \<close>
  3563 \<close>
  3567 
  3564 
  3568 find_theorems \<open>(_ AND _) * _ = _\<close>
       
  3569 
       
  3570 no_notation
  3565 no_notation
  3571   "and"  (infixr \<open>AND\<close> 64)
  3566   "and"  (infixr \<open>AND\<close> 64)
  3572     and or  (infixr \<open>OR\<close>  59)
  3567     and or  (infixr \<open>OR\<close>  59)
  3573     and xor  (infixr \<open>XOR\<close> 59)
  3568     and xor  (infixr \<open>XOR\<close> 59)
  3574 
  3569