21 val protect: thm -> thm |
21 val protect: thm -> thm |
22 val conclude: thm -> thm |
22 val conclude: thm -> thm |
23 val check_finished: Proof.context -> thm -> unit |
23 val check_finished: Proof.context -> thm -> unit |
24 val finish: Proof.context -> thm -> thm |
24 val finish: Proof.context -> thm -> thm |
25 val norm_result: thm -> thm |
25 val norm_result: thm -> thm |
|
26 val fork: (unit -> 'a) -> 'a future |
26 val future_enabled: unit -> bool |
27 val future_enabled: unit -> bool |
27 val local_future_enabled: unit -> bool |
28 val local_future_enabled: unit -> bool |
|
29 val local_future_enforced: unit -> bool |
28 val future_result: Proof.context -> thm future -> term -> thm |
30 val future_result: Proof.context -> thm future -> term -> thm |
29 val prove_internal: cterm list -> cterm -> (thm list -> tactic) -> thm |
31 val prove_internal: cterm list -> cterm -> (thm list -> tactic) -> thm |
30 val prove_multi: Proof.context -> string list -> term list -> term list -> |
32 val prove_multi: Proof.context -> string list -> term list -> term list -> |
31 ({prems: thm list, context: Proof.context} -> tactic) -> thm list |
33 ({prems: thm list, context: Proof.context} -> tactic) -> thm list |
32 val prove_future: Proof.context -> string list -> term list -> term -> |
34 val prove_future: Proof.context -> string list -> term list -> term -> |
98 #> MetaSimplifier.norm_hhf_protect |
100 #> MetaSimplifier.norm_hhf_protect |
99 #> Thm.strip_shyps |
101 #> Thm.strip_shyps |
100 #> Drule.zero_var_indexes; |
102 #> Drule.zero_var_indexes; |
101 |
103 |
102 |
104 |
103 (* future_enabled *) |
105 (* parallel proofs *) |
|
106 |
|
107 fun fork e = Future.fork_pri ~1 (fn () => |
|
108 let |
|
109 val _ = Output.status (Markup.markup Markup.forked ""); |
|
110 val x = e (); (*sic*) |
|
111 val _ = Output.status (Markup.markup Markup.joined ""); |
|
112 in x end); |
104 |
113 |
105 val parallel_proofs = Unsynchronized.ref 1; |
114 val parallel_proofs = Unsynchronized.ref 1; |
106 |
115 |
107 fun future_enabled () = |
116 fun future_enabled () = |
108 Multithreading.enabled () andalso Future.is_worker () andalso ! parallel_proofs >= 1; |
117 Multithreading.enabled () andalso Future.is_worker () andalso ! parallel_proofs >= 1; |
109 |
118 |
110 fun local_future_enabled () = future_enabled () andalso ! parallel_proofs >= 2; |
119 fun local_future_enabled () = future_enabled () andalso ! parallel_proofs >= 2; |
|
120 fun local_future_enforced () = future_enabled () andalso ! parallel_proofs >= 3; |
111 |
121 |
112 |
122 |
113 (* future_result *) |
123 (* future_result *) |
114 |
124 |
115 fun future_result ctxt result prop = |
125 fun future_result ctxt result prop = |
196 else err ("Proved a different theorem: " ^ string_of_term (Thm.prop_of res)) |
206 else err ("Proved a different theorem: " ^ string_of_term (Thm.prop_of res)) |
197 end); |
207 end); |
198 val res = |
208 val res = |
199 if immediate orelse #maxidx (Thm.rep_cterm stmt) >= 0 orelse not (future_enabled ()) |
209 if immediate orelse #maxidx (Thm.rep_cterm stmt) >= 0 orelse not (future_enabled ()) |
200 then result () |
210 then result () |
201 else future_result ctxt' (Future.fork_pri ~1 result) (Thm.term_of stmt); |
211 else future_result ctxt' (fork result) (Thm.term_of stmt); |
202 in |
212 in |
203 Conjunction.elim_balanced (length props) res |
213 Conjunction.elim_balanced (length props) res |
204 |> map (Assumption.export false ctxt' ctxt) |
214 |> map (Assumption.export false ctxt' ctxt) |
205 |> Variable.export ctxt' ctxt |
215 |> Variable.export ctxt' ctxt |
206 |> map Drule.zero_var_indexes |
216 |> map Drule.zero_var_indexes |