src/HOL/Tools/ATP/atp_systems.ML
author blanchet
Sun May 01 18:37:25 2011 +0200 (2011-05-01)
changeset 42577 78414ec6fa4e
parent 42571 67e2f2df68d5
child 42578 1eaf4d437d4c
permissions -rw-r--r--
made the format (TFF or FOF) of the TPTP problem a global argument of the problem again and have the ATPs report which formats they support
blanchet@38047
     1
(*  Title:      HOL/Tools/ATP/atp_systems.ML
wenzelm@28592
     2
    Author:     Fabian Immler, TU Muenchen
blanchet@36371
     3
    Author:     Jasmin Blanchette, TU Muenchen
wenzelm@28592
     4
blanchet@36376
     5
Setup for supported ATPs.
wenzelm@28592
     6
*)
wenzelm@28592
     7
blanchet@36376
     8
signature ATP_SYSTEMS =
wenzelm@28592
     9
sig
blanchet@42577
    10
  type format = ATP_Problem.format
blanchet@42577
    11
  type formula_kind = ATP_Problem.formula_kind
blanchet@39491
    12
  type failure = ATP_Proof.failure
blanchet@38023
    13
blanchet@40059
    14
  type atp_config =
blanchet@38092
    15
    {exec: string * string,
blanchet@38092
    16
     required_execs: (string * string) list,
blanchet@42443
    17
     arguments: int -> Time.time -> (unit -> (string * real) list) -> string,
blanchet@42443
    18
     slices: unit -> (real * (bool * int)) list,
blanchet@38023
    19
     proof_delims: (string * string) list,
blanchet@38023
    20
     known_failures: (failure * string) list,
blanchet@42577
    21
     hypothesis_kind: formula_kind,
blanchet@42577
    22
     formats: format list}
blanchet@38023
    23
blanchet@42443
    24
  datatype e_weight_method =
blanchet@42443
    25
    E_Slices | E_Auto | E_Fun_Weight | E_Sym_Offset_Weight
blanchet@41725
    26
blanchet@41313
    27
  (* for experimentation purposes -- do not use in production code *)
blanchet@41725
    28
  val e_weight_method : e_weight_method Unsynchronized.ref
blanchet@41725
    29
  val e_default_fun_weight : real Unsynchronized.ref
blanchet@41725
    30
  val e_fun_weight_base : real Unsynchronized.ref
blanchet@41770
    31
  val e_fun_weight_span : real Unsynchronized.ref
blanchet@41725
    32
  val e_default_sym_offs_weight : real Unsynchronized.ref
blanchet@41725
    33
  val e_sym_offs_weight_base : real Unsynchronized.ref
blanchet@41770
    34
  val e_sym_offs_weight_span : real Unsynchronized.ref
blanchet@41313
    35
blanchet@40059
    36
  val eN : string
blanchet@40059
    37
  val spassN : string
blanchet@40059
    38
  val vampireN : string
blanchet@42535
    39
  val tofof_eN : string
blanchet@40059
    40
  val sine_eN : string
blanchet@40059
    41
  val snarkN : string
blanchet@41738
    42
  val z3_atpN : string
blanchet@40060
    43
  val remote_prefix : string
blanchet@41738
    44
  val remote_atp :
blanchet@41738
    45
    string -> string -> string list -> (string * string) list
blanchet@42577
    46
    -> (failure * string) list -> (unit -> int) -> formula_kind -> format list
blanchet@42577
    47
    -> string * atp_config
blanchet@40059
    48
  val add_atp : string * atp_config -> theory -> theory
blanchet@40059
    49
  val get_atp : theory -> string -> atp_config
blanchet@41727
    50
  val supported_atps : theory -> string list
blanchet@40059
    51
  val is_atp_installed : theory -> string -> bool
blanchet@35867
    52
  val refresh_systems_on_tptp : unit -> unit
blanchet@35867
    53
  val setup : theory -> theory
wenzelm@28592
    54
end;
wenzelm@28592
    55
blanchet@36376
    56
structure ATP_Systems : ATP_SYSTEMS =
wenzelm@28592
    57
struct
wenzelm@28596
    58
blanchet@42577
    59
open ATP_Problem
blanchet@39491
    60
open ATP_Proof
boehmes@32864
    61
blanchet@40059
    62
(* ATP configuration *)
boehmes@32864
    63
blanchet@40059
    64
type atp_config =
blanchet@38092
    65
  {exec: string * string,
blanchet@38092
    66
   required_execs: (string * string) list,
blanchet@42443
    67
   arguments: int -> Time.time -> (unit -> (string * real) list) -> string,
blanchet@42443
    68
   slices: unit -> (real * (bool * int)) list,
blanchet@36370
    69
   proof_delims: (string * string) list,
blanchet@36370
    70
   known_failures: (failure * string) list,
blanchet@42577
    71
   hypothesis_kind: formula_kind,
blanchet@42577
    72
   formats: format list}
wenzelm@28596
    73
blanchet@38061
    74
val known_perl_failures =
blanchet@38094
    75
  [(CantConnect, "HTTP error"),
blanchet@38094
    76
   (NoPerl, "env: perl"),
blanchet@38065
    77
   (NoLibwwwPerl, "Can't locate HTTP")]
wenzelm@28596
    78
blanchet@40059
    79
(* named ATPs *)
blanchet@40059
    80
blanchet@40059
    81
val eN = "e"
blanchet@40059
    82
val spassN = "spass"
blanchet@40059
    83
val vampireN = "vampire"
blanchet@41740
    84
val z3_atpN = "z3_atp"
blanchet@42535
    85
val tofof_eN = "tofof_e"
blanchet@40059
    86
val sine_eN = "sine_e"
blanchet@40059
    87
val snarkN = "snark"
blanchet@40060
    88
val remote_prefix = "remote_"
blanchet@38001
    89
blanchet@38023
    90
structure Data = Theory_Data
blanchet@38023
    91
(
blanchet@40059
    92
  type T = (atp_config * stamp) Symtab.table
blanchet@38023
    93
  val empty = Symtab.empty
blanchet@38023
    94
  val extend = I
blanchet@38023
    95
  fun merge data : T = Symtab.merge (eq_snd op =) data
blanchet@38023
    96
    handle Symtab.DUP name => error ("Duplicate ATP: " ^ quote name ^ ".")
blanchet@38023
    97
)
blanchet@38017
    98
blanchet@38737
    99
fun to_secs bonus time = (Time.toMilliseconds time + bonus + 999) div 1000
blanchet@36142
   100
blanchet@39491
   101
blanchet@40059
   102
(* E *)
wenzelm@28596
   103
blanchet@40344
   104
(* Give E an extra second to reconstruct the proof. Older versions even get two
blanchet@40344
   105
   seconds, because the "eproof" script wrongly subtracted an entire second to
blanchet@40344
   106
   account for the overhead of the script itself, which is in fact much
blanchet@40344
   107
   lower. *)
blanchet@38737
   108
fun e_bonus () =
blanchet@41334
   109
  if string_ord (getenv "E_VERSION", "1.1") = LESS then 2000 else 1000
blanchet@38737
   110
blanchet@36369
   111
val tstp_proof_delims =
blanchet@36369
   112
  ("# SZS output start CNFRefutation.", "# SZS output end CNFRefutation")
blanchet@36369
   113
blanchet@42443
   114
datatype e_weight_method =
blanchet@42443
   115
  E_Slices | E_Auto | E_Fun_Weight | E_Sym_Offset_Weight
blanchet@41725
   116
blanchet@42443
   117
val e_weight_method = Unsynchronized.ref E_Slices
blanchet@41770
   118
(* FUDGE *)
blanchet@41770
   119
val e_default_fun_weight = Unsynchronized.ref 20.0
blanchet@41725
   120
val e_fun_weight_base = Unsynchronized.ref 0.0
blanchet@41770
   121
val e_fun_weight_span = Unsynchronized.ref 40.0
blanchet@41770
   122
val e_default_sym_offs_weight = Unsynchronized.ref 1.0
blanchet@41770
   123
val e_sym_offs_weight_base = Unsynchronized.ref ~20.0
blanchet@41770
   124
val e_sym_offs_weight_span = Unsynchronized.ref 60.0
blanchet@41725
   125
blanchet@42443
   126
fun e_weight_method_case method fw sow =
blanchet@42443
   127
  case method of
blanchet@41725
   128
    E_Auto => raise Fail "Unexpected \"E_Auto\""
blanchet@41725
   129
  | E_Fun_Weight => fw
blanchet@41725
   130
  | E_Sym_Offset_Weight => sow
blanchet@41725
   131
blanchet@42443
   132
fun scaled_e_weight method w =
blanchet@42443
   133
  w * e_weight_method_case method (!e_fun_weight_span) (!e_sym_offs_weight_span)
blanchet@42443
   134
  + e_weight_method_case method (!e_fun_weight_base) (!e_sym_offs_weight_base)
blanchet@41725
   135
  |> Real.ceil |> signed_string_of_int
blanchet@41313
   136
blanchet@42443
   137
fun e_weight_arguments method weights =
blanchet@42443
   138
  if method = E_Auto then
blanchet@41725
   139
    "-xAutoDev"
blanchet@41725
   140
  else
blanchet@41314
   141
    "--split-clauses=4 --split-reuse-defs --simul-paramod --forward-context-sr \
blanchet@41314
   142
    \--destructive-er-aggressive --destructive-er --presat-simplify \
blanchet@41314
   143
    \--prefer-initial-clauses -tKBO6 -winvfreqrank -c1 -Ginvfreqconjmax -F1 \
blanchet@41314
   144
    \--delete-bad-limit=150000000 -WSelectMaxLComplexAvoidPosPred \
blanchet@42443
   145
    \-H'(4*" ^ e_weight_method_case method "FunWeight" "SymOffsetWeight" ^
blanchet@41725
   146
    "(SimulateSOS, " ^
blanchet@42443
   147
    (e_weight_method_case method (!e_default_fun_weight)
blanchet@42443
   148
                                 (!e_default_sym_offs_weight)
blanchet@41769
   149
     |> Real.ceil |> signed_string_of_int) ^
blanchet@41314
   150
    ",20,1.5,1.5,1" ^
blanchet@42443
   151
    (weights () |> map (fn (s, w) => "," ^ s ^ ":" ^ scaled_e_weight method w)
blanchet@41725
   152
                |> implode) ^
blanchet@41314
   153
    "),3*ConjectureGeneralSymbolWeight(PreferNonGoals,200,100,200,50,50,1,100,\
blanchet@41314
   154
    \1.5,1.5,1),1*Clauseweight(PreferProcessed,1,1,1),1*\
blanchet@41314
   155
    \FIFOWeight(PreferProcessed))'"
blanchet@41313
   156
blanchet@42443
   157
fun is_old_e_version () = (string_ord (getenv "E_VERSION", "1.2w") = LESS)
blanchet@42443
   158
blanchet@42443
   159
fun effective_e_weight_method () =
blanchet@42443
   160
  if is_old_e_version () then E_Auto else !e_weight_method
blanchet@42443
   161
blanchet@42443
   162
(* The order here must correspond to the order in "e_config" below. *)
blanchet@42443
   163
fun method_for_slice slice =
blanchet@42443
   164
  case effective_e_weight_method () of
blanchet@42443
   165
    E_Slices => (case slice of
blanchet@42443
   166
                   0 => E_Sym_Offset_Weight
blanchet@42443
   167
                 | 1 => E_Auto
blanchet@42443
   168
                 | 2 => E_Fun_Weight
blanchet@42443
   169
                 | _ => raise Fail "no such slice")
blanchet@42443
   170
  | method => method
blanchet@42443
   171
blanchet@40059
   172
val e_config : atp_config =
blanchet@38092
   173
  {exec = ("E_HOME", "eproof"),
blanchet@38092
   174
   required_execs = [],
blanchet@42443
   175
   arguments = fn slice => fn timeout => fn weights =>
blanchet@42443
   176
     "--tstp-in --tstp-out -l5 " ^
blanchet@42443
   177
     e_weight_arguments (method_for_slice slice) weights ^
blanchet@42443
   178
     " -tAutoDev --silent --cpu-limit=" ^
blanchet@42443
   179
     string_of_int (to_secs (e_bonus ()) timeout),
blanchet@42443
   180
   slices = fn () =>
blanchet@42443
   181
     if effective_e_weight_method () = E_Slices then
blanchet@42443
   182
       [(0.33333, (true, 100 (* FUDGE *))) (* E_Sym_Offset_Weight *),
blanchet@42443
   183
        (0.33333, (true, 1000 (* FUDGE *))) (* E_Auto *),
blanchet@42443
   184
        (0.33334, (true, 200 (* FUDGE *))) (* E_Fun_Weight *)]
blanchet@42443
   185
     else
blanchet@42443
   186
       [(1.0, (true, 250 (* FUDGE *)))],
blanchet@36369
   187
   proof_delims = [tstp_proof_delims],
blanchet@36265
   188
   known_failures =
blanchet@37995
   189
     [(Unprovable, "SZS status: CounterSatisfiable"),
blanchet@37995
   190
      (Unprovable, "SZS status CounterSatisfiable"),
blanchet@36370
   191
      (TimedOut, "Failure: Resource limit exceeded (time)"),
blanchet@36370
   192
      (TimedOut, "time limit exceeded"),
blanchet@36370
   193
      (OutOfResources,
blanchet@36370
   194
       "# Cannot determine problem status within resource limit"),
blanchet@36370
   195
      (OutOfResources, "SZS status: ResourceOut"),
blanchet@36370
   196
      (OutOfResources, "SZS status ResourceOut")],
blanchet@42577
   197
   hypothesis_kind = Conjecture,
blanchet@42577
   198
   formats = [Fof]}
blanchet@38454
   199
blanchet@40059
   200
val e = (eN, e_config)
wenzelm@28596
   201
wenzelm@28596
   202
blanchet@39491
   203
(* SPASS *)
blanchet@39491
   204
blanchet@36219
   205
(* The "-VarWeight=3" option helps the higher-order problems, probably by
blanchet@36219
   206
   counteracting the presence of "hAPP". *)
blanchet@40059
   207
val spass_config : atp_config =
blanchet@38092
   208
  {exec = ("ISABELLE_ATP", "scripts/spass"),
blanchet@39002
   209
   required_execs = [("SPASS_HOME", "SPASS"), ("SPASS_HOME", "tptp2dfg")],
blanchet@42443
   210
   arguments = fn slice => fn timeout => fn _ =>
blanchet@37962
   211
     ("-Auto -PGiven=0 -PProblem=0 -Splits=0 -FullRed=0 -DocProof \
blanchet@38737
   212
      \-VarWeight=3 -TimeLimit=" ^ string_of_int (to_secs 0 timeout))
blanchet@42443
   213
     |> slice = 0 ? prefix "-SOS=1 ",
blanchet@42443
   214
   slices = K [(0.66667, (false, 150 (* FUDGE *))) (* with SOS *),
blanchet@42443
   215
               (0.33333, (true, 150 (* FUDGE *))) (* without SOS *)],
blanchet@36369
   216
   proof_delims = [("Here is a proof", "Formulae used in the proof")],
blanchet@36289
   217
   known_failures =
blanchet@38061
   218
     known_perl_failures @
blanchet@37413
   219
     [(IncompleteUnprovable, "SPASS beiseite: Completion found"),
blanchet@36370
   220
      (TimedOut, "SPASS beiseite: Ran out of time"),
blanchet@36965
   221
      (OutOfResources, "SPASS beiseite: Maximal number of loops exceeded"),
blanchet@37413
   222
      (MalformedInput, "Undefined symbol"),
blanchet@37414
   223
      (MalformedInput, "Free Variable"),
blanchet@39263
   224
      (SpassTooOld, "tptp2dfg"),
blanchet@39263
   225
      (InternalError, "Please report this error")],
blanchet@42577
   226
   hypothesis_kind = Conjecture,
blanchet@42577
   227
   formats = [Fof]}
blanchet@38454
   228
blanchet@40059
   229
val spass = (spassN, spass_config)
wenzelm@28596
   230
blanchet@38454
   231
blanchet@37509
   232
(* Vampire *)
blanchet@37509
   233
blanchet@40059
   234
val vampire_config : atp_config =
blanchet@38092
   235
  {exec = ("VAMPIRE_HOME", "vampire"),
blanchet@38092
   236
   required_execs = [],
blanchet@42443
   237
   arguments = fn slice => fn timeout => fn _ =>
blanchet@41203
   238
     (* This would work too but it's less tested: "--proof tptp " ^ *)
blanchet@41203
   239
     "--mode casc -t " ^ string_of_int (to_secs 0 timeout) ^
blanchet@41203
   240
     " --thanks \"Andrei and Krystof\" --input_file"
blanchet@42443
   241
     |> slice = 0 ? prefix "--sos on ",
blanchet@42443
   242
   slices = K [(0.66667, (false, 450 (* FUDGE *))) (* with SOS *),
blanchet@42443
   243
               (0.33333, (true, 450 (* FUDGE *))) (* without SOS *)],
blanchet@37509
   244
   proof_delims =
blanchet@37509
   245
     [("=========== Refutation ==========",
blanchet@37509
   246
       "======= End of refutation ======="),
blanchet@38033
   247
      ("% SZS output start Refutation", "% SZS output end Refutation"),
blanchet@38033
   248
      ("% SZS output start Proof", "% SZS output end Proof")],
blanchet@37509
   249
   known_failures =
blanchet@37509
   250
     [(Unprovable, "UNPROVABLE"),
blanchet@37509
   251
      (IncompleteUnprovable, "CANNOT PROVE"),
blanchet@42449
   252
      (IncompleteUnprovable, "SZS status GaveUp"),
blanchet@42332
   253
      (ProofMissing, "[predicate definition introduction]"),
blanchet@42332
   254
      (ProofMissing, "predicate_definition_introduction,[]"), (* TSTP *)
blanchet@38092
   255
      (TimedOut, "SZS status Timeout"),
blanchet@37509
   256
      (Unprovable, "Satisfiability detected"),
blanchet@38647
   257
      (Unprovable, "Termination reason: Satisfiable"),
blanchet@39263
   258
      (VampireTooOld, "not a valid option"),
blanchet@39263
   259
      (Interrupted, "Aborted by signal SIGINT")],
blanchet@42577
   260
   hypothesis_kind = Conjecture,
blanchet@42577
   261
   formats = [Fof]}
blanchet@38454
   262
blanchet@40059
   263
val vampire = (vampireN, vampire_config)
blanchet@37509
   264
blanchet@38454
   265
blanchet@41740
   266
(* Z3 with TPTP syntax *)
blanchet@41740
   267
blanchet@41740
   268
val z3_atp_config : atp_config =
blanchet@41740
   269
  {exec = ("Z3_HOME", "z3"),
blanchet@41740
   270
   required_execs = [],
blanchet@41740
   271
   arguments = fn _ => fn timeout => fn _ =>
blanchet@41766
   272
     "MBQI=true -p -t:" ^ string_of_int (to_secs 0 timeout),
blanchet@42443
   273
   slices = K [(1.0, (false, 250 (* FUDGE *)))],
blanchet@41740
   274
   proof_delims = [],
blanchet@41740
   275
   known_failures =
blanchet@41742
   276
     [(Unprovable, "\nsat"),
blanchet@41742
   277
      (IncompleteUnprovable, "\nunknown"),
blanchet@42443
   278
      (IncompleteUnprovable, "SZS status Satisfiable"),
blanchet@42443
   279
      (ProofMissing, "\nunsat"),
blanchet@42443
   280
      (ProofMissing, "SZS status Unsatisfiable")],
blanchet@42577
   281
   hypothesis_kind = Hypothesis,
blanchet@42577
   282
   formats = [Fof]}
blanchet@41740
   283
blanchet@41740
   284
val z3_atp = (z3_atpN, z3_atp_config)
blanchet@41740
   285
blanchet@41740
   286
blanchet@40059
   287
(* Remote ATP invocation via SystemOnTPTP *)
wenzelm@28596
   288
blanchet@38061
   289
val systems = Synchronized.var "atp_systems" ([] : string list)
immler@31835
   290
immler@31835
   291
fun get_systems () =
blanchet@38061
   292
  case bash_output "\"$ISABELLE_ATP/scripts/remote_atp\" -w 2>&1" of
blanchet@39491
   293
    (output, 0) => split_lines output
blanchet@39491
   294
  | (output, _) =>
blanchet@39491
   295
    error (case extract_known_failure known_perl_failures output of
blanchet@41744
   296
             SOME failure => string_for_failure failure
blanchet@39491
   297
           | NONE => perhaps (try (unsuffix "\n")) output ^ ".")
immler@31835
   298
blanchet@42537
   299
fun find_system name [] systems =
blanchet@42537
   300
    find_first (String.isPrefix (name ^ "---")) systems
blanchet@38690
   301
  | find_system name (version :: versions) systems =
blanchet@38690
   302
    case find_first (String.isPrefix (name ^ "---" ^ version)) systems of
blanchet@38690
   303
      NONE => find_system name versions systems
blanchet@38690
   304
    | res => res
blanchet@38690
   305
blanchet@38690
   306
fun get_system name versions =
blanchet@38589
   307
  Synchronized.change_result systems
blanchet@38589
   308
      (fn systems => (if null systems then get_systems () else systems)
blanchet@38690
   309
                     |> `(find_system name versions))
boehmes@32864
   310
blanchet@38690
   311
fun the_system name versions =
blanchet@38690
   312
  case get_system name versions of
blanchet@39010
   313
    SOME sys => sys
blanchet@41269
   314
  | NONE => error ("System " ^ quote name ^
blanchet@41269
   315
                   " is not available at SystemOnTPTP.")
immler@31835
   316
blanchet@41148
   317
val max_remote_secs = 240 (* give Geoff Sutcliffe's servers a break *)
blanchet@41148
   318
blanchet@38690
   319
fun remote_config system_name system_versions proof_delims known_failures
blanchet@42577
   320
                  default_max_relevant hypothesis_kind formats : atp_config =
blanchet@38092
   321
  {exec = ("ISABELLE_ATP", "scripts/remote_atp"),
blanchet@38092
   322
   required_execs = [],
blanchet@41313
   323
   arguments = fn _ => fn timeout => fn _ =>
blanchet@41148
   324
     " -t " ^ string_of_int (Int.min (max_remote_secs, (to_secs 0 timeout)))
blanchet@41148
   325
     ^ " -s " ^ the_system system_name system_versions,
blanchet@42443
   326
   slices = fn () => [(1.0, (false, default_max_relevant ()))],
blanchet@36369
   327
   proof_delims = insert (op =) tstp_proof_delims proof_delims,
blanchet@38061
   328
   known_failures =
blanchet@38061
   329
     known_failures @ known_perl_failures @
blanchet@42571
   330
     [(IncompleteUnprovable, "says Unknown"),
blanchet@42571
   331
      (TimedOut, "says Timeout")],
blanchet@42577
   332
   hypothesis_kind = hypothesis_kind,
blanchet@42577
   333
   formats = formats}
wenzelm@28596
   334
blanchet@42443
   335
fun int_average f xs = fold (Integer.add o f) xs 0 div length xs
blanchet@42443
   336
blanchet@38690
   337
fun remotify_config system_name system_versions
blanchet@42577
   338
                    ({proof_delims, slices, known_failures, hypothesis_kind,
blanchet@42577
   339
                      formats, ...} : atp_config) : atp_config =
blanchet@38690
   340
  remote_config system_name system_versions proof_delims known_failures
blanchet@42577
   341
                (int_average (snd o snd) o slices) hypothesis_kind formats
blanchet@38023
   342
blanchet@40059
   343
fun remote_atp name system_name system_versions proof_delims known_failures
blanchet@42577
   344
               default_max_relevant hypothesis_kind formats =
blanchet@40060
   345
  (remote_prefix ^ name,
blanchet@38690
   346
   remote_config system_name system_versions proof_delims known_failures
blanchet@42577
   347
                 default_max_relevant hypothesis_kind formats)
blanchet@40059
   348
fun remotify_atp (name, config) system_name system_versions =
blanchet@40060
   349
  (remote_prefix ^ name, remotify_config system_name system_versions config)
wenzelm@28592
   350
blanchet@40059
   351
val remote_e = remotify_atp e "EP" ["1.0", "1.1", "1.2"]
blanchet@40059
   352
val remote_vampire = remotify_atp vampire "Vampire" ["0.6", "9.0", "1.0"]
blanchet@42537
   353
val remote_z3_atp = remotify_atp z3_atp "Z3" ["2.18"]
blanchet@42535
   354
val remote_tofof_e =
blanchet@42559
   355
  remote_atp tofof_eN "ToFoF" ["0.1"] [] (#known_failures e_config)
blanchet@42577
   356
             (K 200 (* FUDGE *)) Conjecture [Tff]
blanchet@41740
   357
val remote_sine_e =
blanchet@42577
   358
  remote_atp sine_eN "SInE" ["0.4"] [] [] (K 500 (* FUDGE *)) Conjecture [Fof]
blanchet@41740
   359
val remote_snark =
blanchet@42537
   360
  remote_atp snarkN "SNARK" ["20080805r024"]
blanchet@42577
   361
             [("refutation.", "end_refutation.")] [] (K 250 (* FUDGE *))
blanchet@42577
   362
             Conjecture [Tff, Fof]
blanchet@38454
   363
blanchet@38454
   364
(* Setup *)
blanchet@38454
   365
blanchet@40059
   366
fun add_atp (name, config) thy =
blanchet@40059
   367
  Data.map (Symtab.update_new (name, (config, stamp ()))) thy
blanchet@40059
   368
  handle Symtab.DUP name => error ("Duplicate ATP: " ^ quote name ^ ".")
blanchet@40059
   369
blanchet@40059
   370
fun get_atp thy name =
blanchet@40059
   371
  the (Symtab.lookup (Data.get thy) name) |> fst
blanchet@40059
   372
  handle Option.Option => error ("Unknown ATP: " ^ name ^ ".")
blanchet@40059
   373
blanchet@41727
   374
val supported_atps = Symtab.keys o Data.get
blanchet@36371
   375
blanchet@40059
   376
fun is_atp_installed thy name =
blanchet@40059
   377
  let val {exec, required_execs, ...} = get_atp thy name in
blanchet@40059
   378
    forall (curry (op <>) "" o getenv o fst) (exec :: required_execs)
blanchet@40059
   379
  end
blanchet@36371
   380
blanchet@40059
   381
fun refresh_systems_on_tptp () =
blanchet@40059
   382
  Synchronized.change systems (fn _ => get_systems ())
blanchet@40059
   383
blanchet@41740
   384
val atps = [e, spass, vampire, z3_atp, remote_e, remote_vampire, remote_z3_atp,
blanchet@42535
   385
            remote_tofof_e, remote_sine_e, remote_snark]
blanchet@40059
   386
val setup = fold add_atp atps
blanchet@35867
   387
wenzelm@28592
   388
end;