equal
deleted
inserted
replaced
186 |
186 |
187 definition xor_bit :: \<open>bit \<Rightarrow> bit \<Rightarrow> bit\<close> |
187 definition xor_bit :: \<open>bit \<Rightarrow> bit \<Rightarrow> bit\<close> |
188 where [simp]: \<open>b XOR c = of_bool (odd b \<noteq> odd c)\<close> for b c :: bit |
188 where [simp]: \<open>b XOR c = of_bool (odd b \<noteq> odd c)\<close> for b c :: bit |
189 |
189 |
190 definition mask_bit :: \<open>nat \<Rightarrow> bit\<close> |
190 definition mask_bit :: \<open>nat \<Rightarrow> bit\<close> |
191 where [simp]: \<open>mask_bit n = of_bool (n > 0)\<close> |
191 where [simp]: \<open>mask n = (of_bool (n > 0) :: bit)\<close> |
|
192 |
|
193 definition set_bit_bit :: \<open>nat \<Rightarrow> bit \<Rightarrow> bit\<close> |
|
194 where [simp]: \<open>set_bit n b = of_bool (n = 0 \<or> odd b)\<close> for b :: bit |
|
195 |
|
196 definition unset_bit_bit :: \<open>nat \<Rightarrow> bit \<Rightarrow> bit\<close> |
|
197 where [simp]: \<open>unset_bit n b = of_bool (n > 0 \<and> odd b)\<close> for b :: bit |
|
198 |
|
199 definition flip_bit_bit :: \<open>nat \<Rightarrow> bit \<Rightarrow> bit\<close> |
|
200 where [simp]: \<open>flip_bit n b = of_bool ((n = 0) \<noteq> odd b)\<close> for b :: bit |
192 |
201 |
193 instance |
202 instance |
194 by standard auto |
203 by standard auto |
195 |
204 |
196 end |
205 end |