src/HOL/Integ/Numeral.thy
changeset 21820 2f2b6a965ccc
parent 21779 6d44dbae4bfa
child 21834 770ce948a59b
equal deleted inserted replaced
21819:8eb82ffcdd15 21820:2f2b6a965ccc
    29 *}
    29 *}
    30 
    30 
    31 datatype bit = B0 | B1
    31 datatype bit = B0 | B1
    32 
    32 
    33 definition
    33 definition
    34   Pls :: int where "Pls == 0"
    34   Pls :: int where
       
    35   "Pls = 0"
    35 
    36 
    36 definition
    37 definition
    37   Min :: int where "Min == - 1"
    38   Min :: int where
       
    39   "Min = - 1"
    38 
    40 
    39 definition
    41 definition
    40   Bit :: "int \<Rightarrow> bit \<Rightarrow> int" (infixl "BIT" 90) where
    42   Bit :: "int \<Rightarrow> bit \<Rightarrow> int" (infixl "BIT" 90) where
    41   "k BIT b == (case b of B0 \<Rightarrow> 0 | B1 \<Rightarrow> 1) + k + k"
    43   "k BIT b = (case b of B0 \<Rightarrow> 0 | B1 \<Rightarrow> 1) + k + k"
    42 
    44 
    43 axclass
    45 class number = -- {* for numeric types: nat, int, real, \dots *}
    44   number < type  -- {* for numeric types: nat, int, real, \dots *}
    46   fixes number_of :: "int \<Rightarrow> 'a"
    45 
       
    46 consts
       
    47   number_of :: "int \<Rightarrow> 'a::number"
       
    48 
    47 
    49 syntax
    48 syntax
    50   "_Numeral" :: "num_const \<Rightarrow> 'a"    ("_")
    49   "_Numeral" :: "num_const \<Rightarrow> 'a"    ("_")
    51 
    50 
    52 setup NumeralSyntax.setup
    51 setup NumeralSyntax.setup