src/HOL/Tools/Sledgehammer/sledgehammer_provers.ML
changeset 48716 1d2a12bb0640
parent 48656 5caa414ce9a2
child 48797 e65385336531
equal deleted inserted replaced
48715:62928b793d8a 48716:1d2a12bb0640
   168 
   168 
   169 fun is_atp_for_format is_format ctxt name =
   169 fun is_atp_for_format is_format ctxt name =
   170   let val thy = Proof_Context.theory_of ctxt in
   170   let val thy = Proof_Context.theory_of ctxt in
   171     case try (get_atp thy) name of
   171     case try (get_atp thy) name of
   172       SOME config =>
   172       SOME config =>
   173       exists (fn (_, (_, ((_, format, _, _, _), _))) => is_format format)
   173       exists (fn (_, ((_, format, _, _, _), _)) => is_format format)
   174              (#best_slices (config ()) ctxt)
   174              (#best_slices (config ()) ctxt)
   175     | NONE => false
   175     | NONE => false
   176   end
   176   end
   177 
   177 
   178 val is_unit_equational_atp = is_atp_for_format (curry (op =) CNF_UEQ)
   178 val is_unit_equational_atp = is_atp_for_format (curry (op =) CNF_UEQ)
   195 fun default_max_facts_for_prover ctxt slice name =
   195 fun default_max_facts_for_prover ctxt slice name =
   196   let val thy = Proof_Context.theory_of ctxt in
   196   let val thy = Proof_Context.theory_of ctxt in
   197     if is_reconstructor name then
   197     if is_reconstructor name then
   198       reconstructor_default_max_facts
   198       reconstructor_default_max_facts
   199     else if is_atp thy name then
   199     else if is_atp thy name then
   200       fold (Integer.max o #1 o fst o snd o snd o snd)
   200       fold (Integer.max o #1 o fst o snd o snd)
   201            (get_slices slice (#best_slices (get_atp thy name ()) ctxt)) 0
   201            (get_slices slice (#best_slices (get_atp thy name ()) ctxt)) 0
   202     else (* is_smt_prover ctxt name *)
   202     else (* is_smt_prover ctxt name *)
   203       SMT_Solver.default_max_relevant ctxt name
   203       SMT_Solver.default_max_relevant ctxt name
   204   end
   204   end
   205 
   205 
   707             |> curry ListPair.zip (map fst facts)
   707             |> curry ListPair.zip (map fst facts)
   708             |> maps (fn (name, rths) =>
   708             |> maps (fn (name, rths) =>
   709                         map (pair name o zero_var_indexes o snd) rths)
   709                         map (pair name o zero_var_indexes o snd) rths)
   710           end
   710           end
   711         fun run_slice time_left (cache_key, cache_value)
   711         fun run_slice time_left (cache_key, cache_value)
   712                 (slice, (time_frac, (complete,
   712                 (slice, (time_frac,
   713                      (key as (best_max_facts, format, best_type_enc,
   713                      (key as (best_max_facts, format, best_type_enc,
   714                               best_lam_trans, best_uncurried_aliases),
   714                               best_lam_trans, best_uncurried_aliases),
   715                       extra)))) =
   715                       extra))) =
   716           let
   716           let
   717             val num_facts =
   717             val num_facts =
   718               length facts |> is_none max_facts ? Integer.min best_max_facts
   718               length facts |> is_none max_facts ? Integer.min best_max_facts
   719             val soundness = if strict then Strict else Non_Strict
   719             val soundness = if strict then Strict else Non_Strict
   720             val type_enc =
   720             val type_enc =
   785                    else
   785                    else
   786                      I)
   786                      I)
   787               |> fst |> split_time
   787               |> fst |> split_time
   788               |> (fn accum as (output, _) =>
   788               |> (fn accum as (output, _) =>
   789                      (accum,
   789                      (accum,
   790                       extract_tstplike_proof_and_outcome verbose complete
   790                       extract_tstplike_proof_and_outcome verbose proof_delims
   791                           proof_delims known_failures output
   791                                                          known_failures output
   792                       |>> atp_proof_from_tstplike_proof atp_problem
   792                       |>> atp_proof_from_tstplike_proof atp_problem
   793                       handle UNRECOGNIZED_ATP_PROOF () =>
   793                       handle UNRECOGNIZED_ATP_PROOF () =>
   794                              ([], SOME ProofIncomplete)))
   794                              ([], SOME ProofIncomplete)))
   795               handle TimeLimit.TimeOut =>
   795               handle TimeLimit.TimeOut =>
   796                      (("", slice_timeout), ([], SOME TimedOut))
   796                      (("", slice_timeout), ([], SOME TimedOut))