15 val with_cleanup : ('a -> unit) -> ('a -> 'b) -> 'a -> 'b |
15 val with_cleanup : ('a -> unit) -> ('a -> 'b) -> 'a -> 'b |
16 val infinite_timeout : Time.time |
16 val infinite_timeout : Time.time |
17 val time_mult : real -> Time.time -> Time.time |
17 val time_mult : real -> Time.time -> Time.time |
18 val parse_bool_option : bool -> string -> string -> bool option |
18 val parse_bool_option : bool -> string -> string -> bool option |
19 val parse_time_option : string -> string -> Time.time option |
19 val parse_time_option : string -> string -> Time.time option |
20 val spying : bool -> (unit -> string * string) -> unit |
|
21 val subgoal_count : Proof.state -> int |
20 val subgoal_count : Proof.state -> int |
22 val reserved_isar_keyword_table : unit -> unit Symtab.table |
21 val reserved_isar_keyword_table : unit -> unit Symtab.table |
23 val thms_in_proof : |
22 val thms_in_proof : |
24 (string Symtab.table * string Symtab.table) option -> thm -> string list |
23 (string Symtab.table * string Symtab.table) option -> thm -> string list |
25 val thms_of_name : Proof.context -> string -> thm list |
24 val thms_of_name : Proof.context -> string -> thm list |
26 val one_day : Time.time |
25 val one_day : Time.time |
27 val one_year : Time.time |
26 val one_year : Time.time |
28 val time_limit : Time.time option -> ('a -> 'b) -> 'a -> 'b |
27 val time_limit : Time.time option -> ('a -> 'b) -> 'a -> 'b |
29 val with_vanilla_print_mode : ('a -> 'b) -> 'a -> 'b |
28 val with_vanilla_print_mode : ('a -> 'b) -> 'a -> 'b |
|
29 val hackish_string_of_term : Proof.context -> term -> string |
|
30 val spying : bool -> (unit -> Proof.state * int * string * string) -> unit |
30 |
31 |
31 (** extrema **) |
32 (** extrema **) |
32 val max : ('a * 'a -> order) -> 'a -> 'a -> 'a |
33 val max : ('a * 'a -> order) -> 'a -> 'a -> 'a |
33 val max_option : ('a * 'a -> order) -> 'a option -> 'a option -> 'a option |
34 val max_option : ('a * 'a -> order) -> 'a option -> 'a option -> 'a option |
34 val max_list : ('a * 'a -> order) -> 'a list -> 'a option |
35 val max_list : ('a * 'a -> order) -> 'a list -> 'a option |
84 if is_none secs orelse Real.< (the secs, 0.0) then |
85 if is_none secs orelse Real.< (the secs, 0.0) then |
85 error ("Parameter " ^ quote name ^ " must be assigned a nonnegative \ |
86 error ("Parameter " ^ quote name ^ " must be assigned a nonnegative \ |
86 \number of seconds (e.g., \"60\", \"0.5\") or \"none\".") |
87 \number of seconds (e.g., \"60\", \"0.5\") or \"none\".") |
87 else |
88 else |
88 SOME (seconds (the secs)) |
89 SOME (seconds (the secs)) |
89 end |
|
90 |
|
91 val spying_version = "a" |
|
92 |
|
93 fun spying false _ = () |
|
94 | spying true f = |
|
95 let val (tool, message) = f () in |
|
96 File.append (Path.explode "$ISABELLE_HOME_USER/spy_sledgehammer") |
|
97 (spying_version ^ " " ^ timestamp () ^ ": " ^ tool ^ ": " ^ message ^ "\n") |
|
98 end |
90 end |
99 |
91 |
100 val subgoal_count = Try.subgoal_count |
92 val subgoal_count = Try.subgoal_count |
101 |
93 |
102 fun reserved_isar_keyword_table () = |
94 fun reserved_isar_keyword_table () = |
165 |
157 |
166 fun with_vanilla_print_mode f x = |
158 fun with_vanilla_print_mode f x = |
167 Print_Mode.setmp (filter (curry (op =) Symbol.xsymbolsN) |
159 Print_Mode.setmp (filter (curry (op =) Symbol.xsymbolsN) |
168 (print_mode_value ())) f x |
160 (print_mode_value ())) f x |
169 |
161 |
|
162 fun hackish_string_of_term ctxt = |
|
163 with_vanilla_print_mode (Syntax.string_of_term ctxt) #> simplify_spaces |
|
164 |
|
165 val spying_version = "b" |
|
166 |
|
167 fun spying false _ = () |
|
168 | spying true f = |
|
169 let |
|
170 val (state, i, tool, message) = f () |
|
171 val ctxt = Proof.context_of state |
|
172 val goal = Logic.get_goal (prop_of (#goal (Proof.goal state))) i |
|
173 val hash = String.substring (SHA1.rep (SHA1.digest (hackish_string_of_term ctxt goal)), 0, 12) |
|
174 in |
|
175 File.append (Path.explode "$ISABELLE_HOME_USER/spy_sledgehammer") |
|
176 (spying_version ^ " " ^ timestamp () ^ ": " ^ hash ^ ": " ^ tool ^ ": " ^ message ^ "\n") |
|
177 end |
|
178 |
170 (** extrema **) |
179 (** extrema **) |
171 |
180 |
172 fun max ord x y = case ord(x,y) of LESS => y | _ => x |
181 fun max ord x y = case ord(x,y) of LESS => y | _ => x |
173 |
182 |
174 fun max_option ord = max (option_ord ord) |
183 fun max_option ord = max (option_ord ord) |