equal
deleted
inserted
replaced
58 val realT: typ |
58 val realT: typ |
59 val binT: typ |
59 val binT: typ |
60 val pls_const: term |
60 val pls_const: term |
61 val min_const: term |
61 val min_const: term |
62 val bit_const: term |
62 val bit_const: term |
|
63 val int_of: int list -> int |
|
64 val dest_binum: term -> int |
63 end; |
65 end; |
64 |
66 |
65 |
67 |
66 structure HOLogic: HOLOGIC = |
68 structure HOLogic: HOLOGIC = |
67 struct |
69 struct |
228 |
230 |
229 val pls_const = Const ("Numeral.bin.Pls", binT) |
231 val pls_const = Const ("Numeral.bin.Pls", binT) |
230 and min_const = Const ("Numeral.bin.Min", binT) |
232 and min_const = Const ("Numeral.bin.Min", binT) |
231 and bit_const = Const ("Numeral.bin.Bit", [binT, boolT] ---> binT); |
233 and bit_const = Const ("Numeral.bin.Bit", [binT, boolT] ---> binT); |
232 |
234 |
|
235 fun int_of [] = 0 |
|
236 | int_of (b :: bs) = b + 2 * int_of bs; |
|
237 |
|
238 fun dest_bit (Const ("False", _)) = 0 |
|
239 | dest_bit (Const ("True", _)) = 1 |
|
240 | dest_bit t = raise TERM("dest_bit", [t]); |
|
241 |
|
242 fun bin_of (Const ("Numeral.bin.Pls", _)) = [] |
|
243 | bin_of (Const ("Numeral.bin.Min", _)) = [~1] |
|
244 | bin_of (Const ("Numeral.bin.Bit", _) $ bs $ b) = dest_bit b :: bin_of bs |
|
245 | bin_of t = raise TERM("bin_of", [t]); |
|
246 |
|
247 val dest_binum = int_of o bin_of; |
|
248 |
233 end; |
249 end; |