public abstract class AbstractBooleanFormulaManager<TFormulaInfo,TType,TEnv,TFuncDecl> extends Object implements BooleanFormulaManager
| Modifier and Type | Field and Description |
|---|---|
protected FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> |
formulaCreator |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractBooleanFormulaManager(FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> pCreator) |
| Modifier and Type | Method and Description |
|---|---|
BooleanFormula |
and(BooleanFormula... pBits) |
BooleanFormula |
and(BooleanFormula pBits1,
BooleanFormula pBits2)
Creates a formula representing an AND of the two arguments.
|
BooleanFormula |
and(Collection<BooleanFormula> pBits) |
protected abstract TFormulaInfo |
and(TFormulaInfo pParam1,
TFormulaInfo pParam2) |
protected TFormulaInfo |
andImpl(Collection<TFormulaInfo> pParams)
Create an n-ary conjunction.
|
BooleanFormula |
equivalence(BooleanFormula pBits1,
BooleanFormula pBits2)
Creates a formula representing an equivalence of the two arguments.
|
protected abstract TFormulaInfo |
equivalence(TFormulaInfo bits1,
TFormulaInfo bits2) |
protected FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> |
getFormulaCreator() |
<T extends Formula> |
ifThenElse(BooleanFormula pBits,
T f1,
T f2)
Creates a formula representing "IF cond THEN f1 ELSE f2".
|
protected abstract TFormulaInfo |
ifThenElse(TFormulaInfo cond,
TFormulaInfo f1,
TFormulaInfo f2) |
BooleanFormula |
implication(BooleanFormula pBits1,
BooleanFormula pBits2) |
protected TFormulaInfo |
implication(TFormulaInfo bits1,
TFormulaInfo bits2) |
boolean |
isFalse(BooleanFormula pBits)
Check, if the formula is the formula "FALSE".
|
protected abstract boolean |
isFalse(TFormulaInfo bits) |
boolean |
isTrue(BooleanFormula pBits)
Check, if the formula is the formula "TRUE".
|
protected abstract boolean |
isTrue(TFormulaInfo bits) |
BooleanFormula |
makeBoolean(boolean value)
Returns a
BooleanFormula representing the given value. |
protected abstract TFormulaInfo |
makeBooleanImpl(boolean value) |
BooleanFormula |
makeFalse()
Shortcut for
makeBoolean(false). |
BooleanFormula |
makeTrue()
Shortcut for
makeBoolean(true). |
BooleanFormula |
makeVariable(String pVar)
Creates a variable with exactly the given name.
|
protected abstract TFormulaInfo |
makeVariableImpl(String pVar) |
BooleanFormula |
not(BooleanFormula pBits)
Creates a formula representing a negation of the argument.
|
protected abstract TFormulaInfo |
not(TFormulaInfo pParam1) |
BooleanFormula |
or(BooleanFormula... pBits) |
BooleanFormula |
or(BooleanFormula pBits1,
BooleanFormula pBits2)
Creates a formula representing an OR of the two arguments.
|
BooleanFormula |
or(Collection<BooleanFormula> pBits) |
protected abstract TFormulaInfo |
or(TFormulaInfo pParam1,
TFormulaInfo pParam2) |
protected TFormulaInfo |
orImpl(Collection<TFormulaInfo> pParams)
Create an n-ary disjunction.
|
Collector<BooleanFormula,?,BooleanFormula> |
toConjunction()
Return a stream
Collector that creates a conjunction of all elements in the stream. |
Set<BooleanFormula> |
toConjunctionArgs(BooleanFormula f,
boolean flatten)
Return a set of formulas such that a conjunction over them is equivalent to the input formula.
|
Collector<BooleanFormula,?,BooleanFormula> |
toDisjunction()
Return a stream
Collector that creates a disjunction of all elements in the stream. |
Set<BooleanFormula> |
toDisjunctionArgs(BooleanFormula f,
boolean flatten)
Return a set of formulas such that a disjunction over them is equivalent to the input formula.
|
protected TType |
toSolverType(FormulaType<?> formulaType) |
BooleanFormula |
transformRecursively(BooleanFormula f,
BooleanFormulaTransformationVisitor pVisitor)
Visit the formula recursively with a given
BooleanFormulaVisitor. |
<R> R |
visit(BooleanFormula pFormula,
BooleanFormulaVisitor<R> visitor)
Visit the formula with the given visitor.
|
void |
visitRecursively(BooleanFormula pF,
BooleanFormulaVisitor<TraversalProcess> pFormulaVisitor)
Visit the formula recursively with a given
BooleanFormulaVisitor. |
BooleanFormula |
xor(BooleanFormula pBits1,
BooleanFormula pBits2)
Creates a formula representing XOR of the two arguments.
|
protected abstract TFormulaInfo |
xor(TFormulaInfo pParam1,
TFormulaInfo pParam2) |
protected final FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> formulaCreator
protected AbstractBooleanFormulaManager(FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> pCreator)
public BooleanFormula makeVariable(String pVar)
BooleanFormulaManagerPlease make sure that the given name is valid in SMT-LIB2. Take a look at FormulaManager.isValidName(java.lang.String) for further information.
This method does not quote or unquote the given name, but uses the plain name "AS IS".
Formula.toString() can return a different String than the given one.
makeVariable in interface BooleanFormulaManagerprotected abstract TFormulaInfo makeVariableImpl(String pVar)
public BooleanFormula makeTrue()
BooleanFormulaManagermakeBoolean(true).makeTrue in interface BooleanFormulaManagerpublic BooleanFormula makeFalse()
BooleanFormulaManagermakeBoolean(false).makeFalse in interface BooleanFormulaManagerpublic BooleanFormula makeBoolean(boolean value)
BooleanFormulaManagerBooleanFormula representing the given value.makeBoolean in interface BooleanFormulaManagervalue - the boolean value the returned Formula should representprotected abstract TFormulaInfo makeBooleanImpl(boolean value)
public BooleanFormula not(BooleanFormula pBits)
BooleanFormulaManagernot in interface BooleanFormulaManagerpBits - a Formula!bitsprotected abstract TFormulaInfo not(TFormulaInfo pParam1)
public BooleanFormula and(BooleanFormula pBits1, BooleanFormula pBits2)
BooleanFormulaManagerand in interface BooleanFormulaManagerpBits1 - a FormulapBits2 - a Formulabits1 & bits2protected abstract TFormulaInfo and(TFormulaInfo pParam1, TFormulaInfo pParam2)
public BooleanFormula and(Collection<BooleanFormula> pBits)
and in interface BooleanFormulaManagerBooleanFormulaManager.and(BooleanFormula, BooleanFormula)public BooleanFormula and(BooleanFormula... pBits)
and in interface BooleanFormulaManagerBooleanFormulaManager.and(BooleanFormula, BooleanFormula)protected TFormulaInfo andImpl(Collection<TFormulaInfo> pParams)
and(Object,
Object) and assumes that all simplifications are done by that method. This method can be
overridden, in which case it should filter out irrelevant operands.pParams - A collection of at least 3 operands.public Collector<BooleanFormula,?,BooleanFormula> toConjunction()
BooleanFormulaManagerCollector that creates a conjunction of all elements in the stream.toConjunction in interface BooleanFormulaManagerpublic BooleanFormula or(BooleanFormula pBits1, BooleanFormula pBits2)
BooleanFormulaManageror in interface BooleanFormulaManagerpBits1 - a FormulapBits2 - a Formulabits1 | bits2public BooleanFormula or(BooleanFormula... pBits)
or in interface BooleanFormulaManagerBooleanFormulaManager.or(BooleanFormula, BooleanFormula)protected abstract TFormulaInfo or(TFormulaInfo pParam1, TFormulaInfo pParam2)
public BooleanFormula xor(BooleanFormula pBits1, BooleanFormula pBits2)
BooleanFormulaManagerxor in interface BooleanFormulaManagerpublic BooleanFormula or(Collection<BooleanFormula> pBits)
or in interface BooleanFormulaManagerBooleanFormulaManager.or(BooleanFormula, BooleanFormula)protected TFormulaInfo orImpl(Collection<TFormulaInfo> pParams)
or(Object,
Object) and assumes that all simplifications are done by that method. This method can be
overridden, in which case it should filter out irrelevant operands.pParams - A collection of at least 3 operands.public Collector<BooleanFormula,?,BooleanFormula> toDisjunction()
BooleanFormulaManagerCollector that creates a disjunction of all elements in the stream.toDisjunction in interface BooleanFormulaManagerprotected abstract TFormulaInfo xor(TFormulaInfo pParam1, TFormulaInfo pParam2)
public final BooleanFormula equivalence(BooleanFormula pBits1, BooleanFormula pBits2)
equivalence in interface BooleanFormulaManagerpBits1 - a FormulapBits2 - a Formulaf1 <-> f2protected abstract TFormulaInfo equivalence(TFormulaInfo bits1, TFormulaInfo bits2)
public final BooleanFormula implication(BooleanFormula pBits1, BooleanFormula pBits2)
implication in interface BooleanFormulaManagerformula1 => formula2.protected TFormulaInfo implication(TFormulaInfo bits1, TFormulaInfo bits2)
public final boolean isTrue(BooleanFormula pBits)
BooleanFormulaManagerisTrue in interface BooleanFormulaManagerprotected abstract boolean isTrue(TFormulaInfo bits)
public final boolean isFalse(BooleanFormula pBits)
BooleanFormulaManagerisFalse in interface BooleanFormulaManagerprotected abstract boolean isFalse(TFormulaInfo bits)
public final <T extends Formula> T ifThenElse(BooleanFormula pBits, T f1, T f2)
ifThenElse in interface BooleanFormulaManagerpBits - a Formulaf1 - a Formulaf2 - a Formulaprotected abstract TFormulaInfo ifThenElse(TFormulaInfo cond, TFormulaInfo f1, TFormulaInfo f2)
public <R> R visit(BooleanFormula pFormula, BooleanFormulaVisitor<R> visitor)
BooleanFormulaManagervisit in interface BooleanFormulaManagerpublic void visitRecursively(BooleanFormula pF, BooleanFormulaVisitor<TraversalProcess> pFormulaVisitor)
BooleanFormulaManagerBooleanFormulaVisitor.
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 BooleanFormulaManagerpublic BooleanFormula transformRecursively(BooleanFormula f, BooleanFormulaTransformationVisitor pVisitor)
BooleanFormulaManagerBooleanFormulaVisitor. The arguments each
visitor method receives are already transformed.
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 BooleanFormulaManagerpublic Set<BooleanFormula> toConjunctionArgs(BooleanFormula f, boolean flatten)
BooleanFormulaManagerExample output:
A /\ B /\ C: A, B, C
toConjunctionArgs in interface BooleanFormulaManagerflatten - If true, flatten recursively.public Set<BooleanFormula> toDisjunctionArgs(BooleanFormula f, boolean flatten)
BooleanFormulaManagerExample output:
A \/ B \/ C: A, B, C
toDisjunctionArgs in interface BooleanFormulaManagerflatten - If true, flatten recursively.protected final FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> getFormulaCreator()
protected final TType toSolverType(FormulaType<?> formulaType)