232 val times0 = map2 ((fn Played time => time) o Lazy.force oo |
232 val times0 = map2 ((fn Played time => time) o Lazy.force oo |
233 preplay_outcome_of_isar_step_for_method (!preplay_data)) labels succ_meths |
233 preplay_outcome_of_isar_step_for_method (!preplay_data)) labels succ_meths |
234 val time_slice = time_mult (1.0 / (Real.fromInt (length labels))) time |
234 val time_slice = time_mult (1.0 / (Real.fromInt (length labels))) time |
235 val timeouts = map (curry Time.+ time_slice #> time_mult merge_timeout_slack) times0 |
235 val timeouts = map (curry Time.+ time_slice #> time_mult merge_timeout_slack) times0 |
236 |
236 |
237 (* FIXME: debugging *) |
|
238 val _ = |
|
239 if the (label_of_isar_step cand) <> l then |
|
240 raise Fail "Sledgehammer_Isar_Compress: try_eliminate" |
|
241 else |
|
242 () |
|
243 |
|
244 (* TODO: should be lazy: stop preplaying as soon as one step fails/times out *) |
237 (* TODO: should be lazy: stop preplaying as soon as one step fails/times out *) |
245 val play_outcomes = map3 (preplay_isar_step ctxt) timeouts succ_meths succs' |
238 val play_outcomes = map3 (preplay_isar_step ctxt) timeouts succ_meths succs' |
246 |
239 |
247 (* ensure none of the modified successors timed out *) |
240 (* ensure none of the modified successors timed out *) |
248 val times = map (fn Played time => time) play_outcomes |
241 val times = map (fn Played time => time) play_outcomes |
280 in |
273 in |
281 compression_loop candidates steps |
274 compression_loop candidates steps |
282 |> remove (op =) dummy_isar_step |
275 |> remove (op =) dummy_isar_step |
283 end |
276 end |
284 |
277 |
285 (* |
278 (* Proofs are compressed bottom-up, beginning with the innermost subproofs. On the innermost |
286 Proofs are compressed bottom-up, beginning with the innermost |
279 proof level, the proof steps have no subproofs. In the best case, these steps can be merged |
287 subproofs. |
280 into just one step, resulting in a trivial subproof. Going one level up, trivial subproofs |
288 On the innermost proof level, the proof steps have no subproofs. |
281 can be eliminated. In the best case, this once again leads to a proof whose proof steps do |
289 In the best case, these steps can be merged into just one step, |
282 not have subproofs. Applying this approach recursively will result in a flat proof in the |
290 resulting in a trivial subproof. Going one level up, trivial subproofs |
283 best cast. *) |
291 can be eliminated. In the best case, this once again leads to a proof |
|
292 whose proof steps do not have subproofs. Applying this approach |
|
293 recursively will result in a flat proof in the best cast. |
|
294 *) |
|
295 fun compress_proof (proof as (Proof (fix, assms, steps))) = |
284 fun compress_proof (proof as (Proof (fix, assms, steps))) = |
296 if compress_further () then Proof (fix, assms, compress_steps steps) else proof |
285 if compress_further () then Proof (fix, assms, compress_steps steps) else proof |
297 and compress_steps steps = |
286 and compress_steps steps = |
298 (* bottom-up: compress innermost proofs first *) |
287 (* bottom-up: compress innermost proofs first *) |
299 steps |> map (fn step => step |> compress_further () ? compress_sub_levels) |
288 steps |> map (fn step => step |> compress_further () ? compress_sub_levels) |