1 (* Title: HOL/TPTP/atp_problem_import.ML
2 Author: Jasmin Blanchette, TU Muenchen
5 Import TPTP problems as Isabelle terms or goals.
8 signature ATP_PROBLEM_IMPORT =
10 val isabelle_tptp_file : string -> unit
11 val nitpick_tptp_file : string -> unit
12 val refute_tptp_file : string -> unit
13 val sledgehammer_tptp_file : string -> unit
14 val translate_tptp_file : string -> string -> string -> unit
17 structure ATP_Problem_Import : ATP_PROBLEM_IMPORT =
22 (* cf. "close_form" in "refute.ML" *)
24 fold (fn ((s, i), T) => fn t' =>
25 Logic.all_const T $ Abs (s, T, abstract_over (Var ((s, i), T), t')))
26 (Term.add_vars t []) t
28 fun mk_meta_not P = Logic.mk_implies (P, @{prop False})
30 fun get_tptp_formula (_, role, P, _) =
31 P |> Logic.varify_global |> close_form
32 |> role = TPTP_Syntax.Role_Conjecture ? mk_meta_not
34 fun read_tptp_file thy file_name =
36 val path = Path.explode file_name
38 TPTP_Interpret.interpret_file true (Path.explode "$TPTP") path [] [] thy
41 (exists (fn (_, role, _, _) => role = TPTP_Syntax.Role_Conjecture) problem,
42 map get_tptp_formula problem)
45 (** Isabelle (combination of provers) **)
47 fun isabelle_tptp_file file_name = ()
50 (** Nitpick (alias Nitrox) **)
52 fun nitpick_tptp_file file_name =
54 val (falsify, ts) = read_tptp_file @{theory} file_name
55 val state = Proof.init @{context}
57 [("card", "1\<emdash>100"),
59 ("sat_solver", "smart"),
62 ("falsify", if falsify then "true" else "false"),
63 (* ("debug", "true"), *)
65 (* ("overlord", "true"), *)
66 ("show_consts", "true"),
68 ("max_potential", "0"),
70 ("expect", Nitpick.genuineN)]
71 |> Nitpick_Isar.default_params @{theory}
77 Nitpick.pick_nits_in_term state params Nitpick.TPTP i n step subst ts
78 (if falsify then @{prop False} else @{prop True}); ()
84 fun print_szs_from_outcome falsify s =
86 (if s = "genuine" then
87 if falsify then "CounterSatisfiable" else "Satisfiable"
92 fun refute_tptp_file file_name =
94 val (falsify, ts) = read_tptp_file @{theory} file_name
96 [("maxtime", "10000"),
98 ("expect", Nitpick.genuineN)]
100 Refute.refute_term @{context} params ts @{prop False}
101 |> print_szs_from_outcome falsify
107 fun sledgehammer_tptp_file file_name = ()
110 (** Translator between TPTP(-like) file formats **)
112 fun translate_tptp_file format in_file_name out_file_name = ()