src/HOL/Tools/Sledgehammer/sledgehammer.ML
author blanchet
Tue Aug 17 16:47:40 2010 +0200 (2010-08-17)
changeset 38490 57de0f12516f
parent 38455 131f7c46cf2c
child 38515 32391240695f
permissions -rw-r--r--
tuning
blanchet@38021
     1
(*  Title:      HOL/Tools/Sledgehammer/sledgehammer.ML
wenzelm@28477
     2
    Author:     Fabian Immler, TU Muenchen
wenzelm@32996
     3
    Author:     Makarius
blanchet@35969
     4
    Author:     Jasmin Blanchette, TU Muenchen
wenzelm@28477
     5
blanchet@38021
     6
Sledgehammer's heart.
wenzelm@28477
     7
*)
wenzelm@28477
     8
blanchet@38021
     9
signature SLEDGEHAMMER =
wenzelm@28477
    10
sig
blanchet@38023
    11
  type failure = ATP_Systems.failure
blanchet@35969
    12
  type relevance_override = Sledgehammer_Fact_Filter.relevance_override
blanchet@36281
    13
  type minimize_command = Sledgehammer_Proof_Reconstruct.minimize_command
blanchet@35969
    14
  type params =
blanchet@35969
    15
    {debug: bool,
blanchet@35969
    16
     verbose: bool,
blanchet@36143
    17
     overlord: bool,
blanchet@35969
    18
     atps: string list,
blanchet@35969
    19
     full_types: bool,
blanchet@36235
    20
     explicit_apply: bool,
blanchet@35969
    21
     relevance_threshold: real,
blanchet@36922
    22
     relevance_convergence: real,
blanchet@36220
    23
     theory_relevant: bool option,
blanchet@36922
    24
     defs_relevant: bool,
blanchet@35969
    25
     isar_proof: bool,
blanchet@36924
    26
     isar_shrink_factor: int,
blanchet@35969
    27
     timeout: Time.time,
blanchet@35969
    28
     minimize_timeout: Time.time}
blanchet@35867
    29
  type problem =
blanchet@35969
    30
    {subgoal: int,
blanchet@35969
    31
     goal: Proof.context * (thm list * thm),
blanchet@35969
    32
     relevance_override: relevance_override,
blanchet@38084
    33
     axioms: (string * thm) list option}
blanchet@35867
    34
  type prover_result =
blanchet@36370
    35
    {outcome: failure option,
blanchet@35969
    36
     message: string,
blanchet@37926
    37
     pool: string Symtab.table,
blanchet@38015
    38
     used_thm_names: string list,
blanchet@35969
    39
     atp_run_time_in_msecs: int,
blanchet@36369
    40
     output: string,
blanchet@35969
    41
     proof: string,
blanchet@38282
    42
     axiom_names: string Vector.vector,
blanchet@38083
    43
     conjecture_shape: int list list}
blanchet@38100
    44
  type prover = params -> minimize_command -> problem -> prover_result
blanchet@35867
    45
blanchet@38023
    46
  val dest_dir : string Config.T
blanchet@38023
    47
  val problem_prefix : string Config.T
blanchet@38023
    48
  val measure_runtime : bool Config.T
blanchet@35969
    49
  val kill_atps: unit -> unit
blanchet@35969
    50
  val running_atps: unit -> unit
wenzelm@29112
    51
  val messages: int option -> unit
blanchet@38023
    52
  val get_prover_fun : theory -> string -> prover
blanchet@38044
    53
  val run_sledgehammer :
blanchet@38044
    54
    params -> int -> relevance_override -> (string -> minimize_command)
blanchet@38044
    55
    -> Proof.state -> unit
blanchet@38023
    56
  val setup : theory -> theory
wenzelm@28477
    57
end;
wenzelm@28477
    58
blanchet@38021
    59
structure Sledgehammer : SLEDGEHAMMER =
wenzelm@28477
    60
struct
wenzelm@28477
    61
blanchet@38028
    62
open ATP_Problem
blanchet@38028
    63
open ATP_Systems
blanchet@37578
    64
open Metis_Clauses
blanchet@38023
    65
open Sledgehammer_Util
blanchet@36063
    66
open Sledgehammer_Fact_Filter
blanchet@38282
    67
open Sledgehammer_Translate
blanchet@36063
    68
open Sledgehammer_Proof_Reconstruct
blanchet@37583
    69
blanchet@38023
    70
blanchet@37583
    71
(** The Sledgehammer **)
blanchet@37583
    72
blanchet@38102
    73
(* Identifier to distinguish Sledgehammer from other tools using
blanchet@38102
    74
   "Async_Manager". *)
blanchet@37585
    75
val das_Tool = "Sledgehammer"
blanchet@37585
    76
blanchet@37585
    77
fun kill_atps () = Async_Manager.kill_threads das_Tool "ATPs"
blanchet@37585
    78
fun running_atps () = Async_Manager.running_threads das_Tool "ATPs"
blanchet@37585
    79
val messages = Async_Manager.thread_messages das_Tool "ATP"
blanchet@35969
    80
blanchet@36281
    81
(** problems, results, provers, etc. **)
blanchet@35969
    82
blanchet@35969
    83
type params =
blanchet@35969
    84
  {debug: bool,
blanchet@35969
    85
   verbose: bool,
blanchet@36143
    86
   overlord: bool,
blanchet@35969
    87
   atps: string list,
blanchet@35969
    88
   full_types: bool,
blanchet@36235
    89
   explicit_apply: bool,
blanchet@35969
    90
   relevance_threshold: real,
blanchet@36922
    91
   relevance_convergence: real,
blanchet@36220
    92
   theory_relevant: bool option,
blanchet@36922
    93
   defs_relevant: bool,
blanchet@35969
    94
   isar_proof: bool,
blanchet@36924
    95
   isar_shrink_factor: int,
blanchet@35969
    96
   timeout: Time.time,
blanchet@35969
    97
   minimize_timeout: Time.time}
blanchet@35867
    98
blanchet@35867
    99
type problem =
blanchet@35969
   100
  {subgoal: int,
blanchet@35969
   101
   goal: Proof.context * (thm list * thm),
blanchet@35969
   102
   relevance_override: relevance_override,
blanchet@38084
   103
   axioms: (string * thm) list option}
blanchet@35867
   104
blanchet@35867
   105
type prover_result =
blanchet@36370
   106
  {outcome: failure option,
blanchet@35969
   107
   message: string,
blanchet@37926
   108
   pool: string Symtab.table,
blanchet@38015
   109
   used_thm_names: string list,
blanchet@35969
   110
   atp_run_time_in_msecs: int,
blanchet@36369
   111
   output: string,
blanchet@35969
   112
   proof: string,
blanchet@38282
   113
   axiom_names: string Vector.vector,
blanchet@38083
   114
   conjecture_shape: int list list}
blanchet@35867
   115
blanchet@38100
   116
type prover = params -> minimize_command -> problem -> prover_result
blanchet@35867
   117
blanchet@38023
   118
(* configuration attributes *)
blanchet@38023
   119
blanchet@38023
   120
val (dest_dir, dest_dir_setup) = Attrib.config_string "atp_dest_dir" (K "");
blanchet@38023
   121
  (*Empty string means create files in Isabelle's temporary files directory.*)
blanchet@38023
   122
blanchet@38023
   123
val (problem_prefix, problem_prefix_setup) =
blanchet@38023
   124
  Attrib.config_string "atp_problem_prefix" (K "prob");
blanchet@38023
   125
blanchet@38023
   126
val (measure_runtime, measure_runtime_setup) =
blanchet@38023
   127
  Attrib.config_bool "atp_measure_runtime" (K false);
wenzelm@28484
   128
blanchet@38023
   129
fun with_path cleanup after f path =
blanchet@38023
   130
  Exn.capture f path
blanchet@38023
   131
  |> tap (fn _ => cleanup path)
blanchet@38023
   132
  |> Exn.release
blanchet@38023
   133
  |> tap (after path)
blanchet@38023
   134
blanchet@38023
   135
(* Splits by the first possible of a list of delimiters. *)
blanchet@38023
   136
fun extract_proof delims output =
blanchet@38023
   137
  case pairself (find_first (fn s => String.isSubstring s output))
blanchet@38023
   138
                (ListPair.unzip delims) of
blanchet@38023
   139
    (SOME begin_delim, SOME end_delim) =>
blanchet@38023
   140
    (output |> first_field begin_delim |> the |> snd
blanchet@38023
   141
            |> first_field end_delim |> the |> fst
blanchet@38023
   142
            |> first_field "\n" |> the |> snd
blanchet@38023
   143
     handle Option.Option => "")
blanchet@38023
   144
  | _ => ""
wenzelm@28484
   145
blanchet@38023
   146
fun extract_proof_and_outcome complete res_code proof_delims known_failures
blanchet@38023
   147
                              output =
blanchet@38061
   148
  case known_failure_in_output output known_failures of
blanchet@38061
   149
    NONE => (case extract_proof proof_delims output of
blanchet@38061
   150
             "" => ("", SOME MalformedOutput)
blanchet@38023
   151
           | proof => if res_code = 0 then (proof, NONE)
blanchet@38023
   152
                      else ("", SOME UnknownError))
blanchet@38061
   153
  | SOME failure =>
blanchet@38023
   154
    ("", SOME (if failure = IncompleteUnprovable andalso complete then
blanchet@38023
   155
                 Unprovable
blanchet@38023
   156
               else
blanchet@38023
   157
                 failure))
wenzelm@28582
   158
blanchet@38023
   159
fun extract_clause_sequence output =
blanchet@38023
   160
  let
blanchet@38023
   161
    val tokens_of = String.tokens (not o Char.isAlphaNum)
blanchet@38023
   162
    fun extract_num ("clause" :: (ss as _ :: _)) =
blanchet@38023
   163
    Int.fromString (List.last ss)
blanchet@38023
   164
      | extract_num _ = NONE
blanchet@38023
   165
  in output |> split_lines |> map_filter (extract_num o tokens_of) end
blanchet@38023
   166
blanchet@38023
   167
val set_ClauseFormulaRelationN = "set_ClauseFormulaRelation"
blanchet@38023
   168
blanchet@38023
   169
val parse_clause_formula_pair =
blanchet@38105
   170
  $$ "(" |-- scan_integer --| $$ "," -- Symbol.scan_id
blanchet@38105
   171
  --| Scan.repeat ($$ "," |-- Symbol.scan_id) --| $$ ")"
blanchet@38023
   172
  --| Scan.option ($$ ",")
blanchet@38023
   173
val parse_clause_formula_relation =
blanchet@38023
   174
  Scan.this_string set_ClauseFormulaRelationN |-- $$ "("
blanchet@38023
   175
  |-- Scan.repeat parse_clause_formula_pair
blanchet@38023
   176
val extract_clause_formula_relation =
blanchet@38023
   177
  Substring.full
blanchet@38023
   178
  #> Substring.position set_ClauseFormulaRelationN
blanchet@38023
   179
  #> snd #> Substring.string #> strip_spaces #> explode
blanchet@38023
   180
  #> parse_clause_formula_relation #> fst
blanchet@38023
   181
blanchet@38023
   182
fun repair_conjecture_shape_and_theorem_names output conjecture_shape
blanchet@38023
   183
                                              thm_names =
blanchet@38023
   184
  if String.isSubstring set_ClauseFormulaRelationN output then
blanchet@38023
   185
    (* This is a hack required for keeping track of axioms after they have been
blanchet@38023
   186
       clausified by SPASS's Flotter tool. The "SPASS_TPTP" script is also part
blanchet@38023
   187
       of this hack. *)
blanchet@38023
   188
    let
blanchet@38040
   189
      val j0 = hd (hd conjecture_shape)
blanchet@38023
   190
      val seq = extract_clause_sequence output
blanchet@38023
   191
      val name_map = extract_clause_formula_relation output
blanchet@38023
   192
      fun renumber_conjecture j =
blanchet@38023
   193
        AList.find (op =) name_map (conjecture_prefix ^ Int.toString (j - j0))
blanchet@38040
   194
        |> map (fn s => find_index (curry (op =) s) seq + 1)
blanchet@38023
   195
    in
blanchet@38040
   196
      (conjecture_shape |> map (maps renumber_conjecture),
blanchet@38105
   197
       seq |> map (fn j => case j |> AList.lookup (op =) name_map |> the
blanchet@38105
   198
                                  |> try (unprefix axiom_prefix) of
blanchet@38023
   199
                             SOME s' => undo_ascii_of s'
blanchet@38023
   200
                           | NONE => "")
blanchet@38023
   201
           |> Vector.fromList)
blanchet@38023
   202
    end
blanchet@38023
   203
  else
blanchet@38023
   204
    (conjecture_shape, thm_names)
blanchet@38023
   205
blanchet@38023
   206
blanchet@38023
   207
(* generic TPTP-based provers *)
blanchet@38023
   208
blanchet@38455
   209
fun prover_fun atp_name
blanchet@38092
   210
        {exec, required_execs, arguments, proof_delims, known_failures,
blanchet@38092
   211
         max_new_relevant_facts_per_iter, prefers_theory_relevant,
blanchet@38092
   212
         explicit_forall}
blanchet@38455
   213
        ({debug, verbose, overlord, full_types, explicit_apply,
blanchet@38455
   214
          relevance_threshold, relevance_convergence, theory_relevant,
blanchet@38455
   215
          defs_relevant, isar_proof, isar_shrink_factor, timeout, ...} : params)
blanchet@38100
   216
        minimize_command
blanchet@38084
   217
        ({subgoal, goal, relevance_override, axioms} : problem) =
blanchet@38023
   218
  let
blanchet@38023
   219
    val (ctxt, (_, th)) = goal;
blanchet@38023
   220
    val thy = ProofContext.theory_of ctxt
blanchet@38023
   221
    val (params, hyp_ts, concl_t) = strip_subgoal th subgoal
blanchet@38455
   222
blanchet@38455
   223
    fun print s = (priority s; if debug then tracing s else ())
blanchet@38455
   224
    fun print_v f = () |> verbose ? print o f
blanchet@38455
   225
    fun print_d f = () |> debug ? print o f
blanchet@38455
   226
blanchet@38084
   227
    val the_axioms =
blanchet@38084
   228
      case axioms of
blanchet@38083
   229
        SOME axioms => axioms
blanchet@38455
   230
      | NONE =>
blanchet@38455
   231
        (print_d (fn () => "Selecting relevant facts for " ^ quote atp_name ^
blanchet@38455
   232
                           ".");
blanchet@38455
   233
         relevant_facts full_types relevance_threshold relevance_convergence
blanchet@38455
   234
                        defs_relevant max_new_relevant_facts_per_iter
blanchet@38455
   235
                        (the_default prefers_theory_relevant theory_relevant)
blanchet@38455
   236
                        relevance_override goal hyp_ts concl_t
blanchet@38455
   237
         |> tap ((fn n => print_v (fn () =>
blanchet@38455
   238
                      "Selected " ^ string_of_int n ^ " fact" ^ plural_s n ^
blanchet@38455
   239
                      " for " ^ quote atp_name ^ ".")) o length))
blanchet@38023
   240
blanchet@38023
   241
    (* path to unique problem file *)
blanchet@38023
   242
    val the_dest_dir = if overlord then getenv "ISABELLE_HOME_USER"
blanchet@38023
   243
                       else Config.get ctxt dest_dir;
blanchet@38023
   244
    val the_problem_prefix = Config.get ctxt problem_prefix;
blanchet@38023
   245
    fun prob_pathname nr =
blanchet@38023
   246
      let
blanchet@38023
   247
        val probfile =
blanchet@38455
   248
          Path.basic ((if overlord then "prob_" ^ atp_name
blanchet@38023
   249
                       else the_problem_prefix ^ serial_string ())
blanchet@38023
   250
                      ^ "_" ^ string_of_int nr)
blanchet@38023
   251
      in
blanchet@38023
   252
        if the_dest_dir = "" then File.tmp_path probfile
blanchet@38023
   253
        else if File.exists (Path.explode the_dest_dir)
blanchet@38023
   254
        then Path.append (Path.explode the_dest_dir) probfile
blanchet@38023
   255
        else error ("No such directory: " ^ the_dest_dir ^ ".")
blanchet@38023
   256
      end;
blanchet@38023
   257
blanchet@38092
   258
    val command = Path.explode (getenv (fst exec) ^ "/" ^ snd exec)
blanchet@38023
   259
    (* write out problem file and call prover *)
blanchet@38023
   260
    fun command_line complete probfile =
blanchet@38023
   261
      let
blanchet@38023
   262
        val core = File.shell_path command ^ " " ^ arguments complete timeout ^
blanchet@38023
   263
                   " " ^ File.shell_path probfile
blanchet@38023
   264
      in
blanchet@38023
   265
        (if Config.get ctxt measure_runtime then
blanchet@38023
   266
           "TIMEFORMAT='%3U'; { time " ^ core ^ " ; }"
blanchet@38023
   267
         else
blanchet@38023
   268
           "exec " ^ core) ^ " 2>&1"
blanchet@38023
   269
      end
blanchet@38023
   270
    fun split_time s =
blanchet@38023
   271
      let
blanchet@38023
   272
        val split = String.tokens (fn c => str c = "\n");
blanchet@38023
   273
        val (output, t) = s |> split |> split_last |> apfst cat_lines;
blanchet@38023
   274
        fun as_num f = f >> (fst o read_int);
blanchet@38023
   275
        val num = as_num (Scan.many1 Symbol.is_ascii_digit);
blanchet@38023
   276
        val digit = Scan.one Symbol.is_ascii_digit;
blanchet@38023
   277
        val num3 = as_num (digit ::: digit ::: (digit >> single));
blanchet@38023
   278
        val time = num --| Scan.$$ "." -- num3 >> (fn (a, b) => a * 1000 + b);
blanchet@38023
   279
        val as_time = the_default 0 o Scan.read Symbol.stopper time o explode;
blanchet@38023
   280
      in (output, as_time t) end;
blanchet@38023
   281
    fun run_on probfile =
blanchet@38092
   282
      case filter (curry (op =) "" o getenv o fst) (exec :: required_execs) of
blanchet@38032
   283
        (home_var, _) :: _ =>
blanchet@38023
   284
        error ("The environment variable " ^ quote home_var ^ " is not set.")
blanchet@38032
   285
      | [] =>
blanchet@38032
   286
        if File.exists command then
blanchet@38032
   287
          let
blanchet@38032
   288
            fun do_run complete =
blanchet@38032
   289
              let
blanchet@38032
   290
                val command = command_line complete probfile
blanchet@38032
   291
                val ((output, msecs), res_code) =
blanchet@38032
   292
                  bash_output command
blanchet@38032
   293
                  |>> (if overlord then
blanchet@38032
   294
                         prefix ("% " ^ command ^ "\n% " ^ timestamp () ^ "\n")
blanchet@38032
   295
                       else
blanchet@38032
   296
                         I)
blanchet@38032
   297
                  |>> (if Config.get ctxt measure_runtime then split_time
blanchet@38032
   298
                       else rpair 0)
blanchet@38032
   299
                val (proof, outcome) =
blanchet@38032
   300
                  extract_proof_and_outcome complete res_code proof_delims
blanchet@38032
   301
                                            known_failures output
blanchet@38032
   302
              in (output, msecs, proof, outcome) end
blanchet@38455
   303
            val _ = print_d (fn () => "Preparing problem for " ^
blanchet@38455
   304
                                      quote atp_name ^ "...")
blanchet@38032
   305
            val readable_names = debug andalso overlord
blanchet@38282
   306
            val (problem, pool, conjecture_offset, axiom_names) =
blanchet@38282
   307
              prepare_problem ctxt readable_names explicit_forall full_types
blanchet@38282
   308
                              explicit_apply hyp_ts concl_t the_axioms
blanchet@38282
   309
            val _ = File.write_list probfile (strings_for_tptp_problem problem)
blanchet@38032
   310
            val conjecture_shape =
blanchet@38032
   311
              conjecture_offset + 1 upto conjecture_offset + length hyp_ts + 1
blanchet@38040
   312
              |> map single
blanchet@38455
   313
            val _ = print_d (fn () => "Running " ^ quote atp_name ^ "...")
blanchet@38032
   314
            val result =
blanchet@38032
   315
              do_run false
blanchet@38032
   316
              |> (fn (_, msecs0, _, SOME _) =>
blanchet@38032
   317
                     do_run true
blanchet@38032
   318
                     |> (fn (output, msecs, proof, outcome) =>
blanchet@38032
   319
                            (output, msecs0 + msecs, proof, outcome))
blanchet@38032
   320
                   | result => result)
blanchet@38282
   321
          in ((pool, conjecture_shape, axiom_names), result) end
blanchet@38032
   322
        else
blanchet@38032
   323
          error ("Bad executable: " ^ Path.implode command ^ ".")
blanchet@38023
   324
blanchet@38023
   325
    (* If the problem file has not been exported, remove it; otherwise, export
blanchet@38023
   326
       the proof file too. *)
blanchet@38023
   327
    fun cleanup probfile =
blanchet@38023
   328
      if the_dest_dir = "" then try File.rm probfile else NONE
blanchet@38023
   329
    fun export probfile (_, (output, _, _, _)) =
blanchet@38023
   330
      if the_dest_dir = "" then
blanchet@38023
   331
        ()
blanchet@38023
   332
      else
blanchet@38023
   333
        File.write (Path.explode (Path.implode probfile ^ "_proof")) output
blanchet@38023
   334
blanchet@38282
   335
    val ((pool, conjecture_shape, axiom_names),
blanchet@38282
   336
         (output, msecs, proof, outcome)) =
blanchet@38023
   337
      with_path cleanup export run_on (prob_pathname subgoal)
blanchet@38282
   338
    val (conjecture_shape, axiom_names) =
blanchet@38023
   339
      repair_conjecture_shape_and_theorem_names output conjecture_shape
blanchet@38282
   340
                                                axiom_names
blanchet@38023
   341
blanchet@38023
   342
    val (message, used_thm_names) =
blanchet@38023
   343
      case outcome of
blanchet@38023
   344
        NONE =>
blanchet@38023
   345
        proof_text isar_proof
blanchet@38023
   346
            (pool, debug, isar_shrink_factor, ctxt, conjecture_shape)
blanchet@38282
   347
            (full_types, minimize_command, proof, axiom_names, th, subgoal)
blanchet@38023
   348
      | SOME failure => (string_for_failure failure ^ "\n", [])
blanchet@38023
   349
  in
blanchet@38023
   350
    {outcome = outcome, message = message, pool = pool,
blanchet@38023
   351
     used_thm_names = used_thm_names, atp_run_time_in_msecs = msecs,
blanchet@38282
   352
     output = output, proof = proof, axiom_names = axiom_names,
blanchet@38083
   353
     conjecture_shape = conjecture_shape}
blanchet@38023
   354
  end
blanchet@38023
   355
blanchet@38023
   356
fun get_prover_fun thy name = prover_fun name (get_prover thy name)
blanchet@38023
   357
blanchet@37584
   358
fun start_prover_thread (params as {verbose, full_types, timeout, ...}) i n
blanchet@38455
   359
                        relevance_override minimize_command proof_state
blanchet@38455
   360
                        atp_name =
blanchet@36379
   361
  let
blanchet@38023
   362
    val thy = Proof.theory_of proof_state
blanchet@37584
   363
    val birth_time = Time.now ()
blanchet@37584
   364
    val death_time = Time.+ (birth_time, timeout)
blanchet@38455
   365
    val prover = get_prover_fun thy atp_name
blanchet@36379
   366
    val {context = ctxt, facts, goal} = Proof.goal proof_state;
blanchet@36379
   367
    val desc =
blanchet@38455
   368
      "ATP " ^ quote atp_name ^ " for subgoal " ^ string_of_int i ^ ":\n" ^
blanchet@36392
   369
      Syntax.string_of_term ctxt (Thm.term_of (Thm.cprem_of goal i));
blanchet@37584
   370
  in
blanchet@37585
   371
    Async_Manager.launch das_Tool verbose birth_time death_time desc
blanchet@37584
   372
        (fn () =>
blanchet@37584
   373
            let
blanchet@37584
   374
              val problem =
blanchet@37584
   375
                {subgoal = i, goal = (ctxt, (facts, goal)),
blanchet@38084
   376
                 relevance_override = relevance_override, axioms = NONE}
blanchet@37584
   377
            in
blanchet@38455
   378
              prover params (minimize_command atp_name) problem |> #message
blanchet@37994
   379
              handle ERROR message => "Error: " ^ message ^ "\n"
blanchet@38290
   380
                   | exn => "Internal error: \n" ^ ML_Compiler.exn_message exn ^
blanchet@38290
   381
                            "\n"
blanchet@37584
   382
            end)
blanchet@37584
   383
  end
wenzelm@28582
   384
blanchet@38044
   385
fun run_sledgehammer {atps = [], ...} _ _ _ _ = error "No ATP is set."
blanchet@38044
   386
  | run_sledgehammer (params as {atps, ...}) i relevance_override
blanchet@38044
   387
                     minimize_command state =
blanchet@38044
   388
    case subgoal_count state of
blanchet@38044
   389
      0 => priority "No subgoal!"
blanchet@38044
   390
    | n =>
blanchet@38044
   391
      let
blanchet@38044
   392
        val _ = kill_atps ()
blanchet@38044
   393
        val _ = priority "Sledgehammering..."
blanchet@38044
   394
        val _ = app (start_prover_thread params i n relevance_override
blanchet@38044
   395
                                         minimize_command state) atps
blanchet@38044
   396
      in () end
blanchet@38044
   397
blanchet@38023
   398
val setup =
blanchet@38023
   399
  dest_dir_setup
blanchet@38023
   400
  #> problem_prefix_setup
blanchet@38023
   401
  #> measure_runtime_setup
blanchet@38023
   402
wenzelm@28582
   403
end;