12 #include "../ICPModule/ICPModule.h"
49 return ! carl::is_zero(
mOffset);
64 const carl::Interval<Integer>&
bounds()
const {
77 std::size_t safeWidth1 = _summand1.
width();
78 std::size_t safeWidth2 = _summand2.
width();
89 std::size_t
width = ((safeWidth1 > safeWidth2) ? safeWidth1 : safeWidth2) + 1;
101 return (_out <<
"[" << (_type.
mSigned ?
"s" :
"u") << _type.
mWidth <<
"+" << _type.
mOffset <<
"]");
119 assert(_type.
width() == _term.width());
129 carl::Variable
var = carl::fresh_bitvector_variable();
130 carl::Sort bvSort = carl::SortManager::getInstance().getSort(
"BitVec", std::vector<std::size_t>({_type.
width()}));
149 return (_out << _term.
mTerm <<
" " << _term.
mType);
218 return (_out << _poly.
constant() <<
" (const)");
220 return (_out << _poly.
term());
273 Poly rightPoly(- _constraint.lhs().constant_part());
274 Poly leftPoly(_constraint.lhs() - _constraint.lhs().constant_part());
276 if(leftPoly.lcoeff() < 0) {
308 template<
typename Element,
typename Origin>
349 template<
typename Element,
typename Origin>
377 bool add(
const Element& _element,
const Origin& _origin) {
382 mItems.push_back(newElement);
383 auto inserted = std::prev(
mItems.end());
388 lookup->second->addOrigin(_origin);
398 std::list<typename Super::iterator>& occurings = originIt->second;
400 for(
auto& item : occurings) {
401 if(item->removeOrigin(_origin)) {
416 bool removedAnything =
false;
418 for(
auto& it = _origins.begin();it != _origins.end();++it) {
422 return removedAnything;
453 template<
class Settings>
489 return SettingsType::moduleName;
const carl::BVTerm & term() const
const carl::BVTerm & operator()() const
AnnotatedBVTerm(const BVAnnotation &_type)
const BVAnnotation & type() const
friend std::ostream & operator<<(std::ostream &_out, const AnnotatedBVTerm &_term)
AnnotatedBVTerm(const BVAnnotation &_type, const carl::BVTerm &_term)
AnnotatedBVTerm(std::size_t _width, bool _signed, Integer _offset=0)
friend std::ostream & operator<<(std::ostream &_out, const BVAnnotation &_type)
const Integer & lower_bound() const
BVAnnotation(std::size_t _width, bool _signed, Integer _offset=0)
static BVAnnotation forSum(BVAnnotation _summand1, BVAnnotation _summand2)
BVAnnotation withOffset(Integer _newOffset) const
const Integer & offset() const
static BVAnnotation forProduct(BVAnnotation _factor1, BVAnnotation _factor2)
carl::Interval< Integer > mBounds
const Integer & upper_bound() const
const carl::Interval< Integer > & bounds() const
BVAnnotation withWidth(std::size_t _width) const
std::size_t width() const
BlastedConstr(bool _satisfied)
BlastedConstr(const FormulaT &_formula, const FormulasT &_constraints)
const FormulasT & constraints() const
const FormulaT & formula() const
friend std::ostream & operator<<(std::ostream &_out, const BlastedConstr &_constr)
BlastedConstr(const FormulaT &_formula)
friend std::ostream & operator<<(std::ostream &_out, const BlastedPoly &_poly)
const Integer & lower_bound() const
const Integer & constant() const
const AnnotatedBVTerm & term() const
BlastedPoly(Integer _constant)
BlastedPoly(AnnotatedBVTerm _term, FormulasT _constraints)
BlastedPoly(Integer _constant, FormulasT _constraints)
const FormulasT & constraints() const
BlastedPoly(AnnotatedBVTerm _term)
const Integer & upper_bound() const
std::set< Element > mElementsWithoutOrigins
std::list< ElementWO > Super
bool removeOrigin(const Origin &_origin)
std::map< Element, typename Super::iterator > mElementPositions
bool add(const Element &_element, const Origin &_origin)
std::map< Origin, std::list< typename Super::iterator > > mOriginOccurings
const_iterator cend() const
ElementWithOrigins< Element, Origin > ElementWO
CollectionWithOrigins(bool _trackElementsWithoutOrigins=true)
bool mTrackElementsWithoutOrigins
Super::const_iterator const_iterator
bool contains(const Element &_element)
void clearElementsWithoutOrigins()
bool removeOrigins(const std::set< Origin > &_origins)
const std::set< Element > & elementsWithoutOrigins() const
const_iterator cbegin() const
const PolyTree & right() const
const PolyTree & left() const
carl::Relation relation() const
ConstrTree(const ConstraintT &_constraint)
const ConstraintT & constraint() const
ElementWithOrigins(const Element &_element, const Origin &_origin)
ElementWithOrigins(const Element &_element)
const Element & element() const
std::set< Origin > mOrigins
bool removeOrigin(const Origin &_origin)
const std::set< Origin > & origins() const
void addOrigin(const Origin &_origin)
IntegerInterval get_num(const RationalInterval &_interval) const
carl::Interval< Integer > IntegerInterval
Answer checkCore()
Checks the received formula for consistency.
std::size_t chooseWidth(const Integer &_numberToCover, std::size_t _maxWidth, bool _signed) const
carl::Variable::Arg getICPSubstitute(const Poly &_poly)
std::map< Poly, std::set< Poly > > mPolyParents
void removeFormulaFromICP(const FormulaT &_formula, const FormulaT &_origin)
std::pair< BlastedPoly, bool > shrinkToRange(const BlastedPoly &_input, const IntegerInterval &_interval) const
std::set< Poly > mShrunkPolys
void addFormulaToICP(const FormulaT &_formula, const FormulaT &_origin)
void unblastVariable(const carl::Variable &_variable)
VariableBounds mBoundsInRestriction
void addConstraintFormulaToICP(const FormulaT &_formula)
bool informCore(const FormulaT &_constraint)
Informs the module about the given constraint.
void removeOriginFromICP(const FormulaT &_origin)
IntBlastModule(const ModuleInput *_formula, Conditionals &_conditionals, Manager *_manager=NULL)
BlastedPoly blastSum(const BlastedPoly &_summand1, const BlastedPoly &_summand2)
void unblastPoly(const Poly &_polys)
void addPolyParents(const ConstraintT &_constraint)
carl::BVTerm encodeBVConstant(const Integer &_constant, const BVAnnotation &_type) const
VariableBounds mBoundsFromInput
void addSubstitutesToICP(const ConstraintT &_constraint, const FormulaT &_origin)
FormulasT blastConstraint(const ConstraintT &_constraint)
void addBoundRestrictionsToICP(carl::Variable _variable, const BVAnnotation &blastedType)
std::map< Poly, BlastedPoly > mPolyBlastings
CollectionWithOrigins< carl::Variable, FormulaT > mInputVariables
bool reblastingNeeded(const BlastedPoly &_previousBlasting, const IntegerInterval &_interval, bool _linear) const
const BlastedPoly & blastPolyTree(const PolyTree &_poly, FormulasT &_collectedFormulas)
void recheckShrunkPolys()
bool evaluateRelation(carl::Relation _relation, const Integer &_first, const Integer &_second) const
void init()
Informs all backends about the so far encountered constraints, which have not yet been communicated.
void unblastPolys(const std::set< Poly > &_polys)
void updateModelFromICP() const
SolutionOrigin mSolutionOrigin
FormulaSetT mFormulasToEncode
void removeBoundRestrictionsFromICP(carl::Variable _variable)
void encodeFormulaToBV(const FormulaT &_formula)
std::map< Poly, carl::Variable > mSubstitutes
std::set< Poly > parentalClosure(std::set< Poly > _children)
void removeCore(ModuleInput::const_iterator _subformula)
Removes the subformula of the received formula at the given position to the considered ones of this m...
FormulasT mProcessedFormulasFromICP
void updateBoundsFromICP()
BlastedPoly blastProduct(const BlastedPoly &_factor1, const BlastedPoly &_factor2)
std::vector< std::atomic_bool * > mICPFoundAnswer
void updateModel() const
Updates the current assignment into the model.
void updateOutsideRestrictionConstraint(bool _fromICPOnly)
bool addCore(ModuleInput::const_iterator _subformula)
The module has to take the given sub-formula of the received formula into account.
void addPolyParent(const Poly &_child, const Poly &_parent)
smtrat::vb::VariableBounds< FormulaT > VariableBounds
const BlastedConstr & blastConstrTree(const ConstrTree &_constraint, FormulasT &_collectedFormulas)
std::string moduleName() const
std::map< ConstraintT, BlastedConstr > mConstrBlastings
carl::BVTerm resizeBVTerm(const AnnotatedBVTerm &_term, std::size_t _width) const
void addFormulaToBV(const FormulaT &_formula, const FormulaT &_origin)
FormulaT mConstraintFromBounds
FormulaT encodeConstraintToBV(const FormulaT &_original, FormulasT *_collectedBitvectorConstraints)
int blastVariable(const carl::Variable &_variable, const IntegerInterval &_interval, bool _allowOffset)
void updateModelFromBV() const
void removeOriginFromBV(const FormulaT &_origin)
CollectionWithOrigins< carl::Variable, FormulaT > mNonlinearInputVariables
Integer decodeBVConstant(const carl::BVValue &_value, const BVAnnotation &_type) const
ICPModule< ICPSettings1 > mICP
A base class for all kind of theory solving methods.
carl::BVVariable BVVariable
carl::BVTerm BVTerm
Typedef for bitvector term.
Class to create the formulas for axioms.
carl::FormulaSet< Poly > FormulaSetT
carl::Formula< Poly > FormulaT
const settings::Settings & Settings()
carl::Interval< Rational > RationalInterval
carl::MultivariatePolynomial< Rational > Poly
Answer
An enum with the possible answers a Module can give.
std::vector< std::atomic_bool * > Conditionals
A vector of atomic bool pointers.
carl::Constraint< Poly > ConstraintT
carl::Formulas< Poly > FormulasT
carl::IntegralType< Rational >::type Integer