src/HOL/Tools/Sledgehammer/sledgehammer_util.ML
changeset 36142 f5e15e9aae10
parent 36062 194cb6e3c13f
child 36169 27b1cc58715e
     1.1 --- a/src/HOL/Tools/Sledgehammer/sledgehammer_util.ML	Wed Apr 14 17:10:16 2010 +0200
     1.2 +++ b/src/HOL/Tools/Sledgehammer/sledgehammer_util.ML	Wed Apr 14 18:23:51 2010 +0200
     1.3 @@ -6,6 +6,7 @@
     1.4  
     1.5  signature SLEDGEHAMMER_UTIL =
     1.6  sig
     1.7 +  val plural_s : int -> string
     1.8    val serial_commas : string -> string list -> string list
     1.9    val parse_bool_option : bool -> string -> string -> bool option
    1.10    val parse_time_option : string -> string -> Time.time option
    1.11 @@ -17,12 +18,7 @@
    1.12  structure Sledgehammer_Util : SLEDGEHAMMER_UTIL =
    1.13  struct
    1.14  
    1.15 -(* This hash function is recommended in Compilers: Principles, Techniques, and
    1.16 -   Tools, by Aho, Sethi and Ullman. The hashpjw function, which they
    1.17 -   particularly recommend, triggers a bug in versions of Poly/ML up to 4.2.0. *)
    1.18 -fun hashw (u, w) = Word.+ (u, Word.* (0w65599, w))
    1.19 -fun hashw_char (c, w) = hashw (Word.fromInt (Char.ord c), w)
    1.20 -fun hashw_string (s:string, w) = CharVector.foldl hashw_char w s
    1.21 +fun plural_s n = if n = 1 then "" else "s"
    1.22  
    1.23  fun serial_commas _ [] = ["??"]
    1.24    | serial_commas _ [s] = [s]
    1.25 @@ -60,4 +56,11 @@
    1.26          SOME (Time.fromMilliseconds msecs)
    1.27      end
    1.28  
    1.29 +(* This hash function is recommended in Compilers: Principles, Techniques, and
    1.30 +   Tools, by Aho, Sethi and Ullman. The hashpjw function, which they
    1.31 +   particularly recommend, triggers a bug in versions of Poly/ML up to 4.2.0. *)
    1.32 +fun hashw (u, w) = Word.+ (u, Word.* (0w65599, w))
    1.33 +fun hashw_char (c, w) = hashw (Word.fromInt (Char.ord c), w)
    1.34 +fun hashw_string (s:string, w) = CharVector.foldl hashw_char w s
    1.35 +
    1.36  end;