src/HOL/TPTP/atp_theory_export.ML
changeset 80306 c2537860ccf8
parent 77429 110988ad5b4c
equal deleted inserted replaced
80305:95b51df1382e 80306:c2537860ccf8
   162         css_table
   162         css_table
   163       |> sort (Sledgehammer_MaSh.crude_thm_ord ctxt o apply2 snd)
   163       |> sort (Sledgehammer_MaSh.crude_thm_ord ctxt o apply2 snd)
   164     val problem =
   164     val problem =
   165       facts
   165       facts
   166       |> map (fn ((_, loc), th) =>
   166       |> map (fn ((_, loc), th) =>
   167         ((Thm.get_name_hint th, loc), th |> Thm.prop_of |> mono ? monomorphize_term ctxt))
   167         ((Thm_Name.short (Thm.get_name_hint th), loc), th |> Thm.prop_of |> mono ? monomorphize_term ctxt))
   168       |> generate_atp_problem ctxt true format Axiom type_enc Exporter combsN false false true []
   168       |> generate_atp_problem ctxt true format Axiom type_enc Exporter combsN false false true []
   169         \<^prop>\<open>False\<close>
   169         \<^prop>\<open>False\<close>
   170       |> #1 |> sort_by (heading_sort_key o fst)
   170       |> #1 |> sort_by (heading_sort_key o fst)
   171     val prelude = fst (split_last problem)
   171     val prelude = fst (split_last problem)
   172     val name_tabs = Sledgehammer_Fact.build_name_tables Thm.get_name_hint facts
   172     val name_tabs = Sledgehammer_Fact.build_name_tables (Thm_Name.short o Thm.get_name_hint) facts
   173     val infers =
   173     val infers =
   174       if infer_policy = No_Inferences then
   174       if infer_policy = No_Inferences then
   175         []
   175         []
   176       else
   176       else
   177         facts
   177         facts
   178         |> map (fn (_, th) =>
   178         |> map (fn (_, th) =>
   179                    (fact_name_of (Thm.get_name_hint th),
   179                    (fact_name_of (Thm_Name.short (Thm.get_name_hint th)),
   180                     th |> Sledgehammer_Util.thms_in_proof max_dependencies (SOME name_tabs)
   180                     th |> Sledgehammer_Util.thms_in_proof max_dependencies (SOME name_tabs)
   181                        |> these |> map fact_name_of))
   181                        |> these |> map fact_name_of))
   182     val all_problem_names =
   182     val all_problem_names =
   183       problem |> maps (map ident_of_problem_line o snd) |> distinct (op =)
   183       problem |> maps (map ident_of_problem_line o snd) |> distinct (op =)
   184     val all_problem_name_set = Symtab.make (map (rpair ()) all_problem_names)
   184     val all_problem_name_set = Symtab.make (map (rpair ()) all_problem_names)
   293       ||> split_last
   293       ||> split_last
   294       ||> apsnd (snd
   294       ||> apsnd (snd
   295            #> chop_maximal_groups (op = o apply2 theory_name_of_fact)
   295            #> chop_maximal_groups (op = o apply2 theory_name_of_fact)
   296            #> map (`(include_base_name_of_fact o hd)))
   296            #> map (`(include_base_name_of_fact o hd)))
   297 
   297 
   298     val fact_tab = Symtab.make (map (fn fact as (_, th) => (Thm.get_name_hint th, fact)) facts)
   298     val fact_tab = Symtab.make (map (fn fact as (_, th) => (Thm_Name.short (Thm.get_name_hint th), fact)) facts)
   299 
   299 
   300     fun write_prelude () =
   300     fun write_prelude () =
   301       let val ss = lines_of_atp_problem format (K []) prelude in
   301       let val ss = lines_of_atp_problem format (K []) prelude in
   302         File.append file_order_path (prelude_base_name ^ "\n");
   302         File.append file_order_path (prelude_base_name ^ "\n");
   303         write_lines (ap include_dir prelude_name) ss
   303         write_lines (ap include_dir prelude_name) ss
   316       let
   316       let
   317         val (hyp_ts, conj_t) = Logic.strip_horn (Thm.prop_of (snd fact))
   317         val (hyp_ts, conj_t) = Logic.strip_horn (Thm.prop_of (snd fact))
   318         val mepo = Sledgehammer_MePo.mepo_suggested_facts ctxt
   318         val mepo = Sledgehammer_MePo.mepo_suggested_facts ctxt
   319           (Sledgehammer_Commands.default_params thy []) max_facts NONE hyp_ts conj_t facts
   319           (Sledgehammer_Commands.default_params thy []) max_facts NONE hyp_ts conj_t facts
   320       in
   320       in
   321         map (suffix "\n" o fact_name_of o Thm.get_name_hint o snd) mepo
   321         map (suffix "\n" o fact_name_of o Thm_Name.short o Thm.get_name_hint o snd) mepo
   322       end
   322       end
   323 
   323 
   324     fun write_problem_files _ _ _ _ [] = ()
   324     fun write_problem_files _ _ _ _ [] = ()
   325       | write_problem_files _ seen_facts includes [] groups =
   325       | write_problem_files _ seen_facts includes [] groups =
   326         write_problem_files 1 seen_facts includes includes groups
   326         write_problem_files 1 seen_facts includes includes groups