7 #include <carl-arith/extended/Encoding.h>
8 #include <carl-formula/formula/functions/Visit.h>
13 template<
typename Settings>
67 SMTRAT_LOG_DEBUG(
"smtrat.mcsat",
"Checking whether " << f <<
" is feasible");
71 if (std::holds_alternative<ModelValues>(res)) {
74 SMTRAT_LOG_DEBUG(
"smtrat.mcsat", f <<
" is infeasible with reason " << std::get<FormulasT>(res));
82 for (
const auto& r: reason) expl.emplace_back(r.negated());
88 #ifdef SMTRAT_DEVOPTION_Validation
91 if (std::holds_alternative<FormulaT>(*res)) {
93 formula = std::get<FormulaT>(*res);
98 formula = std::get<ClauseChain>(*res).resolve();
102 carl::Assignment<RAN> ass;
103 for (
const auto& [key, value] :
getTrail().model()) {
105 ass.emplace(key.asVariable(), value.asRAN());
107 assert(value.isRational());
108 ass.emplace(key.asVariable(),
RAN(value.asRational()));
111 carl::EncodingCache<Poly> cache;
112 formula = carl::visit_result(formula, [&](
const FormulaT& f) {
113 if (f.type() == carl::FormulaType::VARCOMPARE) {
114 auto [conds, constr] = carl::encode_as_constraints(f.variable_comparison(), ass, cache);
116 for (const auto& c: conds) {
117 fs.emplace_back(FormulaT(ConstraintT(c)));
137 auto res = explain(
var, reason,
true);
143 return mAssignmentFinder.active(getTrail(), f);
148 template<
typename Settings>
#define SMTRAT_VALIDATION_INIT_STATIC(channel, variable)
#define SMTRAT_VALIDATION_ADD_TO(variable, name, formula, consistent)
Represent the trail, i.e.
const auto & assignedVariables() const
void popConstraint(const FormulaT &f)
void popAssignment(carl::Variable v)
const auto & variables() const
const auto & model() const
void pushConstraint(const FormulaT &f)
Assert a constraint/literal.
void updateVariables(const carl::Variables &variables)
void pushAssignment(carl::Variable v, const ModelValue &mv, const FormulaT &f)
AssignmentOrConflict findAssignment(carl::Variable var) const
void pushAssignment(carl::Variable v, const ModelValue &mv, const FormulaT &f)
bool isActive(const FormulaT &f) const
const auto & getModel() const
void popAssignment(carl::Variable v)
void popConstraint(const FormulaT &f)
mcsat::Bookkeeping mBookkeeping
void pushConstraint(const FormulaT &f)
const auto & getTrail() const
Explanation explain(carl::Variable var, const FormulaT &f, const FormulasT &reason)
Settings::AssignmentFinderBackend mAssignmentFinder
Settings::ExplanationBackend mExplanation
AssignmentOrConflict isInfeasible(carl::Variable var, const FormulaT &f)
const auto & assignedVariables() const
const auto & variables() const
void initVariables(const carl::Variables &variables)
Explanation explain(carl::Variable var, const FormulasT &reason, bool force_use_core=false) const
std::vector< std::pair< carl::Variable, ModelValue > > ModelValues
std::variant< FormulaT, ClauseChain > Explanation
std::variant< ModelValues, FormulasT > AssignmentOrConflict
Class to create the formulas for axioms.
carl::ModelValue< Rational, Poly > ModelValue
carl::Formula< Poly > FormulaT
std::ostream & operator<<(std::ostream &os, CMakeOptionPrinter cmop)
carl::Constraint< Poly > ConstraintT
carl::Formulas< Poly > FormulasT
#define SMTRAT_LOG_INFO(channel, msg)
#define SMTRAT_LOG_ERROR(channel, msg)
#define SMTRAT_LOG_DEBUG(channel, msg)