13 |
13 |
14 datatype failure = |
14 datatype failure = |
15 Unprovable | IncompleteUnprovable | CantConnect | TimedOut | |
15 Unprovable | IncompleteUnprovable | CantConnect | TimedOut | |
16 OutOfResources | SpassTooOld | VampireTooOld | NoPerl | NoLibwwwPerl | |
16 OutOfResources | SpassTooOld | VampireTooOld | NoPerl | NoLibwwwPerl | |
17 NoRealZ3 | MalformedInput | MalformedOutput | Interrupted | Crashed | |
17 NoRealZ3 | MalformedInput | MalformedOutput | Interrupted | Crashed | |
18 InternalError | UnknownError |
18 InternalError | UnknownError of string |
19 |
19 |
20 type step_name = string * string option |
20 type step_name = string * string option |
21 |
21 |
22 datatype 'a step = |
22 datatype 'a step = |
23 Definition of step_name * 'a * 'a | |
23 Definition of step_name * 'a * 'a | |
24 Inference of step_name * 'a * step_name list |
24 Inference of step_name * 'a * step_name list |
25 |
25 |
26 type 'a proof = 'a uniform_formula step list |
26 type 'a proof = 'a uniform_formula step list |
27 |
27 |
28 val strip_spaces : (char -> bool) -> string -> string |
28 val strip_spaces : (char -> bool) -> string -> string |
|
29 val short_output : bool -> string -> string |
29 val string_for_failure : string -> failure -> string |
30 val string_for_failure : string -> failure -> string |
30 val extract_important_message : string -> string |
31 val extract_important_message : string -> string |
31 val extract_known_failure : |
32 val extract_known_failure : |
32 (failure * string) list -> string -> failure option |
33 (failure * string) list -> string -> failure option |
33 val extract_tstplike_proof_and_outcome : |
34 val extract_tstplike_proof_and_outcome : |
34 bool -> int -> (string * string) list -> (failure * string) list -> string |
35 bool -> bool -> int -> (string * string) list -> (failure * string) list |
35 -> string * failure option |
36 -> string -> string * failure option |
36 val is_same_step : step_name * step_name -> bool |
37 val is_same_step : step_name * step_name -> bool |
37 val atp_proof_from_tstplike_string : bool -> string -> string proof |
38 val atp_proof_from_tstplike_string : bool -> string -> string proof |
38 val map_term_names_in_atp_proof : |
39 val map_term_names_in_atp_proof : |
39 (string -> string) -> string proof -> string proof |
40 (string -> string) -> string proof -> string proof |
40 val nasty_atp_proof : string Symtab.table -> string proof -> string proof |
41 val nasty_atp_proof : string Symtab.table -> string proof -> string proof |
47 |
48 |
48 datatype failure = |
49 datatype failure = |
49 Unprovable | IncompleteUnprovable | CantConnect | TimedOut | OutOfResources | |
50 Unprovable | IncompleteUnprovable | CantConnect | TimedOut | OutOfResources | |
50 SpassTooOld | VampireTooOld | NoPerl | NoLibwwwPerl | NoRealZ3 | |
51 SpassTooOld | VampireTooOld | NoPerl | NoLibwwwPerl | NoRealZ3 | |
51 MalformedInput | MalformedOutput | Interrupted | Crashed | InternalError | |
52 MalformedInput | MalformedOutput | Interrupted | Crashed | InternalError | |
52 UnknownError |
53 UnknownError of string |
53 |
54 |
54 fun strip_spaces_in_list _ [] = [] |
55 fun strip_spaces_in_list _ [] = [] |
55 | strip_spaces_in_list _ [c1] = if Char.isSpace c1 then [] else [str c1] |
56 | strip_spaces_in_list _ [c1] = if Char.isSpace c1 then [] else [str c1] |
56 | strip_spaces_in_list is_evil [c1, c2] = |
57 | strip_spaces_in_list is_evil [c1, c2] = |
57 strip_spaces_in_list is_evil [c1] @ strip_spaces_in_list is_evil [c2] |
58 strip_spaces_in_list is_evil [c1] @ strip_spaces_in_list is_evil [c2] |
69 fun strip_spaces is_evil = |
70 fun strip_spaces is_evil = |
70 implode o strip_spaces_in_list is_evil o String.explode |
71 implode o strip_spaces_in_list is_evil o String.explode |
71 |
72 |
72 fun is_ident_char c = Char.isAlphaNum c orelse c = #"_" |
73 fun is_ident_char c = Char.isAlphaNum c orelse c = #"_" |
73 val strip_spaces_except_between_ident_chars = strip_spaces is_ident_char |
74 val strip_spaces_except_between_ident_chars = strip_spaces is_ident_char |
|
75 |
|
76 fun elide_string threshold s = |
|
77 if size s > threshold then |
|
78 String.extract (s, 0, SOME (threshold div 2 - 5)) ^ " ...... " ^ |
|
79 String.extract (s, size s - (threshold + 1) div 2 + 6, NONE) |
|
80 else |
|
81 s |
|
82 fun short_output verbose output = |
|
83 if verbose then elide_string 1000 output else "" |
74 |
84 |
75 fun missing_message_tail prover = |
85 fun missing_message_tail prover = |
76 " appears to be missing. You will need to install it if you want to run " ^ |
86 " appears to be missing. You will need to install it if you want to run " ^ |
77 prover ^ "s remotely." |
87 prover ^ "s remotely." |
78 |
88 |
110 | string_for_failure prover Interrupted = |
120 | string_for_failure prover Interrupted = |
111 "The " ^ prover ^ " was interrupted." |
121 "The " ^ prover ^ " was interrupted." |
112 | string_for_failure prover Crashed = "The " ^ prover ^ " crashed." |
122 | string_for_failure prover Crashed = "The " ^ prover ^ " crashed." |
113 | string_for_failure prover InternalError = |
123 | string_for_failure prover InternalError = |
114 "An internal " ^ prover ^ " error occurred." |
124 "An internal " ^ prover ^ " error occurred." |
115 | string_for_failure prover UnknownError = |
125 | string_for_failure prover (UnknownError string) = |
116 (* "An" is correct for "ATP" and "SMT". *) |
126 (* "An" is correct for "ATP" and "SMT". *) |
117 "An " ^ prover ^ " error occurred." |
127 "An " ^ prover ^ " error occurred" ^ |
|
128 (if string = "" then "." else ":\n" ^ string) |
118 |
129 |
119 fun extract_delimited (begin_delim, end_delim) output = |
130 fun extract_delimited (begin_delim, end_delim) output = |
120 output |> first_field begin_delim |> the |> snd |
131 output |> first_field begin_delim |> the |> snd |
121 |> first_field end_delim |> the |> fst |
132 |> first_field end_delim |> the |> fst |
122 |> first_field "\n" |> the |> snd |
133 |> first_field "\n" |> the |> snd |
144 fun extract_known_failure known_failures output = |
155 fun extract_known_failure known_failures output = |
145 known_failures |
156 known_failures |
146 |> find_first (fn (_, pattern) => String.isSubstring pattern output) |
157 |> find_first (fn (_, pattern) => String.isSubstring pattern output) |
147 |> Option.map fst |
158 |> Option.map fst |
148 |
159 |
149 fun extract_tstplike_proof_and_outcome complete res_code proof_delims |
160 fun extract_tstplike_proof_and_outcome verbose complete res_code proof_delims |
150 known_failures output = |
161 known_failures output = |
151 case extract_known_failure known_failures output of |
162 case extract_known_failure known_failures output of |
152 NONE => (case extract_tstplike_proof proof_delims output of |
163 NONE => (case extract_tstplike_proof proof_delims output of |
153 "" => ("", SOME (if res_code = 0 andalso output = "" then |
164 "" => ("", SOME (if res_code = 0 andalso output = "" then |
154 Interrupted |
165 Interrupted |
155 else |
166 else |
156 UnknownError)) |
167 UnknownError (short_output verbose output))) |
157 | tstplike_proof => if res_code = 0 then (tstplike_proof, NONE) |
168 | tstplike_proof => |
158 else ("", SOME UnknownError)) |
169 if res_code = 0 then (tstplike_proof, NONE) |
|
170 else ("", SOME (UnknownError (short_output verbose output)))) |
159 | SOME failure => |
171 | SOME failure => |
160 ("", SOME (if failure = IncompleteUnprovable andalso complete then |
172 ("", SOME (if failure = IncompleteUnprovable andalso complete then |
161 Unprovable |
173 Unprovable |
162 else |
174 else |
163 failure)) |
175 failure)) |