src/HOL/Tools/ATP/atp_systems.ML
author blanchet
Mon Aug 06 22:12:17 2012 +0200 (2012-08-06)
changeset 48700 d06138bfeb45
parent 48653 6ac7fd9b3a54
child 48715 62928b793d8a
permissions -rw-r--r--
added iProver(-Eq) local
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@47038
    10
  type term_order = ATP_Problem.term_order
blanchet@45301
    11
  type atp_format = ATP_Problem.atp_format
blanchet@47976
    12
  type formula_role = ATP_Problem.formula_role
blanchet@39491
    13
  type failure = ATP_Proof.failure
blanchet@38023
    14
blanchet@46409
    15
  type slice_spec = int * atp_format * string * string * bool
blanchet@40059
    16
  type atp_config =
blanchet@48376
    17
    {exec : string list * string list,
blanchet@42646
    18
     arguments :
blanchet@43473
    19
       Proof.context -> bool -> string -> Time.time
blanchet@47038
    20
       -> term_order * (unit -> (string * int) list)
blanchet@47038
    21
          * (unit -> (string * real) list) -> string,
blanchet@42578
    22
     proof_delims : (string * string) list,
blanchet@42578
    23
     known_failures : (failure * string) list,
blanchet@47976
    24
     prem_role : formula_role,
blanchet@43473
    25
     best_slices :
blanchet@47962
    26
       Proof.context -> (real * (bool * (slice_spec * string))) list,
blanchet@47962
    27
     best_max_mono_iters : int,
blanchet@47962
    28
     best_max_new_mono_instances : int}
blanchet@38023
    29
blanchet@47962
    30
  val default_max_mono_iters : int
blanchet@47962
    31
  val default_max_new_mono_instances : int
blanchet@44099
    32
  val force_sos : bool Config.T
blanchet@47032
    33
  val term_order : string Config.T
blanchet@43566
    34
  val e_smartN : string
blanchet@43566
    35
  val e_autoN : string
blanchet@43566
    36
  val e_fun_weightN : string
blanchet@43566
    37
  val e_sym_offset_weightN : string
blanchet@47032
    38
  val e_selection_heuristic : string Config.T
blanchet@42646
    39
  val e_default_fun_weight : real Config.T
blanchet@42646
    40
  val e_fun_weight_base : real Config.T
blanchet@42646
    41
  val e_fun_weight_span : real Config.T
blanchet@42646
    42
  val e_default_sym_offs_weight : real Config.T
blanchet@42646
    43
  val e_sym_offs_weight_base : real Config.T
blanchet@42646
    44
  val e_sym_offs_weight_span : real Config.T
blanchet@46643
    45
  val alt_ergoN : string
blanchet@46643
    46
  val dummy_thfN : string
blanchet@40059
    47
  val eN : string
blanchet@48651
    48
  val e_malesN : string
blanchet@44590
    49
  val e_sineN : string
blanchet@44590
    50
  val e_tofofN : string
blanchet@45338
    51
  val iproverN : string
blanchet@45338
    52
  val iprover_eqN : string
blanchet@44590
    53
  val leo2N : string
blanchet@44590
    54
  val satallaxN : string
blanchet@44590
    55
  val snarkN : string
blanchet@40059
    56
  val spassN : string
blanchet@48131
    57
  val spass_polyN : string
blanchet@40059
    58
  val vampireN : string
blanchet@42938
    59
  val waldmeisterN : string
blanchet@44423
    60
  val z3_tptpN : string
blanchet@40060
    61
  val remote_prefix : string
blanchet@41738
    62
  val remote_atp :
blanchet@41738
    63
    string -> string -> string list -> (string * string) list
blanchet@47976
    64
    -> (failure * string) list -> formula_role
blanchet@47606
    65
    -> (Proof.context -> slice_spec * string) -> string * (unit -> atp_config)
blanchet@47606
    66
  val add_atp : string * (unit -> atp_config) -> theory -> theory
blanchet@47606
    67
  val get_atp : theory -> string -> (unit -> atp_config)
blanchet@41727
    68
  val supported_atps : theory -> string list
blanchet@40059
    69
  val is_atp_installed : theory -> string -> bool
blanchet@35867
    70
  val refresh_systems_on_tptp : unit -> unit
blanchet@47055
    71
  val effective_term_order : Proof.context -> string -> term_order
blanchet@35867
    72
  val setup : theory -> theory
wenzelm@28592
    73
end;
wenzelm@28592
    74
blanchet@36376
    75
structure ATP_Systems : ATP_SYSTEMS =
wenzelm@28592
    76
struct
wenzelm@28596
    77
blanchet@42577
    78
open ATP_Problem
blanchet@39491
    79
open ATP_Proof
blanchet@46320
    80
open ATP_Problem_Generate
boehmes@32864
    81
blanchet@40059
    82
(* ATP configuration *)
boehmes@32864
    83
blanchet@47962
    84
val default_max_mono_iters = 3 (* FUDGE *)
blanchet@47962
    85
val default_max_new_mono_instances = 200 (* FUDGE *)
blanchet@47962
    86
blanchet@46409
    87
type slice_spec = int * atp_format * string * string * bool
blanchet@46409
    88
blanchet@40059
    89
type atp_config =
blanchet@48376
    90
  {exec : string list * string list,
blanchet@42646
    91
   arguments :
blanchet@43473
    92
     Proof.context -> bool -> string -> Time.time
blanchet@47038
    93
     -> term_order * (unit -> (string * int) list)
blanchet@47038
    94
        * (unit -> (string * real) list) -> string,
blanchet@42578
    95
   proof_delims : (string * string) list,
blanchet@42578
    96
   known_failures : (failure * string) list,
blanchet@47976
    97
   prem_role : formula_role,
blanchet@47962
    98
   best_slices : Proof.context -> (real * (bool * (slice_spec * string))) list,
blanchet@47962
    99
   best_max_mono_iters : int,
blanchet@47962
   100
   best_max_new_mono_instances : int}
wenzelm@28596
   101
blanchet@42723
   102
(* "best_slices" must be found empirically, taking a wholistic approach since
blanchet@46407
   103
   the ATPs are run in parallel. The "real" component gives the faction of the
blanchet@46409
   104
   time available given to the slice and should add up to 1.0. The first "bool"
blanchet@42723
   105
   component indicates whether the slice's strategy is complete; the "int", the
blanchet@43569
   106
   preferred number of facts to pass; the first "string", the preferred type
blanchet@45521
   107
   system (which should be sound or quasi-sound); the second "string", the
blanchet@46409
   108
   preferred lambda translation scheme; the second "bool", whether uncurried
blanchet@46409
   109
   aliased should be generated; the third "string", extra information to
blanchet@45521
   110
   the prover (e.g., SOS or no SOS).
blanchet@42723
   111
blanchet@42723
   112
   The last slice should be the most "normal" one, because it will get all the
blanchet@43569
   113
   time available if the other slices fail early and also because it is used if
blanchet@43569
   114
   slicing is disabled (e.g., by the minimizer). *)
blanchet@42710
   115
blanchet@38061
   116
val known_perl_failures =
blanchet@38094
   117
  [(CantConnect, "HTTP error"),
blanchet@38094
   118
   (NoPerl, "env: perl"),
blanchet@38065
   119
   (NoLibwwwPerl, "Can't locate HTTP")]
wenzelm@28596
   120
blanchet@45203
   121
fun known_szs_failures wrap =
blanchet@45203
   122
  [(Unprovable, wrap "CounterSatisfiable"),
blanchet@45203
   123
   (Unprovable, wrap "Satisfiable"),
blanchet@45203
   124
   (GaveUp, wrap "GaveUp"),
blanchet@45203
   125
   (GaveUp, wrap "Unknown"),
blanchet@45203
   126
   (GaveUp, wrap "Incomplete"),
blanchet@45203
   127
   (ProofMissing, wrap "Theorem"),
blanchet@45203
   128
   (ProofMissing, wrap "Unsatisfiable"),
blanchet@45203
   129
   (TimedOut, wrap "Timeout"),
blanchet@45203
   130
   (Inappropriate, wrap "Inappropriate"),
blanchet@45203
   131
   (OutOfResources, wrap "ResourceOut"),
blanchet@45203
   132
   (OutOfResources, wrap "MemoryOut"),
blanchet@45203
   133
   (Interrupted, wrap "Forced"),
blanchet@45203
   134
   (Interrupted, wrap "User")]
blanchet@45203
   135
blanchet@45203
   136
val known_szs_status_failures = known_szs_failures (prefix "SZS status ")
blanchet@45203
   137
val known_says_failures = known_szs_failures (prefix " says ")
blanchet@45203
   138
blanchet@40059
   139
(* named ATPs *)
blanchet@40059
   140
blanchet@46643
   141
val alt_ergoN = "alt_ergo"
blanchet@47055
   142
val dummy_thfN = "dummy_thf" (* for experiments *)
blanchet@40059
   143
val eN = "e"
blanchet@48651
   144
val e_malesN = "e_males"
blanchet@44590
   145
val e_sineN = "e_sine"
blanchet@44590
   146
val e_tofofN = "e_tofof"
blanchet@45338
   147
val iproverN = "iprover"
blanchet@45338
   148
val iprover_eqN = "iprover_eq"
blanchet@44099
   149
val leo2N = "leo2"
blanchet@44099
   150
val satallaxN = "satallax"
blanchet@44590
   151
val snarkN = "snark"
blanchet@40059
   152
val spassN = "spass"
blanchet@48131
   153
val spass_polyN = "spass_poly"
blanchet@40059
   154
val vampireN = "vampire"
blanchet@44590
   155
val waldmeisterN = "waldmeister"
blanchet@44423
   156
val z3_tptpN = "z3_tptp"
blanchet@40060
   157
val remote_prefix = "remote_"
blanchet@38001
   158
blanchet@38023
   159
structure Data = Theory_Data
blanchet@38023
   160
(
blanchet@47606
   161
  type T = ((unit -> atp_config) * stamp) Symtab.table
blanchet@38023
   162
  val empty = Symtab.empty
blanchet@38023
   163
  val extend = I
blanchet@46407
   164
  fun merge data : T =
blanchet@46407
   165
    Symtab.merge (eq_snd (op =)) data
blanchet@38023
   166
    handle Symtab.DUP name => error ("Duplicate ATP: " ^ quote name ^ ".")
blanchet@38023
   167
)
blanchet@38017
   168
blanchet@43981
   169
fun to_secs min time = Int.max (min, (Time.toMilliseconds time + 999) div 1000)
blanchet@36142
   170
blanchet@43473
   171
val sosN = "sos"
blanchet@43473
   172
val no_sosN = "no_sos"
blanchet@43473
   173
blanchet@44099
   174
val force_sos = Attrib.setup_config_bool @{binding atp_force_sos} (K false)
blanchet@44099
   175
blanchet@47032
   176
val smartN = "smart"
blanchet@47073
   177
(* val kboN = "kbo" *)
blanchet@47032
   178
val lpoN = "lpo"
blanchet@47034
   179
val xweightsN = "_weights"
blanchet@47034
   180
val xprecN = "_prec"
blanchet@47034
   181
val xsimpN = "_simp" (* SPASS-specific *)
blanchet@47032
   182
blanchet@47038
   183
(* Possible values for "atp_term_order":
blanchet@47049
   184
   "smart", "(kbo|lpo)(_weights)?(_prec|_simp)?" *)
blanchet@47032
   185
val term_order =
blanchet@47032
   186
  Attrib.setup_config_string @{binding atp_term_order} (K smartN)
blanchet@47032
   187
blanchet@46643
   188
(* Alt-Ergo *)
blanchet@46643
   189
blanchet@48130
   190
val alt_ergo_tff1 = TFF (Polymorphic, TPTP_Explicit)
blanchet@46643
   191
blanchet@46643
   192
val alt_ergo_config : atp_config =
blanchet@48376
   193
  {exec = (["WHY3_HOME"], ["why3"]),
blanchet@48651
   194
   arguments = fn _ => fn _ => fn _ => fn timeout => fn _ =>
blanchet@48651
   195
       "--format tff1 --prover alt-ergo --timelimit " ^
blanchet@48651
   196
       string_of_int (to_secs 1 timeout),
blanchet@46643
   197
   proof_delims = [],
blanchet@46643
   198
   known_failures =
blanchet@46643
   199
     [(ProofMissing, ": Valid"),
blanchet@46643
   200
      (TimedOut, ": Timeout"),
blanchet@46643
   201
      (GaveUp, ": Unknown")],
blanchet@47976
   202
   prem_role = Hypothesis,
blanchet@46643
   203
   best_slices = fn _ =>
blanchet@46643
   204
     (* FUDGE *)
blanchet@47962
   205
     [(1.0, (false, ((100, alt_ergo_tff1, "poly_native", liftingN, false), "")))],
blanchet@47962
   206
   best_max_mono_iters = default_max_mono_iters,
blanchet@47962
   207
   best_max_new_mono_instances = default_max_new_mono_instances}
blanchet@46643
   208
blanchet@47646
   209
val alt_ergo = (alt_ergoN, fn () => alt_ergo_config)
blanchet@46643
   210
blanchet@46643
   211
blanchet@40059
   212
(* E *)
wenzelm@28596
   213
blanchet@48653
   214
fun is_e_at_least_1_3 () = (string_ord (getenv "E_VERSION", "1.3") <> LESS)
blanchet@48653
   215
fun is_e_at_least_1_6 () = (string_ord (getenv "E_VERSION", "1.6") <> LESS)
blanchet@44420
   216
blanchet@36369
   217
val tstp_proof_delims =
blanchet@42962
   218
  [("# SZS output start CNFRefutation.", "# SZS output end CNFRefutation"),
blanchet@42962
   219
   ("% SZS output start CNFRefutation", "% SZS output end CNFRefutation")]
blanchet@36369
   220
blanchet@43473
   221
val e_smartN = "smart"
blanchet@42646
   222
val e_autoN = "auto"
blanchet@42646
   223
val e_fun_weightN = "fun_weight"
blanchet@42646
   224
val e_sym_offset_weightN = "sym_offset_weight"
blanchet@41725
   225
blanchet@47032
   226
val e_selection_heuristic =
blanchet@47032
   227
  Attrib.setup_config_string @{binding atp_e_selection_heuristic} (K e_smartN)
blanchet@41770
   228
(* FUDGE *)
blanchet@42646
   229
val e_default_fun_weight =
blanchet@42646
   230
  Attrib.setup_config_real @{binding atp_e_default_fun_weight} (K 20.0)
blanchet@42646
   231
val e_fun_weight_base =
blanchet@42646
   232
  Attrib.setup_config_real @{binding atp_e_fun_weight_base} (K 0.0)
blanchet@42646
   233
val e_fun_weight_span =
blanchet@42646
   234
  Attrib.setup_config_real @{binding atp_e_fun_weight_span} (K 40.0)
blanchet@42646
   235
val e_default_sym_offs_weight =
blanchet@42646
   236
  Attrib.setup_config_real @{binding atp_e_default_sym_offs_weight} (K 1.0)
blanchet@42646
   237
val e_sym_offs_weight_base =
blanchet@42646
   238
  Attrib.setup_config_real @{binding atp_e_sym_offs_weight_base} (K ~20.0)
blanchet@42646
   239
val e_sym_offs_weight_span =
blanchet@42646
   240
  Attrib.setup_config_real @{binding atp_e_sym_offs_weight_span} (K 60.0)
blanchet@41725
   241
blanchet@47038
   242
fun e_selection_heuristic_case heuristic fw sow =
blanchet@47038
   243
  if heuristic = e_fun_weightN then fw
blanchet@47038
   244
  else if heuristic = e_sym_offset_weightN then sow
blanchet@47038
   245
  else raise Fail ("unexpected " ^ quote heuristic)
blanchet@41725
   246
blanchet@47038
   247
fun scaled_e_selection_weight ctxt heuristic w =
blanchet@47038
   248
  w * Config.get ctxt (e_selection_heuristic_case heuristic
blanchet@47029
   249
                           e_fun_weight_span e_sym_offs_weight_span)
blanchet@47038
   250
  + Config.get ctxt (e_selection_heuristic_case heuristic
blanchet@47029
   251
                         e_fun_weight_base e_sym_offs_weight_base)
blanchet@41725
   252
  |> Real.ceil |> signed_string_of_int
blanchet@41313
   253
blanchet@47038
   254
fun e_selection_weight_arguments ctxt heuristic sel_weights =
blanchet@47038
   255
  if heuristic = e_autoN then
blanchet@47038
   256
    "-xAuto"
blanchet@41725
   257
  else
blanchet@43622
   258
    (* supplied by Stephan Schulz *)
blanchet@41314
   259
    "--split-clauses=4 --split-reuse-defs --simul-paramod --forward-context-sr \
blanchet@41314
   260
    \--destructive-er-aggressive --destructive-er --presat-simplify \
blanchet@47505
   261
    \--prefer-initial-clauses -winvfreqrank -c1 -Ginvfreqconjmax -F1 \
blanchet@47505
   262
    \--delete-bad-limit=150000000 -WSelectMaxLComplexAvoidPosPred -H'(4*" ^
blanchet@47038
   263
    e_selection_heuristic_case heuristic "FunWeight" "SymOffsetWeight" ^
blanchet@48376
   264
    "(SimulateSOS," ^
blanchet@47038
   265
    (e_selection_heuristic_case heuristic
blanchet@47029
   266
         e_default_fun_weight e_default_sym_offs_weight
blanchet@42646
   267
     |> Config.get ctxt |> Real.ceil |> signed_string_of_int) ^
blanchet@41314
   268
    ",20,1.5,1.5,1" ^
blanchet@47030
   269
    (sel_weights ()
blanchet@47029
   270
     |> map (fn (s, w) => "," ^ s ^ ":" ^
blanchet@47038
   271
                          scaled_e_selection_weight ctxt heuristic w)
blanchet@42646
   272
     |> implode) ^
blanchet@41314
   273
    "),3*ConjectureGeneralSymbolWeight(PreferNonGoals,200,100,200,50,50,1,100,\
blanchet@41314
   274
    \1.5,1.5,1),1*Clauseweight(PreferProcessed,1,1,1),1*\
blanchet@41314
   275
    \FIFOWeight(PreferProcessed))'"
blanchet@41313
   276
blanchet@47038
   277
val e_ord_weights =
blanchet@47038
   278
  map (fn (s, w) => s ^ ":" ^ string_of_int w) #> space_implode ","
blanchet@47038
   279
fun e_ord_precedence [_] = ""
blanchet@47038
   280
  | e_ord_precedence info = info |> map fst |> space_implode "<"
blanchet@47038
   281
blanchet@47039
   282
fun e_term_order_info_arguments false false _ = ""
blanchet@47039
   283
  | e_term_order_info_arguments gen_weights gen_prec ord_info =
blanchet@47038
   284
    let val ord_info = ord_info () in
blanchet@47038
   285
      (if gen_weights then "--order-weights='" ^ e_ord_weights ord_info ^ "' "
blanchet@47038
   286
       else "") ^
blanchet@47038
   287
      (if gen_prec then "--precedence='" ^ e_ord_precedence ord_info ^ "' "
blanchet@47038
   288
       else "")
blanchet@47038
   289
    end
blanchet@47038
   290
blanchet@48232
   291
fun e_shell_level_argument full_proof =
blanchet@48653
   292
  if is_e_at_least_1_6 () then
blanchet@48232
   293
    " --pcl-shell-level=" ^ (if full_proof then "0" else "2")
blanchet@48232
   294
  else
blanchet@48232
   295
    ""
blanchet@48232
   296
blanchet@47032
   297
fun effective_e_selection_heuristic ctxt =
blanchet@48653
   298
  if is_e_at_least_1_3 () then Config.get ctxt e_selection_heuristic
blanchet@48232
   299
  else e_autoN
blanchet@42443
   300
blanchet@48653
   301
fun e_kbo () = if is_e_at_least_1_3 () then "KBO6" else "KBO"
blanchet@47505
   302
blanchet@40059
   303
val e_config : atp_config =
blanchet@48376
   304
  {exec = (["E_HOME"], ["eproof_ram", "eproof"]),
blanchet@48651
   305
   arguments = fn ctxt => fn full_proof => fn heuristic => fn timeout =>
blanchet@48651
   306
       fn ({is_lpo, gen_weights, gen_prec, ...}, ord_info, sel_weights) =>
blanchet@48651
   307
       "--tstp-in --tstp-out --output-level=5 --silent " ^
blanchet@48651
   308
       e_selection_weight_arguments ctxt heuristic sel_weights ^ " " ^
blanchet@48651
   309
       e_term_order_info_arguments gen_weights gen_prec ord_info ^ " " ^
blanchet@48651
   310
       "--term-ordering=" ^ (if is_lpo then "LPO4" else e_kbo ()) ^ " " ^
blanchet@48651
   311
       "--cpu-limit=" ^ string_of_int (to_secs 2 timeout) ^
blanchet@48651
   312
       e_shell_level_argument full_proof,
blanchet@48376
   313
   proof_delims = tstp_proof_delims,
blanchet@36265
   314
   known_failures =
blanchet@45203
   315
     [(TimedOut, "Failure: Resource limit exceeded (time)"),
blanchet@47972
   316
      (TimedOut, "time limit exceeded")] @
blanchet@47972
   317
     known_szs_status_failures,
blanchet@47976
   318
   prem_role = Conjecture,
blanchet@42646
   319
   best_slices = fn ctxt =>
blanchet@47038
   320
     let val heuristic = effective_e_selection_heuristic ctxt in
blanchet@43474
   321
       (* FUDGE *)
blanchet@47038
   322
       if heuristic = e_smartN then
blanchet@46449
   323
         [(0.333, (true, ((500, FOF, "mono_tags??", combsN, false), e_fun_weightN))),
blanchet@46449
   324
          (0.334, (true, ((50, FOF, "mono_guards??", combsN, false), e_fun_weightN))),
blanchet@46449
   325
          (0.333, (true, ((1000, FOF, "mono_tags??", combsN, false), e_sym_offset_weightN)))]
blanchet@43473
   326
       else
blanchet@47038
   327
         [(1.0, (true, ((500, FOF, "mono_tags??", combsN, false), heuristic)))]
blanchet@47962
   328
     end,
blanchet@47962
   329
   best_max_mono_iters = default_max_mono_iters,
blanchet@47962
   330
   best_max_new_mono_instances = default_max_new_mono_instances}
blanchet@38454
   331
blanchet@47646
   332
val e = (eN, fn () => e_config)
wenzelm@28596
   333
wenzelm@28596
   334
blanchet@48651
   335
(* E-MaLeS *)
blanchet@48651
   336
blanchet@48651
   337
val e_males_config : atp_config =
blanchet@48651
   338
  {exec = (["E_MALES_HOME"], ["emales.py"]),
blanchet@48651
   339
   arguments = fn _ => fn _ => fn _ => fn timeout => fn _ =>
blanchet@48651
   340
       "-t " ^ string_of_int (to_secs 1 timeout) ^ " -p",
blanchet@48651
   341
   proof_delims = tstp_proof_delims,
blanchet@48651
   342
   known_failures = #known_failures e_config,
blanchet@48651
   343
   prem_role = Conjecture,
blanchet@48651
   344
   best_slices =
blanchet@48651
   345
     (* FUDGE *)
blanchet@48651
   346
     K [(1.0, (true, ((1000, FOF, "mono_tags??", combsN, false), "")))],
blanchet@48651
   347
   best_max_mono_iters = default_max_mono_iters,
blanchet@48651
   348
   best_max_new_mono_instances = default_max_new_mono_instances}
blanchet@48651
   349
blanchet@48651
   350
val e_males = (e_malesN, fn () => e_males_config)
blanchet@48651
   351
blanchet@48651
   352
blanchet@48700
   353
(* iProver *)
blanchet@48700
   354
blanchet@48700
   355
val iprover_config : atp_config =
blanchet@48700
   356
  {exec = (["IPROVER_HOME"], ["iprover"]),
blanchet@48700
   357
   arguments = fn _ => fn _ => fn _ => fn timeout => fn _ =>
blanchet@48700
   358
       "--clausifier vclausify_rel --time_out_real " ^
blanchet@48700
   359
       string_of_real (Time.toReal timeout),
blanchet@48700
   360
   proof_delims = tstp_proof_delims,
blanchet@48700
   361
   known_failures =
blanchet@48700
   362
     [(ProofIncomplete, "% SZS output start CNFRefutation")] @
blanchet@48700
   363
     known_szs_status_failures,
blanchet@48700
   364
   prem_role = Hypothesis,
blanchet@48700
   365
   best_slices =
blanchet@48700
   366
     (* FUDGE *)
blanchet@48700
   367
     K [(1.0, (true, ((150, FOF, "mono_guards??", liftingN, false), "")))],
blanchet@48700
   368
   best_max_mono_iters = default_max_mono_iters,
blanchet@48700
   369
   best_max_new_mono_instances = default_max_new_mono_instances}
blanchet@48700
   370
blanchet@48700
   371
val iprover = (iproverN, fn () => iprover_config)
blanchet@48700
   372
blanchet@48700
   373
blanchet@48700
   374
(* iProver-Eq *)
blanchet@48700
   375
blanchet@48700
   376
val iprover_eq_config : atp_config =
blanchet@48700
   377
  {exec = (["IPROVER_EQ_HOME"], ["iprover-eq"]),
blanchet@48700
   378
   arguments = #arguments iprover_config,
blanchet@48700
   379
   proof_delims = #proof_delims iprover_config,
blanchet@48700
   380
   known_failures = #known_failures iprover_config,
blanchet@48700
   381
   prem_role = #prem_role iprover_config,
blanchet@48700
   382
   best_slices = #best_slices iprover_config,
blanchet@48700
   383
   best_max_mono_iters = #best_max_mono_iters iprover_config,
blanchet@48700
   384
   best_max_new_mono_instances = #best_max_new_mono_instances iprover_config}
blanchet@48700
   385
blanchet@48700
   386
val iprover_eq = (iprover_eqN, fn () => iprover_eq_config)
blanchet@48700
   387
blanchet@48700
   388
blanchet@44099
   389
(* LEO-II *)
blanchet@44099
   390
blanchet@48004
   391
(* LEO-II supports definitions, but it performs significantly better on our
blanchet@48004
   392
   benchmarks when they are not used. *)
blanchet@48004
   393
val leo2_thf0 =
blanchet@48130
   394
  THF (Monomorphic, TPTP_Explicit, THF_Without_Choice, THF_Without_Defs)
blanchet@44754
   395
blanchet@44099
   396
val leo2_config : atp_config =
blanchet@48376
   397
  {exec = (["LEO2_HOME"], ["leo"]),
blanchet@48651
   398
   arguments = fn _ => fn _ => fn _ => fn timeout => fn _ =>
blanchet@48651
   399
       "--foatp e --atp e=\"$E_HOME\"/eprover \
blanchet@48651
   400
       \--atp epclextract=\"$E_HOME\"/epclextract \
blanchet@48651
   401
       \--proofoutput 1 --timeout " ^ string_of_int (to_secs 1 timeout),
blanchet@44099
   402
   proof_delims = tstp_proof_delims,
blanchet@45207
   403
   known_failures =
blanchet@47974
   404
     [(TimedOut, "CPU time limit exceeded, terminating"),
blanchet@47972
   405
      (GaveUp, "No.of.Axioms")] @
blanchet@47972
   406
     known_szs_status_failures,
blanchet@47976
   407
   prem_role = Hypothesis,
blanchet@47914
   408
   best_slices =
blanchet@44099
   409
     (* FUDGE *)
blanchet@48097
   410
     K [(1.0, (true, ((40, leo2_thf0, "mono_native_higher", keep_lamsN, false), "")))],
blanchet@47962
   411
   best_max_mono_iters = default_max_mono_iters - 1 (* FUDGE *),
blanchet@47962
   412
   best_max_new_mono_instances = default_max_new_mono_instances div 2 (* FUDGE *)}
blanchet@39491
   413
blanchet@47646
   414
val leo2 = (leo2N, fn () => leo2_config)
blanchet@44099
   415
blanchet@44099
   416
blanchet@44099
   417
(* Satallax *)
blanchet@44099
   418
blanchet@48004
   419
val satallax_thf0 =
blanchet@48130
   420
  THF (Monomorphic, TPTP_Explicit, THF_With_Choice, THF_With_Defs)
blanchet@44754
   421
blanchet@44099
   422
val satallax_config : atp_config =
blanchet@48376
   423
  {exec = (["SATALLAX_HOME"], ["satallax"]),
blanchet@48651
   424
   arguments = fn _ => fn _ => fn _ => fn timeout => fn _ =>
blanchet@48651
   425
       "-p hocore -t " ^ string_of_int (to_secs 1 timeout),
blanchet@45162
   426
   proof_delims =
blanchet@45162
   427
     [("% Higher-Order Unsat Core BEGIN", "% Higher-Order Unsat Core END")],
blanchet@45203
   428
   known_failures = known_szs_status_failures,
blanchet@47981
   429
   prem_role = Hypothesis,
blanchet@44416
   430
   best_slices =
blanchet@44754
   431
     (* FUDGE *)
blanchet@47985
   432
     K [(1.0, (true, ((60, satallax_thf0, "mono_native_higher", keep_lamsN, false), "")))],
blanchet@47962
   433
   best_max_mono_iters = default_max_mono_iters - 1 (* FUDGE *),
blanchet@47962
   434
   best_max_new_mono_instances = default_max_new_mono_instances div 2 (* FUDGE *)}
blanchet@44099
   435
blanchet@47646
   436
val satallax = (satallaxN, fn () => satallax_config)
blanchet@44099
   437
blanchet@44099
   438
blanchet@44099
   439
(* SPASS *)
blanchet@42725
   440
blanchet@48005
   441
val spass_H1SOS = "-Heuristic=1 -SOS"
blanchet@48005
   442
val spass_H2LR0LT0 = "-Heuristic=2 -LR=0 -LT=0"
blanchet@48005
   443
val spass_H2SOS = "-Heuristic=2 -SOS"
blanchet@48005
   444
val spass_H2NuVS0 = "-Heuristic=2 -RNuV=1 -Sorts=0"
blanchet@48005
   445
val spass_H2NuVS0Red2 = "-Heuristic=2 -RNuV=1 -Sorts=0 -RFRew=2 -RBRew=2 -RTaut=2"
blanchet@47055
   446
blanchet@48005
   447
(* FIXME: Make "SPASS_NEW_HOME" legacy. *)
blanchet@48005
   448
val spass_config : atp_config =
blanchet@48376
   449
  {exec = (["SPASS_NEW_HOME", "SPASS_HOME"], ["SPASS"]),
blanchet@48005
   450
   arguments = fn _ => fn _ => fn extra_options => fn timeout => fn _ =>
blanchet@48651
   451
       ("-Isabelle=1 -TimeLimit=" ^ string_of_int (to_secs 1 timeout))
blanchet@48651
   452
       |> extra_options <> "" ? prefix (extra_options ^ " "),
blanchet@36369
   453
   proof_delims = [("Here is a proof", "Formulae used in the proof")],
blanchet@36289
   454
   known_failures =
blanchet@48005
   455
     [(OldSPASS, "Unrecognized option Isabelle"),
blanchet@47950
   456
      (GaveUp, "SPASS beiseite: Completion found"),
blanchet@36370
   457
      (TimedOut, "SPASS beiseite: Ran out of time"),
blanchet@36965
   458
      (OutOfResources, "SPASS beiseite: Maximal number of loops exceeded"),
blanchet@37413
   459
      (MalformedInput, "Undefined symbol"),
blanchet@37414
   460
      (MalformedInput, "Free Variable"),
blanchet@44391
   461
      (Unprovable, "No formulae and clauses found in input file"),
blanchet@47972
   462
      (InternalError, "Please report this error")] @
blanchet@47972
   463
      known_perl_failures,
blanchet@47976
   464
   prem_role = Conjecture,
blanchet@48005
   465
   best_slices = fn _ =>
blanchet@42723
   466
     (* FUDGE *)
blanchet@48131
   467
     [(0.1667, (false, ((150, DFG Monomorphic, "mono_native", combsN, true), ""))),
blanchet@48131
   468
      (0.1667, (false, ((500, DFG Monomorphic, "mono_native", liftingN, true), spass_H2SOS))),
blanchet@48131
   469
      (0.1666, (false, ((50, DFG Monomorphic,  "mono_native", liftingN, true), spass_H2LR0LT0))),
blanchet@48131
   470
      (0.1000, (false, ((250, DFG Monomorphic, "mono_native", combsN, true), spass_H2NuVS0))),
blanchet@48131
   471
      (0.1000, (false, ((1000, DFG Monomorphic, "mono_native", liftingN, true), spass_H1SOS))),
blanchet@48131
   472
      (0.1000, (false, ((150, DFG Monomorphic, "poly_guards??", liftingN, false), spass_H2NuVS0Red2))),
blanchet@48131
   473
      (0.1000, (false, ((300, DFG Monomorphic, "mono_native", combsN, true), spass_H2SOS))),
blanchet@48558
   474
      (0.1000, (false, ((100, DFG Monomorphic, "mono_native", combs_and_liftingN, true), "")))],
blanchet@47962
   475
   best_max_mono_iters = default_max_mono_iters,
blanchet@47962
   476
   best_max_new_mono_instances = default_max_new_mono_instances}
blanchet@38454
   477
blanchet@48005
   478
val spass = (spassN, fn () => spass_config)
blanchet@38454
   479
blanchet@37509
   480
(* Vampire *)
blanchet@37509
   481
blanchet@48007
   482
(* Vampire 1.8 has TFF support, but the support was buggy until revision
blanchet@48007
   483
   1435 (or shortly before). *)
blanchet@48653
   484
fun is_vampire_at_least_1_8 () =
blanchet@48653
   485
  string_ord (getenv "VAMPIRE_VERSION", "1.8") <> LESS
blanchet@48653
   486
fun is_vampire_beyond_1_8 () =
blanchet@47055
   487
  string_ord (getenv "VAMPIRE_VERSION", "1.8") = GREATER
blanchet@44420
   488
blanchet@48130
   489
val vampire_tff0 = TFF (Monomorphic, TPTP_Implicit)
blanchet@44589
   490
blanchet@40059
   491
val vampire_config : atp_config =
blanchet@48376
   492
  {exec = (["VAMPIRE_HOME"], ["vampire"]),
blanchet@43569
   493
   arguments = fn _ => fn _ => fn sos => fn timeout => fn _ =>
blanchet@48651
   494
       "--mode casc -t " ^ string_of_int (to_secs 1 timeout) ^
blanchet@48653
   495
       " --proof tptp --output_axiom_names on" ^
blanchet@48653
   496
       (if is_vampire_at_least_1_8 () then
blanchet@48653
   497
          " --forced_options propositional_to_bdd=off"
blanchet@48653
   498
        else
blanchet@48653
   499
          "") ^
blanchet@48653
   500
       " --thanks \"Andrei and Krystof\" --input_file"
blanchet@48651
   501
       |> sos = sosN ? prefix "--sos on ",
blanchet@37509
   502
   proof_delims =
blanchet@37509
   503
     [("=========== Refutation ==========",
blanchet@37509
   504
       "======= End of refutation ======="),
blanchet@38033
   505
      ("% SZS output start Refutation", "% SZS output end Refutation"),
blanchet@38033
   506
      ("% SZS output start Proof", "% SZS output end Proof")],
blanchet@37509
   507
   known_failures =
blanchet@43050
   508
     [(GaveUp, "UNPROVABLE"),
blanchet@43050
   509
      (GaveUp, "CANNOT PROVE"),
blanchet@37509
   510
      (Unprovable, "Satisfiability detected"),
blanchet@38647
   511
      (Unprovable, "Termination reason: Satisfiable"),
blanchet@47972
   512
      (Interrupted, "Aborted by signal SIGINT")] @
blanchet@47972
   513
     known_szs_status_failures,
blanchet@47976
   514
   prem_role = Conjecture,
blanchet@42725
   515
   best_slices = fn ctxt =>
blanchet@42723
   516
     (* FUDGE *)
blanchet@48653
   517
     (if is_vampire_beyond_1_8 () then
blanchet@47948
   518
        [(0.333, (false, ((500, vampire_tff0, "mono_native", combs_or_liftingN, false), sosN))),
blanchet@47948
   519
         (0.333, (false, ((150, vampire_tff0, "poly_guards??", combs_or_liftingN, false), sosN))),
blanchet@47055
   520
         (0.334, (true, ((50, vampire_tff0, "mono_native", combs_or_liftingN, false), no_sosN)))]
blanchet@47055
   521
      else
blanchet@46449
   522
        [(0.333, (false, ((150, FOF, "poly_guards??", combs_or_liftingN, false), sosN))),
blanchet@46449
   523
         (0.333, (false, ((500, FOF, "mono_tags??", combs_or_liftingN, false), sosN))),
blanchet@47055
   524
         (0.334, (true, ((50, FOF, "mono_guards??", combs_or_liftingN, false), no_sosN)))])
blanchet@44099
   525
     |> (if Config.get ctxt force_sos then hd #> apfst (K 1.0) #> single
blanchet@47962
   526
         else I),
blanchet@47962
   527
   best_max_mono_iters = default_max_mono_iters,
blanchet@47962
   528
   best_max_new_mono_instances = default_max_new_mono_instances}
blanchet@38454
   529
blanchet@47646
   530
val vampire = (vampireN, fn () => vampire_config)
blanchet@37509
   531
blanchet@38454
   532
blanchet@41740
   533
(* Z3 with TPTP syntax *)
blanchet@41740
   534
blanchet@48130
   535
val z3_tff0 = TFF (Monomorphic, TPTP_Implicit)
blanchet@44589
   536
blanchet@44423
   537
val z3_tptp_config : atp_config =
blanchet@48376
   538
  {exec = (["Z3_HOME"], ["z3"]),
blanchet@43354
   539
   arguments = fn _ => fn _ => fn _ => fn timeout => fn _ =>
blanchet@48651
   540
       "MBQI=true DISPLAY_UNSAT_CORE=true -tptp -t:" ^
blanchet@48651
   541
       string_of_int (to_secs 1 timeout),
blanchet@48539
   542
   proof_delims = [("\ncore(", ").")],
blanchet@45203
   543
   known_failures = known_szs_status_failures,
blanchet@47976
   544
   prem_role = Hypothesis,
blanchet@42723
   545
   best_slices =
blanchet@44423
   546
     (* FUDGE *)
blanchet@46435
   547
     K [(0.5, (false, ((250, z3_tff0, "mono_native", combsN, false), ""))),
blanchet@46435
   548
        (0.25, (false, ((125, z3_tff0, "mono_native", combsN, false), ""))),
blanchet@46435
   549
        (0.125, (false, ((62, z3_tff0, "mono_native", combsN, false), ""))),
blanchet@47962
   550
        (0.125, (false, ((31, z3_tff0, "mono_native", combsN, false), "")))],
blanchet@47962
   551
   best_max_mono_iters = default_max_mono_iters,
blanchet@47962
   552
   best_max_new_mono_instances = default_max_new_mono_instances}
blanchet@41740
   553
blanchet@47646
   554
val z3_tptp = (z3_tptpN, fn () => z3_tptp_config)
blanchet@41740
   555
blanchet@44590
   556
blanchet@48131
   557
(* Not really a prover: Experimental Polymorphic THF and DFG output *)
blanchet@44590
   558
blanchet@44754
   559
fun dummy_config format type_enc : atp_config =
blanchet@48376
   560
  {exec = (["ISABELLE_ATP"], ["scripts/dummy_atp"]),
blanchet@44590
   561
   arguments = K (K (K (K (K "")))),
blanchet@44590
   562
   proof_delims = [],
blanchet@45203
   563
   known_failures = known_szs_status_failures,
blanchet@47976
   564
   prem_role = Hypothesis,
blanchet@45521
   565
   best_slices =
blanchet@46407
   566
     K [(1.0, (false, ((200, format, type_enc,
blanchet@46407
   567
                        if is_format_higher_order format then keep_lamsN
blanchet@47962
   568
                        else combsN, false), "")))],
blanchet@47962
   569
   best_max_mono_iters = default_max_mono_iters,
blanchet@47962
   570
   best_max_new_mono_instances = default_max_new_mono_instances}
blanchet@44590
   571
blanchet@48004
   572
val dummy_thf_format =
blanchet@48130
   573
  THF (Polymorphic, TPTP_Explicit, THF_With_Choice, THF_With_Defs)
blanchet@46435
   574
val dummy_thf_config = dummy_config dummy_thf_format "poly_native_higher"
blanchet@47646
   575
val dummy_thf = (dummy_thfN, fn () => dummy_thf_config)
blanchet@44754
   576
blanchet@48131
   577
val spass_poly_format = DFG Polymorphic
blanchet@48131
   578
val spass_poly_config = dummy_config spass_poly_format "tc_native"
blanchet@48131
   579
val spass_poly = (spass_polyN, fn () => spass_poly_config)
blanchet@41740
   580
blanchet@40059
   581
(* Remote ATP invocation via SystemOnTPTP *)
wenzelm@28596
   582
blanchet@38061
   583
val systems = Synchronized.var "atp_systems" ([] : string list)
immler@31835
   584
immler@31835
   585
fun get_systems () =
blanchet@44589
   586
  case Isabelle_System.bash_output
blanchet@44589
   587
           "\"$ISABELLE_ATP/scripts/remote_atp\" -w 2>&1" of
blanchet@39491
   588
    (output, 0) => split_lines output
blanchet@39491
   589
  | (output, _) =>
blanchet@39491
   590
    error (case extract_known_failure known_perl_failures output of
blanchet@41744
   591
             SOME failure => string_for_failure failure
wenzelm@47499
   592
           | NONE => trim_line output ^ ".")
immler@31835
   593
blanchet@42537
   594
fun find_system name [] systems =
blanchet@42537
   595
    find_first (String.isPrefix (name ^ "---")) systems
blanchet@38690
   596
  | find_system name (version :: versions) systems =
blanchet@38690
   597
    case find_first (String.isPrefix (name ^ "---" ^ version)) systems of
blanchet@38690
   598
      NONE => find_system name versions systems
blanchet@38690
   599
    | res => res
blanchet@38690
   600
blanchet@38690
   601
fun get_system name versions =
blanchet@38589
   602
  Synchronized.change_result systems
blanchet@38589
   603
      (fn systems => (if null systems then get_systems () else systems)
blanchet@42955
   604
                     |> `(`(find_system name versions)))
boehmes@32864
   605
blanchet@38690
   606
fun the_system name versions =
blanchet@38690
   607
  case get_system name versions of
blanchet@42955
   608
    (SOME sys, _) => sys
blanchet@46480
   609
  | (NONE, []) => error ("SystemOnTPTP is not available.")
blanchet@42955
   610
  | (NONE, syss) =>
blanchet@46480
   611
    case syss |> filter_out (String.isPrefix "%")
blanchet@46480
   612
              |> filter_out (curry (op =) "") of
blanchet@46480
   613
      [] => error ("SystemOnTPTP is not available.")
blanchet@46480
   614
    | [msg] => error ("SystemOnTPTP is not available: " ^ msg ^ ".")
blanchet@46480
   615
    | syss =>
blanchet@46480
   616
      error ("System " ^ quote name ^ " is not available at SystemOnTPTP.\n" ^
blanchet@46480
   617
             "(Available systems: " ^ commas_quote syss ^ ".)")
immler@31835
   618
blanchet@41148
   619
val max_remote_secs = 240 (* give Geoff Sutcliffe's servers a break *)
blanchet@41148
   620
blanchet@38690
   621
fun remote_config system_name system_versions proof_delims known_failures
blanchet@47976
   622
                  prem_role best_slice : atp_config =
blanchet@48376
   623
  {exec = (["ISABELLE_ATP"], ["scripts/remote_atp"]),
blanchet@47074
   624
   arguments = fn _ => fn _ => fn command => fn timeout => fn _ =>
blanchet@48651
   625
       (if command <> "" then "-c " ^ quote command ^ " " else "") ^
blanchet@48651
   626
       "-s " ^ the_system system_name system_versions ^ " " ^
blanchet@48651
   627
       "-t " ^ string_of_int (Int.min (max_remote_secs, to_secs 1 timeout)),
blanchet@42962
   628
   proof_delims = union (op =) tstp_proof_delims proof_delims,
blanchet@45203
   629
   known_failures = known_failures @ known_perl_failures @ known_says_failures,
blanchet@47976
   630
   prem_role = prem_role,
blanchet@47962
   631
   best_slices = fn ctxt => [(1.0, (false, best_slice ctxt))],
blanchet@47962
   632
   best_max_mono_iters = default_max_mono_iters,
blanchet@47962
   633
   best_max_new_mono_instances = default_max_new_mono_instances}
blanchet@42443
   634
blanchet@43500
   635
fun remotify_config system_name system_versions best_slice
blanchet@47976
   636
        ({proof_delims, known_failures, prem_role, ...} : atp_config)
blanchet@47912
   637
        : atp_config =
blanchet@38690
   638
  remote_config system_name system_versions proof_delims known_failures
blanchet@47976
   639
                prem_role best_slice
blanchet@38023
   640
blanchet@40059
   641
fun remote_atp name system_name system_versions proof_delims known_failures
blanchet@47976
   642
               prem_role best_slice =
blanchet@40060
   643
  (remote_prefix ^ name,
blanchet@47912
   644
   fn () => remote_config system_name system_versions proof_delims
blanchet@47976
   645
                          known_failures prem_role best_slice)
blanchet@43500
   646
fun remotify_atp (name, config) system_name system_versions best_slice =
blanchet@43500
   647
  (remote_prefix ^ name,
blanchet@47606
   648
   remotify_config system_name system_versions best_slice o config)
wenzelm@28592
   649
blanchet@48130
   650
val explicit_tff0 = TFF (Monomorphic, TPTP_Explicit)
blanchet@44589
   651
blanchet@43500
   652
val remote_e =
blanchet@43500
   653
  remotify_atp e "EP" ["1.0", "1.1", "1.2"]
blanchet@47074
   654
      (K ((750, FOF, "mono_tags??", combsN, false), "") (* FUDGE *))
blanchet@48700
   655
val remote_iprover =
blanchet@48700
   656
  remotify_atp iprover "iProver" []
blanchet@48700
   657
      (K ((150, FOF, "mono_guards??", liftingN, false), "") (* FUDGE *))
blanchet@48700
   658
val remote_iprover_eq =
blanchet@48700
   659
  remotify_atp iprover_eq "iProver-Eq" []
blanchet@48700
   660
      (K ((150, FOF, "mono_guards??", liftingN, false), "") (* FUDGE *))
blanchet@44099
   661
val remote_leo2 =
blanchet@44099
   662
  remotify_atp leo2 "LEO-II" ["1.2.8", "1.2.6"]
blanchet@47074
   663
      (K ((100, leo2_thf0, "mono_native_higher", liftingN, false), "") (* FUDGE *))
blanchet@44099
   664
val remote_satallax =
blanchet@47074
   665
  remotify_atp satallax "Satallax" ["2.3", "2.2", "2"]
blanchet@47076
   666
      (K ((100, satallax_thf0, "mono_native_higher", keep_lamsN, false), "") (* FUDGE *))
blanchet@43500
   667
val remote_vampire =
blanchet@48077
   668
  remotify_atp vampire "Vampire" ["2.6", "2.5", "1.8"]
blanchet@47074
   669
      (K ((250, vampire_tff0, "mono_native", combs_or_liftingN, false), "") (* FUDGE *))
blanchet@44423
   670
val remote_z3_tptp =
blanchet@44754
   671
  remotify_atp z3_tptp "Z3" ["3.0"]
blanchet@47074
   672
      (K ((250, z3_tff0, "mono_native", combsN, false), "") (* FUDGE *))
blanchet@44092
   673
val remote_e_sine =
blanchet@47912
   674
  remote_atp e_sineN "SInE" ["0.4"] [] (#known_failures e_config) Conjecture
blanchet@47074
   675
      (K ((500, FOF, "mono_guards??", combsN, false), "") (* FUDGE *))
blanchet@41740
   676
val remote_snark =
blanchet@42939
   677
  remote_atp snarkN "SNARK" ["20080805r029", "20080805r024"]
blanchet@47912
   678
      [("refutation.", "end_refutation.")] [] Hypothesis
blanchet@47074
   679
      (K ((100, explicit_tff0, "mono_native", liftingN, false), "") (* FUDGE *))
blanchet@44092
   680
val remote_e_tofof =
blanchet@47912
   681
  remote_atp e_tofofN "ToFoF" ["0.1"] [] (#known_failures e_config) Hypothesis
blanchet@47074
   682
      (K ((150, explicit_tff0, "mono_native", liftingN, false), "") (* FUDGE *))
blanchet@42938
   683
val remote_waldmeister =
blanchet@42938
   684
  remote_atp waldmeisterN "Waldmeister" ["710"]
blanchet@45521
   685
      [("#START OF PROOF", "Proved Goals:")]
blanchet@45521
   686
      [(OutOfResources, "Too many function symbols"),
blanchet@47506
   687
       (Inappropriate, "****  Unexpected end of file."),
blanchet@45521
   688
       (Crashed, "Unrecoverable Segmentation Fault")]
blanchet@47912
   689
      Hypothesis
blanchet@47898
   690
      (K ((50, CNF_UEQ, "raw_mono_tags??", combsN, false), "") (* FUDGE *))
blanchet@38454
   691
blanchet@38454
   692
(* Setup *)
blanchet@38454
   693
blanchet@40059
   694
fun add_atp (name, config) thy =
blanchet@40059
   695
  Data.map (Symtab.update_new (name, (config, stamp ()))) thy
blanchet@40059
   696
  handle Symtab.DUP name => error ("Duplicate ATP: " ^ quote name ^ ".")
blanchet@40059
   697
blanchet@40059
   698
fun get_atp thy name =
blanchet@40059
   699
  the (Symtab.lookup (Data.get thy) name) |> fst
blanchet@40059
   700
  handle Option.Option => error ("Unknown ATP: " ^ name ^ ".")
blanchet@40059
   701
blanchet@41727
   702
val supported_atps = Symtab.keys o Data.get
blanchet@36371
   703
blanchet@40059
   704
fun is_atp_installed thy name =
blanchet@48376
   705
  let val {exec, ...} = get_atp thy name () in
blanchet@48376
   706
    exists (fn var => getenv var <> "") (fst exec)
blanchet@40059
   707
  end
blanchet@36371
   708
blanchet@40059
   709
fun refresh_systems_on_tptp () =
blanchet@40059
   710
  Synchronized.change systems (fn _ => get_systems ())
blanchet@40059
   711
blanchet@47055
   712
fun effective_term_order ctxt atp =
blanchet@47055
   713
  let val ord = Config.get ctxt term_order in
blanchet@47055
   714
    if ord = smartN then
blanchet@48005
   715
      if atp = spassN then
blanchet@47073
   716
        {is_lpo = false, gen_weights = true, gen_prec = true, gen_simp = false}
blanchet@47055
   717
      else
blanchet@47055
   718
        {is_lpo = false, gen_weights = false, gen_prec = false,
blanchet@47055
   719
         gen_simp = false}
blanchet@47055
   720
    else
blanchet@47055
   721
      let val is_lpo = String.isSubstring lpoN ord in
blanchet@47055
   722
        {is_lpo = is_lpo,
blanchet@47055
   723
         gen_weights = not is_lpo andalso String.isSubstring xweightsN ord,
blanchet@47055
   724
         gen_prec = String.isSubstring xprecN ord,
blanchet@47055
   725
         gen_simp = String.isSubstring xsimpN ord}
blanchet@47055
   726
      end
blanchet@47055
   727
  end
blanchet@47055
   728
blanchet@47606
   729
val atps=
blanchet@48700
   730
  [alt_ergo, e, e_males, iprover, iprover_eq, leo2, satallax, spass, spass_poly,
blanchet@48700
   731
   vampire, z3_tptp, dummy_thf, remote_e, remote_e_sine, remote_e_tofof,
blanchet@48700
   732
   remote_iprover, remote_iprover_eq, remote_leo2, remote_satallax,
blanchet@48700
   733
   remote_vampire, remote_z3_tptp, remote_snark, remote_waldmeister]
blanchet@47055
   734
blanchet@47606
   735
val setup = fold add_atp atps
blanchet@35867
   736
wenzelm@28592
   737
end;