249 add_suffix (of_indent ind ^ "let ") |
249 add_suffix (of_indent ind ^ "let ") |
250 #> add_term t1 |
250 #> add_term t1 |
251 #> add_suffix " = " |
251 #> add_suffix " = " |
252 #> add_term t2 |
252 #> add_term t2 |
253 #> add_suffix "\n" |
253 #> add_suffix "\n" |
254 | add_step ind (Prove (qs, Fix xs, l, t, subproofs, By (facts, method))) = |
254 | add_step ind (Prove (qs, xs, l, t, subproofs, (facts, method))) = |
255 (case xs of |
255 (case xs of |
256 [] => (* have *) |
256 [] => (* have *) |
257 add_step_pre ind qs subproofs |
257 add_step_pre ind qs subproofs |
258 #> add_suffix (of_prove qs (length subproofs) ^ " ") |
258 #> add_suffix (of_prove qs (length subproofs) ^ " ") |
259 #> add_step_post ind l t facts method "" |
259 #> add_step_post ind l t facts method "" |
272 else |
272 else |
273 "")) |
273 "")) |
274 |
274 |
275 and add_steps ind = fold (add_step ind) |
275 and add_steps ind = fold (add_step ind) |
276 |
276 |
277 and of_proof ind ctxt (Proof (Fix xs, Assume assms, steps)) = |
277 and of_proof ind ctxt (Proof (xs, assms, steps)) = |
278 ("", ctxt) |
278 ("", ctxt) |> add_fix ind xs |> add_assms ind assms |> add_steps ind steps |> fst |
279 |> add_fix ind xs |
|
280 |> add_assms ind assms |
|
281 |> add_steps ind steps |
|
282 |> fst |
|
283 |
|
284 in |
279 in |
285 (* FIXME: sh_try0 might produce one-step proofs that are better than the |
280 (* One-step Metis proofs are pointless; better use the one-liner directly. *) |
286 Metis one-liners *) |
281 (case proof of |
287 (* One-step proofs are pointless; better use the Metis one-liner |
282 Proof ([], [], [Prove (_, [], _, _, [], (_, MetisM))]) => "" |
288 directly. *) |
283 | _ => |
289 (*case proof of |
284 (if i <> 1 then "prefer " ^ string_of_int i ^ "\n" else "") ^ |
290 Proof (Fix [], Assume [], [Prove (_, Fix [], _, _, [], _)]) => "" |
285 of_indent 0 ^ "proof -\n" ^ of_proof 1 ctxt proof ^ |
291 | _ =>*) (if i <> 1 then "prefer " ^ string_of_int i ^ "\n" else "") ^ |
286 of_indent 0 ^ (if n <> 1 then "next" else "qed")) |
292 of_indent 0 ^ "proof -\n" ^ of_proof 1 ctxt proof ^ |
|
293 of_indent 0 ^ (if n <> 1 then "next" else "qed") |
|
294 end |
287 end |
295 |
288 |
296 end; |
289 end; |