src/HOL/Tools/numeral.ML
changeset 25932 db0fd0ecdcd4
parent 25919 8b1c0d434824
child 25967 dd602eb20f3f
equal deleted inserted replaced
25931:b1d1ab3e5a2e 25932:db0fd0ecdcd4
     7 
     7 
     8 signature NUMERAL =
     8 signature NUMERAL =
     9 sig
     9 sig
    10   val mk_cnumeral: int -> cterm
    10   val mk_cnumeral: int -> cterm
    11   val mk_cnumber: ctyp -> int -> cterm
    11   val mk_cnumber: ctyp -> int -> cterm
       
    12   val add_code: string -> bool -> bool -> string -> theory -> theory
    12 end;
    13 end;
    13 
    14 
    14 structure Numeral: NUMERAL =
    15 structure Numeral: NUMERAL =
    15 struct
    16 struct
    16 
    17 
    49   | mk_cnumber T 1 = instT T oneT one
    50   | mk_cnumber T 1 = instT T oneT one
    50   | mk_cnumber T i = Thm.capply (instT T numberT number_of) (mk_cnumeral i);
    51   | mk_cnumber T i = Thm.capply (instT T numberT number_of) (mk_cnumeral i);
    51 
    52 
    52 end;
    53 end;
    53 
    54 
       
    55 
       
    56 (* code generator *)
       
    57 
       
    58 fun add_code number_of negative unbounded target =
       
    59   CodeTarget.add_pretty_numeral target unbounded negative number_of
       
    60   @{const_name Int.B0} @{const_name Int.B1}
       
    61   @{const_name Int.Pls} @{const_name Int.Min}
       
    62   @{const_name Int.Bit};
       
    63 
    54 end;
    64 end;