src/HOL/Tools/ATP_Manager/atp_systems.ML
author blanchet
Fri Jun 25 12:07:52 2010 +0200 (2010-06-25)
changeset 37550 fc2f979b9a08
parent 37514 b147d01b8ebc
child 37574 b8c1f4c46983
permissions -rw-r--r--
split SPASS time slot between SOS and non-SOS, in case SOS times out
blanchet@36376
     1
(*  Title:      HOL/Tools/ATP_Manager/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@35867
    10
  type prover = ATP_Manager.prover
boehmes@32864
    11
blanchet@35867
    12
  (* hooks for problem files *)
blanchet@36376
    13
  val dest_dir : string Config.T
blanchet@35867
    14
  val problem_prefix : string Config.T
blanchet@35867
    15
  val measure_runtime : bool Config.T
boehmes@32864
    16
blanchet@35867
    17
  val refresh_systems_on_tptp : unit -> unit
blanchet@36371
    18
  val default_atps_param_value : unit -> string
blanchet@35867
    19
  val setup : theory -> theory
wenzelm@28592
    20
end;
wenzelm@28592
    21
blanchet@36376
    22
structure ATP_Systems : ATP_SYSTEMS =
wenzelm@28592
    23
struct
wenzelm@28596
    24
blanchet@36187
    25
open Sledgehammer_Util
blanchet@35969
    26
open Sledgehammer_Fact_Preprocessor
blanchet@35865
    27
open Sledgehammer_HOL_Clause
blanchet@35865
    28
open Sledgehammer_Fact_Filter
blanchet@35865
    29
open Sledgehammer_Proof_Reconstruct
blanchet@37509
    30
open Sledgehammer_TPTP_Format
blanchet@35867
    31
open ATP_Manager
blanchet@35826
    32
blanchet@36376
    33
(** generic ATP **)
wenzelm@28596
    34
wenzelm@32944
    35
(* external problem files *)
boehmes@32864
    36
blanchet@36376
    37
val (dest_dir, dest_dir_setup) = Attrib.config_string "atp_dest_dir" (K "");
boehmes@32864
    38
  (*Empty string means create files in Isabelle's temporary files directory.*)
boehmes@32864
    39
boehmes@32864
    40
val (problem_prefix, problem_prefix_setup) =
wenzelm@36001
    41
  Attrib.config_string "atp_problem_prefix" (K "prob");
boehmes@32864
    42
boehmes@33247
    43
val (measure_runtime, measure_runtime_setup) =
wenzelm@36001
    44
  Attrib.config_bool "atp_measure_runtime" (K false);
boehmes@33247
    45
boehmes@32864
    46
blanchet@35867
    47
(* prover configuration *)
boehmes@32864
    48
wenzelm@32941
    49
type prover_config =
blanchet@36917
    50
  {home_var: string,
blanchet@36370
    51
   executable: string,
blanchet@37514
    52
   arguments: bool -> Time.time -> string,
blanchet@36370
    53
   proof_delims: (string * string) list,
blanchet@36370
    54
   known_failures: (failure * string) list,
blanchet@36382
    55
   max_axiom_clauses: int,
blanchet@36370
    56
   prefers_theory_relevant: bool};
wenzelm@28596
    57
wenzelm@28596
    58
wenzelm@28596
    59
(* basic template *)
wenzelm@28596
    60
blanchet@36370
    61
val remotify = prefix "remote_"
blanchet@36370
    62
boehmes@32458
    63
fun with_path cleanup after f path =
boehmes@32458
    64
  Exn.capture f path
boehmes@32458
    65
  |> tap (fn _ => cleanup path)
boehmes@32458
    66
  |> Exn.release
blanchet@36369
    67
  |> tap (after path)
blanchet@36369
    68
blanchet@36369
    69
(* Splits by the first possible of a list of delimiters. *)
blanchet@36369
    70
fun extract_proof delims output =
blanchet@36369
    71
  case pairself (find_first (fn s => String.isSubstring s output))
blanchet@36369
    72
                (ListPair.unzip delims) of
blanchet@36369
    73
    (SOME begin_delim, SOME end_delim) =>
blanchet@36549
    74
    (output |> first_field begin_delim |> the |> snd
blanchet@36549
    75
            |> first_field end_delim |> the |> fst
blanchet@36549
    76
            |> first_field "\n" |> the |> snd
blanchet@36549
    77
     handle Option.Option => "")
blanchet@36369
    78
  | _ => ""
boehmes@32458
    79
blanchet@37514
    80
fun extract_proof_and_outcome complete res_code proof_delims known_failures
blanchet@37514
    81
                              output =
blanchet@36370
    82
  case map_filter (fn (failure, pattern) =>
blanchet@36370
    83
                      if String.isSubstring pattern output then SOME failure
blanchet@36370
    84
                      else NONE) known_failures of
blanchet@36369
    85
    [] => (case extract_proof proof_delims output of
blanchet@36370
    86
             "" => ("", SOME UnknownError)
blanchet@36370
    87
           | proof => if res_code = 0 then (proof, NONE)
blanchet@36370
    88
                      else ("", SOME UnknownError))
blanchet@37514
    89
  | (failure :: _) =>
blanchet@37514
    90
    ("", SOME (if failure = IncompleteUnprovable andalso complete then
blanchet@37514
    91
                 Unprovable
blanchet@37514
    92
               else
blanchet@37514
    93
                 failure))
blanchet@36370
    94
blanchet@36370
    95
fun string_for_failure Unprovable = "The ATP problem is unprovable."
blanchet@37413
    96
  | string_for_failure IncompleteUnprovable =
blanchet@37413
    97
    "The ATP cannot prove the problem."
blanchet@36370
    98
  | string_for_failure TimedOut = "Timed out."
blanchet@36370
    99
  | string_for_failure OutOfResources = "The ATP ran out of resources."
blanchet@36370
   100
  | string_for_failure OldSpass =
blanchet@36393
   101
    (* FIXME: Change the error message below to point to the Isabelle download
blanchet@36393
   102
       page once the package is there (around the Isabelle2010 release). *)
blanchet@36370
   103
    "Warning: Sledgehammer requires a more recent version of SPASS with \
blanchet@36370
   104
    \support for the TPTP syntax. To install it, download and untar the \
blanchet@36370
   105
    \package \"http://isabelle.in.tum.de/~blanchet/spass-3.7.tgz\" and add the \
blanchet@36370
   106
    \\"spass-3.7\" directory's full path to \"" ^
blanchet@36370
   107
    Path.implode (Path.expand (Path.appends
blanchet@36370
   108
        (Path.variable "ISABELLE_HOME_USER" ::
blanchet@36370
   109
         map Path.basic ["etc", "components"]))) ^
blanchet@36370
   110
    "\" on a line of its own."
blanchet@36965
   111
  | string_for_failure MalformedInput =
blanchet@36965
   112
    "Internal Sledgehammer error: The ATP problem is malformed. Please report \
blanchet@36965
   113
    \this to the Isabelle developers."
blanchet@36370
   114
  | string_for_failure MalformedOutput = "Error: The ATP output is malformed."
blanchet@36370
   115
  | string_for_failure UnknownError = "Error: An unknown ATP error occurred."
blanchet@35865
   116
blanchet@36400
   117
fun shape_of_clauses _ [] = []
blanchet@36400
   118
  | shape_of_clauses j ([] :: clauses) = [] :: shape_of_clauses j clauses
blanchet@37498
   119
  | shape_of_clauses j ((_ :: lits) :: clauses) =
blanchet@36400
   120
    let val shape = shape_of_clauses (j + 1) (lits :: clauses) in
blanchet@36400
   121
      (j :: hd shape) :: tl shape
blanchet@36400
   122
    end
blanchet@36400
   123
blanchet@37499
   124
(* generic TPTP-based provers *)
blanchet@37499
   125
blanchet@37499
   126
fun generic_tptp_prover
blanchet@37499
   127
        (name, {home_var, executable, arguments, proof_delims, known_failures,
blanchet@37499
   128
                max_axiom_clauses, prefers_theory_relevant})
blanchet@37499
   129
        ({debug, overlord, full_types, explicit_apply, respect_no_atp,
blanchet@37499
   130
          relevance_threshold, relevance_convergence, theory_relevant,
blanchet@37499
   131
          defs_relevant, isar_proof, isar_shrink_factor, ...} : params)
blanchet@37499
   132
        minimize_command timeout
blanchet@35969
   133
        ({subgoal, goal, relevance_override, axiom_clauses, filtered_clauses}
blanchet@35969
   134
         : problem) =
wenzelm@28596
   135
  let
immler@31750
   136
    (* get clauses and prepare them for writing *)
blanchet@37498
   137
    val (ctxt, (_, th)) = goal;
wenzelm@32942
   138
    val thy = ProofContext.theory_of ctxt;
blanchet@36400
   139
    val goal_clss = #1 (neg_conjecture_clauses ctxt th subgoal)
blanchet@36400
   140
    val goal_cls = List.concat goal_clss
immler@31752
   141
    val the_filtered_clauses =
wenzelm@32942
   142
      (case filtered_clauses of
blanchet@37499
   143
        NONE => relevant_facts full_types respect_no_atp relevance_threshold
blanchet@37499
   144
                    relevance_convergence defs_relevant max_axiom_clauses
blanchet@37499
   145
                    (the_default prefers_theory_relevant theory_relevant)
blanchet@37499
   146
                    relevance_override goal goal_cls
wenzelm@32942
   147
      | SOME fcls => fcls);
blanchet@37506
   148
    val the_axiom_clauses = axiom_clauses |> the_default the_filtered_clauses
blanchet@35969
   149
    val (internal_thm_names, clauses) =
blanchet@37499
   150
      prepare_clauses full_types goal_cls the_axiom_clauses the_filtered_clauses
blanchet@37499
   151
                      thy
immler@31750
   152
boehmes@32864
   153
    (* path to unique problem file *)
blanchet@36376
   154
    val the_dest_dir = if overlord then getenv "ISABELLE_HOME_USER"
blanchet@36376
   155
                       else Config.get ctxt dest_dir;
blanchet@36376
   156
    val the_problem_prefix = Config.get ctxt problem_prefix;
boehmes@32864
   157
    fun prob_pathname nr =
blanchet@36143
   158
      let
blanchet@36143
   159
        val probfile =
blanchet@36568
   160
          Path.basic ((if overlord then "prob_" ^ name
blanchet@36568
   161
                       else the_problem_prefix ^ serial_string ())
blanchet@36143
   162
                      ^ "_" ^ string_of_int nr)
wenzelm@32942
   163
      in
blanchet@36376
   164
        if the_dest_dir = "" then File.tmp_path probfile
blanchet@36376
   165
        else if File.exists (Path.explode the_dest_dir)
blanchet@36376
   166
        then Path.append (Path.explode the_dest_dir) probfile
blanchet@36376
   167
        else error ("No such directory: " ^ the_dest_dir ^ ".")
wenzelm@32942
   168
      end;
boehmes@32864
   169
blanchet@36917
   170
    val home = getenv home_var
blanchet@36289
   171
    val command = Path.explode (home ^ "/" ^ executable)
immler@31750
   172
    (* write out problem file and call prover *)
blanchet@37514
   173
    fun command_line complete probfile =
blanchet@37514
   174
      let
blanchet@37514
   175
        val core = File.shell_path command ^ " " ^ arguments complete timeout ^
blanchet@37514
   176
                   " " ^ File.shell_path probfile
blanchet@37514
   177
      in
blanchet@37514
   178
        (if Config.get ctxt measure_runtime then
blanchet@37514
   179
           "TIMEFORMAT='%3U'; { time " ^ core ^ " ; }"
blanchet@37514
   180
         else
blanchet@37514
   181
           "exec " ^ core) ^ " 2>&1" ^
blanchet@37514
   182
        (if overlord then
blanchet@37514
   183
           " | sed 's/,/, /g' \
blanchet@37514
   184
           \| sed 's/\\([^!=<]\\)\\([=|]\\)\\([^=>]\\)/\\1 \\2 \\3/g' \
blanchet@37514
   185
           \| sed 's/  / /g' | sed 's/| |/||/g' \
blanchet@37514
   186
           \| sed 's/ = = =/===/g' \
blanchet@37514
   187
           \| sed 's/= = /== /g'"
blanchet@37514
   188
         else
blanchet@37514
   189
           "")
blanchet@37514
   190
      end
boehmes@32510
   191
    fun split_time s =
boehmes@32510
   192
      let
wenzelm@32942
   193
        val split = String.tokens (fn c => str c = "\n");
blanchet@36369
   194
        val (output, t) = s |> split |> split_last |> apfst cat_lines;
wenzelm@32942
   195
        fun as_num f = f >> (fst o read_int);
wenzelm@32942
   196
        val num = as_num (Scan.many1 Symbol.is_ascii_digit);
wenzelm@32942
   197
        val digit = Scan.one Symbol.is_ascii_digit;
wenzelm@32942
   198
        val num3 = as_num (digit ::: digit ::: (digit >> single));
wenzelm@32942
   199
        val time = num --| Scan.$$ "." -- num3 >> (fn (a, b) => a * 1000 + b);
wenzelm@32942
   200
        val as_time = the_default 0 o Scan.read Symbol.stopper time o explode;
blanchet@36369
   201
      in (output, as_time t) end;
boehmes@32458
   202
    fun run_on probfile =
blanchet@36289
   203
      if File.exists command then
blanchet@37514
   204
        let
blanchet@37514
   205
          fun do_run complete =
blanchet@37514
   206
            let
blanchet@37514
   207
              val command = command_line complete probfile
blanchet@37514
   208
              val ((output, msecs), res_code) =
blanchet@37514
   209
                bash_output command
blanchet@37514
   210
                |>> (if overlord then
blanchet@37514
   211
                       prefix ("% " ^ command ^ "\n% " ^ timestamp () ^ "\n")
blanchet@37514
   212
                     else
blanchet@37514
   213
                       I)
blanchet@37514
   214
                |>> (if Config.get ctxt measure_runtime then split_time
blanchet@37514
   215
                     else rpair 0)
blanchet@37514
   216
              val (proof, outcome) =
blanchet@37514
   217
                extract_proof_and_outcome complete res_code proof_delims
blanchet@37514
   218
                                          known_failures output
blanchet@37514
   219
            in (output, msecs, proof, outcome) end
blanchet@37514
   220
          val (pool, conjecture_offset) =
blanchet@37514
   221
            write_tptp_file (debug andalso overlord) full_types explicit_apply
blanchet@37514
   222
                            probfile clauses
blanchet@37514
   223
          val conjecture_shape = shape_of_clauses (conjecture_offset + 1) goal_clss
blanchet@37514
   224
          val result =
blanchet@37514
   225
            do_run false
blanchet@37550
   226
            |> (fn (_, msecs0, _, SOME _) =>
blanchet@37514
   227
                   do_run true
blanchet@37514
   228
                   |> (fn (output, msecs, proof, outcome) =>
blanchet@37514
   229
                          (output, msecs0 + msecs, proof, outcome))
blanchet@37514
   230
                 | result => result)
blanchet@37514
   231
        in ((pool, conjecture_shape), result) end
blanchet@36917
   232
      else if home = "" then
blanchet@36917
   233
        error ("The environment variable " ^ quote home_var ^ " is not set.")
blanchet@36382
   234
      else
blanchet@36382
   235
        error ("Bad executable: " ^ Path.implode command ^ ".");
wenzelm@28592
   236
blanchet@36167
   237
    (* If the problem file has not been exported, remove it; otherwise, export
blanchet@36167
   238
       the proof file too. *)
blanchet@36376
   239
    fun cleanup probfile =
blanchet@36376
   240
      if the_dest_dir = "" then try File.rm probfile else NONE
blanchet@37514
   241
    fun export probfile (_, (output, _, _, _)) =
blanchet@36376
   242
      if the_dest_dir = "" then
blanchet@36187
   243
        ()
blanchet@36187
   244
      else
blanchet@37514
   245
        File.write (Path.explode (Path.implode probfile ^ "_proof")) output
wenzelm@32257
   246
blanchet@37514
   247
    val ((pool, conjecture_shape), (output, msecs, proof, outcome)) =
blanchet@37514
   248
      with_path cleanup export run_on (prob_pathname subgoal)
blanchet@37514
   249
blanchet@35969
   250
    val (message, relevant_thm_names) =
blanchet@36370
   251
      case outcome of
blanchet@36400
   252
        NONE =>
blanchet@36400
   253
        proof_text isar_proof
blanchet@37480
   254
            (pool, debug, isar_shrink_factor, ctxt, conjecture_shape)
blanchet@37480
   255
            (full_types, minimize_command, proof, internal_thm_names, th,
blanchet@37480
   256
             subgoal)
blanchet@36370
   257
      | SOME failure => (string_for_failure failure ^ "\n", [])
boehmes@32864
   258
  in
blanchet@36393
   259
    {outcome = outcome, message = message, pool = pool,
blanchet@37514
   260
     relevant_thm_names = relevant_thm_names, atp_run_time_in_msecs = msecs,
blanchet@37514
   261
     output = output, proof = proof, internal_thm_names = internal_thm_names,
blanchet@36400
   262
     conjecture_shape = conjecture_shape,
blanchet@35969
   263
     filtered_clauses = the_filtered_clauses}
blanchet@37499
   264
  end
wenzelm@28596
   265
blanchet@35969
   266
fun tptp_prover name p = (name, generic_tptp_prover (name, p));
wenzelm@28596
   267
blanchet@36382
   268
fun to_generous_secs time = (Time.toMilliseconds time + 999) div 1000
blanchet@36142
   269
wenzelm@28596
   270
(* E prover *)
wenzelm@28596
   271
blanchet@36369
   272
val tstp_proof_delims =
blanchet@36369
   273
  ("# SZS output start CNFRefutation.", "# SZS output end CNFRefutation")
blanchet@36369
   274
blanchet@35969
   275
val e_config : prover_config =
blanchet@36917
   276
  {home_var = "E_HOME",
blanchet@36289
   277
   executable = "eproof",
blanchet@37514
   278
   arguments = fn _ => fn timeout =>
blanchet@36382
   279
     "--tstp-in --tstp-out -l5 -xAutoDev -tAutoDev --silent --cpu-limit=" ^
blanchet@36382
   280
     string_of_int (to_generous_secs timeout),
blanchet@36369
   281
   proof_delims = [tstp_proof_delims],
blanchet@36265
   282
   known_failures =
blanchet@36370
   283
     [(Unprovable, "SZS status: Satisfiable"),
blanchet@36370
   284
      (Unprovable, "SZS status Satisfiable"),
blanchet@36370
   285
      (TimedOut, "Failure: Resource limit exceeded (time)"),
blanchet@36370
   286
      (TimedOut, "time limit exceeded"),
blanchet@36370
   287
      (OutOfResources,
blanchet@36370
   288
       "# Cannot determine problem status within resource limit"),
blanchet@36370
   289
      (OutOfResources, "SZS status: ResourceOut"),
blanchet@36370
   290
      (OutOfResources, "SZS status ResourceOut")],
blanchet@36382
   291
   max_axiom_clauses = 100,
blanchet@36289
   292
   prefers_theory_relevant = false}
blanchet@35969
   293
val e = tptp_prover "e" e_config
wenzelm@28596
   294
wenzelm@28596
   295
blanchet@36219
   296
(* The "-VarWeight=3" option helps the higher-order problems, probably by
blanchet@36219
   297
   counteracting the presence of "hAPP". *)
blanchet@37498
   298
val spass_config : prover_config =
blanchet@36917
   299
  {home_var = "SPASS_HOME",
blanchet@36289
   300
   executable = "SPASS",
blanchet@37550
   301
   (* "div 2" accounts for the fact that SPASS is often run twice. *)
blanchet@37514
   302
   arguments = fn complete => fn timeout =>
blanchet@37514
   303
     ("-TPTP -Auto -PGiven=0 -PProblem=0 -Splits=0 -FullRed=0 -DocProof \
blanchet@37550
   304
      \-VarWeight=3 -TimeLimit=" ^
blanchet@37550
   305
      string_of_int (to_generous_secs timeout div 2))
blanchet@37514
   306
     |> not complete ? prefix "-SOS=1 ",
blanchet@36369
   307
   proof_delims = [("Here is a proof", "Formulae used in the proof")],
blanchet@36289
   308
   known_failures =
blanchet@37413
   309
     [(IncompleteUnprovable, "SPASS beiseite: Completion found"),
blanchet@36370
   310
      (TimedOut, "SPASS beiseite: Ran out of time"),
blanchet@36965
   311
      (OutOfResources, "SPASS beiseite: Maximal number of loops exceeded"),
blanchet@37413
   312
      (MalformedInput, "Undefined symbol"),
blanchet@37414
   313
      (MalformedInput, "Free Variable"),
blanchet@37414
   314
      (OldSpass, "unrecognized option `-TPTP'"),
blanchet@37414
   315
      (OldSpass, "Unrecognized option TPTP")],
blanchet@36382
   316
   max_axiom_clauses = 40,
blanchet@36289
   317
   prefers_theory_relevant = true}
blanchet@37414
   318
val spass = tptp_prover "spass" spass_config
wenzelm@28596
   319
blanchet@37509
   320
(* Vampire *)
blanchet@37509
   321
blanchet@37509
   322
val vampire_config : prover_config =
blanchet@37509
   323
  {home_var = "VAMPIRE_HOME",
blanchet@37509
   324
   executable = "vampire",
blanchet@37514
   325
   arguments = fn _ => fn timeout =>
blanchet@37509
   326
     "--output_syntax tptp --mode casc -t " ^
blanchet@37509
   327
     string_of_int (to_generous_secs timeout),
blanchet@37509
   328
   proof_delims =
blanchet@37509
   329
     [("=========== Refutation ==========",
blanchet@37509
   330
       "======= End of refutation ======="),
blanchet@37509
   331
      ("% SZS output start Refutation", "% SZS output end Refutation")],
blanchet@37509
   332
   known_failures =
blanchet@37509
   333
     [(Unprovable, "UNPROVABLE"),
blanchet@37509
   334
      (IncompleteUnprovable, "CANNOT PROVE"),
blanchet@37509
   335
      (Unprovable, "Satisfiability detected"),
blanchet@37509
   336
      (OutOfResources, "Refutation not found")],
blanchet@37509
   337
   max_axiom_clauses = 60,
blanchet@37509
   338
   prefers_theory_relevant = false}
blanchet@37509
   339
val vampire = tptp_prover "vampire" vampire_config
blanchet@37509
   340
blanchet@37509
   341
(* Remote prover invocation via SystemOnTPTP *)
wenzelm@28596
   342
blanchet@36376
   343
val systems = Synchronized.var "atp_systems" ([]: string list);
immler@31835
   344
immler@31835
   345
fun get_systems () =
blanchet@36370
   346
  case bash_output "\"$ISABELLE_ATP_MANAGER/SystemOnTPTP\" -w" of
blanchet@36370
   347
    (answer, 0) => split_lines answer
blanchet@36370
   348
  | (answer, _) =>
blanchet@36370
   349
    error ("Failed to get available systems at SystemOnTPTP:\n" ^ answer)
immler@31835
   350
blanchet@35867
   351
fun refresh_systems_on_tptp () =
blanchet@37509
   352
  Synchronized.change systems (fn _ => get_systems ())
immler@31835
   353
immler@31835
   354
fun get_system prefix = Synchronized.change_result systems (fn systems =>
boehmes@32864
   355
  (if null systems then get_systems () else systems)
wenzelm@32942
   356
  |> `(find_first (String.isPrefix prefix)));
boehmes@32864
   357
wenzelm@32948
   358
fun the_system prefix =
boehmes@32864
   359
  (case get_system prefix of
blanchet@37509
   360
    NONE => error ("System " ^ quote prefix ^ " not available at SystemOnTPTP.")
wenzelm@32942
   361
  | SOME sys => sys);
immler@31835
   362
blanchet@36265
   363
val remote_known_failures =
blanchet@36370
   364
  [(TimedOut, "says Timeout"),
blanchet@36377
   365
   (MalformedOutput, "Remote script could not extract proof")]
blanchet@35865
   366
blanchet@37509
   367
fun remote_config atp_prefix args
blanchet@36382
   368
        ({proof_delims, known_failures, max_axiom_clauses,
blanchet@36369
   369
          prefers_theory_relevant, ...} : prover_config) : prover_config =
blanchet@36917
   370
  {home_var = "ISABELLE_ATP_MANAGER",
blanchet@36289
   371
   executable = "SystemOnTPTP",
blanchet@37514
   372
   arguments = fn _ => fn timeout =>
blanchet@36382
   373
     args ^ " -t " ^ string_of_int (to_generous_secs timeout) ^ " -s " ^
blanchet@36382
   374
     the_system atp_prefix,
blanchet@36369
   375
   proof_delims = insert (op =) tstp_proof_delims proof_delims,
blanchet@36265
   376
   known_failures = remote_known_failures @ known_failures,
blanchet@36382
   377
   max_axiom_clauses = max_axiom_clauses,
blanchet@36289
   378
   prefers_theory_relevant = prefers_theory_relevant}
wenzelm@28596
   379
blanchet@37509
   380
fun remote_tptp_prover prover atp_prefix args config =
blanchet@37509
   381
  tptp_prover (remotify (fst prover)) (remote_config atp_prefix args config)
boehmes@32864
   382
blanchet@37509
   383
val remote_e = remote_tptp_prover e "EP---" "" e_config
blanchet@37509
   384
val remote_spass = remote_tptp_prover spass "SPASS---" "-x" spass_config
blanchet@37509
   385
val remote_vampire = remote_tptp_prover vampire "Vampire---9" "" vampire_config
wenzelm@28592
   386
blanchet@36917
   387
fun maybe_remote (name, _) ({home_var, ...} : prover_config) =
blanchet@36917
   388
  name |> getenv home_var = "" ? remotify
blanchet@36371
   389
blanchet@36371
   390
fun default_atps_param_value () =
blanchet@36371
   391
  space_implode " " [maybe_remote e e_config, maybe_remote spass spass_config,
blanchet@36371
   392
                     remotify (fst vampire)]
blanchet@36371
   393
blanchet@37509
   394
val provers = [e, spass, vampire, remote_e, remote_spass, remote_vampire]
blanchet@35867
   395
val prover_setup = fold add_prover provers
blanchet@35867
   396
blanchet@35867
   397
val setup =
blanchet@36376
   398
  dest_dir_setup
blanchet@35867
   399
  #> problem_prefix_setup
blanchet@35867
   400
  #> measure_runtime_setup
blanchet@36371
   401
  #> prover_setup
blanchet@35867
   402
wenzelm@28592
   403
end;