equal
deleted
inserted
replaced
27 fun can_apply timeout_opt pre post tac st = |
27 fun can_apply timeout_opt pre post tac st = |
28 let val {goal, ...} = Proof.goal st in |
28 let val {goal, ...} = Proof.goal st in |
29 (case (case timeout_opt of |
29 (case (case timeout_opt of |
30 SOME timeout => TimeLimit.timeLimit timeout |
30 SOME timeout => TimeLimit.timeLimit timeout |
31 | NONE => fn f => fn x => f x) (Seq.pull o tac) (pre st) of |
31 | NONE => fn f => fn x => f x) (Seq.pull o tac) (pre st) of |
32 SOME (x, _) => nprems_of (post x) < nprems_of goal |
32 SOME (x, _) => Thm.nprems_of (post x) < Thm.nprems_of goal |
33 | NONE => false) |
33 | NONE => false) |
34 end; |
34 end; |
35 |
35 |
36 fun apply_generic timeout_opt name command pre post apply st = |
36 fun apply_generic timeout_opt name command pre post apply st = |
37 let val timer = Timer.startRealTimer () in |
37 let val timer = Timer.startRealTimer () in |
66 fun apply_named_method (name, ((all_goals, run_if_auto_try), attrs)) mode timeout_opt quad st = |
66 fun apply_named_method (name, ((all_goals, run_if_auto_try), attrs)) mode timeout_opt quad st = |
67 if mode <> Auto_Try orelse run_if_auto_try then |
67 if mode <> Auto_Try orelse run_if_auto_try then |
68 let val attrs = attrs_text attrs quad in |
68 let val attrs = attrs_text attrs quad in |
69 apply_generic timeout_opt name |
69 apply_generic timeout_opt name |
70 ((name ^ attrs |> attrs <> "" ? enclose "(" ")") ^ |
70 ((name ^ attrs |> attrs <> "" ? enclose "(" ")") ^ |
71 (if all_goals andalso nprems_of (#goal (Proof.goal st)) > 1 then "[1]" else "")) |
71 (if all_goals andalso Thm.nprems_of (#goal (Proof.goal st)) > 1 then "[1]" else "")) |
72 I (#goal o Proof.goal) |
72 I (#goal o Proof.goal) |
73 (apply_named_method_on_first_goal (Proof.context_of st) (name ^ attrs)) st |
73 (apply_named_method_on_first_goal (Proof.context_of st) (name ^ attrs)) st |
74 end |
74 end |
75 else |
75 else |
76 NONE; |
76 NONE; |
139 (case mode of |
139 (case mode of |
140 Auto_Try => "Auto Try0 found a proof" |
140 Auto_Try => "Auto Try0 found a proof" |
141 | Try => "Try0 found a proof" |
141 | Try => "Try0 found a proof" |
142 | Normal => "Try this") ^ ": " ^ |
142 | Normal => "Try this") ^ ": " ^ |
143 Active.sendback_markup [Markup.padding_command] |
143 Active.sendback_markup [Markup.padding_command] |
144 ((if nprems_of (#goal (Proof.goal st)) = 1 then "by" |
144 ((if Thm.nprems_of (#goal (Proof.goal st)) = 1 then "by" |
145 else "apply") ^ " " ^ command) ^ |
145 else "apply") ^ " " ^ command) ^ |
146 (case xs of |
146 (case xs of |
147 [(_, ms)] => " (" ^ time_string ms ^ ")." |
147 [(_, ms)] => " (" ^ time_string ms ^ ")." |
148 | xs => "\n(" ^ space_implode "; " (map tool_time_string xs) ^ ").") |
148 | xs => "\n(" ^ space_implode "; " (map tool_time_string xs) ^ ").") |
149 in |
149 in |