src/HOL/Tools/ATP_Manager/atp_manager.ML
author boehmes
Sat Oct 03 12:05:40 2009 +0200 (2009-10-03)
changeset 32864 a226f29d4bdc
parent 32824 712ad8109fff
child 32865 f8d1e16ec758
permissions -rw-r--r--
re-organized signature of AtpWrapper structure: records instead of unnamed parameters and return values,
eliminated unused provers,
turned references into configuration values
wenzelm@32327
     1
(*  Title:      HOL/Tools/ATP_Manager/atp_manager.ML
wenzelm@28477
     2
    Author:     Fabian Immler, TU Muenchen
wenzelm@28477
     3
wenzelm@28571
     4
ATP threads are registered here.
wenzelm@28571
     5
Threads with the same birth-time are seen as one group.
wenzelm@28571
     6
All threads of a group are killed when one thread of it has been successful,
wenzelm@28571
     7
or after a certain time,
wenzelm@28571
     8
or when the maximum number of threads exceeds; then the oldest thread is killed.
wenzelm@28477
     9
*)
wenzelm@28477
    10
wenzelm@28477
    11
signature ATP_MANAGER =
wenzelm@28477
    12
sig
wenzelm@28586
    13
  val get_atps: unit -> string
wenzelm@28477
    14
  val set_atps: string -> unit
wenzelm@28586
    15
  val get_max_atps: unit -> int
wenzelm@28586
    16
  val set_max_atps: int -> unit
wenzelm@28586
    17
  val get_timeout: unit -> int
wenzelm@28477
    18
  val set_timeout: int -> unit
nipkow@31791
    19
  val get_full_types: unit -> bool
wenzelm@31793
    20
  val set_full_types: bool -> unit
wenzelm@28586
    21
  val kill: unit -> unit
wenzelm@28586
    22
  val info: unit -> unit
wenzelm@29112
    23
  val messages: int option -> unit
boehmes@32864
    24
  val add_prover: string * AtpWrapper.prover -> theory -> theory
wenzelm@28484
    25
  val print_provers: theory -> unit
boehmes@32864
    26
  val get_prover: string -> theory -> AtpWrapper.prover option
wenzelm@28571
    27
  val sledgehammer: string list -> Proof.state -> unit
wenzelm@28477
    28
end;
wenzelm@28477
    29
wenzelm@28586
    30
structure AtpManager: ATP_MANAGER =
wenzelm@28477
    31
struct
wenzelm@28477
    32
wenzelm@28586
    33
(** preferences **)
wenzelm@28586
    34
wenzelm@29112
    35
val message_store_limit = 20;
wenzelm@29112
    36
val message_display_limit = 5;
wenzelm@29112
    37
wenzelm@28586
    38
local
wenzelm@28586
    39
nipkow@32824
    40
val atps = Unsynchronized.ref "e spass remote_vampire";
wenzelm@32740
    41
val max_atps = Unsynchronized.ref 5;   (* ~1 means infinite number of atps *)
wenzelm@32740
    42
val timeout = Unsynchronized.ref 60;
wenzelm@32740
    43
val full_types = Unsynchronized.ref false;
wenzelm@28586
    44
wenzelm@28586
    45
in
wenzelm@28586
    46
wenzelm@28586
    47
fun get_atps () = CRITICAL (fn () => ! atps);
wenzelm@28586
    48
fun set_atps str = CRITICAL (fn () => atps := str);
wenzelm@28586
    49
wenzelm@28586
    50
fun get_max_atps () = CRITICAL (fn () => ! max_atps);
wenzelm@28586
    51
fun set_max_atps number = CRITICAL (fn () => max_atps := number);
wenzelm@28586
    52
wenzelm@28586
    53
fun get_timeout () = CRITICAL (fn () => ! timeout);
wenzelm@28586
    54
fun set_timeout time = CRITICAL (fn () => timeout := time);
wenzelm@28586
    55
nipkow@31791
    56
fun get_full_types () = CRITICAL (fn () => ! full_types);
wenzelm@31793
    57
fun set_full_types bool = CRITICAL (fn () => full_types := bool);
nipkow@31791
    58
wenzelm@28586
    59
val _ =
wenzelm@30982
    60
  ProofGeneralPgip.add_preference Preferences.category_proof
wenzelm@28586
    61
    (Preferences.string_pref atps
wenzelm@28589
    62
      "ATP: provers" "Default automatic provers (separated by whitespace)");
wenzelm@28586
    63
wenzelm@30982
    64
val _ =
wenzelm@30982
    65
  ProofGeneralPgip.add_preference Preferences.category_proof
wenzelm@28586
    66
    (Preferences.int_pref max_atps
wenzelm@28589
    67
      "ATP: maximum number" "How many provers may run in parallel");
wenzelm@28586
    68
wenzelm@30982
    69
val _ =
wenzelm@30982
    70
  ProofGeneralPgip.add_preference Preferences.category_proof
wenzelm@28586
    71
    (Preferences.int_pref timeout
wenzelm@28589
    72
      "ATP: timeout" "ATPs will be interrupted after this time (in seconds)");
wenzelm@28586
    73
nipkow@31791
    74
val _ =
nipkow@31791
    75
  ProofGeneralPgip.add_preference Preferences.category_proof
nipkow@31791
    76
    (Preferences.bool_pref full_types
nipkow@31791
    77
      "ATP: full types" "ATPs will use full type information");
nipkow@31791
    78
wenzelm@28586
    79
end;
wenzelm@28586
    80
wenzelm@28586
    81
wenzelm@28586
    82
wenzelm@28586
    83
(** thread management **)
wenzelm@28586
    84
wenzelm@28582
    85
(* data structures over threads *)
wenzelm@28582
    86
wenzelm@28582
    87
structure ThreadHeap = HeapFun
wenzelm@28582
    88
(
wenzelm@28582
    89
  type elem = Time.time * Thread.thread;
wenzelm@28582
    90
  fun ord ((a, _), (b, _)) = Time.compare (a, b);
wenzelm@28595
    91
);
wenzelm@28582
    92
wenzelm@31368
    93
fun lookup_thread xs = AList.lookup Thread.equal xs;
wenzelm@31368
    94
fun delete_thread xs = AList.delete Thread.equal xs;
wenzelm@31368
    95
fun update_thread xs = AList.update Thread.equal xs;
wenzelm@28582
    96
wenzelm@28582
    97
wenzelm@28582
    98
(* state of thread manager *)
wenzelm@28477
    99
wenzelm@28582
   100
datatype T = State of
immler@30830
   101
 {managing_thread: Thread.thread option,
immler@30830
   102
  timeout_heap: ThreadHeap.T,
wenzelm@28582
   103
  oldest_heap: ThreadHeap.T,
wenzelm@28582
   104
  active: (Thread.thread * (Time.time * Time.time * string)) list,
wenzelm@29112
   105
  cancelling: (Thread.thread * (Time.time * Time.time * string)) list,
immler@29620
   106
  messages: string list,
immler@29620
   107
  store: string list};
wenzelm@28582
   108
immler@30830
   109
fun make_state managing_thread timeout_heap oldest_heap active cancelling messages store =
immler@30830
   110
  State {managing_thread = managing_thread, timeout_heap = timeout_heap, oldest_heap = oldest_heap,
immler@29620
   111
    active = active, cancelling = cancelling, messages = messages, store = store};
wenzelm@28582
   112
immler@30830
   113
val state = Synchronized.var "atp_manager"
immler@30830
   114
  (make_state NONE ThreadHeap.empty ThreadHeap.empty [] [] [] []);
wenzelm@28582
   115
wenzelm@31368
   116
wenzelm@29150
   117
(* unregister thread *)
wenzelm@28582
   118
immler@29620
   119
fun unregister (success, message) thread = Synchronized.change state
immler@30830
   120
  (fn state as State {managing_thread, timeout_heap, oldest_heap, active, cancelling, messages, store} =>
wenzelm@29150
   121
    (case lookup_thread active thread of
wenzelm@29150
   122
      SOME (birthtime, _, description) =>
wenzelm@29150
   123
        let
wenzelm@29150
   124
          val (group, active') =
wenzelm@29150
   125
            if success then List.partition (fn (_, (tb, _, _)) => tb = birthtime) active
wenzelm@29150
   126
            else List.partition (fn (th, _) => Thread.equal (th, thread)) active
wenzelm@28582
   127
wenzelm@29150
   128
          val now = Time.now ()
wenzelm@29150
   129
          val cancelling' =
immler@29620
   130
            fold (fn (th, (tb, _, desc)) => update_thread (th, (tb, now, desc))) group cancelling
wenzelm@28582
   131
immler@29620
   132
          val message' = description ^ "\n" ^ message ^
immler@29596
   133
            (if length group <= 1 then ""
immler@29596
   134
             else "\nInterrupted " ^ string_of_int (length group - 1) ^ " other group members")
immler@29620
   135
          val store' = message' ::
immler@29620
   136
            (if length store <= message_store_limit then store
immler@29620
   137
             else #1 (chop message_store_limit store))
immler@30830
   138
        in make_state
immler@30830
   139
          managing_thread timeout_heap oldest_heap active' cancelling' (message' :: messages) store'
immler@30830
   140
        end
wenzelm@30800
   141
    | NONE => state));
wenzelm@28582
   142
wenzelm@28582
   143
wenzelm@28595
   144
(* kill excessive atp threads *)
wenzelm@28595
   145
wenzelm@28595
   146
fun excessive_atps active =
wenzelm@28595
   147
  let val max = get_max_atps ()
wenzelm@28595
   148
  in length active > max andalso max > ~1 end;
wenzelm@28595
   149
wenzelm@28595
   150
local
wenzelm@28595
   151
wenzelm@28595
   152
fun kill_oldest () =
wenzelm@28595
   153
  let exception Unchanged in
wenzelm@29112
   154
    Synchronized.change_result state
immler@30830
   155
      (fn State {managing_thread, timeout_heap, oldest_heap, active, cancelling, messages, store} =>
wenzelm@28595
   156
        if ThreadHeap.is_empty oldest_heap orelse not (excessive_atps active)
wenzelm@28595
   157
        then raise Unchanged
wenzelm@28595
   158
        else
wenzelm@28595
   159
          let val ((_, oldest_thread), oldest_heap') = ThreadHeap.min_elem oldest_heap
immler@30830
   160
          in (oldest_thread,
immler@30830
   161
          make_state managing_thread timeout_heap oldest_heap' active cancelling messages store) end)
immler@29620
   162
      |> unregister (false, "Interrupted (maximum number of ATPs exceeded)")
wenzelm@28595
   163
    handle Unchanged => ()
wenzelm@28595
   164
  end;
wenzelm@28595
   165
wenzelm@28595
   166
in
wenzelm@28595
   167
wenzelm@28595
   168
fun kill_excessive () =
wenzelm@28595
   169
  let val State {active, ...} = Synchronized.value state
wenzelm@28595
   170
  in if excessive_atps active then (kill_oldest (); kill_excessive ()) else () end;
wenzelm@28595
   171
wenzelm@28595
   172
end;
wenzelm@28595
   173
immler@29620
   174
fun print_new_messages () =
immler@29620
   175
  let val to_print = Synchronized.change_result state
immler@30830
   176
    (fn State {managing_thread, timeout_heap, oldest_heap, active, cancelling, messages, store} =>
immler@30830
   177
      (messages, make_state managing_thread timeout_heap oldest_heap active cancelling [] store))
wenzelm@30800
   178
  in
wenzelm@30800
   179
    if null to_print then ()
wenzelm@30800
   180
    else priority ("Sledgehammer: " ^ space_implode "\n\n" to_print)
wenzelm@30800
   181
  end;
immler@29620
   182
wenzelm@28595
   183
wenzelm@30800
   184
(* start a watching thread -- only one may exist *)
wenzelm@28582
   185
immler@30830
   186
fun check_thread_manager () = Synchronized.change state
immler@30830
   187
  (fn State {managing_thread, timeout_heap, oldest_heap, active, cancelling, messages, store} =>
immler@30830
   188
    if (case managing_thread of SOME thread => Thread.isActive thread | NONE => false)
immler@30830
   189
    then make_state managing_thread timeout_heap oldest_heap active cancelling messages store
immler@30830
   190
    else let val managing_thread = SOME (SimpleThread.fork false (fn () =>
immler@30830
   191
      let
immler@30830
   192
        val min_wait_time = Time.fromMilliseconds 300
immler@30830
   193
        val max_wait_time = Time.fromSeconds 10
wenzelm@28582
   194
immler@30830
   195
        (* wait for next thread to cancel, or maximum*)
immler@30830
   196
        fun time_limit (State {timeout_heap, ...}) =
immler@30830
   197
          (case try ThreadHeap.min timeout_heap of
immler@30830
   198
            NONE => SOME (Time.+ (Time.now (), max_wait_time))
immler@30830
   199
          | SOME (time, _) => SOME time)
wenzelm@28582
   200
immler@30830
   201
        (* action: find threads whose timeout is reached, and interrupt cancelling threads *)
immler@30830
   202
        fun action (State {managing_thread, timeout_heap, oldest_heap, active, cancelling,
immler@30830
   203
                           messages, store}) =
immler@30830
   204
          let val (timeout_threads, timeout_heap') =
immler@30830
   205
            ThreadHeap.upto (Time.now (), Thread.self ()) timeout_heap
immler@30830
   206
          in
immler@30830
   207
            if null timeout_threads andalso null cancelling andalso not (excessive_atps active)
immler@30830
   208
            then NONE
immler@30830
   209
            else
immler@30830
   210
              let
immler@30830
   211
                val _ = List.app (SimpleThread.interrupt o #1) cancelling
immler@30830
   212
                val cancelling' = filter (Thread.isActive o #1) cancelling
immler@30830
   213
                val state' = make_state
immler@30830
   214
                  managing_thread timeout_heap' oldest_heap active cancelling' messages store
immler@30830
   215
              in SOME (map #2 timeout_threads, state') end
immler@30830
   216
          end
immler@30830
   217
      in
immler@30830
   218
        while Synchronized.change_result state
immler@30830
   219
          (fn st as
immler@30830
   220
            State {managing_thread, timeout_heap, oldest_heap, active, cancelling, messages, store} =>
immler@30830
   221
            if (null active) andalso (null cancelling) andalso (null messages)
immler@30830
   222
            then (false, make_state NONE timeout_heap oldest_heap active cancelling messages store)
immler@30830
   223
            else (true, st))
immler@30830
   224
        do
immler@30830
   225
          (Synchronized.timed_access state time_limit action
immler@30830
   226
            |> these
immler@30830
   227
            |> List.app (unregister (false, "Interrupted (reached timeout)"));
immler@30830
   228
            kill_excessive ();
immler@30830
   229
            print_new_messages ();
immler@30830
   230
            (*give threads time to respond to interrupt*)
immler@30830
   231
            OS.Process.sleep min_wait_time)
immler@30830
   232
      end))
immler@30830
   233
    in make_state managing_thread timeout_heap oldest_heap active cancelling messages store end);
wenzelm@28582
   234
wenzelm@28582
   235
wenzelm@28582
   236
(* thread is registered here by sledgehammer *)
wenzelm@28477
   237
wenzelm@28582
   238
fun register birthtime deadtime (thread, desc) =
immler@30798
   239
 (Synchronized.change state
immler@30830
   240
    (fn State {managing_thread, timeout_heap, oldest_heap, active, cancelling, messages, store} =>
wenzelm@29112
   241
      let
wenzelm@29112
   242
        val timeout_heap' = ThreadHeap.insert (deadtime, thread) timeout_heap
wenzelm@29112
   243
        val oldest_heap' = ThreadHeap.insert (birthtime, thread) oldest_heap
wenzelm@29112
   244
        val active' = update_thread (thread, (birthtime, deadtime, desc)) active
immler@30830
   245
      in make_state managing_thread timeout_heap' oldest_heap' active' cancelling messages store end);
immler@30798
   246
  check_thread_manager ());
wenzelm@28477
   247
wenzelm@28477
   248
wenzelm@28586
   249
wenzelm@28586
   250
(** user commands **)
wenzelm@28582
   251
wenzelm@28586
   252
(* kill: move all threads to cancelling *)
wenzelm@28586
   253
wenzelm@28586
   254
fun kill () = Synchronized.change state
immler@30830
   255
  (fn State {managing_thread, timeout_heap, oldest_heap, active, cancelling, messages, store} =>
wenzelm@28582
   256
    let val formerly_active = map (fn (th, (tb, _, desc)) => (th, (tb, Time.now (), desc))) active
immler@30830
   257
    in make_state
immler@30830
   258
      managing_thread timeout_heap oldest_heap [] (formerly_active @ cancelling) messages store
immler@30830
   259
    end);
wenzelm@28582
   260
wenzelm@28582
   261
wenzelm@29112
   262
(* ATP info *)
wenzelm@28582
   263
wenzelm@28582
   264
fun info () =
wenzelm@28582
   265
  let
wenzelm@29112
   266
    val State {active, cancelling, ...} = Synchronized.value state
wenzelm@29112
   267
wenzelm@28571
   268
    fun running_info (_, (birth_time, dead_time, desc)) = "Running: "
wenzelm@28589
   269
        ^ (string_of_int o Time.toSeconds) (Time.- (Time.now (), birth_time))
wenzelm@28477
   270
        ^ " s  --  "
wenzelm@28589
   271
        ^ (string_of_int o Time.toSeconds) (Time.- (dead_time, Time.now ()))
wenzelm@28571
   272
        ^ " s to live:\n" ^ desc
wenzelm@28571
   273
    fun cancelling_info (_, (_, dead_time, desc)) = "Trying to interrupt thread since "
wenzelm@28586
   274
        ^ (string_of_int o Time.toSeconds) (Time.- (Time.now (), dead_time))
wenzelm@28571
   275
        ^ " s:\n" ^ desc
wenzelm@29112
   276
wenzelm@28589
   277
    val running =
wenzelm@28589
   278
      if null active then "No ATPs running."
wenzelm@28589
   279
      else space_implode "\n\n" ("Running ATPs:" :: map running_info active)
wenzelm@28589
   280
    val interrupting =
wenzelm@28589
   281
      if null cancelling then ""
wenzelm@28589
   282
      else space_implode "\n\n"
wenzelm@28589
   283
        ("Trying to interrupt the following ATPs:" :: map cancelling_info cancelling)
wenzelm@29112
   284
wenzelm@28582
   285
  in writeln (running ^ "\n" ^ interrupting) end;
wenzelm@28582
   286
wenzelm@29112
   287
fun messages opt_limit =
wenzelm@29112
   288
  let
wenzelm@29112
   289
    val limit = the_default message_display_limit opt_limit;
immler@29620
   290
    val State {store = msgs, ...} = Synchronized.value state
wenzelm@29112
   291
    val header = "Recent ATP messages" ^
wenzelm@29112
   292
      (if length msgs <= limit then ":" else " (" ^ string_of_int limit ^ " displayed):");
wenzelm@29116
   293
  in writeln (space_implode "\n\n" (header :: #1 (chop limit msgs))) end;
wenzelm@29112
   294
wenzelm@28582
   295
wenzelm@28477
   296
wenzelm@28586
   297
(** The Sledgehammer **)
wenzelm@28477
   298
wenzelm@28582
   299
(* named provers *)
wenzelm@28484
   300
wenzelm@28582
   301
fun err_dup_prover name = error ("Duplicate prover: " ^ quote name);
wenzelm@28477
   302
wenzelm@28582
   303
structure Provers = TheoryDataFun
wenzelm@28582
   304
(
boehmes@32864
   305
  type T = (AtpWrapper.prover * stamp) Symtab.table
wenzelm@28582
   306
  val empty = Symtab.empty
wenzelm@28582
   307
  val copy = I
wenzelm@28582
   308
  val extend = I
wenzelm@28582
   309
  fun merge _ tabs : T = Symtab.merge (eq_snd op =) tabs
wenzelm@28589
   310
    handle Symtab.DUP dup => err_dup_prover dup
wenzelm@28582
   311
);
wenzelm@28484
   312
boehmes@32864
   313
fun add_prover (name, prover) thy =
wenzelm@28595
   314
  Provers.map (Symtab.update_new (name, (prover, stamp ()))) thy
wenzelm@28582
   315
    handle Symtab.DUP dup => err_dup_prover dup;
wenzelm@28582
   316
wenzelm@28582
   317
fun print_provers thy = Pretty.writeln
wenzelm@28582
   318
  (Pretty.strs ("external provers:" :: sort_strings (Symtab.keys (Provers.get thy))));
wenzelm@28571
   319
immler@31037
   320
fun get_prover name thy = case Symtab.lookup (Provers.get thy) name of
immler@31037
   321
  NONE => NONE
immler@31037
   322
| SOME (prover, _) => SOME prover;
wenzelm@28586
   323
wenzelm@28595
   324
(* start prover thread *)
wenzelm@28484
   325
wenzelm@28595
   326
fun start_prover name birthtime deadtime i proof_state =
immler@31037
   327
  (case get_prover name (Proof.theory_of proof_state) of
wenzelm@28595
   328
    NONE => warning ("Unknown external prover: " ^ quote name)
immler@31037
   329
  | SOME prover =>
wenzelm@28595
   330
      let
wenzelm@28595
   331
        val (ctxt, (_, goal)) = Proof.get_goal proof_state
wenzelm@28595
   332
        val desc =
wenzelm@28595
   333
          "external prover " ^ quote name ^ " for subgoal " ^ string_of_int i ^ ":\n" ^
wenzelm@28595
   334
            Syntax.string_of_term ctxt (Thm.term_of (Thm.cprem_of goal i))
wenzelm@28595
   335
        val _ = SimpleThread.fork true (fn () =>
wenzelm@28595
   336
          let
wenzelm@28595
   337
            val _ = register birthtime deadtime (Thread.self (), desc)
boehmes@32864
   338
            val problem = AtpWrapper.atp_problem_of_goal (get_full_types ()) i
boehmes@32864
   339
              (Proof.get_goal proof_state)
immler@31037
   340
            val result =
boehmes@32864
   341
              let val AtpWrapper.Prover_Result {success, message, ...} =
boehmes@32864
   342
                prover problem (get_timeout ())
immler@31037
   343
              in (success, message) end
wenzelm@28835
   344
              handle ResHolClause.TOO_TRIVIAL
wenzelm@28835
   345
                => (true, "Empty clause: Try this command: " ^ Markup.markup Markup.sendback "apply metis")
wenzelm@28835
   346
              | ERROR msg
wenzelm@28835
   347
                => (false, "Error: " ^ msg)
immler@29620
   348
            val _ = unregister result (Thread.self ())
wenzelm@28595
   349
          in () end handle Interrupt => ())
wenzelm@28595
   350
      in () end);
wenzelm@28582
   351
wenzelm@28582
   352
wenzelm@28582
   353
(* sledghammer for first subgoal *)
wenzelm@28582
   354
wenzelm@28582
   355
fun sledgehammer names proof_state =
wenzelm@28582
   356
  let
wenzelm@28595
   357
    val provers =
wenzelm@28586
   358
      if null names then String.tokens (Symbol.is_ascii_blank o String.str) (get_atps ())
wenzelm@28582
   359
      else names
wenzelm@28582
   360
    val birthtime = Time.now ()
wenzelm@28595
   361
    val deadtime = Time.+ (birthtime, Time.fromSeconds (get_timeout ()))
wenzelm@28595
   362
  in List.app (fn name => start_prover name birthtime deadtime 1 proof_state) provers end;
wenzelm@28582
   363
wenzelm@28582
   364
wenzelm@28586
   365
wenzelm@28586
   366
(** Isar command syntax **)
wenzelm@28582
   367
wenzelm@28582
   368
local structure K = OuterKeyword and P = OuterParse in
wenzelm@28582
   369
wenzelm@28582
   370
val _ =
wenzelm@28582
   371
  OuterSyntax.improper_command "atp_kill" "kill all managed provers" K.diag
wenzelm@28586
   372
    (Scan.succeed (Toplevel.no_timing o Toplevel.imperative kill));
wenzelm@28582
   373
wenzelm@28582
   374
val _ =
wenzelm@28582
   375
  OuterSyntax.improper_command "atp_info" "print information about managed provers" K.diag
wenzelm@28582
   376
    (Scan.succeed (Toplevel.no_timing o Toplevel.imperative info));
wenzelm@28582
   377
wenzelm@28582
   378
val _ =
wenzelm@29112
   379
  OuterSyntax.improper_command "atp_messages" "print recent messages issued by managed provers" K.diag
wenzelm@29112
   380
    (Scan.option (P.$$$ "(" |-- P.nat --| P.$$$ ")") >>
wenzelm@29112
   381
      (fn limit => Toplevel.no_timing o Toplevel.imperative (fn () => messages limit)));
wenzelm@29112
   382
wenzelm@29112
   383
val _ =
wenzelm@28582
   384
  OuterSyntax.improper_command "print_atps" "print external provers" K.diag
wenzelm@28582
   385
    (Scan.succeed (Toplevel.no_timing o Toplevel.unknown_theory o
wenzelm@28582
   386
      Toplevel.keep (print_provers o Toplevel.theory_of)));
wenzelm@28582
   387
wenzelm@28582
   388
val _ =
wenzelm@28582
   389
  OuterSyntax.command "sledgehammer" "call all automatic theorem provers" K.diag
wenzelm@28582
   390
    (Scan.repeat P.xname >> (fn names => Toplevel.no_timing o Toplevel.unknown_proof o
wenzelm@30800
   391
      Toplevel.keep (sledgehammer names o Toplevel.proof_of)));
wenzelm@28582
   392
wenzelm@28582
   393
end;
wenzelm@28582
   394
wenzelm@28582
   395
end;
immler@30537
   396