16 #include <boost/dynamic_bitset.hpp>
18 #include "../arithmetic/Constraint.h"
19 #include "../uninterpreted/UEquality.h"
20 #include "../uninterpreted/UFManager.h"
21 #include "../bitvector/BVConstraintPool.h"
22 #include "../bitvector/BVConstraint.h"
34 template<
typename Pol>
38 template<
typename Pol>
45 template<
typename Pol>
78 if( _content !=
nullptr )
83 #define ACTIVITY_LOCK_GUARD std::lock_guard<std::mutex> lock1( mpContent->mActivityMutex );
84 #define VARIABLES_LOCK_GUARD std::lock_guard<std::mutex> lock3( mpContent->mVariablesMutex );
86 #define ACTIVITY_LOCK_GUARD
87 #define VARIABLES_LOCK_GUARD
200 _formula.mpContent =
nullptr;
226 _formula.mpContent =
nullptr;
270 std::size_t
id()
const
302 if(
mpContent->mpVariables ==
nullptr ) {
330 return std::get<Formula<Pol>>(
mpContent->mContent);
339 return std::get<Formulas<Pol>>(
mpContent->mContent)[0];
348 return std::get<Formulas<Pol>>(
mpContent->mContent)[1];
357 return std::get<Formulas<Pol>>(
mpContent->mContent)[0];
366 return std::get<Formulas<Pol>>(
mpContent->mContent)[1];
375 return std::get<Formulas<Pol>>(
mpContent->mContent)[2];
384 return std::get<QuantifierContent<Pol>>(
mpContent->mContent).mVariables;
393 return std::get<QuantifierContent<Pol>>(
mpContent->mContent).mFormula;
403 return std::get<Formulas<Pol>>(
mpContent->mContent);
413 return std::get<Constraint<Pol>>(
mpContent->mContent);
418 return std::get<VariableComparison<Pol>>(
mpContent->mContent);
423 return std::get<VariableAssignment<Pol>>(
mpContent->mContent);
429 return std::get<BVConstraint>(
mpContent->mContent);
439 return std::get<carl::Variable>(
mpContent->mContent);
449 return std::get<UEquality>(
mpContent->mContent);
494 return std::get<Formulas<Pol>>(
mpContent->mContent).
end();
522 return std::get<Formula<Pol>>(
mpContent->mContent);
524 return *(--(std::get<Formulas<Pol>>(
mpContent->mContent).
end()));
692 if( *
this == _formula )
697 return std::get<Formula<Pol>>(
mpContent->mContent) == _formula;
728 assert( _formula.
id() != 0 );
739 assert( _formula.
id() != 0 );
750 assert( _formula.
id() != 0 );
761 assert( _formula.
id() != 0 );
786 template<
typename Pol>
787 struct hash<
carl::FormulaContent<Pol>>
796 return _formulaContent.
hash();
803 template<
typename Pol>
804 struct hash<
carl::Formula<Pol>>
813 return _formula.
hash();
#define ACTIVITY_LOCK_GUARD
#define VARIABLES_LOCK_GUARD
MultivariatePolynomial< Rational > Pol
carl is the main namespace for the library.
FormulaType
Represent the type of a formula to allow faster/specialized processing.
static constexpr Condition PROP_CONTAINS_NONLINEAR_POLYNOMIAL
std::set< Formula< Poly > > FormulaSet
std::ostream & operator<<(std::ostream &os, const BasicConstraint< Poly > &c)
Prints the given constraint on the given stream.
static constexpr Condition PROP_CONTAINS_BOOLEAN
static constexpr Condition PROP_TRUE
bool is_bound(const BasicConstraint< Pol > &constr)
static constexpr Condition PROP_IS_A_LITERAL
std::vector< Formula< Poly > > Formulas
static constexpr Condition PROP_IS_PURE_CONJUNCTION
static constexpr Condition PROP_CONTAINS_UNINTERPRETED_EQUATIONS
static constexpr Condition PROP_CONTAINS_INTEGER_VALUED_VARS
static constexpr Condition PROP_CONTAINS_REAL_VALUED_VARS
std::multiset< Formula< Poly > > FormulasMulti
static constexpr Condition PROP_CONTAINS_BITVECTOR
void variables(const BasicConstraint< Pol > &c, carlVariables &vars)
std::set< Variable > Variables
static constexpr Condition PROP_CONTAINS_PSEUDOBOOLEAN
auto & get(const std::string &name)
A Variable represents an algebraic variable that can be used throughout carl.
Represent a sum type/variant of an (in)equality between a variable on the left-hand side and multivar...
static FormulaPool< Pol > & getInstance()
Returns the single instance of this class by reference.
Represent a polynomial (in)equality against zero.
Represent an SMT formula, which can be an atom for some background theory or a boolean combination of...
const VariableAssignment< Pol > & variable_assignment() const
const FormulaContent< Pol > * mpContent
The content of this formula.
const Formula & subformula() const
bool operator==(const Formula &_formula) const
Formula(const Formula &_formula)
const_iterator begin() const
Formula(FormulaType _type, const Formula &_subformula)
Formula(FormulaType _type, const std::vector< Variable > &_vars, const Formula &_term)
Formula(const Pol &_pol, Relation _rel)
bool is_constraint_conjunction() const
const VariableComparison< Pol > & variable_comparison() const
const Formula & premise() const
Formula(FormulaType _type=FALSE)
Pol PolynomialType
A typedef for the template argument.
const Formula & conclusion() const
const Formula & quantified_formula() const
carl::Variable::Arg boolean() const
bool is_only_propositional() const
bool is_integer_constraint_conjunction() const
Formula(FormulaType _type, const Formula &_subformulaA, const Formula &_subformulaB, const Formula &_subformulaC)
bool is_real_constraint_conjunction() const
typename Formulas< Pol >::const_iterator const_iterator
A constant iterator to a sub-formula of a formula.
bool contains(const Formula &_formula) const
const Formula & remove_negations() const
Formula(const FormulaContent< Pol > *_content)
const Constraint< Pol > & constraint() const
Formula(Variable::Arg _booleanVar)
const std::vector< carl::Variable > & quantified_variables() const
Formula & operator=(const Formula &_formula)
bool property_holds(const Condition &_property) const
Checks if the given property holds for this formula.
const Formulas< Pol > & subformulas() const
Formula(const BVConstraint &_constraint)
static void init(FormulaContent< Pol > &_content)
Gets the propositions of this formula.
Formula(const Constraint< Pol > &_constraint)
const Formula & first_case() const
const_reverse_iterator rbegin() const
Formula(Formula &&_formula) noexcept
bool operator>=(const Formula &_formula) const
const_reverse_iterator rend() const
Formula(const UTerm &_lhs, const UTerm &_rhs, bool _negated)
Formula operator!() const
typename Formulas< Pol >::const_reverse_iterator const_reverse_iterator
A constant reverse iterator to a sub-formula of a formula.
bool operator<=(const Formula &_formula) const
bool operator<(const Formula &_formula) const
const Formula & second_case() const
Formula(FormulaType _type, Formulas< Pol > &&_subasts)
const BVConstraint & bv_constraint() const
Formula(FormulaType _type, const FormulaSet< Pol > &_subasts)
Formula(FormulaType _type, const Formula &_subformulaA, const Formula &_subformulaB)
Formula(FormulaType _type, std::vector< Variable > &&_vars, const Formula &_term)
const UEquality & u_equality() const
friend std::ostream & operator<<(std::ostream &os, const Formula< P > &f)
The output operator of a formula.
bool operator!=(const Formula &_formula) const
Formula(FormulaType _type, const Formulas< Pol > &_subasts)
Formula(FormulaType _type, FormulaSet< Pol > &&_subasts)
Formula base_formula() const
void set_activity(double _activity) const
Sets the activity to the given value.
Formula & operator=(Formula &&_formula)
Formula(FormulaType _type, const std::initializer_list< Formula< Pol >> &_subasts)
const_iterator end() const
const Condition & properties() const
static void addConstraintProperties(const Constraint< Pol > &_constraint, Condition &_properties)
Adds the propositions of the given constraint to the propositions of this formula.
bool is_boolean_combination() const
Formula(const UEquality &_eq)
Formula(FormulaType _type, Formula &&_subformula)
bool operator>(const Formula &_formula) const
const Variables & variables() const
const Formula & condition() const
Formula(const VariableAssignment< Pol > &_variableAssignment)
const Formula & back() const
Formula(const VariableComparison< Pol > &_variableComparison)
Formula(FormulaType _type, const FormulasMulti< Pol > &_subformulas)
std::size_t operator()(const carl::FormulaContent< Pol > &_formulaContent) const
std::size_t operator()(const carl::Formula< Pol > &_formula) const
Implements an uninterpreted equality, that is an equality of either two uninterpreted function instan...
Implements an uninterpreted term, that is either an uninterpreted variable or an uninterpreted functi...