equal
deleted
inserted
replaced
5 *) |
5 *) |
6 |
6 |
7 signature TRY = |
7 signature TRY = |
8 sig |
8 sig |
9 type tool = |
9 type tool = |
10 string * (int * string * (bool -> Proof.state -> bool * (string * Proof.state))) |
10 string * (int * string * (bool -> Proof.state -> bool * (string * string list))) |
11 |
11 |
12 val tryN : string |
12 val tryN : string |
13 |
13 |
14 val serial_commas : string -> string list -> string list |
14 val serial_commas : string -> string list -> string list |
15 val subgoal_count : Proof.state -> int |
15 val subgoal_count : Proof.state -> int |
20 |
20 |
21 structure Try : TRY = |
21 structure Try : TRY = |
22 struct |
22 struct |
23 |
23 |
24 type tool = |
24 type tool = |
25 string * (int * string * (bool -> Proof.state -> bool * (string * Proof.state))) |
25 string * (int * string * (bool -> Proof.state -> bool * (string * string list))) |
26 |
26 |
27 val tryN = "try" |
27 val tryN = "try" |
28 |
28 |
29 |
29 |
30 (* helpers *) |
30 (* helpers *) |
85 fun auto_try state = |
85 fun auto_try state = |
86 get_tools (Proof.theory_of state) |
86 get_tools (Proof.theory_of state) |
87 |> map_filter (fn (_, (_, auto, tool)) => if Options.default_bool auto then SOME tool else NONE) |
87 |> map_filter (fn (_, (_, auto, tool)) => if Options.default_bool auto then SOME tool else NONE) |
88 |> Par_List.get_some (fn tool => |
88 |> Par_List.get_some (fn tool => |
89 case try (tool true) state of |
89 case try (tool true) state of |
90 SOME (true, (_, state)) => SOME state |
90 SOME (true, (_, outcome)) => SOME outcome |
91 | _ => NONE) |
91 | _ => NONE) |
92 |> the_default state |
92 |> the_default [] |
93 |
93 |
94 |
94 |
95 (* asynchronous print function (PIDE) *) |
95 (* asynchronous print function (PIDE) *) |
96 |
96 |
97 fun print_function ((name, (weight, auto, tool)): tool) = |
97 fun print_function ((name, (weight, auto, tool)): tool) = |
109 |> Proof.map_context (Context_Position.set_visible false) |
109 |> Proof.map_context (Context_Position.set_visible false) |
110 val auto_time_limit = Options.default_real @{system_option auto_time_limit} |
110 val auto_time_limit = Options.default_real @{system_option auto_time_limit} |
111 in |
111 in |
112 if auto_time_limit > 0.0 then |
112 if auto_time_limit > 0.0 then |
113 (case TimeLimit.timeLimit (seconds auto_time_limit) (fn () => tool true state) () of |
113 (case TimeLimit.timeLimit (seconds auto_time_limit) (fn () => tool true state) () of |
114 (true, (_, state')) => |
114 (true, (_, outcome)) => List.app writeln outcome |
115 List.app Pretty.writeln (Proof.pretty_goal_messages state') |
|
116 | _ => ()) |
115 | _ => ()) |
117 else () |
116 else () |
118 end handle exn => if Exn.is_interrupt exn then reraise exn else ()} |
117 end handle exn => if Exn.is_interrupt exn then reraise exn else ()} |
119 else NONE) |
118 else NONE) |
120 |
119 |