| author | desharna |
| Tue, 11 Mar 2025 10:20:44 +0100 | |
| changeset 82248 | e8c96013ea8a |
| parent 82217 | 24d83211de9a |
| child 82355 | 4ace4f6f7101 |
| permissions | -rw-r--r-- |
| 46641 | 1 |
(* Title: HOL/Tools/try0.ML |
|
38942
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
2 |
Author: Jasmin Blanchette, TU Muenchen |
|
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
3 |
|
|
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
4 |
Try a combination of proof methods. |
|
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
5 |
*) |
|
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
6 |
|
| 46641 | 7 |
signature TRY0 = |
|
38942
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
8 |
sig |
| 55177 | 9 |
val silence_methods : bool -> Proof.context -> Proof.context |
|
81369
0677712016b5
try0: add 'use' modifier for thms to insert;
Fabian Huch <huch@in.tum.de>
parents:
81368
diff
changeset
|
10 |
datatype modifier = Use | Simp | Intro | Elim | Dest |
| 82214 | 11 |
type xthm = Facts.ref * Token.src list |
12 |
type tagged_xthm = xthm * modifier list |
|
| 82213 | 13 |
type result = {name: string, command: string, time: Time.time, state: Proof.state}
|
| 82217 | 14 |
val apply_proof_method : string -> Time.time option -> (xthm * modifier list) list -> |
15 |
Proof.state -> result option |
|
| 82214 | 16 |
val try0 : Time.time option -> tagged_xthm list -> Proof.state -> result list |
| 81365 | 17 |
end |
|
38942
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
18 |
|
| 46641 | 19 |
structure Try0 : TRY0 = |
|
38942
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
20 |
struct |
|
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
21 |
|
| 81365 | 22 |
val noneN = "none" |
|
43026
0f15575a6465
handle non-auto try cases gracefully in Try Methods
blanchet
parents:
43024
diff
changeset
|
23 |
|
| 81365 | 24 |
datatype mode = Auto_Try | Try | Normal |
|
43020
abb5d1f907e4
added "try" command, to launch Solve Direct, Quickcheck, Nitpick, Sledgehammer, and Try Methods
blanchet
parents:
43018
diff
changeset
|
25 |
|
| 81365 | 26 |
val default_timeout = seconds 5.0 |
| 38944 | 27 |
|
|
81361
6c0f8a16784d
improve try0: solve multiple subgoals at once, if possible;
Fabian Huch <huch@in.tum.de>
parents:
81360
diff
changeset
|
28 |
fun run_tac timeout_opt tac st = |
|
6c0f8a16784d
improve try0: solve multiple subgoals at once, if possible;
Fabian Huch <huch@in.tum.de>
parents:
81360
diff
changeset
|
29 |
let val with_timeout = |
|
6c0f8a16784d
improve try0: solve multiple subgoals at once, if possible;
Fabian Huch <huch@in.tum.de>
parents:
81360
diff
changeset
|
30 |
(case timeout_opt of SOME timeout => Timeout.apply_physical timeout | NONE => I) |
| 81365 | 31 |
in with_timeout (Seq.pull o tac) st |> Option.map fst end |
|
38942
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
32 |
|
|
81372
895a4626fba3
try0: stop early if more subgoals are created;
Fabian Huch <huch@in.tum.de>
parents:
81371
diff
changeset
|
33 |
val num_goals = Thm.nprems_of o #goal o Proof.goal |
|
895a4626fba3
try0: stop early if more subgoals are created;
Fabian Huch <huch@in.tum.de>
parents:
81371
diff
changeset
|
34 |
fun apply_recursive recurse elapsed0 timeout_opt apply st = |
|
81361
6c0f8a16784d
improve try0: solve multiple subgoals at once, if possible;
Fabian Huch <huch@in.tum.de>
parents:
81360
diff
changeset
|
35 |
(case Timing.timing (Option.join o try (run_tac timeout_opt apply)) st of |
|
6c0f8a16784d
improve try0: solve multiple subgoals at once, if possible;
Fabian Huch <huch@in.tum.de>
parents:
81360
diff
changeset
|
36 |
({elapsed, ...}, SOME st') =>
|
|
81372
895a4626fba3
try0: stop early if more subgoals are created;
Fabian Huch <huch@in.tum.de>
parents:
81371
diff
changeset
|
37 |
if recurse andalso num_goals st' > 0 andalso num_goals st' < num_goals st then |
|
81361
6c0f8a16784d
improve try0: solve multiple subgoals at once, if possible;
Fabian Huch <huch@in.tum.de>
parents:
81360
diff
changeset
|
38 |
let val timeout_opt1 = (Option.map (fn timeout => timeout - elapsed) timeout_opt) |
|
81372
895a4626fba3
try0: stop early if more subgoals are created;
Fabian Huch <huch@in.tum.de>
parents:
81371
diff
changeset
|
39 |
in apply_recursive recurse (elapsed0 + elapsed) timeout_opt1 apply st' end |
|
81361
6c0f8a16784d
improve try0: solve multiple subgoals at once, if possible;
Fabian Huch <huch@in.tum.de>
parents:
81360
diff
changeset
|
40 |
else (elapsed0 + elapsed, st') |
|
6c0f8a16784d
improve try0: solve multiple subgoals at once, if possible;
Fabian Huch <huch@in.tum.de>
parents:
81360
diff
changeset
|
41 |
|_ => (elapsed0, st)) |
|
38942
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
42 |
|
|
81361
6c0f8a16784d
improve try0: solve multiple subgoals at once, if possible;
Fabian Huch <huch@in.tum.de>
parents:
81360
diff
changeset
|
43 |
fun parse_method ctxt s = |
|
57918
f5d73caba4e5
tuned signature according to Scala version -- prefer explicit argument;
wenzelm
parents:
56982
diff
changeset
|
44 |
enclose "(" ")" s
|
|
81361
6c0f8a16784d
improve try0: solve multiple subgoals at once, if possible;
Fabian Huch <huch@in.tum.de>
parents:
81360
diff
changeset
|
45 |
|> Token.explode (Thy_Header.get_keywords' ctxt) Position.start |
|
57918
f5d73caba4e5
tuned signature according to Scala version -- prefer explicit argument;
wenzelm
parents:
56982
diff
changeset
|
46 |
|> filter Token.is_proper |
|
f5d73caba4e5
tuned signature according to Scala version -- prefer explicit argument;
wenzelm
parents:
56982
diff
changeset
|
47 |
|> Scan.read Token.stopper Method.parse |
| 81365 | 48 |
|> (fn SOME (Method.Source src, _) => src | _ => raise Fail "expected Source") |
|
38942
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
49 |
|
|
81369
0677712016b5
try0: add 'use' modifier for thms to insert;
Fabian Huch <huch@in.tum.de>
parents:
81368
diff
changeset
|
50 |
datatype modifier = Use | Simp | Intro | Elim | Dest |
| 82214 | 51 |
type xthm = Facts.ref * Token.src list |
52 |
type tagged_xthm = xthm * modifier list |
|
| 81366 | 53 |
|
| 82214 | 54 |
fun string_of_xthm ((xref, args) : xthm) = |
| 81470 | 55 |
(case xref of |
56 |
Facts.Fact literal => literal |> Symbol_Pos.explode0 |> Symbol_Pos.implode |> cartouche |
|
57 |
| _ => |
|
58 |
Facts.string_of_ref xref) ^ implode |
|
59 |
(map (enclose "[" "]" o Pretty.unformatted_string_of o Token.pretty_src \<^context>) args) |
|
|
81367
6b724cf59eed
clarified: proper type for facts;
Fabian Huch <huch@in.tum.de>
parents:
81366
diff
changeset
|
60 |
|
| 82214 | 61 |
fun add_attr_text (tagged : tagged_xthm list) (tag, src) s = |
|
81367
6b724cf59eed
clarified: proper type for facts;
Fabian Huch <huch@in.tum.de>
parents:
81366
diff
changeset
|
62 |
let |
|
6b724cf59eed
clarified: proper type for facts;
Fabian Huch <huch@in.tum.de>
parents:
81366
diff
changeset
|
63 |
val fs = tagged |> filter (fn (_, tags) => member (op =) tags tag) |> map (string_of_xthm o fst) |
| 81365 | 64 |
in if null fs then s else s ^ " " ^ (if src = "" then "" else src ^ ": ") ^ implode_space fs end |
| 55179 | 65 |
|
| 82214 | 66 |
fun attrs_text tags (tagged : tagged_xthm list) = |
| 81365 | 67 |
"" |> fold (add_attr_text tagged) tags |
|
41999
3c029ef9e0f2
added "simp:", "intro:", and "elim:" to "try" command
blanchet
parents:
41038
diff
changeset
|
68 |
|
| 82213 | 69 |
type result = {name: string, command: string, time: Time.time, state: Proof.state}
|
|
81362
f586fdabe670
clarified: proper return type;
Fabian Huch <huch@in.tum.de>
parents:
81361
diff
changeset
|
70 |
|
| 82216 | 71 |
local |
72 |
||
| 81366 | 73 |
val full_attrs = [(Simp, "simp"), (Intro, "intro"), (Elim, "elim"), (Dest, "dest")] |
74 |
val clas_attrs = [(Intro, "intro"), (Elim, "elim"), (Dest, "dest")] |
|
75 |
val simp_attrs = [(Simp, "add")] |
|
76 |
val metis_attrs = [(Simp, ""), (Intro, ""), (Elim, ""), (Dest, "")] |
|
| 81365 | 77 |
val no_attrs = [] |
|
41999
3c029ef9e0f2
added "simp:", "intro:", and "elim:" to "try" command
blanchet
parents:
41038
diff
changeset
|
78 |
|
| 81364 | 79 |
(* name * ((all_goals, run_if_auto_try), tags *) |
| 82216 | 80 |
val raw_named_methods = |
|
41999
3c029ef9e0f2
added "simp:", "intro:", and "elim:" to "try" command
blanchet
parents:
41038
diff
changeset
|
81 |
[("simp", ((false, true), simp_attrs)),
|
|
3c029ef9e0f2
added "simp:", "intro:", and "elim:" to "try" command
blanchet
parents:
41038
diff
changeset
|
82 |
("auto", ((true, true), full_attrs)),
|
| 55178 | 83 |
("blast", ((false, true), clas_attrs)),
|
84 |
("metis", ((false, true), metis_attrs)),
|
|
|
63961
2fd9656c4c82
invoke argo as part of the tried automatic proof methods
boehmes
parents:
63690
diff
changeset
|
85 |
("argo", ((false, true), no_attrs)),
|
| 55178 | 86 |
("linarith", ((false, true), no_attrs)),
|
87 |
("presburger", ((false, true), no_attrs)),
|
|
88 |
("algebra", ((false, true), no_attrs)),
|
|
|
41999
3c029ef9e0f2
added "simp:", "intro:", and "elim:" to "try" command
blanchet
parents:
41038
diff
changeset
|
89 |
("fast", ((false, false), clas_attrs)),
|
|
44890
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
nipkow
parents:
44651
diff
changeset
|
90 |
("fastforce", ((false, false), full_attrs)),
|
|
41999
3c029ef9e0f2
added "simp:", "intro:", and "elim:" to "try" command
blanchet
parents:
41038
diff
changeset
|
91 |
("force", ((false, false), full_attrs)),
|
| 56850 | 92 |
("meson", ((false, false), metis_attrs)),
|
| 78239 | 93 |
("satx", ((false, false), no_attrs)),
|
| 81365 | 94 |
("order", ((false, true), no_attrs))]
|
| 55179 | 95 |
|
| 82217 | 96 |
fun apply_raw_named_method (name, ((all_goals, _), attrs)) timeout_opt tagged st : |
97 |
result option = |
|
98 |
let |
|
99 |
val unused = |
|
100 |
tagged |
|
101 |
|> filter |
|
102 |
(fn (_, tags) => not (null tags) andalso null (inter (op =) tags (attrs |> map fst))) |
|
103 |
|> map fst |
|
104 |
||
105 |
val attrs = attrs_text attrs tagged |
|
106 |
||
107 |
val ctxt = Proof.context_of st |
|
108 |
||
109 |
val text = |
|
110 |
name ^ attrs |
|
111 |
|> parse_method ctxt |
|
112 |
|> Method.method_cmd ctxt |
|
113 |
|> Method.Basic |
|
114 |
|> (fn m => Method.Combinator (Method.no_combinator_info, Method.Select_Goals 1, [m])) |
|
115 |
||
116 |
val apply = |
|
117 |
Proof.using [Attrib.eval_thms ctxt unused |> map (rpair [] o single)] |
|
118 |
#> Proof.refine text #> Seq.filter_results |
|
119 |
val num_before = num_goals st |
|
120 |
val multiple_goals = all_goals andalso num_before > 1 |
|
121 |
val (time, st') = apply_recursive multiple_goals Time.zeroTime timeout_opt apply st |
|
122 |
val num_after = num_goals st' |
|
123 |
val select = "[" ^ string_of_int (num_before - num_after) ^ "]" |
|
124 |
val unused = implode_space (unused |> map string_of_xthm) |
|
125 |
val command = |
|
126 |
(if unused <> "" then "using " ^ unused ^ " " else "") ^ |
|
127 |
(if num_after = 0 then "by " else "apply ") ^ |
|
128 |
(name ^ attrs |> attrs <> "" ? enclose "(" ")") ^
|
|
129 |
(if multiple_goals andalso num_after > 0 then select else "") |
|
130 |
in |
|
131 |
if num_before > num_after then |
|
132 |
SOME {name = name, command = command, time = time, state = st'}
|
|
133 |
else NONE |
|
134 |
end |
|
135 |
||
| 82216 | 136 |
in |
137 |
||
138 |
val named_methods = map fst raw_named_methods |
|
| 82217 | 139 |
|
140 |
fun apply_proof_method name timeout_opt tagged st : |
|
141 |
result option = |
|
142 |
(case AList.lookup (op =) raw_named_methods name of |
|
143 |
NONE => NONE |
|
144 |
| SOME raw_method => apply_raw_named_method (name, raw_method) timeout_opt tagged st) |
|
145 |
||
146 |
fun maybe_apply_proof_method name mode timeout_opt tagged st : |
|
147 |
result option = |
|
148 |
(case AList.lookup (op =) raw_named_methods name of |
|
149 |
NONE => NONE |
|
150 |
| SOME (raw_method as ((_, run_if_auto_try), _)) => |
|
151 |
if mode <> Auto_Try orelse run_if_auto_try then |
|
152 |
apply_raw_named_method (name, raw_method) timeout_opt tagged st |
|
153 |
else |
|
154 |
NONE) |
|
| 82216 | 155 |
|
156 |
end |
|
|
38942
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
157 |
|
| 82217 | 158 |
val maybe_apply_methods = map maybe_apply_proof_method named_methods |
159 |
||
| 82213 | 160 |
fun time_string time = string_of_int (Time.toMilliseconds time) ^ " ms" |
161 |
fun tool_time_string (s, time) = s ^ ": " ^ time_string time |
|
|
38942
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
162 |
|
| 55177 | 163 |
(* Makes reconstructor tools as silent as possible. The "set_visible" calls suppresses "Unification |
164 |
bound exceeded" warnings and the like. *) |
|
165 |
fun silence_methods debug = |
|
166 |
Config.put Metis_Tactic.verbose debug |
|
|
60275
d8a4fe35da00
silence local Unify.trace_bound as well: existing tools either refer to Proof.context or theory;
wenzelm
parents:
60190
diff
changeset
|
167 |
#> not debug ? (fn ctxt => |
|
d8a4fe35da00
silence local Unify.trace_bound as well: existing tools either refer to Proof.context or theory;
wenzelm
parents:
60190
diff
changeset
|
168 |
ctxt |
| 62984 | 169 |
|> Simplifier_Trace.disable |
|
60275
d8a4fe35da00
silence local Unify.trace_bound as well: existing tools either refer to Proof.context or theory;
wenzelm
parents:
60190
diff
changeset
|
170 |
|> Context_Position.set_visible false |
|
79743
3648e9c88d0c
add option for unify trace (now disabled by default as printing is excessive and rarely used);
Fabian Huch <huch@in.tum.de>
parents:
79742
diff
changeset
|
171 |
|> Config.put Unify.unify_trace false |
|
81373
8abdd60acd60
try0: avoid mapping background theory -- should be handled by Context_Position visibility;
Fabian Huch <huch@in.tum.de>
parents:
81372
diff
changeset
|
172 |
|> Config.put Argo_Tactic.trace "none") |
| 55177 | 173 |
|
| 82214 | 174 |
fun generic_try0 mode timeout_opt (tagged : tagged_xthm list) st = |
| 41038 | 175 |
let |
| 81365 | 176 |
val st = Proof.map_contexts (silence_methods false) st |
177 |
fun try_method method = method mode timeout_opt tagged st |
|
|
81362
f586fdabe670
clarified: proper return type;
Fabian Huch <huch@in.tum.de>
parents:
81361
diff
changeset
|
178 |
fun get_message {command, time, ...} = "Found proof: " ^ Active.sendback_markup_command
|
| 81365 | 179 |
command ^ " (" ^ time_string time ^ ")"
|
180 |
val print_step = Option.map (tap (writeln o get_message)) |
|
| 82213 | 181 |
fun get_results methods : result list = |
182 |
if mode = Normal then |
|
183 |
methods |
|
184 |
|> Par_List.map (try_method #> print_step) |
|
185 |
|> map_filter I |
|
186 |
|> sort (Time.compare o apply2 #time) |
|
187 |
else |
|
188 |
methods |
|
189 |
|> Par_List.get_some try_method |
|
190 |
|> the_list |
|
| 41038 | 191 |
in |
|
43026
0f15575a6465
handle non-auto try cases gracefully in Try Methods
blanchet
parents:
43024
diff
changeset
|
192 |
if mode = Normal then |
| 82216 | 193 |
"Trying " ^ implode_space (Try.serial_commas "and" (map quote named_methods)) ^ |
| 55179 | 194 |
"..." |
| 58843 | 195 |
|> writeln |
|
43026
0f15575a6465
handle non-auto try cases gracefully in Try Methods
blanchet
parents:
43024
diff
changeset
|
196 |
else |
|
0f15575a6465
handle non-auto try cases gracefully in Try Methods
blanchet
parents:
43024
diff
changeset
|
197 |
(); |
| 82217 | 198 |
(case get_results maybe_apply_methods of |
|
81362
f586fdabe670
clarified: proper return type;
Fabian Huch <huch@in.tum.de>
parents:
81361
diff
changeset
|
199 |
[] => (if mode = Normal then writeln "No proof found" else (); ((false, (noneN, [])), [])) |
|
f586fdabe670
clarified: proper return type;
Fabian Huch <huch@in.tum.de>
parents:
81361
diff
changeset
|
200 |
| results as {name, command, ...} :: _ =>
|
| 41038 | 201 |
let |
|
81362
f586fdabe670
clarified: proper return type;
Fabian Huch <huch@in.tum.de>
parents:
81361
diff
changeset
|
202 |
val method_times = |
|
f586fdabe670
clarified: proper return type;
Fabian Huch <huch@in.tum.de>
parents:
81361
diff
changeset
|
203 |
results |
|
f586fdabe670
clarified: proper return type;
Fabian Huch <huch@in.tum.de>
parents:
81361
diff
changeset
|
204 |
|> map (fn {name, time, ...} => (time, name))
|
|
f586fdabe670
clarified: proper return type;
Fabian Huch <huch@in.tum.de>
parents:
81361
diff
changeset
|
205 |
|> AList.coalesce (op =) |
| 81365 | 206 |
|> map (swap o apsnd commas) |
| 41038 | 207 |
val message = |
|
43026
0f15575a6465
handle non-auto try cases gracefully in Try Methods
blanchet
parents:
43024
diff
changeset
|
208 |
(case mode of |
| 52970 | 209 |
Auto_Try => "Auto Try0 found a proof" |
210 |
| Try => "Try0 found a proof" |
|
| 43031 | 211 |
| Normal => "Try this") ^ ": " ^ |
|
81361
6c0f8a16784d
improve try0: solve multiple subgoals at once, if possible;
Fabian Huch <huch@in.tum.de>
parents:
81360
diff
changeset
|
212 |
Active.sendback_markup_command command ^ |
|
81362
f586fdabe670
clarified: proper return type;
Fabian Huch <huch@in.tum.de>
parents:
81361
diff
changeset
|
213 |
(case method_times of |
|
63690
48a2c88091d7
tuning punctuation in messages output by Isabelle
blanchet
parents:
63518
diff
changeset
|
214 |
[(_, ms)] => " (" ^ time_string ms ^ ")"
|
| 81365 | 215 |
| method_times => "\n(" ^ space_implode "; " (map tool_time_string method_times) ^ ")")
|
| 41038 | 216 |
in |
|
81362
f586fdabe670
clarified: proper return type;
Fabian Huch <huch@in.tum.de>
parents:
81361
diff
changeset
|
217 |
((true, (name, if mode = Auto_Try then [message] else (writeln message; []))), results) |
| 54291 | 218 |
end) |
| 81365 | 219 |
end |
| 39331 | 220 |
|
| 81365 | 221 |
fun try0 timeout_opt = snd oo generic_try0 Normal timeout_opt |
|
38942
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
222 |
|
|
81363
fec95447c5bd
try0: pass tagged thms for better control;
Fabian Huch <huch@in.tum.de>
parents:
81362
diff
changeset
|
223 |
fun try0_trans tagged = |
|
60190
906de96ba68a
allow diagnostic proof commands with skip_proofs;
wenzelm
parents:
60094
diff
changeset
|
224 |
Toplevel.keep_proof |
| 81365 | 225 |
(ignore o generic_try0 Normal (SOME default_timeout) tagged o Toplevel.proof_of) |
|
41999
3c029ef9e0f2
added "simp:", "intro:", and "elim:" to "try" command
blanchet
parents:
41038
diff
changeset
|
226 |
|
|
81367
6b724cf59eed
clarified: proper type for facts;
Fabian Huch <huch@in.tum.de>
parents:
81366
diff
changeset
|
227 |
val parse_fact_refs = Scan.repeat1 (Scan.unless (Parse.name -- Args.colon) Parse.thm) |
| 55179 | 228 |
|
|
41999
3c029ef9e0f2
added "simp:", "intro:", and "elim:" to "try" command
blanchet
parents:
41038
diff
changeset
|
229 |
val parse_attr = |
| 81366 | 230 |
Args.$$$ "simp" |-- Args.colon |-- parse_fact_refs >> (map (rpair [Simp])) |
231 |
|| Args.$$$ "intro" |-- Args.colon |-- parse_fact_refs >> (map (rpair [Intro])) |
|
232 |
|| Args.$$$ "elim" |-- Args.colon |-- parse_fact_refs >> (map (rpair [Elim])) |
|
233 |
|| Args.$$$ "dest" |-- Args.colon |-- parse_fact_refs >> (map (rpair [Dest])) |
|
| 55179 | 234 |
|
|
41999
3c029ef9e0f2
added "simp:", "intro:", and "elim:" to "try" command
blanchet
parents:
41038
diff
changeset
|
235 |
fun parse_attrs x = |
| 55179 | 236 |
(Args.parens parse_attrs |
| 81365 | 237 |
|| Scan.repeat parse_attr >> (fn tagged => fold (curry (op @)) tagged [])) x |
|
41999
3c029ef9e0f2
added "simp:", "intro:", and "elim:" to "try" command
blanchet
parents:
41038
diff
changeset
|
238 |
|
|
38942
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
239 |
val _ = |
| 67149 | 240 |
Outer_Syntax.command \<^command_keyword>\<open>try0\<close> "try a combination of proof methods" |
| 81365 | 241 |
(Scan.optional parse_attrs [] #>> try0_trans) |
|
38942
e10c11971fa7
"try" -- a new diagnosis tool that tries to apply several methods in parallel
blanchet
parents:
diff
changeset
|
242 |
|
| 74508 | 243 |
val _ = |
244 |
Try.tool_setup |
|
245 |
{name = "try0", weight = 30, auto_option = \<^system_option>\<open>auto_methods\<close>,
|
|
| 81365 | 246 |
body = fn auto => fst o generic_try0 (if auto then Auto_Try else Try) NONE []} |
| 39331 | 247 |
|
| 81365 | 248 |
end |