135 end) |
135 end) |
136 |> (fn (used_facts, (meth, play)) => |
136 |> (fn (used_facts, (meth, play)) => |
137 (used_facts |> filter_out (fn (_, (sc, _)) => sc = Chained), (meth, play))) |
137 (used_facts |> filter_out (fn (_, (sc, _)) => sc = Chained), (meth, play))) |
138 |
138 |
139 fun launch_prover (params as {verbose, spy, max_facts, induction_rules, ...}) mode only learn |
139 fun launch_prover (params as {verbose, spy, max_facts, induction_rules, ...}) mode only learn |
140 ({comment, state, goal, subgoal, subgoal_count, factss, found_proof} : prover_problem) name = |
140 ({comment, state, goal, subgoal, subgoal_count, facts, found_proof} : prover_problem) name = |
141 let |
141 let |
142 val ctxt = Proof.context_of state |
142 val ctxt = Proof.context_of state |
143 |
143 |
144 val _ = spying spy (fn () => (state, subgoal, name, "Launched")) |
144 val _ = spying spy (fn () => (state, subgoal, name, "Launched")) |
145 val max_facts = max_facts |> the_default (default_max_facts_of_prover ctxt name) |
145 val max_facts = max_facts |> the_default (default_max_facts_of_prover ctxt name) |
146 val num_facts = |
146 val num_facts = length (snd facts) |> not only ? Integer.min max_facts |
147 (case factss of |
|
148 (_, facts) :: _ => length facts |> not only ? Integer.min max_facts |
|
149 | _ => 0) |
|
150 val induction_rules = induction_rules_for_prover ctxt name induction_rules |
147 val induction_rules = induction_rules_for_prover ctxt name induction_rules |
151 |
148 |
152 val problem = |
149 val problem = |
153 {comment = comment, state = state, goal = goal, subgoal = subgoal, |
150 {comment = comment, state = state, goal = goal, subgoal = subgoal, |
154 subgoal_count = subgoal_count, |
151 subgoal_count = subgoal_count, |
155 factss = factss |
152 facts = facts |
156 (* We take num_facts because factss contains the maximum of all called provers. *) |
153 (* We take "num_facts" because "facts" contains the maximum of all called provers. *) |
157 |> map (apsnd (take num_facts o maybe_filter_out_induction_rules induction_rules)), |
154 |> apsnd (take num_facts o maybe_filter_out_induction_rules induction_rules), |
158 found_proof = found_proof} |
155 found_proof = found_proof} |
159 |
156 |
160 fun print_used_facts used_facts used_from = |
157 fun print_used_facts used_facts used_from = |
161 tag_list 1 used_from |
158 tag_list 1 used_from |
162 |> map (fn (j, fact) => fact |> apsnd (K j)) |
159 |> map (fn (j, fact) => fact |> apsnd (K j)) |
186 in |
183 in |
187 (commas (indices @ unknowns), fact_filter) |
184 (commas (indices @ unknowns), fact_filter) |
188 end |
185 end |
189 |
186 |
190 val filter_infos = |
187 val filter_infos = |
191 map filter_info (("actual", used_from) :: factss) |
188 map filter_info [("actual", used_from), facts] |
192 |> AList.group (op =) |
189 |> AList.group (op =) |
193 |> map (fn (indices, fact_filters) => commas fact_filters ^ ": " ^ indices) |
190 |> map (fn (indices, fact_filters) => commas fact_filters ^ ": " ^ indices) |
194 in |
191 in |
195 "Success: Found proof with " ^ string_of_int num_used_facts ^ " of " ^ |
192 "Success: Found proof with " ^ string_of_int num_used_facts ^ " of " ^ |
196 string_of_int num_facts ^ " fact" ^ plural_s num_facts ^ |
193 string_of_int num_facts ^ " fact" ^ plural_s num_facts ^ |
346 factss |
343 factss |
347 end |
344 end |
348 |
345 |
349 fun launch_provers () = |
346 fun launch_provers () = |
350 let |
347 let |
351 val factss = get_factss provers |
348 val facts = hd (get_factss provers) (* temporary *) |
352 val problem = |
349 val problem = |
353 {comment = "", state = state, goal = goal, subgoal = i, subgoal_count = n, |
350 {comment = "", state = state, goal = goal, subgoal = i, subgoal_count = n, |
354 factss = factss, found_proof = found_proof} |
351 facts = facts, found_proof = found_proof} |
355 val learn = mash_learn_proof ctxt params (Thm.prop_of goal) |
352 val learn = mash_learn_proof ctxt params (Thm.prop_of goal) |
356 val launch = launch_prover_and_preplay params mode writeln_result only learn |
353 val launch = launch_prover_and_preplay params mode writeln_result only learn |
357 in |
354 in |
358 if mode = Auto_Try then |
355 if mode = Auto_Try then |
359 (SH_Unknown, "") |
356 (SH_Unknown, "") |