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