Package com.articulate.sigma.trans
Class TPTP3ProofProcessor
java.lang.Object
com.articulate.sigma.trans.TPTP3ProofProcessor
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanstatic booleanbooleanbooleanList<tptp_parser.TPTPFormula> -
Constructor Summary
ConstructorsConstructorDescription*************************************************************** -
Method Summary
Modifier and TypeMethodDescription************************************************************* Create a proof in a format suitable for GraphViz' input format http://www.graphviz.org/.static StringcreateProofDotGraphImage(String filename) Creates a specified formatted image from a generated *.dot file from GraphViz.*************************************************************** Return the answer clause, or null if not present*************************************************************** Returns the most specific type for skolem variable.getInferenceType(String supportId) ***************************************************************int***************************************************************getPrologArgs(String line) *************************************************************** return the predicate and arguments to a valid prolog expression p(a1,a2...an) where a1..an are an atom, a string or a prolog expressionstatic boolean*************************************************************** Input: s__Arc13_1 Output: Arc13_1*************************************************************** Join TPTP3 proof statements that are formatted over multiple lines.joinNreverseInputLines(List<String> inputs) *************************************************************** Join TPTP3 proof statements that are formatted over multiple lines and reverse them for Vampire, which presents proofs in reverse order.static void***************************************************************parseAnswerTuples(List<String> st, String strQuery, KB kb, StringBuilder qlist) *************************************************************** Return a list of answers if prover finds bindings for wh- queries.voidparseProofFromFile(String filename, KB kb) ***************************************************************voidparseProofOutput(LineNumberReader lnr, KB kb) *************************************************************** Compute bindings and proof from theorem prover's responsevoidparseProofOutput(String st, KB kb) ***************************************************************voidparseProofOutput(List<String> lines, String kifQuery, KB kb, StringBuilder qlist) Parses TPTP (Thousands of Problems for Theorem Provers) proof output from a theorem prover and extracts proof steps, answer bindings, and status information.parseProofStep(String line) *************************************************************** Parse a step like the following into its constituents fof(c_0_5, axiom, (s__subclass(s__Artifact,s__Object)), c_0_3).parseSupports(String supportId) *************************************************************** Parse support / proof statements in the responsevoid*************************************************************** Print out prover's bindingsstatic voidprintPrologTerm(com.igormaznitsa.prologparser.terms.PrologTerm pt) ***************************************************************voidprintProof(int level) *************************************************************** Print proof removing some steps based on proof level 1 = full proof 2 = remove steps with single support 3 = show only axioms from the KBvoidprocessAnswers(String line) *************************************************************** Return bindings from TPTP3 answer tuplesvoidprocessAnswersFromProof(StringBuilder qlist, String query) *************************************************************** Put bindings from TPTP3 proof answer variables into bindingMapremoveDupInArray(List<String> input) *************************************************************** Remove duplicates in an Array without changing the orderList<tptp_parser.TPTPFormula> renumberProof(List<tptp_parser.TPTPFormula> proof) *************************************************************** renumber a proof after simplificationvoidrenumberSupport(Map<String, tptp_parser.TPTPFormula> ftable, tptp_parser.TPTPFormula ps) *************************************************************** Look through the chain of supporting steps for a source axiom or an axiom with more than one premise.reorderVampire4_8(List<String> cleaned) reorderVampireProofAnyDialect(List<String> lines) Reorder a Vampire 4.8-style reverse proof into 5.0-style forward order.*************************************************************** just replace skolem terms with "something" for nowvoidstatic voidshowHelp()***************************************************************List<tptp_parser.TPTPFormula> simplifyProof(int level) *************************************************************** Simplify proof to remove steps with single support other than axioms from the KB (plus optional readability filtering for ans*).voidsimpPara()*************************************************************** simplify and paraphrase a proofsupportIdToInts(List<String> supportIds) *************************************************************** Parse support / proof statements in the responsestatic StringtoFOFLine(tptp_parser.TPTPFormula f) Format a TPTPFormula as a single fof(...) line.toString()
-
Field Details
-
debug
public static boolean debug -
status
-
noConjecture
public boolean noConjecture -
inconsistency
public boolean inconsistency -
containsFalse
public boolean containsFalse -
bindings
-
bindingMap
-
skolemTypes
-
proof
-
idTable
-
-
Constructor Details
-
TPTP3ProofProcessor
public TPTP3ProofProcessor()***************************************************************
-
-
Method Details
-
toString
-
joinLines
*************************************************************** Join TPTP3 proof statements that are formatted over multiple lines. Note that comment lines are left unchanged. -
joinNreverseInputLines
*************************************************************** Join TPTP3 proof statements that are formatted over multiple lines and reverse them for Vampire, which presents proofs in reverse order. Note that comment lines are left unchanged. -
getPrologArgs
*************************************************************** return the predicate and arguments to a valid prolog expression p(a1,a2...an) where a1..an are an atom, a string or a prolog expression -
getInferenceType
*************************************************************** -
supportIdToInts
*************************************************************** Parse support / proof statements in the response -
parseSupports
*************************************************************** Parse support / proof statements in the response -
parseProofStep
*************************************************************** Parse a step like the following into its constituents fof(c_0_5, axiom, (s__subclass(s__Artifact,s__Object)), c_0_3). fof(c_0_2, negated_conjecture, (~(?[X1]:(s__subclass(X1,s__Object)invalid input: '&'~$answer(esk1_1(X1))))), inference(assume_negation,[status(cth)],[inference(add_answer_literal,[status(thm)],[c_0_0, theory(answers)])])). -
processAnswers
*************************************************************** Return bindings from TPTP3 answer tuples -
extractAnswerClause
*************************************************************** Return the answer clause, or null if not present -
removeDupInArray
*************************************************************** Remove duplicates in an Array without changing the order -
processAnswersFromProof
*************************************************************** Put bindings from TPTP3 proof answer variables into bindingMap -
findTypesForSkolemTerms
*************************************************************** Returns the most specific type for skolem variable.- Parameters:
kb- The knowledge base used to find skolem term's types For example, original binding = esk3_0 set binding = "An instance of Human" (Human is the most specific type for esk3_0 in the given proof) original binding = esk3_1 set binding = "An instance of Human, Agent" (If multiple types are found for esk3_1)- Returns:
- the most specific type for skolem variable
-
isSkolemRelation
*************************************************************** Input: s__Arc13_1 Output: Arc13_1 -
printAnswers
public void printAnswers()*************************************************************** Print out prover's bindings -
parseProofOutput
*************************************************************** Compute bindings and proof from theorem prover's response -
parseProofOutput
Parses TPTP (Thousands of Problems for Theorem Provers) proof output from a theorem prover and extracts proof steps, answer bindings, and status information. This method processes the textual output lines from automated theorem provers (such as Vampire or E Prover), identifying and extracting:- SZS status information (e.g., "Refutation", "Theorem", "CounterSatisfiable")
- Answer bindings for query variables in bracketed format
- Individual proof steps in TPTP formula format (fof/cnf/tff)
- Proof metadata including support relationships and inference rules
- Detects potential knowledge base inconsistencies (refutations without conjectures)
- Strips proof step numbers from Vampire output if present
- Filters out type declarations in TFF proofs
- Normalizes proof step numbering for consistent display
- Extracts types for Skolem terms introduced during proving
- Parameters:
lines- the proof output lines returned by the theorem proverkifQuery- the original query in KIF (Knowledge Interchange Format) syntaxkb- the knowledge base being queriedqlist- a StringBuilder containing the list of quantified variables in order, used for answer extraction and binding- See Also:
-
parseAnswerTuples
*************************************************************** Return a list of answers if prover finds bindings for wh- queries. Return "Proof Found" if prover finds contradiction for boolean queries. For example, tuple_list = [[esk3_1(s__Org1_1)]|_] Output = [Org1_1] tuple_list = [[esk3_0]|_] Output = [An instance of Human] (Human is the most specific type for esk3_0 in the given proof) -
parseProofOutput
*************************************************************** -
parseProofFromFile
*************************************************************** -
printPrologTerm
public static void printPrologTerm(com.igormaznitsa.prologparser.terms.PrologTerm pt) *************************************************************** -
getNumFromIDtable
***************************************************************- Returns:
- an int from the idTable or add a new id to the table and give it a new number
-
createProofDotGraphImage
Creates a specified formatted image from a generated *.dot file from GraphViz.- Parameters:
filename- the generated *.dot filename to create an image from- Returns:
- the path to the generated image file
- Throws:
IOException
-
createProofDotGraph
************************************************************* Create a proof in a format suitable for GraphViz' input format http://www.graphviz.org/. Generate a proof imate from the .dot output with a command likedot SUMO-graph.dot -Tgif > graph.gif- Throws:
IOException
-
setGraphFormulaFormat
-
printProof
public void printProof(int level) *************************************************************** Print proof removing some steps based on proof level 1 = full proof 2 = remove steps with single support 3 = show only axioms from the KB -
renumberSupport
*************************************************************** Look through the chain of supporting steps for a source axiom or an axiom with more than one premise. -
simplifyProof
*************************************************************** Simplify proof to remove steps with single support other than axioms from the KB (plus optional readability filtering for ans*). -
renumberProof
*************************************************************** renumber a proof after simplification -
reorderVampire4_8
-
reorderVampireProofAnyDialect
Reorder a Vampire 4.8-style reverse proof into 5.0-style forward order. Works for FOF/TFF/THF (and CNF) blocks. Input and output are lists of lines. Expected input: ONLY the proof section lines (between SZS start/end). If you pass the whole file, non-formula lines will be preserved around the reordered blocks. -
toFOFLine
Format a TPTPFormula as a single fof(...) line. -
replaceSkolems
*************************************************************** just replace skolem terms with "something" for now -
simpPara
public void simpPara()*************************************************************** simplify and paraphrase a proof -
showHelp
public static void showHelp()*************************************************************** -
main
***************************************************************- Throws:
IOException
-