equal
deleted
inserted
replaced
22 val protect: thm -> thm |
22 val protect: thm -> thm |
23 val conclude: thm -> thm |
23 val conclude: thm -> thm |
24 val check_finished: Proof.context -> thm -> thm |
24 val check_finished: Proof.context -> thm -> thm |
25 val finish: Proof.context -> thm -> thm |
25 val finish: Proof.context -> thm -> thm |
26 val norm_result: thm -> thm |
26 val norm_result: thm -> thm |
27 val fork_name: string -> (unit -> 'a) -> 'a future |
27 val fork_name: string -> int -> (unit -> 'a) -> 'a future |
28 val fork: (unit -> 'a) -> 'a future |
28 val fork: int -> (unit -> 'a) -> 'a future |
29 val peek_futures: serial -> unit future list |
29 val peek_futures: serial -> unit future list |
30 val reset_futures: unit -> Future.group list |
30 val reset_futures: unit -> Future.group list |
31 val future_enabled_level: int -> bool |
31 val future_enabled_level: int -> bool |
32 val future_enabled: unit -> bool |
32 val future_enabled: unit -> bool |
33 val future_enabled_nested: int -> bool |
33 val future_enabled_nested: int -> bool |
132 let val props = Markup.properties [(Markup.taskN, Task_Queue.str_of_task task)] |
132 let val props = Markup.properties [(Markup.taskN, Task_Queue.str_of_task task)] |
133 in Output.status (implode (map (Markup.markup_only o props) markups)) end; |
133 in Output.status (implode (map (Markup.markup_only o props) markups)) end; |
134 |
134 |
135 in |
135 in |
136 |
136 |
137 fun fork_name name e = |
137 fun fork_name name pri e = |
138 uninterruptible (fn _ => fn () => |
138 uninterruptible (fn _ => fn () => |
139 let |
139 let |
140 val pos = Position.thread_data (); |
140 val pos = Position.thread_data (); |
141 val id = the_default 0 (Position.parse_id pos); |
141 val id = the_default 0 (Position.parse_id pos); |
142 val _ = count_forked 1; |
142 val _ = count_forked 1; |
143 |
143 |
144 val future = |
144 val future = |
145 (singleton o Future.forks) |
145 (singleton o Future.forks) |
146 {name = name, group = NONE, deps = [], pri = ~1, interrupts = false} |
146 {name = name, group = NONE, deps = [], pri = pri, interrupts = false} |
147 (fn () => |
147 (fn () => |
148 let |
148 let |
149 val task = the (Future.worker_task ()); |
149 val task = the (Future.worker_task ()); |
150 val _ = status task [Markup.running]; |
150 val _ = status task [Markup.running]; |
151 val result = |
151 val result = |
165 in Exn.release result end); |
165 in Exn.release result end); |
166 val _ = status (Future.task_of future) [Markup.forked]; |
166 val _ = status (Future.task_of future) [Markup.forked]; |
167 val _ = register_forked id future; |
167 val _ = register_forked id future; |
168 in future end) (); |
168 in future end) (); |
169 |
169 |
170 fun fork e = fork_name "Goal.fork" e; |
170 fun fork pri e = fork_name "Goal.fork" pri e; |
171 |
171 |
172 fun forked_count () = #1 (Synchronized.value forked_proofs); |
172 fun forked_count () = #1 (Synchronized.value forked_proofs); |
173 |
173 |
174 fun peek_futures id = |
174 fun peek_futures id = |
175 Inttab.lookup_list (#3 (Synchronized.value forked_proofs)) id; |
175 Inttab.lookup_list (#3 (Synchronized.value forked_proofs)) id; |
283 else err ("Proved a different theorem: " ^ string_of_term (Thm.prop_of res)) |
283 else err ("Proved a different theorem: " ^ string_of_term (Thm.prop_of res)) |
284 end); |
284 end); |
285 val res = |
285 val res = |
286 if immediate orelse #maxidx (Thm.rep_cterm stmt) >= 0 orelse not (future_enabled ()) |
286 if immediate orelse #maxidx (Thm.rep_cterm stmt) >= 0 orelse not (future_enabled ()) |
287 then result () |
287 then result () |
288 else future_result ctxt' (fork result) (Thm.term_of stmt); |
288 else future_result ctxt' (fork ~1 result) (Thm.term_of stmt); |
289 in |
289 in |
290 Conjunction.elim_balanced (length props) res |
290 Conjunction.elim_balanced (length props) res |
291 |> map (Assumption.export false ctxt' ctxt) |
291 |> map (Assumption.export false ctxt' ctxt) |
292 |> Variable.export ctxt' ctxt |
292 |> Variable.export ctxt' ctxt |
293 |> map Drule.zero_var_indexes |
293 |> map Drule.zero_var_indexes |