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