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