src/HOL/Tools/numeral.ML
changeset 28708 a1a436f09ec6
parent 28663 bd8438543bf2
child 31056 01ac77eb660b
equal deleted inserted replaced
28707:548703affff5 28708:a1a436f09ec6
    77           | dest_num (t1 `$ t2) =
    77           | dest_num (t1 `$ t2) =
    78               let val (n, b) = (dest_num t2, dest_bit t1)
    78               let val (n, b) = (dest_num t2, dest_bit t1)
    79               in case n of SOME n => SOME (2 * n + b) | NONE => NONE end
    79               in case n of SOME n => SOME (2 * n + b) | NONE => NONE end
    80           | dest_num _ = Code_Printer.nerror thm "Illegal numeral expression: illegal term";
    80           | dest_num _ = Code_Printer.nerror thm "Illegal numeral expression: illegal term";
    81       in dest_num end;
    81       in dest_num end;
    82     fun pretty _ naming thm _ _ _ [(t, _)] =
    82     fun pretty _ naming thm _ _ [(t, _)] =
    83       (Code_Printer.str o pr_numeral unbounded o the_default 0 o dest_numeral naming thm) t;
    83       (Code_Printer.str o pr_numeral unbounded o the_default 0 o dest_numeral naming thm) t;
    84   in
    84   in
    85     thy
    85     thy
    86     |> Code_Target.add_syntax_const target number_of (SOME (1, pretty))
    86     |> Code_Target.add_syntax_const target number_of (SOME (1, pretty))
    87   end;
    87   end;