src/HOL/Tools/Sledgehammer/sledgehammer_prover_atp.ML
changeset 75000 4466fae54ff9
parent 74981 10df7a627ab6
child 75016 873b581fd690
equal deleted inserted replaced
74999:300463f379bf 75000:4466fae54ff9
   131 val atp_important_message_keep_quotient = 25
   131 val atp_important_message_keep_quotient = 25
   132 
   132 
   133 fun run_atp mode name
   133 fun run_atp mode name
   134     ({debug, verbose, overlord, type_enc, strict, lam_trans, uncurried_aliases, fact_filter,
   134     ({debug, verbose, overlord, type_enc, strict, lam_trans, uncurried_aliases, fact_filter,
   135      max_facts, max_mono_iters, max_new_mono_instances, isar_proofs, compress, try0, smt_proofs,
   135      max_facts, max_mono_iters, max_new_mono_instances, isar_proofs, compress, try0, smt_proofs,
   136      slice, minimize, timeout, preplay_timeout, ...} : params)
   136      slice, minimize, timeout, preplay_timeout, spy, ...} : params)
   137     ({comment, state, goal, subgoal, subgoal_count, factss, found_proof, ...} : prover_problem) =
   137     ({comment, state, goal, subgoal, subgoal_count, factss, found_proof, ...} : prover_problem) =
   138   let
   138   let
   139     val thy = Proof.theory_of state
   139     val thy = Proof.theory_of state
   140     val ctxt = Proof.context_of state
   140     val ctxt = Proof.context_of state
   141 
   141 
   252                 " with " ^ string_of_int num_facts ^ " fact" ^
   252                 " with " ^ string_of_int num_facts ^ " fact" ^
   253                 plural_s num_facts ^ " for " ^ string_of_time slice_timeout ^ "..."
   253                 plural_s num_facts ^ " for " ^ string_of_time slice_timeout ^ "..."
   254                 |> writeln
   254                 |> writeln
   255               else
   255               else
   256                 ()
   256                 ()
   257             val value as (atp_problem, _, _, _) =
   257             val ({elapsed, ...}, value as (atp_problem, _, _, _)) = Timing.timing (fn () =>
   258               if cache_key = SOME key then
   258               if cache_key = SOME key then
   259                 cache_value
   259                 cache_value
   260               else
   260               else
   261                 let
   261                 let
   262                   val sound = is_type_enc_sound type_enc
   262                   val sound = is_type_enc_sound type_enc
   270                   |> take num_facts
   270                   |> take num_facts
   271                   |> not (is_type_enc_polymorphic type_enc) ? monomorphize_facts
   271                   |> not (is_type_enc_polymorphic type_enc) ? monomorphize_facts
   272                   |> map (apsnd Thm.prop_of)
   272                   |> map (apsnd Thm.prop_of)
   273                   |> generate_atp_problem ctxt generate_info format prem_role type_enc atp_mode
   273                   |> generate_atp_problem ctxt generate_info format prem_role type_enc atp_mode
   274                     lam_trans uncurried_aliases readable_names true hyp_ts concl_t
   274                     lam_trans uncurried_aliases readable_names true hyp_ts concl_t
   275                 end
   275                 end) ()
       
   276 
       
   277             val () = spying spy (fn () =>
       
   278               (state, subgoal, name, "Slice #" ^ string_of_int (slice + 1) ^
       
   279                " generating ATP problem in " ^ string_of_int (Time.toMilliseconds elapsed) ^ " ms"))
   276 
   280 
   277             fun sel_weights () = atp_problem_selection_weights atp_problem
   281             fun sel_weights () = atp_problem_selection_weights atp_problem
   278             fun ord_info () = atp_problem_term_order_info atp_problem
   282             fun ord_info () = atp_problem_term_order_info atp_problem
   279 
   283 
   280             val ord = effective_term_order ctxt name
   284             val ord = effective_term_order ctxt name
   307                  |>> atp_proof_of_tstplike_proof (perhaps (try (unprefix remote_prefix)) name)
   311                  |>> atp_proof_of_tstplike_proof (perhaps (try (unprefix remote_prefix)) name)
   308                    atp_problem
   312                    atp_problem
   309                  handle UNRECOGNIZED_ATP_PROOF () => ([], SOME ProofUnparsable)))
   313                  handle UNRECOGNIZED_ATP_PROOF () => ([], SOME ProofUnparsable)))
   310               handle Timeout.TIMEOUT _ => (("", slice_timeout), ([], SOME TimedOut))
   314               handle Timeout.TIMEOUT _ => (("", slice_timeout), ([], SOME TimedOut))
   311                 | ERROR msg => (("", Time.zeroTime), ([], SOME (UnknownError msg)))
   315                 | ERROR msg => (("", Time.zeroTime), ([], SOME (UnknownError msg)))
       
   316 
       
   317             val () = spying spy (fn () =>
       
   318               (state, subgoal, name, "Slice #" ^ string_of_int (slice + 1) ^
       
   319                " running command in " ^ string_of_int (Time.toMilliseconds run_time) ^ " ms"))
   312 
   320 
   313             val outcome =
   321             val outcome =
   314               (case outcome of
   322               (case outcome of
   315                 NONE =>
   323                 NONE =>
   316                 (case used_facts_in_unsound_atp_proof ctxt (map fst facts) atp_proof of
   324                 (case used_facts_in_unsound_atp_proof ctxt (map fst facts) atp_proof of