src/HOL/Tools/Sledgehammer/sledgehammer_provers.ML
changeset 42962 3b50fdeb6cfc
parent 42956 9aeb0f6ad971
child 42963 5725deb11ae7
equal deleted inserted replaced
42961:f30ae82cb62e 42962:3b50fdeb6cfc
   357     (info, (smt_fact_weight ctxt j num_facts, th |> Thm.transfer thy))
   357     (info, (smt_fact_weight ctxt j num_facts, th |> Thm.transfer thy))
   358   end
   358   end
   359 
   359 
   360 fun untranslated_fact (Untranslated_Fact p) = p
   360 fun untranslated_fact (Untranslated_Fact p) = p
   361   | untranslated_fact (SMT_Weighted_Fact (info, (_, th))) = (info, th)
   361   | untranslated_fact (SMT_Weighted_Fact (info, (_, th))) = (info, th)
   362 fun atp_translated_fact ctxt fact =
   362 fun atp_translated_fact ctxt format fact =
   363   translate_atp_fact ctxt false (untranslated_fact fact)
   363   translate_atp_fact ctxt format false (untranslated_fact fact)
   364 fun smt_weighted_fact _ _ (SMT_Weighted_Fact p, _) = p
   364 fun smt_weighted_fact _ _ (SMT_Weighted_Fact p, _) = p
   365   | smt_weighted_fact ctxt num_facts (fact, j) =
   365   | smt_weighted_fact ctxt num_facts (fact, j) =
   366     (untranslated_fact fact, j) |> weight_smt_fact ctxt num_facts
   366     (untranslated_fact fact, j) |> weight_smt_fact ctxt num_facts
   367 
   367 
   368 fun overlord_file_location_for_prover prover =
   368 fun overlord_file_location_for_prover prover =
   437 
   437 
   438 val fallback_best_type_systems =
   438 val fallback_best_type_systems =
   439   [Preds (Mangled_Monomorphic, Nonmonotonic_Types, Light)]
   439   [Preds (Mangled_Monomorphic, Nonmonotonic_Types, Light)]
   440 
   440 
   441 fun adjust_dumb_type_sys formats (Simple_Types level) =
   441 fun adjust_dumb_type_sys formats (Simple_Types level) =
   442     if member (op =) formats TFF then (TFF, Simple_Types level)
   442     (case inter (op =) formats [TFF, THF] of
   443     else (FOF, Preds (Mangled_Monomorphic, level, Heavy))
   443        format :: _ => (format, Simple_Types level)
       
   444      | [] => adjust_dumb_type_sys formats
       
   445                                   (Preds (Mangled_Monomorphic, level, Heavy)))
   444   | adjust_dumb_type_sys formats type_sys =
   446   | adjust_dumb_type_sys formats type_sys =
   445     (* We could return (TFF, type_sys) in all cases but this would require the
       
   446        TFF provers to accept problems in which constants are implicitly
       
   447        declared. Today neither SNARK nor ToFoF-E satisfy this criterion. *)
       
   448     if member (op =) formats CNF_UEQ then
   447     if member (op =) formats CNF_UEQ then
   449       (CNF_UEQ, case type_sys of
   448       (CNF_UEQ, case type_sys of
   450                   Tags _ => type_sys
   449                   Tags _ => type_sys
   451                 | _ => Preds (polymorphism_of_type_sys type_sys,
   450                 | _ => Preds (polymorphism_of_type_sys type_sys,
   452                               Const_Arg_Types, Light))
   451                               Const_Arg_Types, Light))
   453     else if member (op =) formats FOF then
   452     else if member (op =) formats FOF then
   454       (FOF, type_sys)
   453       (FOF, type_sys)
   455     else
   454     else
   456       (TFF, Simple_Types All_Types)
   455       (* We could return "type_sys" in all cases but this would require the
       
   456          TFF and THF provers to accept problems in which constants are
       
   457          implicitly declared. Today neither SNARK nor ToFoF-E satisfy this
       
   458          criterion. (FIXME: what about LEO-II?) *)
       
   459       (hd formats, Simple_Types All_Types)
   457 fun determine_format_and_type_sys _ formats (Dumb_Type_Sys type_sys) =
   460 fun determine_format_and_type_sys _ formats (Dumb_Type_Sys type_sys) =
   458     adjust_dumb_type_sys formats type_sys
   461     adjust_dumb_type_sys formats type_sys
   459   | determine_format_and_type_sys best_type_systems formats
   462   | determine_format_and_type_sys best_type_systems formats
   460                                   (Smart_Type_Sys full_types) =
   463                                   (Smart_Type_Sys full_types) =
   461     map type_sys_from_string best_type_systems @ fallback_best_type_systems
   464     map type_sys_from_string best_type_systems @ fallback_best_type_systems
   552                         |> not (null blacklist)
   555                         |> not (null blacklist)
   553                            ? filter_out (member (op =) blacklist o fst
   556                            ? filter_out (member (op =) blacklist o fst
   554                                          o untranslated_fact)
   557                                          o untranslated_fact)
   555                         |> polymorphism_of_type_sys type_sys <> Polymorphic
   558                         |> polymorphism_of_type_sys type_sys <> Polymorphic
   556                            ? monomorphize_facts
   559                            ? monomorphize_facts
   557                         |> map (atp_translated_fact ctxt)
   560                         |> map (atp_translated_fact ctxt format)
   558                 val real_ms = Real.fromInt o Time.toMilliseconds
   561                 val real_ms = Real.fromInt o Time.toMilliseconds
   559                 val slice_timeout =
   562                 val slice_timeout =
   560                   ((real_ms time_left
   563                   ((real_ms time_left
   561                     |> (if slice < num_actual_slices - 1 then
   564                     |> (if slice < num_actual_slices - 1 then
   562                           curry Real.min (time_frac * real_ms timeout)
   565                           curry Real.min (time_frac * real_ms timeout)