src/HOL/Tools/ATP/atp_problem.ML
changeset 43085 0a2f5b86bdd7
parent 43000 bd424c3dde46
child 43092 93ec303e1917
equal deleted inserted replaced
43084:946c8e171ffd 43085:0a2f5b86bdd7
    68   val formula_fold :
    68   val formula_fold :
    69     bool option -> (bool option -> 'c -> 'd -> 'd) -> ('a, 'b, 'c) formula
    69     bool option -> (bool option -> 'c -> 'd -> 'd) -> ('a, 'b, 'c) formula
    70     -> 'd -> 'd
    70     -> 'd -> 'd
    71   val formula_map : ('c -> 'd) -> ('a, 'b, 'c) formula -> ('a, 'b, 'd) formula
    71   val formula_map : ('c -> 'd) -> ('a, 'b, 'c) formula -> ('a, 'b, 'd) formula
    72   val is_format_typed : format -> bool
    72   val is_format_typed : format -> bool
    73   val timestamp : unit -> string
       
    74   val hashw : word * word -> word
       
    75   val hashw_string : string * word -> word
       
    76   val tptp_strings_for_atp_problem : format -> string problem -> string list
    73   val tptp_strings_for_atp_problem : format -> string problem -> string list
    77   val filter_cnf_ueq_problem :
    74   val filter_cnf_ueq_problem :
    78     (string * string) problem -> (string * string) problem
    75     (string * string) problem -> (string * string) problem
    79   val declare_undeclared_syms_in_atp_problem :
    76   val declare_undeclared_syms_in_atp_problem :
    80     string -> string -> (string * string) problem -> (string * string) problem
    77     string -> string -> (string * string) problem -> (string * string) problem
    84        * (string Symtab.table * string Symtab.table) option
    81        * (string Symtab.table * string Symtab.table) option
    85 end;
    82 end;
    86 
    83 
    87 structure ATP_Problem : ATP_PROBLEM =
    84 structure ATP_Problem : ATP_PROBLEM =
    88 struct
    85 struct
       
    86 
       
    87 open ATP_Util
       
    88 
    89 
    89 
    90 (** ATP problem **)
    90 (** ATP problem **)
    91 
    91 
    92 datatype 'a fo_term = ATerm of 'a * 'a fo_term list
    92 datatype 'a fo_term = ATerm of 'a * 'a fo_term list
    93 datatype quantifier = AForall | AExists
    93 datatype quantifier = AForall | AExists
   170   | formula_map f (AConn (c, phis)) = AConn (c, map (formula_map f) phis)
   170   | formula_map f (AConn (c, phis)) = AConn (c, map (formula_map f) phis)
   171   | formula_map f (AAtom tm) = AAtom (f tm)
   171   | formula_map f (AAtom tm) = AAtom (f tm)
   172 
   172 
   173 val is_format_typed = member (op =) [TFF, THF]
   173 val is_format_typed = member (op =) [TFF, THF]
   174 
   174 
   175 val timestamp = Date.fmt "%Y-%m-%d %H:%M:%S" o Date.fromTimeLocal o Time.now
       
   176 
       
   177 (* This hash function is recommended in "Compilers: Principles, Techniques, and
       
   178    Tools" by Aho, Sethi, and Ullman. The "hashpjw" function, which they
       
   179    particularly recommend, triggers a bug in versions of Poly/ML up to 4.2.0. *)
       
   180 fun hashw (u, w) = Word.+ (u, Word.* (0w65599, w))
       
   181 fun hashw_char (c, w) = hashw (Word.fromInt (Char.ord c), w)
       
   182 fun hashw_string (s : string, w) = CharVector.foldl hashw_char w s
       
   183 
       
   184 fun string_for_kind Axiom = "axiom"
   175 fun string_for_kind Axiom = "axiom"
   185   | string_for_kind Definition = "definition"
   176   | string_for_kind Definition = "definition"
   186   | string_for_kind Lemma = "lemma"
   177   | string_for_kind Lemma = "lemma"
   187   | string_for_kind Hypothesis = "hypothesis"
   178   | string_for_kind Hypothesis = "hypothesis"
   188   | string_for_kind Conjecture = "conjecture"
   179   | string_for_kind Conjecture = "conjecture"