src/HOL/Tools/atp_manager.ML
author wenzelm
Tue, 18 Nov 2008 11:26:59 +0100
changeset 28835 d4d8eba5f781
parent 28595 67e3945b53f1
child 29112 f2b45eea6dac
permissions -rw-r--r--
changes by Fabian Immler: improved handling of prover errors; explicit treatment of clauses that are too trivial for resolution;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
     1
(*  Title:      HOL/Tools/atp_manager.ML
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
     3
    Author:     Fabian Immler, TU Muenchen
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
     4
28571
47d88239658d ** Update from Fabian **
wenzelm
parents: 28543
diff changeset
     5
ATP threads are registered here.
47d88239658d ** Update from Fabian **
wenzelm
parents: 28543
diff changeset
     6
Threads with the same birth-time are seen as one group.
47d88239658d ** Update from Fabian **
wenzelm
parents: 28543
diff changeset
     7
All threads of a group are killed when one thread of it has been successful,
47d88239658d ** Update from Fabian **
wenzelm
parents: 28543
diff changeset
     8
or after a certain time,
47d88239658d ** Update from Fabian **
wenzelm
parents: 28543
diff changeset
     9
or when the maximum number of threads exceeds; then the oldest thread is killed.
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
    10
*)
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
    11
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
    12
signature ATP_MANAGER =
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
    13
sig
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    14
  val get_atps: unit -> string
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
    15
  val set_atps: string -> unit
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    16
  val get_max_atps: unit -> int
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    17
  val set_max_atps: int -> unit
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    18
  val get_timeout: unit -> int
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
    19
  val set_timeout: int -> unit
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    20
  val kill: unit -> unit
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    21
  val info: unit -> unit
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
    22
  type prover = int -> Proof.state -> bool * string
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
    23
  val add_prover: string -> prover -> theory -> theory
28484
4ed9239b09c1 misc simplifcation and tuning;
wenzelm
parents: 28478
diff changeset
    24
  val print_provers: theory -> unit
28571
47d88239658d ** Update from Fabian **
wenzelm
parents: 28543
diff changeset
    25
  val sledgehammer: string list -> Proof.state -> unit
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
    26
end;
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
    27
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    28
structure AtpManager: ATP_MANAGER =
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
    29
struct
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
    30
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    31
(** preferences **)
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    32
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    33
local
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    34
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    35
val atps = ref "e";
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    36
val max_atps = ref 5;   (* ~1 means infinite number of atps *)
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    37
val timeout = ref 60;
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    38
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    39
in
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    40
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    41
fun get_atps () = CRITICAL (fn () => ! atps);
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    42
fun set_atps str = CRITICAL (fn () => atps := str);
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    43
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    44
fun get_max_atps () = CRITICAL (fn () => ! max_atps);
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    45
fun set_max_atps number = CRITICAL (fn () => max_atps := number);
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    46
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    47
fun get_timeout () = CRITICAL (fn () => ! timeout);
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    48
fun set_timeout time = CRITICAL (fn () => timeout := time);
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    49
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    50
val _ =
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    51
  ProofGeneralPgip.add_preference "Proof"
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    52
    (Preferences.string_pref atps
28589
581b2ab9827a adding preferences is now permissive, no error handling here;
wenzelm
parents: 28586
diff changeset
    53
      "ATP: provers" "Default automatic provers (separated by whitespace)");
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    54
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    55
val _ = ProofGeneralPgip.add_preference "Proof"
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    56
    (Preferences.int_pref max_atps
28589
581b2ab9827a adding preferences is now permissive, no error handling here;
wenzelm
parents: 28586
diff changeset
    57
      "ATP: maximum number" "How many provers may run in parallel");
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    58
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    59
val _ = ProofGeneralPgip.add_preference "Proof"
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    60
    (Preferences.int_pref timeout
28589
581b2ab9827a adding preferences is now permissive, no error handling here;
wenzelm
parents: 28586
diff changeset
    61
      "ATP: timeout" "ATPs will be interrupted after this time (in seconds)");
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    62
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    63
end;
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    64
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    65
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    66
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    67
(** thread management **)
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    68
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    69
(* data structures over threads *)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    70
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    71
structure ThreadHeap = HeapFun
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    72
(
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    73
  type elem = Time.time * Thread.thread;
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    74
  fun ord ((a, _), (b, _)) = Time.compare (a, b);
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
    75
);
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    76
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    77
val lookup_thread = AList.lookup Thread.equal;
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    78
val delete_thread = AList.delete Thread.equal;
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    79
val update_thread = AList.update Thread.equal;
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    80
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    81
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    82
(* state of thread manager *)
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
    83
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    84
datatype T = State of
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    85
 {timeout_heap: ThreadHeap.T,
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    86
  oldest_heap: ThreadHeap.T,
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    87
  active: (Thread.thread * (Time.time * Time.time * string)) list,
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    88
  cancelling: (Thread.thread * (Time.time * Time.time * string)) list};
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    89
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    90
fun make_state timeout_heap oldest_heap active cancelling =
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    91
  State {timeout_heap = timeout_heap, oldest_heap = oldest_heap,
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    92
    active = active, cancelling = cancelling};
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    93
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    94
val state = Synchronized.var "atp_manager" (make_state ThreadHeap.empty ThreadHeap.empty [] []);
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
    95
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    96
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
    97
(* the managing thread *)
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    98
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
    99
(*watches over running threads and interrupts them if required*)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   100
val managing_thread = ref (NONE: Thread.thread option);
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
   101
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   102
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   103
(* unregister thread from thread manager -- move to cancelling *)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   104
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   105
fun unregister (success, message) thread = Synchronized.change_result state
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   106
  (fn State {timeout_heap, oldest_heap, active, cancelling} =>
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
   107
    let
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   108
      val info = lookup_thread active thread
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   109
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   110
      (* get birthtime of unregistering thread if successful - for group-killing*)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   111
      val birthtime = case info of NONE => Time.zeroTime
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   112
        | SOME (tb, _, _) => if success then tb else Time.zeroTime
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   113
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   114
      (* move unregistering thread to cancelling *)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   115
      val active' = delete_thread thread active
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   116
      val cancelling' = case info of NONE => cancelling
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   117
        | SOME (tb, _, desc) => update_thread (thread, (tb, Time.now (), desc)) cancelling
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   118
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   119
      (* move all threads of the same group to cancelling *)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   120
      val group_threads = active |> map_filter (fn (th, (tb, _, desc)) =>
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   121
          if tb = birthtime then SOME (th, (tb, Time.now (), desc)) else NONE)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   122
      val active'' = filter_out (fn (_, (tb, _, _)) => tb = birthtime) active'
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   123
      val cancelling'' = append group_threads cancelling'
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   124
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   125
      (* message for user *)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   126
      val message' = case info of NONE => ""
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   127
        | SOME (_, _, desc) => "Sledgehammer: " ^ desc ^ "\n" ^ message ^
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   128
          (if null group_threads then ""
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   129
           else "\nInterrupted " ^ string_of_int (length group_threads - 1) ^ " other group members")
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   130
    in (message', make_state timeout_heap oldest_heap active'' cancelling'') end);
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   131
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   132
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   133
(* kill excessive atp threads *)
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   134
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   135
fun excessive_atps active =
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   136
  let val max = get_max_atps ()
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   137
  in length active > max andalso max > ~1 end;
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   138
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   139
local
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   140
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   141
fun kill_oldest () =
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   142
  let exception Unchanged in
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   143
    Synchronized.change_result state (fn State {timeout_heap, oldest_heap, active, cancelling} =>
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   144
        if ThreadHeap.is_empty oldest_heap orelse not (excessive_atps active)
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   145
        then raise Unchanged
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   146
        else
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   147
          let val ((_, oldest_thread), oldest_heap') = ThreadHeap.min_elem oldest_heap
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   148
          in (oldest_thread, make_state timeout_heap oldest_heap' active cancelling) end)
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   149
      |> (priority o unregister (false, "Interrupted (maximum number of ATPs exceeded)"))
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   150
    handle Unchanged => ()
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   151
  end;
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   152
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   153
in
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   154
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   155
fun kill_excessive () =
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   156
  let val State {active, ...} = Synchronized.value state
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   157
  in if excessive_atps active then (kill_oldest (); kill_excessive ()) else () end;
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   158
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   159
end;
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   160
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   161
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   162
(* start a watching thread which runs forever -- only one may exist *)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   163
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   164
fun check_thread_manager () = CRITICAL (fn () =>
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   165
  if (case ! managing_thread of SOME thread => Thread.isActive thread | NONE => false)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   166
  then () else managing_thread := SOME (SimpleThread.fork false (fn () =>
28571
47d88239658d ** Update from Fabian **
wenzelm
parents: 28543
diff changeset
   167
    let
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   168
      val min_wait_time = Time.fromMilliseconds 300
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   169
      val max_wait_time = Time.fromSeconds 10
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   170
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   171
      (* wait for next thread to cancel, or maximum*)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   172
      fun time_limit (State {timeout_heap, ...}) =
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   173
        (case try ThreadHeap.min timeout_heap of
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   174
          NONE => SOME (Time.+ (Time.now (), max_wait_time))
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   175
        | SOME (time, _) => SOME time)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   176
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   177
      (* action: cancel find threads whose timeout is reached, and interrupt cancelling threads *)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   178
      fun action (State {timeout_heap, oldest_heap, active, cancelling}) =
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   179
        let val (timeout_threads, timeout_heap') =
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   180
          ThreadHeap.upto (Time.now (), Thread.self ()) timeout_heap
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   181
        in
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   182
          if null timeout_threads andalso null cancelling andalso not (excessive_atps active)
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   183
          then NONE
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   184
          else
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   185
            let
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   186
              val _ = List.app (SimpleThread.interrupt o #1) cancelling
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   187
              val cancelling' = filter (Thread.isActive o #1) cancelling
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   188
              val state' = make_state timeout_heap' oldest_heap active cancelling'
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   189
            in SOME (map #2 timeout_threads, state') end
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   190
        end
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   191
    in
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   192
      while true do
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   193
       (Synchronized.timed_access state time_limit action
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   194
        |> these
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   195
        |> List.app (priority o unregister (false, "Interrupted (reached timeout)"));
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   196
        kill_excessive ();
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   197
        (*give threads time to respond to interrupt*)
28571
47d88239658d ** Update from Fabian **
wenzelm
parents: 28543
diff changeset
   198
        OS.Process.sleep min_wait_time)
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   199
    end)));
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   200
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   201
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   202
(* thread is registered here by sledgehammer *)
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
   203
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   204
fun register birthtime deadtime (thread, desc) =
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   205
 (check_thread_manager ();
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   206
  Synchronized.change state (fn State {timeout_heap, oldest_heap, active, cancelling} =>
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   207
    let
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   208
      val timeout_heap' = ThreadHeap.insert (deadtime, thread) timeout_heap
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   209
      val oldest_heap' = ThreadHeap.insert (birthtime, thread) oldest_heap
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   210
      val active' = update_thread (thread, (birthtime, deadtime, desc)) active
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   211
    in make_state timeout_heap' oldest_heap' active' cancelling end));
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
   212
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
   213
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   214
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   215
(** user commands **)
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   216
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   217
(* kill: move all threads to cancelling *)
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   218
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   219
fun kill () = Synchronized.change state
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   220
  (fn State {timeout_heap, oldest_heap, active, cancelling} =>
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   221
    let val formerly_active = map (fn (th, (tb, _, desc)) => (th, (tb, Time.now (), desc))) active
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   222
    in make_state timeout_heap oldest_heap [] (formerly_active @ cancelling) end);
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   223
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   224
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   225
(* info: information on running threads *)
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   226
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   227
fun info () =
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   228
  let
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   229
    val State {timeout_heap, oldest_heap, active, cancelling} = Synchronized.value state
28571
47d88239658d ** Update from Fabian **
wenzelm
parents: 28543
diff changeset
   230
    fun running_info (_, (birth_time, dead_time, desc)) = "Running: "
28589
581b2ab9827a adding preferences is now permissive, no error handling here;
wenzelm
parents: 28586
diff changeset
   231
        ^ (string_of_int o Time.toSeconds) (Time.- (Time.now (), birth_time))
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
   232
        ^ " s  --  "
28589
581b2ab9827a adding preferences is now permissive, no error handling here;
wenzelm
parents: 28586
diff changeset
   233
        ^ (string_of_int o Time.toSeconds) (Time.- (dead_time, Time.now ()))
28571
47d88239658d ** Update from Fabian **
wenzelm
parents: 28543
diff changeset
   234
        ^ " s to live:\n" ^ desc
47d88239658d ** Update from Fabian **
wenzelm
parents: 28543
diff changeset
   235
    fun cancelling_info (_, (_, dead_time, desc)) = "Trying to interrupt thread since "
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   236
        ^ (string_of_int o Time.toSeconds) (Time.- (Time.now (), dead_time))
28571
47d88239658d ** Update from Fabian **
wenzelm
parents: 28543
diff changeset
   237
        ^ " s:\n" ^ desc
28589
581b2ab9827a adding preferences is now permissive, no error handling here;
wenzelm
parents: 28586
diff changeset
   238
    val running =
581b2ab9827a adding preferences is now permissive, no error handling here;
wenzelm
parents: 28586
diff changeset
   239
      if null active then "No ATPs running."
581b2ab9827a adding preferences is now permissive, no error handling here;
wenzelm
parents: 28586
diff changeset
   240
      else space_implode "\n\n" ("Running ATPs:" :: map running_info active)
581b2ab9827a adding preferences is now permissive, no error handling here;
wenzelm
parents: 28586
diff changeset
   241
    val interrupting =
581b2ab9827a adding preferences is now permissive, no error handling here;
wenzelm
parents: 28586
diff changeset
   242
      if null cancelling then ""
581b2ab9827a adding preferences is now permissive, no error handling here;
wenzelm
parents: 28586
diff changeset
   243
      else space_implode "\n\n"
581b2ab9827a adding preferences is now permissive, no error handling here;
wenzelm
parents: 28586
diff changeset
   244
        ("Trying to interrupt the following ATPs:" :: map cancelling_info cancelling)
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   245
  in writeln (running ^ "\n" ^ interrupting) end;
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   246
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   247
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
   248
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   249
(** The Sledgehammer **)
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
   250
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   251
(* named provers *)
28484
4ed9239b09c1 misc simplifcation and tuning;
wenzelm
parents: 28478
diff changeset
   252
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   253
type prover = int -> Proof.state -> bool * string;
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   254
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   255
fun err_dup_prover name = error ("Duplicate prover: " ^ quote name);
28477
9339d4dcec8b version of sledgehammer using threads instead of processes, misc cleanup;
wenzelm
parents:
diff changeset
   256
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   257
structure Provers = TheoryDataFun
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   258
(
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   259
  type T = (prover * stamp) Symtab.table
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   260
  val empty = Symtab.empty
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   261
  val copy = I
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   262
  val extend = I
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   263
  fun merge _ tabs : T = Symtab.merge (eq_snd op =) tabs
28589
581b2ab9827a adding preferences is now permissive, no error handling here;
wenzelm
parents: 28586
diff changeset
   264
    handle Symtab.DUP dup => err_dup_prover dup
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   265
);
28484
4ed9239b09c1 misc simplifcation and tuning;
wenzelm
parents: 28478
diff changeset
   266
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   267
fun add_prover name prover thy =
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   268
  Provers.map (Symtab.update_new (name, (prover, stamp ()))) thy
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   269
    handle Symtab.DUP dup => err_dup_prover dup;
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   270
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   271
fun print_provers thy = Pretty.writeln
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   272
  (Pretty.strs ("external provers:" :: sort_strings (Symtab.keys (Provers.get thy))));
28571
47d88239658d ** Update from Fabian **
wenzelm
parents: 28543
diff changeset
   273
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   274
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   275
(* start prover thread *)
28484
4ed9239b09c1 misc simplifcation and tuning;
wenzelm
parents: 28478
diff changeset
   276
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   277
fun start_prover name birthtime deadtime i proof_state =
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   278
  (case Symtab.lookup (Provers.get (Proof.theory_of proof_state)) name of
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   279
    NONE => warning ("Unknown external prover: " ^ quote name)
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   280
  | SOME (prover, _) =>
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   281
      let
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   282
        val (ctxt, (_, goal)) = Proof.get_goal proof_state
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   283
        val desc =
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   284
          "external prover " ^ quote name ^ " for subgoal " ^ string_of_int i ^ ":\n" ^
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   285
            Syntax.string_of_term ctxt (Thm.term_of (Thm.cprem_of goal i))
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   286
        val _ = SimpleThread.fork true (fn () =>
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   287
          let
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   288
            val _ = register birthtime deadtime (Thread.self (), desc)
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   289
            val result = prover i proof_state
28835
d4d8eba5f781 changes by Fabian Immler:
wenzelm
parents: 28595
diff changeset
   290
              handle ResHolClause.TOO_TRIVIAL
d4d8eba5f781 changes by Fabian Immler:
wenzelm
parents: 28595
diff changeset
   291
                => (true, "Empty clause: Try this command: " ^ Markup.markup Markup.sendback "apply metis")
d4d8eba5f781 changes by Fabian Immler:
wenzelm
parents: 28595
diff changeset
   292
              | ERROR msg
d4d8eba5f781 changes by Fabian Immler:
wenzelm
parents: 28595
diff changeset
   293
                => (false, "Error: " ^ msg)
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   294
            val _ = priority (unregister result (Thread.self ()))
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   295
          in () end handle Interrupt => ())
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   296
      in () end);
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   297
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   298
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   299
(* sledghammer for first subgoal *)
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   300
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   301
fun sledgehammer names proof_state =
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   302
  let
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   303
    val provers =
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   304
      if null names then String.tokens (Symbol.is_ascii_blank o String.str) (get_atps ())
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   305
      else names
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   306
    val birthtime = Time.now ()
28595
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   307
    val deadtime = Time.+ (birthtime, Time.fromSeconds (get_timeout ()))
67e3945b53f1 add_prover: plain prover function, without thread;
wenzelm
parents: 28589
diff changeset
   308
  in List.app (fn name => start_prover name birthtime deadtime 1 proof_state) provers end;
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   309
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   310
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   311
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   312
(** Isar command syntax **)
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   313
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   314
local structure K = OuterKeyword and P = OuterParse in
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   315
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   316
val _ =
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   317
  OuterSyntax.improper_command "atp_kill" "kill all managed provers" K.diag
28586
d238b83ba3fc renamed kill_all to kill, in conformance with atp_kill command;
wenzelm
parents: 28582
diff changeset
   318
    (Scan.succeed (Toplevel.no_timing o Toplevel.imperative kill));
28582
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   319
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   320
val _ =
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   321
  OuterSyntax.improper_command "atp_info" "print information about managed provers" K.diag
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   322
    (Scan.succeed (Toplevel.no_timing o Toplevel.imperative info));
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   323
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   324
val _ =
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   325
  OuterSyntax.improper_command "print_atps" "print external provers" K.diag
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   326
    (Scan.succeed (Toplevel.no_timing o Toplevel.unknown_theory o
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   327
      Toplevel.keep (print_provers o Toplevel.theory_of)));
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   328
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   329
val _ =
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   330
  OuterSyntax.command "sledgehammer" "call all automatic theorem provers" K.diag
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   331
    (Scan.repeat P.xname >> (fn names => Toplevel.no_timing o Toplevel.unknown_proof o
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   332
    Toplevel.keep ((sledgehammer names) o Toplevel.proof_of)));
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   333
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   334
end;
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   335
c269a3045fdf info: back to plain printing;
wenzelm
parents: 28571
diff changeset
   336
end;