29 let |
33 let |
30 val report_path = report_file_name |> Path.explode |
34 val report_path = report_file_name |> Path.explode |
31 val _ = File.write report_path "" |
35 val _ = File.write report_path "" |
32 fun print s = (tracing s; File.append report_path (s ^ "\n")) |
36 fun print s = (tracing s; File.append report_path (s ^ "\n")) |
33 val {provers, max_facts, slice, type_enc, lam_trans, timeout, ...} = |
37 val {provers, max_facts, slice, type_enc, lam_trans, timeout, ...} = |
34 Sledgehammer_Isar.default_params ctxt [] |
38 default_params ctxt [] |
35 val prover = hd provers |
39 val prover = hd provers |
36 val slack_max_facts = generous_max_facts (the max_facts) |
40 val slack_max_facts = generous_max_facts (the max_facts) |
37 val sugg_path = sugg_file_name |> Path.explode |
41 val sugg_path = sugg_file_name |> Path.explode |
38 val lines = sugg_path |> File.read_lines |
42 val lines = sugg_path |> File.read_lines |
39 val css = Sledgehammer_Fact.clasimpset_rule_table_of ctxt |
43 val css = clasimpset_rule_table_of ctxt |
40 val facts = all_facts ctxt true false Symtab.empty [] [] css |
44 val facts = all_facts ctxt true false Symtab.empty [] [] css |
41 val all_names = build_all_names nickname_of facts |
45 val all_names = build_all_names nickname_of facts |
42 val mepo_ok = Unsynchronized.ref 0 |
46 val mepo_ok = Unsynchronized.ref 0 |
43 val mash_ok = Unsynchronized.ref 0 |
47 val mash_ok = Unsynchronized.ref 0 |
44 val mesh_ok = Unsynchronized.ref 0 |
48 val mesh_ok = Unsynchronized.ref 0 |
45 val isar_ok = Unsynchronized.ref 0 |
49 val isar_ok = Unsynchronized.ref 0 |
46 fun with_index facts s = (find_index (curry (op =) s) facts + 1, s) |
50 fun with_index facts s = (find_index (curry (op =) s) facts + 1, s) |
47 fun index_string (j, s) = s ^ "@" ^ string_of_int j |
51 fun index_string (j, s) = s ^ "@" ^ string_of_int j |
48 fun str_of_res label facts ({outcome, run_time, used_facts, ...} |
52 fun str_of_res label facts ({outcome, run_time, used_facts, ...} |
49 : Sledgehammer_Provers.prover_result) = |
53 : prover_result) = |
50 let val facts = facts |> map (fn ((name, _), _) => name ()) in |
54 let val facts = facts |> map (fn ((name, _), _) => name ()) in |
51 " " ^ label ^ ": " ^ |
55 " " ^ label ^ ": " ^ |
52 (if is_none outcome then |
56 (if is_none outcome then |
53 "Success (" ^ ATP_Util.string_from_time run_time ^ "): " ^ |
57 "Success (" ^ ATP_Util.string_from_time run_time ^ "): " ^ |
54 (used_facts |> map (with_index facts o fst) |
58 (used_facts |> map (with_index facts o fst) |
75 val goal = goal_of_thm (Proof_Context.theory_of ctxt) th |
79 val goal = goal_of_thm (Proof_Context.theory_of ctxt) th |
76 val (_, hyp_ts, concl_t) = ATP_Util.strip_subgoal ctxt goal 1 |
80 val (_, hyp_ts, concl_t) = ATP_Util.strip_subgoal ctxt goal 1 |
77 val isar_deps = isar_dependencies_of all_names th |> these |
81 val isar_deps = isar_dependencies_of all_names th |> these |
78 val facts = facts |> filter (fn (_, th') => thm_ord (th', th) = LESS) |
82 val facts = facts |> filter (fn (_, th') => thm_ord (th', th) = LESS) |
79 val mepo_facts = |
83 val mepo_facts = |
80 Sledgehammer_MePo.mepo_suggested_facts ctxt params prover |
84 mepo_suggested_facts ctxt params prover slack_max_facts NONE hyp_ts |
81 slack_max_facts NONE hyp_ts concl_t facts |
85 concl_t facts |
82 |> Sledgehammer_MePo.weight_mepo_facts |
86 |> weight_mepo_facts |
83 val (mash_facts, mash_unks) = |
87 val (mash_facts, mash_unks) = |
84 find_mash_suggestions slack_max_facts suggs facts [] [] |
88 find_mash_suggestions slack_max_facts suggs facts [] [] |
85 |>> weight_mash_facts |
89 |>> weight_mash_facts |
86 val mess = [(0.5, (mepo_facts, [])), (0.5, (mash_facts, mash_unks))] |
90 val mess = [(0.5, (mepo_facts, [])), (0.5, (mash_facts, mash_unks))] |
87 val mesh_facts = mesh_facts slack_max_facts mess |
91 val mesh_facts = mesh_facts slack_max_facts mess |
91 let |
95 let |
92 val prob_prefix = |
96 val prob_prefix = |
93 "goal_" ^ string_of_int j ^ "__" ^ escape_meta name ^ "__" ^ |
97 "goal_" ^ string_of_int j ^ "__" ^ escape_meta name ^ "__" ^ |
94 heading |
98 heading |
95 in |
99 in |
96 Config.put Sledgehammer_Provers.dest_dir dir |
100 Config.put dest_dir dir |
97 #> Config.put Sledgehammer_Provers.problem_prefix |
101 #> Config.put problem_prefix (prob_prefix ^ "__") |
98 (prob_prefix ^ "__") |
|
99 #> Config.put SMT_Config.debug_files (dir ^ "/" ^ prob_prefix) |
102 #> Config.put SMT_Config.debug_files (dir ^ "/" ^ prob_prefix) |
100 end |
103 end |
101 | set_file_name _ NONE = I |
104 | set_file_name _ NONE = I |
102 fun prove ok heading get facts = |
105 fun prove ok heading get facts = |
103 let |
106 let |
104 fun nickify ((_, stature), th) = ((K (nickname_of th), stature), th) |
107 fun nickify ((_, stature), th) = ((K (nickname_of th), stature), th) |
105 val facts = |
108 val facts = |
106 facts |
109 facts |
107 |> map get |
110 |> map get |
108 |> Sledgehammer_Fact.maybe_instantiate_inducts ctxt hyp_ts concl_t |
111 |> maybe_instantiate_inducts ctxt hyp_ts concl_t |
109 |> take (the max_facts) |
112 |> take (the max_facts) |
110 |> map nickify |
113 |> map nickify |
111 val ctxt = ctxt |> set_file_name heading prob_dir_name |
114 val ctxt = ctxt |> set_file_name heading prob_dir_name |
112 val res as {outcome, ...} = |
115 val res as {outcome, ...} = |
113 run_prover_for_mash ctxt params prover facts goal |
116 run_prover_for_mash ctxt params prover facts goal |
126 end |
129 end |
127 fun total_of heading ok n = |
130 fun total_of heading ok n = |
128 " " ^ heading ^ ": " ^ string_of_int (!ok) ^ " (" ^ |
131 " " ^ heading ^ ": " ^ string_of_int (!ok) ^ " (" ^ |
129 Real.fmt (StringCvt.FIX (SOME 1)) |
132 Real.fmt (StringCvt.FIX (SOME 1)) |
130 (100.0 * Real.fromInt (!ok) / Real.fromInt n) ^ "%)" |
133 (100.0 * Real.fromInt (!ok) / Real.fromInt n) ^ "%)" |
131 val inst_inducts = Config.get ctxt Sledgehammer_Fact.instantiate_inducts |
134 val inst_inducts = Config.get ctxt instantiate_inducts |
132 val options = |
135 val options = |
133 [prover, string_of_int (the max_facts) ^ " facts", |
136 [prover, string_of_int (the max_facts) ^ " facts", |
134 "slice" |> not slice ? prefix "dont_", the_default "smart" type_enc, |
137 "slice" |> not slice ? prefix "dont_", the_default "smart" type_enc, |
135 the_default "smart" lam_trans, ATP_Util.string_from_time timeout, |
138 the_default "smart" lam_trans, |
|
139 ATP_Util.string_from_time (timeout |> the_default one_year), |
136 "instantiate_inducts" |> not inst_inducts ? prefix "dont_"] |
140 "instantiate_inducts" |> not inst_inducts ? prefix "dont_"] |
137 val n = length lines |
141 val n = length lines |
138 in |
142 in |
139 print " * * *"; |
143 print " * * *"; |
140 print ("Options: " ^ commas options); |
144 print ("Options: " ^ commas options); |