src/HOL/Tools/numeral_syntax.ML
changeset 15013 34264f5e4691
parent 14981 e73f8140af78
child 15595 dc8a41c7cefc
equal deleted inserted replaced
15012:28fa57b57209 15013:34264f5e4691
    26 
    26 
    27 fun prefix_len _ [] = 0
    27 fun prefix_len _ [] = 0
    28   | prefix_len pred (x :: xs) =
    28   | prefix_len pred (x :: xs) =
    29       if pred x then 1 + prefix_len pred xs else 0;
    29       if pred x then 1 + prefix_len pred xs else 0;
    30 
    30 
    31 fun bin_of (Const ("bin.Pls", _)) = []
    31 fun bin_of (Const ("Numeral.Pls", _)) = []
    32   | bin_of (Const ("bin.Min", _)) = [~1]
    32   | bin_of (Const ("Numeral.Min", _)) = [~1]
    33   | bin_of (Const ("Bit", _) $ bs $ b) = dest_bit b :: bin_of bs
    33   | bin_of (Const ("Bit", _) $ bs $ b) = dest_bit b :: bin_of bs
    34   | bin_of _ = raise Match;
    34   | bin_of _ = raise Match;
    35 
    35 
    36 val dest_bin = HOLogic.int_of o bin_of;
    36 val dest_bin = HOLogic.int_of o bin_of;
    37 
    37 
    68 
    68 
    69 
    69 
    70 (* theory setup *)
    70 (* theory setup *)
    71 
    71 
    72 val setup =
    72 val setup =
    73  [Theory.hide_consts false ["Numeral.bin.Pls", "Numeral.bin.Min"],
    73  [Theory.hide_consts false ["Numeral.Pls", "Numeral.Min"],
    74   Theory.add_trfuns ([], [("_Numeral", numeral_tr)], [], []),
    74   Theory.add_trfuns ([], [("_Numeral", numeral_tr)], [], []),
    75   Theory.add_trfunsT [("number_of", numeral_tr'), ("Numeral.number_of", numeral_tr')]];
    75   Theory.add_trfunsT [("number_of", numeral_tr'), ("Numeral.number_of", numeral_tr')]];
    76 
    76 
    77 
    77 
    78 end;
    78 end;