src/HOL/hologic.ML
changeset 17083 051b0897bc98
parent 16971 968adbfbf93b
child 18285 83e92f9b32c4
equal deleted inserted replaced
17082:b0e9462db0b4 17083:051b0897bc98
    82   val number_of_const: typ -> term
    82   val number_of_const: typ -> term
    83   val int_of: int list -> IntInf.int
    83   val int_of: int list -> IntInf.int
    84   val dest_binum: term -> IntInf.int
    84   val dest_binum: term -> IntInf.int
    85   val mk_bin: IntInf.int -> term
    85   val mk_bin: IntInf.int -> term
    86   val bin_of : term -> int list
    86   val bin_of : term -> int list
       
    87   val listT : typ -> typ
    87   val mk_list: ('a -> term) -> typ -> 'a list -> term
    88   val mk_list: ('a -> term) -> typ -> 'a list -> term
    88   val dest_list: term -> term list
    89   val dest_list: term -> term list
    89 end;
    90 end;
    90 
    91 
    91 
    92 
   341 val realT = Type ("RealDef.real", []);
   342 val realT = Type ("RealDef.real", []);
   342 
   343 
   343 
   344 
   344 (* list *)
   345 (* list *)
   345 
   346 
   346 fun mk_list f T [] = Const ("List.list.Nil", Type ("List.list", [T]))
   347 fun listT T =  Type ("List.list", [T])
       
   348 
       
   349 fun mk_list f T [] = Const ("List.list.Nil", listT T)
   347   | mk_list f T (x :: xs) = Const ("List.list.Cons",
   350   | mk_list f T (x :: xs) = Const ("List.list.Cons",
   348       T --> Type ("List.list", [T]) --> Type ("List.list", [T])) $ f x $
   351       T --> listT T --> listT T) $ f x $
   349         mk_list f T xs;
   352         mk_list f T xs;
   350 
   353 
   351 fun dest_list (Const ("List.list.Nil", _)) = []
   354 fun dest_list (Const ("List.list.Nil", _)) = []
   352   | dest_list (Const ("List.list.Cons", _) $ x $ xs) = x :: dest_list xs
   355   | dest_list (Const ("List.list.Cons", _) $ x $ xs) = x :: dest_list xs
   353   | dest_list t = raise TERM ("dest_list", [t]);
   356   | dest_list t = raise TERM ("dest_list", [t]);