283 |
283 |
284 val proof = |
284 val proof = |
285 ProofHistory.applys o Method.proof o apsome Comment.ignore_interest o Comment.ignore_interest'; |
285 ProofHistory.applys o Method.proof o apsome Comment.ignore_interest o Comment.ignore_interest'; |
286 |
286 |
287 |
287 |
|
288 (* print result *) |
|
289 |
|
290 fun pretty_result {kind, name, thm} = |
|
291 Pretty.block [Pretty.str (kind ^ " " ^ name ^ ":"), Pretty.fbrk, Display.pretty_thm thm]; |
|
292 |
|
293 val print_result = Pretty.writeln o pretty_result; |
|
294 fun cond_print_result int res = if int then print_result res else (); |
|
295 |
|
296 fun proof'' f = Toplevel.proof' (f o cond_print_result); |
|
297 |
|
298 |
288 (* local endings *) |
299 (* local endings *) |
289 |
300 |
290 val local_qed = |
301 val local_qed = |
291 Toplevel.proof' o (ProofHistory.applys_close oo Method.local_qed) |
302 proof'' o (ProofHistory.applys_close oo Method.local_qed) o apsome Comment.ignore_interest; |
292 o apsome Comment.ignore_interest; |
|
293 |
303 |
294 val local_terminal_proof = |
304 val local_terminal_proof = |
295 Toplevel.proof' o (ProofHistory.applys_close oo Method.local_terminal_proof) |
305 proof'' o (ProofHistory.applys_close oo Method.local_terminal_proof) o Comment.ignore_interest; |
296 o Comment.ignore_interest; |
306 |
297 |
307 val local_immediate_proof = proof'' (ProofHistory.applys_close o Method.local_immediate_proof); |
298 val local_immediate_proof = |
308 val local_default_proof = proof'' (ProofHistory.applys_close o Method.local_default_proof); |
299 Toplevel.proof' (ProofHistory.applys_close o Method.local_immediate_proof); |
|
300 |
|
301 val local_default_proof = |
|
302 Toplevel.proof' (ProofHistory.applys_close o Method.local_default_proof); |
|
303 |
309 |
304 |
310 |
305 (* global endings *) |
311 (* global endings *) |
306 |
312 |
307 val kill_proof = Proof.theory_of o ProofHistory.current; |
313 val kill_proof = Proof.theory_of o ProofHistory.current; |
308 |
314 |
309 fun global_result finish = Toplevel.proof_to_theory (fn prf => |
315 fun global_result finish = Toplevel.proof_to_theory (fn prf => |
310 let |
316 let |
311 val state = ProofHistory.current prf; |
317 val state = ProofHistory.current prf; |
312 val _ = if Proof.at_bottom state then () else raise Toplevel.UNDEF; |
318 val _ = if Proof.at_bottom state then () else raise Toplevel.UNDEF; |
313 val (thy, {kind, name, thm}) = finish state; |
319 val (thy, res) = finish state; |
314 |
320 in print_result res; thy end); |
315 val prt_result = Pretty.block |
|
316 [Pretty.str (kind ^ " " ^ name ^ ":"), Pretty.fbrk, Display.pretty_thm thm]; |
|
317 in Pretty.writeln prt_result; thy end); |
|
318 |
321 |
319 fun gen_global_qed_with prep_att (alt_name, raw_atts) meth state = |
322 fun gen_global_qed_with prep_att (alt_name, raw_atts) meth state = |
320 let |
323 let |
321 val thy = Proof.theory_of state; |
324 val thy = Proof.theory_of state; |
322 val alt_atts = apsome (map (prep_att thy)) raw_atts; |
325 val alt_atts = apsome (map (prep_att thy)) raw_atts; |