Class AbstractNumeralFormulaManager<TFormulaInfo,TType,TEnv,ParamFormulaType extends NumeralFormula,ResultFormulaType extends NumeralFormula,TFuncDecl>
- All Implemented Interfaces:
NumeralFormulaManager<ParamFormulaType,ResultFormulaType>
NumeralFormulaManager. It handles all the unwrapping and wrapping
from Formula instances to solver-specific formula representations, such that the concrete
class needs to handle only its own internal types.- Implementation Requirements:
- The method
NumeralFormulaManager.getFormulaType()must be safe to be called from the constructor (the default implementations ofIntegerFormulaManagerandRationalFormulaManagersatisfy this).
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FormulaCreator<TFormulaInfo,TType, TEnv, TFuncDecl> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractNumeralFormulaManager(FormulaCreator<TFormulaInfo, TType, TEnv, TFuncDecl> pCreator, AbstractNumeralFormulaManager.NonLinearArithmetic pNonLinearArithmetic) -
Method Summary
Modifier and TypeMethodDescriptionadd(ParamFormulaType pNumber1, ParamFormulaType pNumber2) protected abstract TFormulaInfoadd(TFormulaInfo pParam1, TFormulaInfo pParam2) protected final TFormulaInfoThis method tries to represent a BigDecimal using only BigInteger.distinct(List<ParamFormulaType> pNumbers) All given numbers are pairwise unequal.protected abstract TFormulaInfodistinctImpl(List<TFormulaInfo> pNumbers) divide(ParamFormulaType pNumber1, ParamFormulaType pNumber2) Create a formula representing the division of two operands according to Boute's Euclidean definition.protected TFormulaInfodivide(TFormulaInfo pParam1, TFormulaInfo pParam2) If a solver does not support this operation, e.g.equal(ParamFormulaType pNumber1, ParamFormulaType pNumber2) protected abstract TFormulaInfoequal(TFormulaInfo pParam1, TFormulaInfo pParam2) floor(ParamFormulaType number) Theflooroperation returns the nearest integer formula that is less or equal to the given argument formula.protected TFormulaInfofloor(TFormulaInfo number) protected final FormulaCreator<TFormulaInfo,TType, TEnv, TFuncDecl> greaterOrEquals(ParamFormulaType pNumber1, ParamFormulaType pNumber2) protected abstract TFormulaInfogreaterOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2) greaterThan(ParamFormulaType pNumber1, ParamFormulaType pNumber2) protected abstract TFormulaInfogreaterThan(TFormulaInfo pParam1, TFormulaInfo pParam2) protected abstract booleanisNumeral(TFormulaInfo val) Check whether the argument is a numeric constant (including negated constants).lessOrEquals(ParamFormulaType pNumber1, ParamFormulaType pNumber2) protected abstract TFormulaInfolessOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2) lessThan(ParamFormulaType pNumber1, ParamFormulaType pNumber2) protected abstract TFormulaInfolessThan(TFormulaInfo pParam1, TFormulaInfo pParam2) makeNumber(double pNumber) Create a numeric literal with a given value.makeNumber(long i) makeNumber(String i) makeNumber(BigDecimal pNumber) Create a numeric literal with a given value.makeNumber(Rational pRational) protected abstract TFormulaInfomakeNumberImpl(double pNumber) protected abstract TFormulaInfomakeNumberImpl(long i) protected abstract TFormulaInfoprotected abstract TFormulaInfomakeNumberImpl(BigDecimal pNumber) protected abstract TFormulaInfoprotected TFormulaInfomakeNumberImpl(Rational pRational) makeVariable(String pVar) Creates a variable with exactly the given name.protected abstract TFormulaInfomodularCongruence(ParamFormulaType pNumber1, ParamFormulaType pNumber2, long pModulo) modularCongruence(ParamFormulaType pNumber1, ParamFormulaType pNumber2, BigInteger pModulo) protected TFormulaInfomodularCongruence(TFormulaInfo a, TFormulaInfo b, long m) protected TFormulaInfomodulo(ParamFormulaType pNumber1, ParamFormulaType pNumber2) protected TFormulaInfomodulo(TFormulaInfo pParam1, TFormulaInfo pParam2) If a solver does not support this operation, e.g.multiply(ParamFormulaType pNumber1, ParamFormulaType pNumber2) protected TFormulaInfomultiply(TFormulaInfo pParam1, TFormulaInfo pParam2) If a solver does not support this operation, e.g.negate(ParamFormulaType pNumber) protected abstract TFormulaInfonegate(TFormulaInfo pParam1) subtract(ParamFormulaType pNumber1, ParamFormulaType pNumber2) protected abstract TFormulaInfosubtract(TFormulaInfo pParam1, TFormulaInfo pParam2) sum(List<ParamFormulaType> operands) protected TFormulaInfosumImpl(List<TFormulaInfo> operands) protected final TTypetoSolverType(FormulaType<?> formulaType) protected ResultFormulaTypewrap(TFormulaInfo pTerm) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.sosy_lab.java_smt.api.NumeralFormulaManager
getFormulaType
-
Field Details
-
formulaCreator
-
-
Constructor Details
-
AbstractNumeralFormulaManager
protected AbstractNumeralFormulaManager(FormulaCreator<TFormulaInfo, TType, TEnv, TFuncDecl> pCreator, AbstractNumeralFormulaManager.NonLinearArithmetic pNonLinearArithmetic)
-
-
Method Details
-
wrap
-
isNumeral
Check whether the argument is a numeric constant (including negated constants). -
makeNumber
- Specified by:
makeNumberin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
makeNumberImpl
-
makeNumber
- Specified by:
makeNumberin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
makeNumberImpl
-
makeNumber
- Specified by:
makeNumberin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
makeNumberImpl
-
makeNumber
- Specified by:
makeNumberin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
makeNumberImpl
-
makeNumber
Description copied from interface:NumeralFormulaManagerCreate a numeric literal with a given value. Note: if the theory represented by this instance cannot handle rational numbers, the value may get rounded or otherwise represented imprecisely.- Specified by:
makeNumberin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
makeNumberImpl
-
makeNumber
Description copied from interface:NumeralFormulaManagerCreate a numeric literal with a given value. Note: if the theory represented by this instance cannot handle rational numbers, the value may get rounded or otherwise represented imprecisely.- Specified by:
makeNumberin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
makeNumberImpl
-
decimalAsInteger
This method tries to represent a BigDecimal using only BigInteger. It can be used for implementingmakeNumber(BigDecimal)when the current theory supports only integers and division by constants. -
makeVariable
Description copied from interface:NumeralFormulaManagerCreates a variable with exactly the given name.Please 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.- Specified by:
makeVariablein interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
makeVariableImpl
-
negate
- Specified by:
negatein interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
negate
-
add
- Specified by:
addin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
add
-
sum
- Specified by:
sumin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
sumImpl
-
subtract
- Specified by:
subtractin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
subtract
-
divide
Description copied from interface:NumeralFormulaManagerCreate a formula representing the division of two operands according to Boute's Euclidean definition.If the denominator evaluates to zero (division-by-zero), either directly as value or indirectly via an additional constraint, then the solver is allowed to choose an arbitrary value for the result of the division (cf. SMTLIB standard for the division operator in Ints or Reals theory).
Note: Some solvers, e.g., Yices2, abort with an exception when exploring a division-by-zero during the SAT-check. This is not compliant to the SMTLIB standard, but sadly happens.
- Specified by:
dividein interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
divide
If a solver does not support this operation, e.g. because of missing support for non-linear arithmetics, we throw UnsupportedOperationException.- Parameters:
pParam1- the dividendpParam2- the divisor
-
modulo
-
modulo
If a solver does not support this operation, e.g. because of missing support for non-linear arithmetics, we throw UnsupportedOperationException.- Parameters:
pParam1- the dividendpParam2- the divisor
-
modularCongruence
public BooleanFormula modularCongruence(ParamFormulaType pNumber1, ParamFormulaType pNumber2, long pModulo) -
modularCongruence
public BooleanFormula modularCongruence(ParamFormulaType pNumber1, ParamFormulaType pNumber2, BigInteger pModulo) -
modularCongruence
- Parameters:
a- first operandb- second operandm- the modulus- Returns:
- the formula representing
a = b (mod m)
-
modularCongruence
- Parameters:
a- first operandb- second operandm- the modulus- Returns:
- the formula representing
a = b (mod m)
-
multiply
- Specified by:
multiplyin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
multiply
If a solver does not support this operation, e.g. because of missing support for non-linear arithmetics, we throw UnsupportedOperationException.- Parameters:
pParam1- first factorpParam2- second factor
-
equal
- Specified by:
equalin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
equal
-
distinct
Description copied from interface:NumeralFormulaManagerAll given numbers are pairwise unequal.- Specified by:
distinctin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
distinctImpl
-
greaterThan
- Specified by:
greaterThanin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
greaterThan
-
greaterOrEquals
- Specified by:
greaterOrEqualsin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
greaterOrEquals
-
lessThan
- Specified by:
lessThanin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
lessThan
-
lessOrEquals
- Specified by:
lessOrEqualsin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
lessOrEquals
-
floor
Description copied from interface:NumeralFormulaManagerTheflooroperation returns the nearest integer formula that is less or equal to the given argument formula.For rational formulas, SMTlib2 denotes this operation as
to_int.- Specified by:
floorin interfaceNumeralFormulaManager<TFormulaInfo,TType>
-
floor
-
getFormulaCreator
-
toSolverType
-