equal
deleted
inserted
replaced
76 val number_of_const: typ -> term |
76 val number_of_const: typ -> term |
77 val int_of: int list -> int |
77 val int_of: int list -> int |
78 val dest_binum: term -> int |
78 val dest_binum: term -> int |
79 val mk_bin: int -> term |
79 val mk_bin: int -> term |
80 val mk_list: ('a -> term) -> typ -> 'a list -> term |
80 val mk_list: ('a -> term) -> typ -> 'a list -> term |
|
81 val dest_list: term -> term list |
81 end; |
82 end; |
82 |
83 |
83 |
84 |
84 structure HOLogic: HOLOGIC = |
85 structure HOLogic: HOLOGIC = |
85 struct |
86 struct |
338 fun mk_list f T [] = Const ("List.list.Nil", Type ("List.list", [T])) |
339 fun mk_list f T [] = Const ("List.list.Nil", Type ("List.list", [T])) |
339 | mk_list f T (x :: xs) = Const ("List.list.Cons", |
340 | mk_list f T (x :: xs) = Const ("List.list.Cons", |
340 T --> Type ("List.list", [T]) --> Type ("List.list", [T])) $ f x $ |
341 T --> Type ("List.list", [T]) --> Type ("List.list", [T])) $ f x $ |
341 mk_list f T xs; |
342 mk_list f T xs; |
342 |
343 |
|
344 fun dest_list (Const ("List.list.Nil", _)) = [] |
|
345 | dest_list (Const ("List.list.Cons", _) $ x $ xs) = x :: dest_list xs |
|
346 | dest_list t = raise TERM ("dest_list", [t]); |
|
347 |
343 end; |
348 end; |