# HG changeset patch # User haftmann # Date 1589044804 0 # Node ID f424e164d75217584b0af76cb5a349cc0b04798f # Parent 3ef1418d64a6fee7c90ec756869028a093fd8c90 modernized notation for bit operations diff -r 3ef1418d64a6 -r f424e164d752 src/HOL/Word/Bits_Int.thy --- a/src/HOL/Word/Bits_Int.thy Fri May 08 13:20:02 2020 +0200 +++ b/src/HOL/Word/Bits_Int.thy Sat May 09 17:20:04 2020 +0000 @@ -1267,7 +1267,7 @@ instantiation int :: bit_operations begin -definition int_not_def: "bitNOT = (\x::int. - x - 1)" +definition int_not_def: "NOT = (\x::int. - x - 1)" function bitAND_int where "bitAND_int x y = @@ -1280,9 +1280,9 @@ declare bitAND_int.simps [simp del] -definition int_or_def: "bitOR = (\x y::int. NOT (NOT x AND NOT y))" - -definition int_xor_def: "bitXOR = (\x y::int. (x AND NOT y) OR (NOT x AND y))" +definition int_or_def: "(OR) = (\x y::int. NOT (NOT x AND NOT y))" + +definition int_xor_def: "(XOR) = (\x y::int. (x AND NOT y) OR (NOT x AND y))" definition [iff]: "i !! n \ bin_nth i n" diff -r 3ef1418d64a6 -r f424e164d752 src/HOL/Word/Tools/smt_word.ML --- a/src/HOL/Word/Tools/smt_word.ML Fri May 08 13:20:02 2020 +0200 +++ b/src/HOL/Word/Tools/smt_word.ML Sat May 09 17:20:04 2020 +0000 @@ -104,10 +104,10 @@ (\<^term>\plus :: 'a::len word \ _\, "bvadd"), (\<^term>\minus :: 'a::len word \ _\, "bvsub"), (\<^term>\times :: 'a::len word \ _\, "bvmul"), - (\<^term>\bitNOT :: 'a::len word \ _\, "bvnot"), - (\<^term>\bitAND :: 'a::len word \ _\, "bvand"), - (\<^term>\bitOR :: 'a::len word \ _\, "bvor"), - (\<^term>\bitXOR :: 'a::len word \ _\, "bvxor"), + (\<^term>\NOT :: 'a::len word \ _\, "bvnot"), + (\<^term>\(AND) :: 'a::len word \ _\, "bvand"), + (\<^term>\(OR) :: 'a::len word \ _\, "bvor"), + (\<^term>\(XOR) :: 'a::len word \ _\, "bvxor"), (\<^term>\word_cat :: 'a::len word \ _\, "concat") ] #> fold (add_word_fun shift) [ (\<^term>\shiftl :: 'a::len word \ _ \, "bvshl"), diff -r 3ef1418d64a6 -r f424e164d752 src/HOL/Word/Word.thy --- a/src/HOL/Word/Word.thy Fri May 08 13:20:02 2020 +0200 +++ b/src/HOL/Word/Word.thy Sat May 09 17:20:04 2020 +0000 @@ -375,16 +375,16 @@ instantiation word :: (len0) bit_operations begin -lift_definition bitNOT_word :: "'a word \ 'a word" is bitNOT +lift_definition bitNOT_word :: "'a word \ 'a word" is NOT by (metis bin_trunc_not) -lift_definition bitAND_word :: "'a word \ 'a word \ 'a word" is bitAND +lift_definition bitAND_word :: "'a word \ 'a word \ 'a word" is \(AND)\ by (metis bin_trunc_and) -lift_definition bitOR_word :: "'a word \ 'a word \ 'a word" is bitOR +lift_definition bitOR_word :: "'a word \ 'a word \ 'a word" is \(OR)\ by (metis bin_trunc_or) -lift_definition bitXOR_word :: "'a word \ 'a word \ 'a word" is bitXOR +lift_definition bitXOR_word :: "'a word \ 'a word \ 'a word" is \(XOR)\ by (metis bin_trunc_xor) definition word_test_bit_def: "test_bit a = bin_nth (uint a)" @@ -4251,19 +4251,19 @@ by (rule word_eqI) (auto simp add: word_ops_nth_size word_size) global_interpretation word_bool_alg: boolean_algebra - where conj = "(AND)" and disj = "(OR)" and compl = bitNOT + where conj = "(AND)" and disj = "(OR)" and compl = NOT and zero = 0 and one = max_word rewrites "word_bool_alg.xor = (XOR)" proof - interpret boolean_algebra - where conj = "(AND)" and disj = "(OR)" and compl = bitNOT + where conj = "(AND)" and disj = "(OR)" and compl = NOT and zero = 0 and one = max_word apply standard apply (simp_all add: word_bw_assocs word_bw_comms word_bw_lcs) apply (fact word_ao_dist2) apply (fact word_oa_dist2) done - show "boolean_algebra (AND) (OR) bitNOT 0 max_word" .. + show "boolean_algebra (AND) (OR) NOT 0 max_word" .. show "xor = (XOR)" by (auto simp add: fun_eq_iff word_eq_iff xor_def word_ops_nth_size word_size) qed