TFormulaInfo - The solver specific type.public abstract class AbstractFormulaManager<TFormulaInfo,TType,TEnv> extends Object implements FormulaManager
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractFormulaManager(FormulaCreator<TFormulaInfo,TType,TEnv> pFormulaCreator,
AbstractFunctionFormulaManager<TFormulaInfo,?,TType,TEnv> functionManager,
AbstractBooleanFormulaManager<TFormulaInfo,TType,TEnv> booleanManager,
IntegerFormulaManager pIntegerManager,
RationalFormulaManager pRationalManager,
AbstractBitvectorFormulaManager<TFormulaInfo,TType,TEnv> bitvectorManager,
AbstractFloatingPointFormulaManager<TFormulaInfo,TType,TEnv> floatingPointManager,
AbstractQuantifiedFormulaManager<TFormulaInfo,TType,TEnv> quantifiedManager,
AbstractArrayFormulaManager<TFormulaInfo,TType,TEnv> arrayManager)
Builds a solver from the given theory implementations
|
| Modifier and Type | Method and Description |
|---|---|
BooleanFormula |
applyTactic(BooleanFormula f,
Tactic tactic)
Apply a tactic which performs formula transformation.
|
protected TFormulaInfo |
applyTacticImpl(TFormulaInfo f,
Tactic tactic) |
Appender |
dumpFormula(BooleanFormula t)
Serialize an input formula to an SMT-LIB format.
|
abstract Appender |
dumpFormula(TFormulaInfo t) |
TFormulaInfo |
extractInfo(Formula f) |
Map<String,Formula> |
extractVariables(Formula f)
Extract names of all free variables 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.
|
AbstractBitvectorFormulaManager<TFormulaInfo,TType,TEnv> |
getBitvectorFormulaManager()
Returns the Bitvector-Theory.
|
AbstractBooleanFormulaManager<TFormulaInfo,TType,TEnv> |
getBooleanFormulaManager()
Returns the Boolean-Theory.
|
TEnv |
getEnvironment() |
FloatingPointFormulaManager |
getFloatingPointFormulaManager()
Returns the Floating-Point-Theory.
|
FormulaCreator<TFormulaInfo,TType,TEnv> |
getFormulaCreator() |
<T extends Formula> |
getFormulaType(T formula)
Returns the type of the given Formula.
|
AbstractFunctionFormulaManager<TFormulaInfo,?,TType,TEnv> |
getFunctionFormulaManager()
Returns the Function-Theory.
|
IntegerFormulaManager |
getIntegerFormulaManager()
Returns the Integer-Theory.
|
AbstractQuantifiedFormulaManager<TFormulaInfo,TType,TEnv> |
getQuantifiedFormulaManager()
Returns the interface for handling quantifiers.
|
RationalFormulaManager |
getRationalFormulaManager()
Returns the Rational-Theory.
|
<T extends Formula> |
makeEqual(T pLhs,
T pRhs)
Create a formula representing equality between two formulas of the same
type.
|
<T extends Formula> |
makeVariable(FormulaType<T> formulaType,
String name)
Create variable of the type equal to
formulaType. |
<T extends Formula> |
simplify(T f)
Simplify an input formula, while ensuring equivalence.
|
protected TFormulaInfo |
simplify(TFormulaInfo f) |
<T extends Formula> |
splitNumeralEqualityIfPossible(T pF)
For a numeral (i.e., non-boolean) equality "x = y",
return a list
x<=y, x>=y. |
protected abstract List<? extends TFormulaInfo> |
splitNumeralEqualityIfPossible(TFormulaInfo pF) |
<T extends Formula> |
substitute(T pF,
Map<? extends Formula,? extends Formula> pFromToMapping)
Substitute every occurrence of any item from
changeFrom
in formula f to the corresponding occurrence from changeTo. |
protected <T1 extends Formula> |
substituteUsingLists(T1 pF,
Map<? extends Formula,? extends Formula> pFromToMapping)
Default implementation for
substitute(Formula, Map) for solvers that provide
an internal substitute operation that takes two lists instead of a map. |
protected TFormulaInfo |
substituteUsingListsImpl(TFormulaInfo pF,
List<TFormulaInfo> substituteFrom,
List<TFormulaInfo> substituteTo)
Backend for
substituteUsingLists(Formula, Map). |
protected <T1 extends Formula,T2 extends Formula> |
substituteUsingMap(T1 pF,
Map<? extends Formula,? extends Formula> pFromToMapping)
Default implementation for
substitute(Formula, Map). |
protected TFormulaInfo |
substituteUsingMapImpl(TFormulaInfo expr,
Map<TFormulaInfo,TFormulaInfo> memoization,
Formula f,
Map<? extends Formula,? extends Formula> fromToMapping) |
<T extends Formula> |
transformRecursively(FormulaTransformationVisitor pFormulaVisitor,
T f)
Visit the formula recursively with a given
FormulaVisitor. |
BooleanFormula |
translate(BooleanFormula other,
SolverContext otherContext)
Translates the formula from another context into the context represented by
this. |
<R> R |
visit(FormulaVisitor<R> visitor,
Formula input)
Visit the formula with a given visitor.
|
void |
visitRecursively(FormulaVisitor<TraversalProcess> pFormulaVisitor,
Formula pF)
Visit the formula recursively with a given
FormulaVisitor. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitparseprotected AbstractFormulaManager(FormulaCreator<TFormulaInfo,TType,TEnv> pFormulaCreator, AbstractFunctionFormulaManager<TFormulaInfo,?,TType,TEnv> functionManager, AbstractBooleanFormulaManager<TFormulaInfo,TType,TEnv> booleanManager, @Nullable IntegerFormulaManager pIntegerManager, @Nullable RationalFormulaManager pRationalManager, @Nullable AbstractBitvectorFormulaManager<TFormulaInfo,TType,TEnv> bitvectorManager, @Nullable AbstractFloatingPointFormulaManager<TFormulaInfo,TType,TEnv> floatingPointManager, @Nullable AbstractQuantifiedFormulaManager<TFormulaInfo,TType,TEnv> quantifiedManager, @Nullable AbstractArrayFormulaManager<TFormulaInfo,TType,TEnv> arrayManager)
public final FormulaCreator<TFormulaInfo,TType,TEnv> getFormulaCreator()
public IntegerFormulaManager getIntegerFormulaManager()
FormulaManagergetIntegerFormulaManager in interface FormulaManagerpublic RationalFormulaManager getRationalFormulaManager()
FormulaManagergetRationalFormulaManager in interface FormulaManagerpublic AbstractBooleanFormulaManager<TFormulaInfo,TType,TEnv> getBooleanFormulaManager()
FormulaManagergetBooleanFormulaManager in interface FormulaManagerpublic AbstractBitvectorFormulaManager<TFormulaInfo,TType,TEnv> getBitvectorFormulaManager()
FormulaManagergetBitvectorFormulaManager in interface FormulaManagerpublic FloatingPointFormulaManager getFloatingPointFormulaManager()
FormulaManagergetFloatingPointFormulaManager in interface FormulaManagerpublic AbstractFunctionFormulaManager<TFormulaInfo,?,TType,TEnv> getFunctionFormulaManager()
FormulaManagergetFunctionFormulaManager in interface FormulaManagerpublic AbstractQuantifiedFormulaManager<TFormulaInfo,TType,TEnv> getQuantifiedFormulaManager()
FormulaManagergetQuantifiedFormulaManager in interface FormulaManagerpublic ArrayFormulaManager getArrayFormulaManager()
FormulaManagergetArrayFormulaManager in interface FormulaManagerpublic abstract Appender dumpFormula(TFormulaInfo t)
public Appender dumpFormula(BooleanFormula t)
FormulaManagerTo 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.
dumpFormula in interface FormulaManagerpublic final <T extends Formula> FormulaType<T> getFormulaType(T formula)
FormulaManagergetFormulaType in interface FormulaManagerpublic final TEnv getEnvironment()
public final TFormulaInfo extractInfo(Formula f)
public BooleanFormula applyTactic(BooleanFormula f, Tactic tactic) throws InterruptedException
FormulaManagerapplyTactic in interface FormulaManagerInterruptedExceptionprotected TFormulaInfo applyTacticImpl(TFormulaInfo f, Tactic tactic) throws InterruptedException
InterruptedExceptionpublic <T extends Formula> T simplify(T f)
FormulaManagerFor solvers that do not provide a simplification API, an original formula is returned.
simplify in interface FormulaManagerf - The input formulaprotected TFormulaInfo simplify(TFormulaInfo f)
public <R> R visit(FormulaVisitor<R> visitor, Formula input)
FormulaManagervisit in interface FormulaManagerpublic void visitRecursively(FormulaVisitor<TraversalProcess> pFormulaVisitor, Formula pF)
FormulaManagerFormulaVisitor.
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.
visitRecursively in interface FormulaManagerpublic <T extends Formula> T transformRecursively(FormulaTransformationVisitor pFormulaVisitor, T f)
FormulaManagerFormulaVisitor.
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.
transformRecursively in interface FormulaManagerpFormulaVisitor - Transformation described by the user.public Map<String,Formula> extractVariables(Formula f)
extractVariables in interface FormulaManagerf - The input formulapublic Map<String,Formula> extractVariablesAndUFs(Formula f)
extractVariablesAndUFs in interface FormulaManagerf - The input formulapublic <T extends Formula> List<T> splitNumeralEqualityIfPossible(T pF)
FormulaManagerx<=y, x>=y.
Otherwise, return the list consisting of the input formula. Note: 1) Returned list always has one or two elements. 2) Conjunction over the returned list is equivalent to the input formula.
splitNumeralEqualityIfPossible in interface FormulaManagerprotected abstract List<? extends TFormulaInfo> splitNumeralEqualityIfPossible(TFormulaInfo pF)
protected final <T1 extends Formula,T2 extends Formula> T1 substituteUsingMap(T1 pF, Map<? extends Formula,? extends Formula> pFromToMapping)
substitute(Formula, Map).protected TFormulaInfo substituteUsingMapImpl(TFormulaInfo expr, Map<TFormulaInfo,TFormulaInfo> memoization, Formula f, Map<? extends Formula,? extends Formula> fromToMapping)
protected final <T1 extends Formula> T1 substituteUsingLists(T1 pF, Map<? extends Formula,? extends Formula> pFromToMapping)
substitute(Formula, Map) for solvers that provide
an internal substitute operation that takes two lists instead of a map.
If this is called, one needs to overwrite
substitute(Formula, Map).
protected TFormulaInfo substituteUsingListsImpl(TFormulaInfo pF, List<TFormulaInfo> substituteFrom, List<TFormulaInfo> substituteTo)
substituteUsingLists(Formula, Map).pF - The formula to change.substituteFrom - The list of parts that should be replaced.substituteTo - The list of replacement parts, in same order.public BooleanFormula translate(BooleanFormula other, SolverContext otherContext)
FormulaManagerthis.
Default implementation relies on string serialization
(FormulaManager.dumpFormula(BooleanFormula) and FormulaManager.parse(String)),
but each solver may implement more efficient translation between its own
contexts.translate in interface FormulaManagerother - Formula belonging to otherContext.otherContext - A different contextthis context.public <T extends Formula> BooleanFormula makeEqual(T pLhs, T pRhs)
FormulaManagermakeEqual in interface FormulaManagerpublic <T extends Formula> T makeVariable(FormulaType<T> formulaType, String name)
FormulaManagerformulaType.makeVariable in interface FormulaManagerformulaType - the type of the variable.name - the name of the variable.public <T extends Formula> T substitute(T pF, Map<? extends Formula,? extends Formula> pFromToMapping)
FormulaManagerchangeFrom
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.
substitute in interface FormulaManagerpF - Formula to change.pFromToMapping - Mapping of old and new formula parts.