Package com.articulate.sigma
Class FormulaUtil
java.lang.Object
com.articulate.sigma.FormulaUtil
Created by sserban on 2/17/15.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringGet the antecedent of an implication.static StringGet the consequent of an implication.createFormulaMatchMemoMapKey(String s1, String s2) Factory method for the memo mapstatic Stringstatic StringgetLiteralWithPredAndRowVar(String pred, Formula f) static List<int[]> getPermutations(int size, BiPredicate<Integer, Integer> validateFn) Generates all permutations of the given size which are valid according to the given callback function.static booleanTest whether a formula is suitable for theorem proving or if it's just a documentation statementkifListToArrayList(String kifListAsString) Returns a new ArrayList formed by extracting in order the top-level members of kifListAsString, which is assumed to be the String representation of a SUO-KIF (LISP) list.static voidstatic StringFactory method for the memo mapstatic voidrunTest()static voidshowHelp()static voidsortBySourceFile(List<Formula> forms) static StringMust check that this is a simple clause before calling!static StringtreeReplace(String oldPattern, String newTerm, String tree) Performs a depth-first search of tree, replacing all terms matching oldPattern with newTerm.
-
Constructor Details
-
FormulaUtil
public FormulaUtil()
-
-
Method Details
-
antecedent
Get the antecedent of an implication. If not a rule, return null -
consequent
Get the consequent of an implication. If not a rule, return null -
toProlog
Must check that this is a simple clause before calling! -
formatCollection
-
getLiteralWithPredAndRowVar
- Returns:
- a string consisting of a literal with the given predicate that also contains a row variable, or null otherwise
-
isDoc
Test whether a formula is suitable for theorem proving or if it's just a documentation statement -
getPermutations
Generates all permutations of the given size which are valid according to the given callback function. -
kifListToArrayList
Returns a new ArrayList formed by extracting in order the top-level members of kifListAsString, which is assumed to be the String representation of a SUO-KIF (LISP) list.- Parameters:
kifListAsString- A SUO-KIF list represented as a String- Returns:
- ArrayList
-
treeReplace
Performs a depth-first search of tree, replacing all terms matching oldPattern with newTerm.- Parameters:
oldPattern- A regular expression pattern to be matched against terms in treenewTerm- A String to replace terms matching oldPatterntree- A String representing a SUO-KIF Formula (list)- Returns:
- A new tree (String), with all occurrences of terms matching oldPattern replaced by newTerm
-
removeAnswerClause
Factory method for the memo map -
createFormulaMatchMemoMapKey
Factory method for the memo map -
runTest
public static void runTest() -
sortBySourceFile
-
showHelp
public static void showHelp() -
main
- Throws:
IOException
-