src/HOL/ex/Numeral.thy
changeset 42290 b1f544c84040
parent 42248 04bffad68aa4
child 45154 66e8a5812f41
equal deleted inserted replaced
42289:dafae095d733 42290:b1f544c84040
   283       | (n, 0) => Const (@{const_name Dig0}, dummyT) $ num_of_int n
   283       | (n, 0) => Const (@{const_name Dig0}, dummyT) $ num_of_int n
   284       | (n, 1) => Const (@{const_name Dig1}, dummyT) $ num_of_int n
   284       | (n, 1) => Const (@{const_name Dig1}, dummyT) $ num_of_int n
   285     else raise Match;
   285     else raise Match;
   286   fun numeral_tr [Free (num, _)] =
   286   fun numeral_tr [Free (num, _)] =
   287         let
   287         let
   288           val {leading_zeros, value, ...} = Syntax.read_xnum num;
   288           val {leading_zeros, value, ...} = Lexicon.read_xnum num;
   289           val _ = leading_zeros = 0 andalso value > 0
   289           val _ = leading_zeros = 0 andalso value > 0
   290             orelse error ("Bad numeral: " ^ num);
   290             orelse error ("Bad numeral: " ^ num);
   291         in Const (@{const_name of_num}, @{typ num} --> dummyT) $ num_of_int value end
   291         in Const (@{const_name of_num}, @{typ num} --> dummyT) $ num_of_int value end
   292     | numeral_tr ts = raise TERM ("numeral_tr", ts);
   292     | numeral_tr ts = raise TERM ("numeral_tr", ts);
   293 in [(@{syntax_const "_Numerals"}, numeral_tr)] end
   293 in [(@{syntax_const "_Numerals"}, numeral_tr)] end