public interface FormulaManager
| Modifier and Type | Method and Description |
|---|---|
BooleanFormula |
applyTactic(BooleanFormula input,
Tactic tactic)
Apply a tactic which performs formula transformation.
|
Appender |
dumpFormula(BooleanFormula pT)
Serialize an input formula to an SMT-LIB format.
|
String |
escape(String variableName)
Get an escaped symbol/name for variables or undefined functions, if necessary.
|
Map<String,Formula> |
extractVariables(Formula f)
Extract the names of all free variables and UFs in a formula.
|
Map<String,Formula> |
extractVariablesAndUFs(Formula f)
Extract the names of all free variables and UFs in a formula.
|
ArrayFormulaManager |
getArrayFormulaManager()
Returns the Array-Theory.
|
BitvectorFormulaManager |
getBitvectorFormulaManager()
Returns the Bitvector-Theory.
|
BooleanFormulaManager |
getBooleanFormulaManager()
Returns the Boolean-Theory.
|
FloatingPointFormulaManager |
getFloatingPointFormulaManager()
Returns the Floating-Point-Theory.
|
<T extends Formula> |
getFormulaType(T formula)
Returns the type of the given Formula.
|
IntegerFormulaManager |
getIntegerFormulaManager()
Returns the Integer-Theory.
|
QuantifiedFormulaManager |
getQuantifiedFormulaManager()
Returns the interface for handling quantifiers.
|
RationalFormulaManager |
getRationalFormulaManager()
Returns the Rational-Theory.
|
SLFormulaManager |
getSLFormulaManager()
Returns the Seperation-Logic-Theory.
|
UFManager |
getUFManager()
Returns the function for dealing with uninterpreted functions (UFs).
|
boolean |
isValidName(String variableName)
Check whether the given String can be used as symbol/name for variables or undefined functions.
|
<T extends Formula> |
makeApplication(FunctionDeclaration<T> declaration,
Formula... args)
Create a function application to the given list of arguments.
|
<T extends Formula> |
makeApplication(FunctionDeclaration<T> declaration,
List<? extends Formula> args)
Create a function application to the given list of arguments.
|
<T extends Formula> |
makeVariable(FormulaType<T> formulaType,
String name)
Create variable of the type equal to
formulaType. |
BooleanFormula |
parse(String s)
Parse a boolean formula given as a String in an SMT-LIB file format.
|
<T extends Formula> |
simplify(T input)
Simplify an input formula, while ensuring equivalence.
|
<T extends Formula> |
substitute(T f,
Map<? extends Formula,? extends Formula> fromToMapping)
Substitute every occurrence of any item from
changeFrom in formula f to the
corresponding occurrence from changeTo. |
<T extends Formula> |
transformRecursively(T f,
FormulaTransformationVisitor pFormulaVisitor)
Visit the formula recursively with a given
FormulaVisitor. |
BooleanFormula |
translateFrom(BooleanFormula formula,
FormulaManager otherContext)
Translates the formula from another context into the context represented by
this. |
String |
unescape(String variableName)
Unescape the symbol/name for variables or undefined functions, if necessary.
|
<R> R |
visit(Formula f,
FormulaVisitor<R> rFormulaVisitor)
Visit the formula with a given visitor.
|
void |
visitRecursively(Formula f,
FormulaVisitor<TraversalProcess> rFormulaVisitor)
Visit the formula recursively with a given
FormulaVisitor. |
IntegerFormulaManager getIntegerFormulaManager()
UnsupportedOperationException - If the theory is not supported by the solver.RationalFormulaManager getRationalFormulaManager()
UnsupportedOperationException - If the theory is not supported by the solver.BooleanFormulaManager getBooleanFormulaManager()
ArrayFormulaManager getArrayFormulaManager()
UnsupportedOperationException - If the theory is not supported by the solver.BitvectorFormulaManager getBitvectorFormulaManager()
UnsupportedOperationException - If the theory is not supported by the solver.FloatingPointFormulaManager getFloatingPointFormulaManager()
UnsupportedOperationException - If the theory is not supported by the solver.UFManager getUFManager()
SLFormulaManager getSLFormulaManager()
UnsupportedOperationException - If the theory is not supported by the solver.QuantifiedFormulaManager getQuantifiedFormulaManager()
UnsupportedOperationException - If the theory is not supported by the solver.<T extends Formula> T makeVariable(FormulaType<T> formulaType, String name)
formulaType.formulaType - the type of the variable.name - the name of the variable.<T extends Formula> T makeApplication(FunctionDeclaration<T> declaration, List<? extends Formula> args)
declaration - Function declarationargs - List of arguments<T extends Formula> T makeApplication(FunctionDeclaration<T> declaration, Formula... args)
declaration - Function declarationargs - List of arguments<T extends Formula> FormulaType<T> getFormulaType(T formula)
BooleanFormula parse(String s) throws IllegalArgumentException
IllegalArgumentException - If the string cannot be parsed.Appender dumpFormula(BooleanFormula pT)
To get a String, simply call Object.toString() on the returned object. This method
is lazy and does not create an output string until the returned object is actually used.
BooleanFormula applyTactic(BooleanFormula input, Tactic tactic) throws InterruptedException
InterruptedException<T extends Formula> T simplify(T input) throws InterruptedException
For solvers that do not provide a simplification API, an original formula is returned.
input - The input formulaInterruptedException@CanIgnoreReturnValue <R> R visit(Formula f, FormulaVisitor<R> rFormulaVisitor)
void visitRecursively(Formula f, FormulaVisitor<TraversalProcess> rFormulaVisitor)
FormulaVisitor.
This method guarantees that the traversal is done iteratively, without using Java recursion, and thus is not prone to StackOverflowErrors.
Furthermore, this method also guarantees that every equal part of the formula is visited only once. Thus it can be used to traverse DAG-like formulas efficiently.
<T extends Formula> T transformRecursively(T f, FormulaTransformationVisitor pFormulaVisitor)
FormulaVisitor.
This method guarantees that the traversal is done iteratively, without using Java recursion, and thus is not prone to StackOverflowErrors.
Furthermore, this method also guarantees that every equal part of the formula is visited only once. Thus it can be used to traverse DAG-like formulas efficiently.
pFormulaVisitor - Transformation described by the user.Map<String,Formula> extractVariables(Formula f)
f - The input formulaMap<String,Formula> extractVariablesAndUFs(Formula f)
f - The input formula<T extends Formula> T substitute(T f, Map<? extends Formula,? extends Formula> fromToMapping)
changeFrom in formula f to the
corresponding occurrence from changeTo.
E.g. if changeFrom contains a variable a and changeTo contains a
variable b all occurrences of a will be changed to b in the returned
formula.
f - Formula to change.fromToMapping - Mapping of old and new formula parts.BooleanFormula translateFrom(BooleanFormula formula, FormulaManager otherContext)
this.
Default implementation relies on string serialization (dumpFormula(BooleanFormula) and
parse(String)), but each solver may implement more efficient translation between its
own contexts.formula - Formula belonging to otherContext.otherContext - Formula manager belonging to the other context.this context.boolean isValidName(String variableName)
We explicitly state that with further development of SMT solvers and the SMTLib specification, the list of forbidden variable names may change in the future. Users should if possible not use logical or mathematical operators, or keywords strongly depending on SMTlib.
If a variable name is rejected, a possibility is escaping, e.g. either substituting the whole variable name or just every invalid character with an escaped form. We recommend to use an escape sequence based on the token "JAVASMT", because it might be unusual enough to appear when encoding a user's problem in SMT. Please not that you might also have to handle escaping the escape sequence. Examples:
"=" (logical operator for equality) can be
replaced with a string "JAVASMT_EQUALS".
"|test|" (the solver SMTInterpol
does not allow the pipe symbol "|" in names) can be replaced with
"JAVASMT_PIPEtestJAVASMT_PIPE".
String escape(String variableName)
See isValidName(String) for further details.
String unescape(String variableName)
The result is undefined for Strings that are not properly escaped.
See isValidName(String) for further details.