115 [Metis_Method (SOME no_typesN, NONE)] |
115 [Metis_Method (SOME no_typesN, NONE)] |
116 val rewrite_methods = simp_based_methods @ basic_systematic_methods @ basic_arith_methods |
116 val rewrite_methods = simp_based_methods @ basic_systematic_methods @ basic_arith_methods |
117 val skolem_methods = basic_systematic_methods |
117 val skolem_methods = basic_systematic_methods |
118 |
118 |
119 fun isar_proof_text ctxt debug isar_proofs smt_proofs isar_params |
119 fun isar_proof_text ctxt debug isar_proofs smt_proofs isar_params |
120 (one_line_params as (_, _, _, _, subgoal, subgoal_count)) = |
120 (one_line_params as ((_, one_line_play), banner, used_facts, minimize_command, subgoal, |
|
121 subgoal_count)) = |
121 let |
122 let |
122 val _ = if debug then Output.urgent_message "Constructing Isar proof..." else () |
123 val _ = if debug then Output.urgent_message "Constructing Isar proof..." else () |
123 |
124 |
124 fun isar_proof_of () = |
125 fun generate_proof_text () = |
125 let |
126 let |
126 val (verbose, alt_metis_args, preplay_timeout, compress, try0, minimize, atp_proof, goal) = |
127 val (verbose, alt_metis_args, preplay_timeout, compress, try0, minimize, atp_proof, goal) = |
127 isar_params () |
128 isar_params () |
128 |
129 |
129 val systematic_methods = insert (op =) (Metis_Method alt_metis_args) systematic_methods0 |
130 val systematic_methods = insert (op =) (Metis_Method alt_metis_args) systematic_methods0 |
327 |> `(preplay_outcome_of_isar_proof (!preplay_data)) |
328 |> `(preplay_outcome_of_isar_proof (!preplay_data)) |
328 ||> (comment_isar_proof comment_of |
329 ||> (comment_isar_proof comment_of |
329 #> chain_isar_proof |
330 #> chain_isar_proof |
330 #> kill_useless_labels_in_isar_proof |
331 #> kill_useless_labels_in_isar_proof |
331 #> relabel_isar_proof_nicely) |
332 #> relabel_isar_proof_nicely) |
332 |
|
333 val isar_text = string_of_isar_proof ctxt subgoal subgoal_count isar_proof |
|
334 val msg = |
|
335 (if verbose then |
|
336 let val num_steps = add_isar_steps (steps_of_isar_proof isar_proof) 0 in |
|
337 [string_of_int num_steps ^ " step" ^ plural_s num_steps] |
|
338 end |
|
339 else |
|
340 []) @ |
|
341 (if do_preplay then [string_of_play_outcome play_outcome] else []) |
|
342 in |
333 in |
343 "\n\nStructured proof" ^ (commas msg |> not (null msg) ? enclose " (" ")") ^ ":\n" ^ |
334 (case add_isar_steps (steps_of_isar_proof isar_proof) 0 of |
344 Active.sendback_markup [Markup.padding_command] isar_text |
335 1 => |
|
336 one_line_proof_text ctxt 0 |
|
337 (if play_outcome_ord (play_outcome, one_line_play) = LESS then |
|
338 (case isar_proof of |
|
339 Proof (_, _, [Prove (_, _, _, _, _, (_, gfs), meth :: _, _)]) => |
|
340 let val used_facts' = filter (member (op =) gfs o fst) used_facts in |
|
341 ((meth, play_outcome), banner, used_facts', minimize_command, subgoal, |
|
342 subgoal_count) |
|
343 end) |
|
344 else |
|
345 one_line_params) ^ |
|
346 (if isar_proofs = SOME true then "\n(No structured proof available -- proof too simple.)" |
|
347 else "") |
|
348 | num_steps => |
|
349 let |
|
350 val msg = |
|
351 (if verbose then [string_of_int num_steps ^ " step" ^ plural_s num_steps] else []) @ |
|
352 (if do_preplay then [string_of_play_outcome play_outcome] else []) |
|
353 in |
|
354 one_line_proof_text ctxt 0 one_line_params ^ |
|
355 "\n\nStructured proof" ^ (commas msg |> not (null msg) ? enclose " (" ")") ^ ":\n" ^ |
|
356 Active.sendback_markup [Markup.padding_command] |
|
357 (string_of_isar_proof ctxt subgoal subgoal_count isar_proof) |
|
358 end) |
345 end |
359 end |
346 |
|
347 val one_line_proof = one_line_proof_text ctxt 0 one_line_params |
|
348 val isar_proof = |
|
349 if debug then |
|
350 isar_proof_of () |
|
351 else |
|
352 (case try isar_proof_of () of |
|
353 SOME s => s |
|
354 | NONE => |
|
355 if isar_proofs = SOME true then "\nWarning: Isar proof construction failed." else "") |
|
356 in |
360 in |
357 one_line_proof ^ isar_proof |
361 if debug then |
|
362 generate_proof_text () |
|
363 else |
|
364 (case try generate_proof_text () of |
|
365 SOME s => s |
|
366 | NONE => |
|
367 one_line_proof_text ctxt 0 one_line_params ^ |
|
368 (if isar_proofs = SOME true then "\nWarning: Isar proof construction failed." else "")) |
358 end |
369 end |
359 |
370 |
360 fun isar_proof_would_be_a_good_idea smt_proofs (meth, play) = |
371 fun isar_proof_would_be_a_good_idea smt_proofs (meth, play) = |
361 (case play of |
372 (case play of |
362 Played _ => meth = SMT2_Method andalso smt_proofs <> SOME true |
373 Played _ => meth = SMT2_Method andalso smt_proofs <> SOME true |