type atp_step_name = string * stringlist type ('a, 'b) atp_step =
atp_step_name * atp_formula_role * 'a * 'b * atp_step_name list
type'a atp_proof = (('a, 'a, ('a, 'a atp_type) atp_term, 'a) atp_formula, string) atp_step list
val agsyholN : string val alt_ergoN : string val cvc5N : string val eN : string val iproverN : string val leo2N : string val leo3N : string val satallaxN : string val spassN : string val vampireN : string val veritN : string val waldmeisterN : string val z3N : string val zipperpositionN : string val remote_prefix : string val dummy_fofN : string val dummy_tfxN : string val dummy_thfN : string
val agsyhol_core_rule : string val spass_input_rule : string val spass_pre_skolemize_rule : string val spass_skolemize_rule : string val zipperposition_define_rule : string
val short_output : bool -> string -> string val string_of_atp_failure : atp_failure -> string val extract_known_atp_failure : (atp_failure * string) list -> string -> atp_failure option val extract_tstplike_proof_and_outcome : bool -> (string * string) list -> (atp_failure * string) list -> string
-> string * atp_failure option val is_same_atp_step : atp_step_name -> atp_step_name -> bool val scan_general_id : stringlist -> string * stringlist val parse_fol_formula : stringlist ->
(string, string atp_type, (string, string atp_type) atp_term, string) atp_formula * stringlist val clean_up_atp_proof_dependencies : string atp_proof -> string atp_proof val map_term_names_in_atp_proof : (string -> string) -> string atp_proof -> string atp_proof val nasty_atp_proof : string Symtab.table -> string atp_proof -> string atp_proof
val skip_term : stringlist -> string * stringlist val parse_hol_formula : stringlist ->
('a, 'b, (string, string ATP_Problem.atp_type) ATP_Problem.atp_term, 'c) ATP_Problem.atp_formula * stringlist val dummy_atype : string ATP_Problem.atp_type val role_of_tptp_string : string -> ATP_Problem.atp_formula_role val parse_line : bool -> string -> ('a * string ATP_Problem.atp_problem_line list) list -> stringlist -> ((string * stringlist) * ATP_Problem.atp_formula_role *
(string, 'b, (string, string ATP_Problem.atp_type) ATP_Problem.atp_term, 'c) ATP_Problem.atp_formula
* string * (string * 'd list) list) list * string list val core_inference : 'a -> 'b -> ('b * 'b list) * ATP_Problem.atp_formula_role *
('c, 'd, (string, 'e) ATP_Problem.atp_term, 'f) ATP_Problem.atp_formula * 'a * 'g list val vampire_step_name_ord : (string * 'a) ord val core_of_agsyhol_proof : string -> stringlistoption val string_of_atp_step : ('a -> string) -> ('b -> string) -> ('a, 'b) atp_step -> string
val agsyholN = "agsyhol" val alt_ergoN = "alt_ergo" val cvc5N = "cvc5" val eN = "e" val iproverN = "iprover" val leo2N = "leo2" val leo3N = "leo3" val satallaxN = "satallax" val spassN = "spass" val vampireN = "vampire" val veritN = "verit" val waldmeisterN = "waldmeister" val z3N = "z3" val zipperpositionN = "zipperposition" val remote_prefix = "remote_"
val dummy_fofN = "dummy_fof" val dummy_tfxN = "dummy_tfx" val dummy_thfN = "dummy_thf"
val agsyhol_core_rule = "__agsyhol_core"(* arbitrary *) val spass_input_rule = "Inp" val spass_pre_skolemize_rule = "__Sko0"(* arbitrary *) val spass_skolemize_rule = "__Sko"(* arbitrary *) val zipperposition_define_rule = "define"(* arbitrary *)
fun short_output verbose output = if verbose then if output = ""then"No details available"else elide_string 1000 output else ""
fun from_lemmas [] = ""
| from_lemmas ss = " from " ^ implode_space (Try.serial_commas "and" (map quote ss))
fun string_of_atp_failure MaybeUnprovable = "Problem maybe unprovable"
| string_of_atp_failure Unprovable = "Problem unprovable"
| string_of_atp_failure GaveUp = "Gave up"
| string_of_atp_failure ProofMissing = "Proof missing"
| string_of_atp_failure ProofIncomplete = "Proof incomplete"
| string_of_atp_failure ProofUnparsable = "Proof unparsable"
| string_of_atp_failure (UnsoundProof (false, ss)) = "Derived the lemma \"False\"" ^ from_lemmas ss ^ ", likely due to the use of an unsound type encoding"
| string_of_atp_failure (UnsoundProof (true, ss)) = "Derived the lemma \"False\"" ^ from_lemmas ss ^ ", likely due to inconsistent axioms or \"sorry\"d lemmas"
| string_of_atp_failure TimedOut = "Timed out"
| string_of_atp_failure Inappropriate = "Problem outside the prover's scope"
| string_of_atp_failure OutOfResources = "Out of resources"
| string_of_atp_failure MalformedInput = "Malformed problem"
| string_of_atp_failure MalformedOutput = "Malformed output"
| string_of_atp_failure Interrupted = "Interrupted"
| string_of_atp_failure Crashed = "Crashed"
| string_of_atp_failure InternalError = "Internal prover error"
| string_of_atp_failure (UnknownError s) = "Prover error" ^ (if s = ""then" (pass the \"verbose\" option for details)"else":\n" ^ s)
fun extract_delimited (begin_delim, end_delim) output =
(case first_field begin_delim output of
SOME (_, tail) =>
(case first_field "\n" tail of
SOME (_, tail') => if end_delim = ""then
tail' else
(case first_field end_delim tail' of
SOME (body, _) => body
| NONE => "")
| NONE => "")
| NONE => "")
(* Splits by the first possible of a list of delimiters. *) fun extract_tstplike_proof delims output =
(case apply2 (find_first (fn s => String.isSubstring s output)) (ListPair.unzip delims) of
(SOME begin_delim, SOME end_delim) => extract_delimited (begin_delim, end_delim) output
| _ => "")
fun extract_tstplike_proof_and_outcome verbose proof_delims known_failures output = let val known_atp_failure = extract_known_atp_failure known_failures output val tstplike_proof = extract_tstplike_proof proof_delims output in
(case (tstplike_proof, known_atp_failure) of
(_, SOME ProofIncomplete) => ("", NONE)
| (_, SOME ProofUnparsable) => ("", NONE)
| ("", SOME ProofMissing) => ("", NONE)
| ("", NONE) => ("", SOME (UnknownError (short_output verbose output)))
| res as ("", _) => res
| (tstplike_proof, _) => (tstplike_proof, NONE)) end
type atp_step_name = string * stringlist
fun is_same_atp_step (s1, _) (s2, _) = s1 = s2
val vampire_fact_prefix = "f"
fun vampire_step_name_ord p = letval q = apply2 fst p in (* The "unprefix" part is to cope with Vampire's output, which puts facts with names of the
form "fN" where N is an integer in reverse order. *)
(case apply2 (Int.fromString o perhaps (try (unprefix vampire_fact_prefix))) q of
(SOME i, SOME j) => int_ord (i, j)
| (SOME _, NONE) => LESS
| (NONE, SOME _) => GREATER
| (NONE, NONE) => string_ord q) end
type ('a, 'b) atp_step = atp_step_name * atp_formula_role * 'a * 'b * atp_step_name list
type'a atp_proof = (('a, 'a, ('a, 'a atp_type) atp_term, 'a) atp_formula, string) atp_step list
(**** PARSING OF TSTP FORMAT ****)
(* Strings enclosed in single quotes (e.g., file names), identifiers possibly starting
with "$" and possibly with "!" in them. *) val scan_general_id =
$$ "'" |-- Scan.repeat (~$$ "'") --| $$ "'" >> implode
|| (Scan.repeat ($$ "$") -- Scan.many1 Symbol.is_letdig >> (op ^ o apply2 implode))
-- Scan.optional (Scan.repeat ($$ "!") -- Scan.many1 Symbol.is_letdig >> (op ^ o apply2 implode)) ""
>> op ^
fun skip_term x = let fun skip _ accum [] = (accum, [])
| skip n accum (ss as s :: ss') = if (s = "," orelse s = ".") andalso n = 0 then
(accum, ss) elseif member (op =) [")", "]"] s then if n = 0 then (accum, ss) else skip (n - 1) (s :: accum) ss' elseif member (op =) ["(", "["] s then
skip (n + 1) (s :: accum) ss' else
skip n (s :: accum) ss' in
(skip 0 [] #>> (rev #> implode)) x end and skip_terms x = (skip_term ::: Scan.repeat ($$ "," |-- skip_term)) x
(* We ignore the stars and the pluses that follow literals in SPASS's output. *) fun parse_decorated_atom x =
(parse_fol_atom --| Scan.repeat ($$ "*" || $$ "+" || $$ " ")) x
fun parse_line full local_name problem = if local_name = spassN then parse_spass_line else parse_tstp_line full problem
fun core_of_agsyhol_proof s =
(case split_lines s of "The transformed problem consists of the following conjectures:" :: conj ::
_ :: proof_term :: _ => SOME (unprefix " " conj :: find_enclosed "<<"">>" proof_term)
| _ => NONE)
fun clean_up_dependencies _ [] = []
| clean_up_dependencies seen ((name, role, u, rule, deps) :: steps) =
(name, role, u, rule, map_filter (fn dep => find_first (is_same_atp_step dep) seen) deps) ::
clean_up_dependencies (name :: seen) steps
fun clean_up_atp_proof_dependencies proof = clean_up_dependencies [] proof
fun map_term_names_in_atp_proof f = let fun map_type (AType ((s, clss), tys)) = AType ((f s, map f clss), map map_type tys)
| map_type (AFun (ty, ty')) = AFun (map_type ty, map_type ty')
| map_type (APi (ss, ty)) = APi (map f ss, map_type ty)
fun map_step (name, role, phi, rule, deps) = (name, role, map_formula phi, rule, deps) in map map_step end
fun nasty_name pool s = Symtab.lookup pool s |> the_default s
fun nasty_atp_proof pool = not (Symtab.is_empty pool) ? map_term_names_in_atp_proof (nasty_name pool)
fun string_of_list f xs = enclose "[""]" (commas (map f xs))
fun string_of_atp_step_name (s, ss) = "(" ^ s ^ ", " ^ string_of_list I ss ^ ")"
fun string_of_atp_step f g (name, role, x, y, names) = let val name' = string_of_atp_step_name name val role' = ATP_Problem.tptp_string_of_role role val x' = f x val y' = g y val names' = string_of_list string_of_atp_step_name names in "(" ^ name' ^ ", " ^ role' ^ ", " ^ x' ^ ", " ^ y' ^ ", " ^ names' ^ ")" end
fun parse_proof full local_name problem =
strip_spaces_except_between_idents
#> raw_explode
#> Scan.error (!! (fn _ => raise UNRECOGNIZED_ATP_PROOF ())
(Scan.finite Symbol.stopper (Scan.repeats1 (parse_line full local_name problem))))
#> (fn (proof, ss) => if null ss then proof elseraise UNRECOGNIZED_ATP_PROOF ())
fun atp_proof_of_tstplike_proof _ _ _ "" = []
| atp_proof_of_tstplike_proof full local_prover problem tstp =
(case core_of_agsyhol_proof tstp of
SOME facts => facts |> map (core_inference agsyhol_core_rule)
| NONE =>
tstp
|> parse_proof full local_prover problem
|> local_prover = vampireN ? perhaps (try (sort (vampire_step_name_ord o apply2 #1))))
val e_symbol_prefixes = ["esk", "epred"]
fun exists_name_in_term pred = let fun ex_name (ATerm ((s, _), tms)) = pred s orelse exists ex_name tms
| ex_name (AAbs ((_, tm), tms)) = exists ex_name (tm :: tms) in ex_name end
fun exists_name_in_formula pred phi =
formula_fold NONE (fn _ => fn tm => fn ex => ex orelse exists_name_in_term pred tm) phi false
fun exists_symbol_in_formula prefixes =
exists_name_in_formula (fn s => exists (fn prefix => String.isPrefix prefix s) prefixes)
fun atp_abduce_candidates_of_output local_prover problem output = let (* Truncate too large output to avoid memory issues. *) val max_size = 1000000 val output = ifString.size output > max_size then String.substring (output, 0, max_size) else
output
fun fold_extract accum [] = accum
| fold_extract accum (line :: lines) = ifString.isSubstring "# info" line
andalso String.isSubstring "negated_conjecture" line then ifString.isSubstring ", 0, 0," line then (* This pattern occurs in the "info()" comment of an E clause that directly emerges from the conjecture. We don't want to tell the user that they can prove "P" by assuming
"P". *)
fold_extract accum lines else let val clean_line =
(case space_explode "#" line of
[] => ""
| before_hash :: _ => before_hash) in
(casetry (parse_proof true local_prover problem) clean_line of
SOME [(_, _, phi, _, _)] => if local_prover = eN andalso exists_symbol_in_formula e_symbol_prefixes phi then
fold_extract accum lines else
fold_extract (phi :: accum) lines
| _ => fold_extract accum lines) end else
fold_extract accum lines in
fold_extract [] (split_lines output) end
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.