src/HOL/Word/Bits.thy
changeset 70192 b4bf82ed0ad5
parent 70191 bdc835d934b7
child 71149 a7d1fb0c9e16
equal deleted inserted replaced
70191:bdc835d934b7 70192:b4bf82ed0ad5
     1 (*  Title:      HOL/Word/Bits.thy
     1 (*  Title:      HOL/Word/Bits.thy
     2     Author:     Author: Brian Huffman, PSU and Gerwin Klein, NICTA
     2     Author:     Brian Huffman, PSU and Gerwin Klein, NICTA
     3 *)
     3 *)
     4 
     4 
     5 section \<open>Syntactic type classes for bit operations\<close>
     5 section \<open>Syntactic type classes for bit operations\<close>
     6 
     6 
     7 theory Bits
     7 theory Bits
    17     and shiftr :: "'a \<Rightarrow> nat \<Rightarrow> 'a"  (infixl ">>" 55)
    17     and shiftr :: "'a \<Rightarrow> nat \<Rightarrow> 'a"  (infixl ">>" 55)
    18   fixes test_bit :: "'a \<Rightarrow> nat \<Rightarrow> bool"  (infixl "!!" 100)
    18   fixes test_bit :: "'a \<Rightarrow> nat \<Rightarrow> bool"  (infixl "!!" 100)
    19     and lsb :: "'a \<Rightarrow> bool"
    19     and lsb :: "'a \<Rightarrow> bool"
    20     and msb :: "'a \<Rightarrow> bool"
    20     and msb :: "'a \<Rightarrow> bool"
    21     and set_bit :: "'a \<Rightarrow> nat \<Rightarrow> bool \<Rightarrow> 'a"
    21     and set_bit :: "'a \<Rightarrow> nat \<Rightarrow> bool \<Rightarrow> 'a"
    22     and set_bits :: "(nat \<Rightarrow> bool) \<Rightarrow> 'a"  (binder "BITS " 10)
       
    23 
    22 
    24 text \<open>
    23 text \<open>
    25   We want the bitwise operations to bind slightly weaker
    24   We want the bitwise operations to bind slightly weaker
    26   than \<open>+\<close> and \<open>-\<close>, but \<open>~~\<close> to
    25   than \<open>+\<close> and \<open>-\<close>, but \<open>~~\<close> to
    27   bind slightly stronger than \<open>*\<close>.
    26   bind slightly stronger than \<open>*\<close>.