src/HOL/Tools/Sledgehammer/sledgehammer_prover_atp.ML
changeset 77488 615a6a6a4b0b
parent 77432 e51aa922079a
child 77602 7c25451ae2c1
equal deleted inserted replaced
77487:57ede1743caf 77488:615a6a6a4b0b
    95 fun suffix_of_mode Auto_Try = "_try"
    95 fun suffix_of_mode Auto_Try = "_try"
    96   | suffix_of_mode Try = "_try"
    96   | suffix_of_mode Try = "_try"
    97   | suffix_of_mode Normal = ""
    97   | suffix_of_mode Normal = ""
    98   | suffix_of_mode MaSh = ""
    98   | suffix_of_mode MaSh = ""
    99   | suffix_of_mode Minimize = "_min"
    99   | suffix_of_mode Minimize = "_min"
   100 
       
   101 (* Important messages are important but not so important that users want to see them each time. *)
       
   102 val important_message_keep_quotient = 25
       
   103 
   100 
   104 fun run_atp mode name
   101 fun run_atp mode name
   105     ({debug, verbose, overlord, abduce = abduce_max_candidates, strict, max_mono_iters,
   102     ({debug, verbose, overlord, abduce = abduce_max_candidates, strict, max_mono_iters,
   106       max_new_mono_instances, isar_proofs, compress, try0, smt_proofs, minimize, slices, timeout,
   103       max_new_mono_instances, isar_proofs, compress, try0, smt_proofs, minimize, slices, timeout,
   107       preplay_timeout, spy, ...} : params)
   104       preplay_timeout, spy, ...} : params)
   282          (output, run_time, used_from, atp_problem, tstplike_proof, atp_proof,
   279          (output, run_time, used_from, atp_problem, tstplike_proof, atp_proof,
   283           atp_abduce_candidates, outcome),
   280           atp_abduce_candidates, outcome),
   284          (format, type_enc)) =
   281          (format, type_enc)) =
   285       with_cleanup clean_up run () |> tap export
   282       with_cleanup clean_up run () |> tap export
   286 
   283 
   287     val important_message =
       
   288       if mode = Normal andalso Random.random_range 0 (important_message_keep_quotient - 1) = 0
       
   289       then extract_important_message output
       
   290       else ""
       
   291 
       
   292     val (outcome, used_facts, preferred_methss, message) =
   284     val (outcome, used_facts, preferred_methss, message) =
   293       (case outcome of
   285       (case outcome of
   294         NONE =>
   286         NONE =>
   295         let
   287         let
   296           val used_facts = sort_by fst (used_facts_in_atp_proof ctxt (map fst used_from) atp_proof)
   288           val used_facts = sort_by fst (used_facts_in_atp_proof ctxt (map fst used_from) atp_proof)
   340 
   332 
   341                 val one_line_params = (preplay (), proof_banner mode name, subgoal, subgoal_count)
   333                 val one_line_params = (preplay (), proof_banner mode name, subgoal, subgoal_count)
   342                 val num_chained = length (#facts (Proof.goal state))
   334                 val num_chained = length (#facts (Proof.goal state))
   343               in
   335               in
   344                 proof_text ctxt debug isar_proofs smt_proofs isar_params num_chained
   336                 proof_text ctxt debug isar_proofs smt_proofs isar_params num_chained
   345                   one_line_params ^
   337                   one_line_params
   346                 (if important_message <> "" then
       
   347                    "\n\nImportant message from Dr. Geoff Sutcliffe:\n" ^ important_message
       
   348                  else
       
   349                    "")
       
   350               end)
   338               end)
   351         end
   339         end
   352       | SOME failure =>
   340       | SOME failure =>
   353         let
   341         let
   354           val max_abduce_candidates =
   342           val max_abduce_candidates =