Package org.sosy_lab.java_smt.basicimpl
Class AbstractBitvectorFormulaManager<TFormulaInfo,TType,TEnv,TFuncDecl>
- java.lang.Object
-
- org.sosy_lab.java_smt.basicimpl.AbstractBitvectorFormulaManager<TFormulaInfo,TType,TEnv,TFuncDecl>
-
- All Implemented Interfaces:
BitvectorFormulaManager
public abstract class AbstractBitvectorFormulaManager<TFormulaInfo,TType,TEnv,TFuncDecl> extends Object implements BitvectorFormulaManager
-
-
Field Summary
Fields Modifier and Type Field Description protected FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl>formulaCreator
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractBitvectorFormulaManager(FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> pCreator, AbstractBooleanFormulaManager<TFormulaInfo,TType,TEnv,TFuncDecl> pBmgr)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BitvectorFormulaadd(BitvectorFormula pNumber1, BitvectorFormula pNumber2)protected abstract TFormulaInfoadd(TFormulaInfo pParam1, TFormulaInfo pParam2)BitvectorFormulaand(BitvectorFormula pBits1, BitvectorFormula pBits2)Creates a formula representing an AND of the two arguments.protected abstract TFormulaInfoand(TFormulaInfo pParam1, TFormulaInfo pParam2)BitvectorFormulaconcat(BitvectorFormula pNumber, BitvectorFormula pAppend)protected abstract TFormulaInfoconcat(TFormulaInfo number, TFormulaInfo pAppend)BooleanFormuladistinct(List<BitvectorFormula> pBits)All given bitvectors are pairwise unequal.protected TFormulaInfodistinctImpl(List<TFormulaInfo> pBits)BitvectorFormuladivide(BitvectorFormula pNumber1, BitvectorFormula pNumber2, boolean signed)protected abstract TFormulaInfodivide(TFormulaInfo pParam1, TFormulaInfo pParam2, boolean signed)BooleanFormulaequal(BitvectorFormula pNumber1, BitvectorFormula pNumber2)protected abstract TFormulaInfoequal(TFormulaInfo pParam1, TFormulaInfo pParam2)BitvectorFormulaextend(BitvectorFormula pNumber, int pExtensionBits, boolean pSigned)Extend a bitvector to the left (add most significant bits).protected abstract TFormulaInfoextend(TFormulaInfo pNumber, int pExtensionBits, boolean pSigned)BitvectorFormulaextract(BitvectorFormula pNumber, int pMsb, int pLsb, boolean pSigned)protected abstract TFormulaInfoextract(TFormulaInfo pNumber, int pMsb, int pLsb, boolean pSigned)protected FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl>getFormulaCreator()intgetLength(BitvectorFormula pNumber)BooleanFormulagreaterOrEquals(BitvectorFormula pNumber1, BitvectorFormula pNumber2, boolean signed)protected abstract TFormulaInfogreaterOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2, boolean signed)BooleanFormulagreaterThan(BitvectorFormula pNumber1, BitvectorFormula pNumber2, boolean signed)protected abstract TFormulaInfogreaterThan(TFormulaInfo pParam1, TFormulaInfo pParam2, boolean signed)BooleanFormulalessOrEquals(BitvectorFormula pNumber1, BitvectorFormula pNumber2, boolean signed)protected abstract TFormulaInfolessOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2, boolean signed)BooleanFormulalessThan(BitvectorFormula pNumber1, BitvectorFormula pNumber2, boolean signed)protected abstract TFormulaInfolessThan(TFormulaInfo pParam1, TFormulaInfo pParam2, boolean signed)BitvectorFormulamakeBitvector(int pLength, long i)Convert a number into a bitvector with given size.BitvectorFormulamakeBitvector(int pLength, BigInteger i)Convert a number into a bitvector with given size.BitvectorFormulamakeBitvector(int length, NumeralFormula.IntegerFormula pI)Convert/Cast a numeral formula into a bitvector with given size.protected TFormulaInfomakeBitvectorImpl(int pLength, long pI)protected abstract TFormulaInfomakeBitvectorImpl(int pLength, BigInteger pI)protected abstract TFormulaInfomakeBitvectorImpl(int length, TFormulaInfo pParam1)BitvectorFormulamakeVariable(int pLength, String pVar)Creates a variable with exactly the given name and bitwidth.BitvectorFormulamakeVariable(FormulaType.BitvectorType type, String pVar)protected abstract TFormulaInfomakeVariableImpl(int pLength, String pVar)BitvectorFormulamodulo(BitvectorFormula pNumber1, BitvectorFormula pNumber2, boolean signed)protected abstract TFormulaInfomodulo(TFormulaInfo pParam1, TFormulaInfo pParam2, boolean signed)BitvectorFormulamultiply(BitvectorFormula pNumber1, BitvectorFormula pNumber2)protected abstract TFormulaInfomultiply(TFormulaInfo pParam1, TFormulaInfo pParam2)BitvectorFormulanegate(BitvectorFormula pNumber)protected abstract TFormulaInfonegate(TFormulaInfo pParam1)BitvectorFormulanot(BitvectorFormula pBits)Creates a formula representing a negation of the argument.protected abstract TFormulaInfonot(TFormulaInfo pParam1)BitvectorFormulaor(BitvectorFormula pBits1, BitvectorFormula pBits2)Creates a formula representing an OR of the two arguments.protected abstract TFormulaInfoor(TFormulaInfo pParam1, TFormulaInfo pParam2)BitvectorFormulashiftLeft(BitvectorFormula pNumber, BitvectorFormula toShift)protected abstract TFormulaInfoshiftLeft(TFormulaInfo pExtract, TFormulaInfo pExtract2)BitvectorFormulashiftRight(BitvectorFormula pNumber, BitvectorFormula toShift, boolean signed)Return a term representing the (arithmetic if signed is true) right shift of number by toShift.protected abstract TFormulaInfoshiftRight(TFormulaInfo pNumber, TFormulaInfo toShift, boolean signed)BitvectorFormulasubtract(BitvectorFormula pNumber1, BitvectorFormula pNumber2)protected abstract TFormulaInfosubtract(TFormulaInfo pParam1, TFormulaInfo pParam2)NumeralFormula.IntegerFormulatoIntegerFormula(BitvectorFormula pI, boolean signed)Interpret a signed/unsigned bitvector formula as an integer formula.protected abstract TFormulaInfotoIntegerFormulaImpl(TFormulaInfo pI, boolean signed)protected TTypetoSolverType(FormulaType<?> formulaType)protected BigIntegertransformValueToRange(int pLength, BigInteger pI)transform a negative value into its positive counterpart.BitvectorFormulaxor(BitvectorFormula pBits1, BitvectorFormula pBits2)protected abstract TFormulaInfoxor(TFormulaInfo pParam1, TFormulaInfo pParam2)
-
-
-
Field Detail
-
formulaCreator
protected final FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> formulaCreator
-
-
Constructor Detail
-
AbstractBitvectorFormulaManager
protected AbstractBitvectorFormulaManager(FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> pCreator, AbstractBooleanFormulaManager<TFormulaInfo,TType,TEnv,TFuncDecl> pBmgr)
-
-
Method Detail
-
makeBitvector
public BitvectorFormula makeBitvector(int length, NumeralFormula.IntegerFormula pI)
Description copied from interface:BitvectorFormulaManagerConvert/Cast a numeral formula into a bitvector with given size.If the numeral formula is too large for the given length, we cut off the largest bits and only use the smallest bits.
- Specified by:
makeBitvectorin interfaceBitvectorFormulaManager
-
makeBitvectorImpl
protected abstract TFormulaInfo makeBitvectorImpl(int length, TFormulaInfo pParam1)
-
toIntegerFormula
public NumeralFormula.IntegerFormula toIntegerFormula(BitvectorFormula pI, boolean signed)
Description copied from interface:BitvectorFormulaManagerInterpret a signed/unsigned bitvector formula as an integer formula.- Specified by:
toIntegerFormulain interfaceBitvectorFormulaManager
-
toIntegerFormulaImpl
protected abstract TFormulaInfo toIntegerFormulaImpl(TFormulaInfo pI, boolean signed)
-
negate
public BitvectorFormula negate(BitvectorFormula pNumber)
- Specified by:
negatein interfaceBitvectorFormulaManager
-
negate
protected abstract TFormulaInfo negate(TFormulaInfo pParam1)
-
add
public BitvectorFormula add(BitvectorFormula pNumber1, BitvectorFormula pNumber2)
- Specified by:
addin interfaceBitvectorFormulaManager
-
add
protected abstract TFormulaInfo add(TFormulaInfo pParam1, TFormulaInfo pParam2)
-
subtract
public BitvectorFormula subtract(BitvectorFormula pNumber1, BitvectorFormula pNumber2)
- Specified by:
subtractin interfaceBitvectorFormulaManager
-
subtract
protected abstract TFormulaInfo subtract(TFormulaInfo pParam1, TFormulaInfo pParam2)
-
divide
public BitvectorFormula divide(BitvectorFormula pNumber1, BitvectorFormula pNumber2, boolean signed)
- Specified by:
dividein interfaceBitvectorFormulaManager
-
divide
protected abstract TFormulaInfo divide(TFormulaInfo pParam1, TFormulaInfo pParam2, boolean signed)
-
modulo
public BitvectorFormula modulo(BitvectorFormula pNumber1, BitvectorFormula pNumber2, boolean signed)
- Specified by:
moduloin interfaceBitvectorFormulaManager
-
modulo
protected abstract TFormulaInfo modulo(TFormulaInfo pParam1, TFormulaInfo pParam2, boolean signed)
-
multiply
public BitvectorFormula multiply(BitvectorFormula pNumber1, BitvectorFormula pNumber2)
- Specified by:
multiplyin interfaceBitvectorFormulaManager
-
multiply
protected abstract TFormulaInfo multiply(TFormulaInfo pParam1, TFormulaInfo pParam2)
-
equal
public BooleanFormula equal(BitvectorFormula pNumber1, BitvectorFormula pNumber2)
- Specified by:
equalin interfaceBitvectorFormulaManager
-
equal
protected abstract TFormulaInfo equal(TFormulaInfo pParam1, TFormulaInfo pParam2)
-
greaterThan
public BooleanFormula greaterThan(BitvectorFormula pNumber1, BitvectorFormula pNumber2, boolean signed)
- Specified by:
greaterThanin interfaceBitvectorFormulaManager
-
greaterThan
protected abstract TFormulaInfo greaterThan(TFormulaInfo pParam1, TFormulaInfo pParam2, boolean signed)
-
greaterOrEquals
public BooleanFormula greaterOrEquals(BitvectorFormula pNumber1, BitvectorFormula pNumber2, boolean signed)
- Specified by:
greaterOrEqualsin interfaceBitvectorFormulaManager
-
greaterOrEquals
protected abstract TFormulaInfo greaterOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2, boolean signed)
-
lessThan
public BooleanFormula lessThan(BitvectorFormula pNumber1, BitvectorFormula pNumber2, boolean signed)
- Specified by:
lessThanin interfaceBitvectorFormulaManager
-
lessThan
protected abstract TFormulaInfo lessThan(TFormulaInfo pParam1, TFormulaInfo pParam2, boolean signed)
-
lessOrEquals
public BooleanFormula lessOrEquals(BitvectorFormula pNumber1, BitvectorFormula pNumber2, boolean signed)
- Specified by:
lessOrEqualsin interfaceBitvectorFormulaManager
-
lessOrEquals
protected abstract TFormulaInfo lessOrEquals(TFormulaInfo pParam1, TFormulaInfo pParam2, boolean signed)
-
not
public BitvectorFormula not(BitvectorFormula pBits)
Description copied from interface:BitvectorFormulaManagerCreates a formula representing a negation of the argument.- Specified by:
notin interfaceBitvectorFormulaManager- Parameters:
pBits- Formula- Returns:
!f1
-
not
protected abstract TFormulaInfo not(TFormulaInfo pParam1)
-
and
public BitvectorFormula and(BitvectorFormula pBits1, BitvectorFormula pBits2)
Description copied from interface:BitvectorFormulaManagerCreates a formula representing an AND of the two arguments.- Specified by:
andin interfaceBitvectorFormulaManager- Parameters:
pBits1- a FormulapBits2- a Formula- Returns:
f1 & f2
-
and
protected abstract TFormulaInfo and(TFormulaInfo pParam1, TFormulaInfo pParam2)
-
or
public BitvectorFormula or(BitvectorFormula pBits1, BitvectorFormula pBits2)
Description copied from interface:BitvectorFormulaManagerCreates a formula representing an OR of the two arguments.- Specified by:
orin interfaceBitvectorFormulaManager- Parameters:
pBits1- a FormulapBits2- a Formula- Returns:
f1 | f2
-
or
protected abstract TFormulaInfo or(TFormulaInfo pParam1, TFormulaInfo pParam2)
-
xor
public BitvectorFormula xor(BitvectorFormula pBits1, BitvectorFormula pBits2)
- Specified by:
xorin interfaceBitvectorFormulaManager
-
xor
protected abstract TFormulaInfo xor(TFormulaInfo pParam1, TFormulaInfo pParam2)
-
makeBitvector
public BitvectorFormula makeBitvector(int pLength, long i)
Description copied from interface:BitvectorFormulaManagerConvert a number into a bitvector with given size.- Specified by:
makeBitvectorin interfaceBitvectorFormulaManager
-
makeBitvectorImpl
protected TFormulaInfo makeBitvectorImpl(int pLength, long pI)
-
makeBitvector
public BitvectorFormula makeBitvector(int pLength, BigInteger i)
Description copied from interface:BitvectorFormulaManagerConvert a number into a bitvector with given size.- Specified by:
makeBitvectorin interfaceBitvectorFormulaManager
-
makeBitvectorImpl
protected abstract TFormulaInfo makeBitvectorImpl(int pLength, BigInteger pI)
-
transformValueToRange
protected final BigInteger transformValueToRange(int pLength, BigInteger pI)
transform a negative value into its positive counterpart.- Throws:
IllegalArgumentException- if the value is out of range for the given size.
-
makeVariable
public BitvectorFormula makeVariable(FormulaType.BitvectorType type, String pVar)
- Specified by:
makeVariablein interfaceBitvectorFormulaManager- See Also:
BitvectorFormulaManager.makeVariable(int, String)
-
makeVariable
public BitvectorFormula makeVariable(int pLength, String pVar)
Description copied from interface:BitvectorFormulaManagerCreates a variable with exactly the given name and bitwidth.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 interfaceBitvectorFormulaManager
-
makeVariableImpl
protected abstract TFormulaInfo makeVariableImpl(int pLength, String pVar)
-
shiftRight
public BitvectorFormula shiftRight(BitvectorFormula pNumber, BitvectorFormula toShift, boolean signed)
Return a term representing the (arithmetic if signed is true) right shift of number by toShift.- Specified by:
shiftRightin interfaceBitvectorFormulaManager
-
shiftRight
protected abstract TFormulaInfo shiftRight(TFormulaInfo pNumber, TFormulaInfo toShift, boolean signed)
-
shiftLeft
public BitvectorFormula shiftLeft(BitvectorFormula pNumber, BitvectorFormula toShift)
- Specified by:
shiftLeftin interfaceBitvectorFormulaManager
-
shiftLeft
protected abstract TFormulaInfo shiftLeft(TFormulaInfo pExtract, TFormulaInfo pExtract2)
-
concat
public final BitvectorFormula concat(BitvectorFormula pNumber, BitvectorFormula pAppend)
- Specified by:
concatin interfaceBitvectorFormulaManager
-
concat
protected abstract TFormulaInfo concat(TFormulaInfo number, TFormulaInfo pAppend)
-
extract
public final BitvectorFormula extract(BitvectorFormula pNumber, int pMsb, int pLsb, boolean pSigned)
- Specified by:
extractin interfaceBitvectorFormulaManager- Parameters:
pNumber- The bitvector to extract.pMsb- Upper index. Must be greater than or equal to 0 and less than the bit-width of number.pLsb- Lower index. Must be less than or equal to msb and greater or equal to 0.pSigned- Whether the extension should depend on the sign bit. Note: Some SMT-Solvers ignore this. (i.e. Boolector)
-
extract
protected abstract TFormulaInfo extract(TFormulaInfo pNumber, int pMsb, int pLsb, boolean pSigned)
-
extend
public final BitvectorFormula extend(BitvectorFormula pNumber, int pExtensionBits, boolean pSigned)
Description copied from interface:BitvectorFormulaManagerExtend a bitvector to the left (add most significant bits).- Specified by:
extendin interfaceBitvectorFormulaManager- Parameters:
pNumber- The bitvector to extend.pExtensionBits- How many bits to add.pSigned- Whether the extension should depend on the sign bit.
-
extend
protected abstract TFormulaInfo extend(TFormulaInfo pNumber, int pExtensionBits, boolean pSigned)
-
getLength
public int getLength(BitvectorFormula pNumber)
- Specified by:
getLengthin interfaceBitvectorFormulaManager
-
distinct
public final BooleanFormula distinct(List<BitvectorFormula> pBits)
Description copied from interface:BitvectorFormulaManagerAll given bitvectors are pairwise unequal.- Specified by:
distinctin interfaceBitvectorFormulaManager
-
distinctImpl
protected TFormulaInfo distinctImpl(List<TFormulaInfo> pBits)
-
getFormulaCreator
protected final FormulaCreator<TFormulaInfo,TType,TEnv,TFuncDecl> getFormulaCreator()
-
toSolverType
protected final TType toSolverType(FormulaType<?> formulaType)
-
-