equal
deleted
inserted
replaced
20 val use_facts: state -> state |
20 val use_facts: state -> state |
21 val reset_facts: state -> state |
21 val reset_facts: state -> state |
22 val assert_forward: state -> state |
22 val assert_forward: state -> state |
23 val assert_backward: state -> state |
23 val assert_backward: state -> state |
24 val enter_forward: state -> state |
24 val enter_forward: state -> state |
|
25 val show_hyps: bool ref |
|
26 val pretty_thm: thm -> Pretty.T |
25 val verbose: bool ref |
27 val verbose: bool ref |
26 val print_state: state -> unit |
28 val print_state: state -> unit |
27 val level: state -> int |
29 val level: state -> int |
28 type method |
30 type method |
29 val method: (thm list -> tactic) -> method |
31 val method: (thm list -> tactic) -> method |
68 val have: string -> context attribute list -> string * (string list * string list) |
70 val have: string -> context attribute list -> string * (string list * string list) |
69 -> state -> state |
71 -> state -> state |
70 val have_i: string -> context attribute list -> term * (term list * term list) |
72 val have_i: string -> context attribute list -> term * (term list * term list) |
71 -> state -> state |
73 -> state -> state |
72 val at_bottom: state -> bool |
74 val at_bottom: state -> bool |
73 val local_qed: (state -> state Seq.seq) -> ({kind: string, name: string, thm: thm} -> unit) |
75 val local_qed: (state -> state Seq.seq) |
74 -> state -> state Seq.seq |
76 -> ({kind: string, name: string, thm: thm} -> unit) * (thm -> unit) -> state -> state Seq.seq |
75 val global_qed: (state -> state Seq.seq) -> state |
77 val global_qed: (state -> state Seq.seq) -> state |
76 -> (theory * {kind: string, name: string, thm: thm}) Seq.seq |
78 -> (theory * {kind: string, name: string, thm: thm}) Seq.seq |
77 val begin_block: state -> state |
79 val begin_block: state -> state |
78 val end_block: state -> state Seq.seq |
80 val end_block: state -> state Seq.seq |
79 val next_block: state -> state |
81 val next_block: state -> state |
278 |
280 |
279 |
281 |
280 |
282 |
281 (** print_state **) |
283 (** print_state **) |
282 |
284 |
|
285 val show_hyps = ProofContext.show_hyps; |
|
286 val pretty_thm = ProofContext.pretty_thm; |
|
287 |
283 val verbose = ProofContext.verbose; |
288 val verbose = ProofContext.verbose; |
284 |
289 |
285 fun print_facts _ None = () |
290 fun print_facts _ None = () |
286 | print_facts s (Some ths) = Pretty.writeln (Pretty.big_list (s ^ " facts:") |
291 | print_facts s (Some ths) = |
287 (map Display.pretty_thm_no_hyps ths)); |
292 Pretty.writeln (Pretty.big_list (s ^ " facts:") (map pretty_thm ths)); |
288 |
293 |
289 fun print_state (state as State ({context, facts, mode, goal = _}, nodes)) = |
294 fun print_state (state as State ({context, facts, mode, goal = _}, nodes)) = |
290 let |
295 let |
291 val ref (_, _, begin_goal) = Goals.current_goals_markers; |
296 val ref (_, _, begin_goal) = Goals.current_goals_markers; |
292 |
297 |
393 (* export results *) |
398 (* export results *) |
394 |
399 |
395 fun RANGE [] _ = all_tac |
400 fun RANGE [] _ = all_tac |
396 | RANGE (tac :: tacs) i = RANGE tacs (i + 1) THEN tac i; |
401 | RANGE (tac :: tacs) i = RANGE tacs (i + 1) THEN tac i; |
397 |
402 |
398 fun export_goal raw_rule inner state = |
403 fun export_goal print_rule raw_rule inner state = |
399 let |
404 let |
400 val (outer, (_, (result, (facts, thm)))) = find_goal 0 state; |
405 val (outer, (_, (result, (facts, thm)))) = find_goal 0 state; |
401 val (exp, tacs) = export_wrt inner (Some outer); |
406 val (exp, tacs) = export_wrt inner (Some outer); |
402 val rule = exp raw_rule; |
407 val rule = exp raw_rule; |
|
408 val _ = print_rule rule; |
403 val thmq = FIRSTGOAL (Tactic.rtac rule THEN' RANGE (map #1 tacs)) thm; |
409 val thmq = FIRSTGOAL (Tactic.rtac rule THEN' RANGE (map #1 tacs)) thm; |
404 in Seq.map (fn th => map_goal (K (result, (facts, th))) state) thmq end; |
410 in Seq.map (fn th => map_goal (K (result, (facts, th))) state) thmq end; |
405 |
411 |
406 |
412 |
407 fun export_thm inner thm = |
413 fun export_thm inner thm = |
637 |> assert_current_goal true; |
643 |> assert_current_goal true; |
638 |
644 |
639 |
645 |
640 (* local_qed *) |
646 (* local_qed *) |
641 |
647 |
642 fun finish_local print_result state = |
648 fun finish_local (print_result, print_rule) state = |
643 let |
649 let |
644 val (ctxt, ((kind, name, t), (_, raw_thm))) = current_goal state; |
650 val (ctxt, ((kind, name, t), (_, raw_thm))) = current_goal state; |
645 val result = prep_result state t raw_thm; |
651 val result = prep_result state t raw_thm; |
646 val (atts, opt_solve) = |
652 val (atts, opt_solve) = |
647 (case kind of |
653 (case kind of |
648 Goal atts => (atts, export_goal result ctxt) |
654 Goal atts => (atts, export_goal print_rule result ctxt) |
649 | Aux atts => (atts, Seq.single) |
655 | Aux atts => (atts, Seq.single) |
650 | _ => err_malformed "finish_local" state); |
656 | _ => err_malformed "finish_local" state); |
651 in |
657 in |
652 print_result {kind = kind_name kind, name = name, thm = result}; |
658 print_result {kind = kind_name kind, name = name, thm = result}; |
653 state |
659 state |
655 |> auto_bind_facts name [t] |
661 |> auto_bind_facts name [t] |
656 |> have_thmss [] name atts [Thm.no_attributes [result]] |
662 |> have_thmss [] name atts [Thm.no_attributes [result]] |
657 |> opt_solve |
663 |> opt_solve |
658 end; |
664 end; |
659 |
665 |
660 fun local_qed finalize print_result state = |
666 fun local_qed finalize print state = |
661 state |
667 state |
662 |> end_proof false |
668 |> end_proof false |
663 |> finalize |
669 |> finalize |
664 |> (Seq.flat o Seq.map (finish_local print_result)); |
670 |> (Seq.flat o Seq.map (finish_local print)); |
665 |
671 |
666 |
672 |
667 (* global_qed *) |
673 (* global_qed *) |
668 |
674 |
669 fun finish_global state = |
675 fun finish_global state = |