5 SMTRAT_LOG_DEBUG(
"smtrat.pbc",
"Trying to convert small formula: " << constraint);
6 assert(constraint.variables().size() == 1);
8 carl::Relation cRel = constraint.relation();
9 const Poly& cLHS = constraint.lhs();
13 for (
const auto& term : cLHS) {
14 if (term.is_constant())
continue;
16 lhsCoeff = term.coeff();
17 lhsVar =
FormulaT(term.single_variable());
20 Rational cRHS = -constraint.lhs().constant_part();
22 if (cRel == carl::Relation::LEQ) {
25 if(cRHS < lhsCoeff && cRHS > 0)
return FormulaT(lhsVar.negated());
28 if(cRHS < lhsCoeff && cRHS < 0)
return FormulaT(carl::FormulaType::FALSE);
31 if(cRHS == 0)
return FormulaT(lhsVar.negated());
34 if(cRHS >= lhsCoeff)
return FormulaT(carl::FormulaType::TRUE);
37 }
else if(lhsCoeff < 0){
39 if(cRHS < lhsCoeff)
return FormulaT(carl::FormulaType::FALSE);
42 if(cRHS >= 0)
return FormulaT(carl::FormulaType::TRUE);
45 if(cRHS >= lhsCoeff && cRHS < 0)
return FormulaT(lhsVar);
49 if(cRHS >= 0)
return FormulaT(carl::FormulaType::TRUE);
52 if(cRHS < 0)
return FormulaT(carl::FormulaType::FALSE);
65 return FormulaT(carl::FormulaType::FALSE);
70 return FormulaT(carl::FormulaType::TRUE);
73 return FormulaT(carl::FormulaType::FALSE);
76 }
else if(cRel == carl::Relation::NEQ){
84 }
else if(lhsCoeff != cRHS){
86 return FormulaT(carl::FormulaType::TRUE);
91 return FormulaT(carl::FormulaType::FALSE);
94 return FormulaT(carl::FormulaType::TRUE);
104 return constraint.variables().size() == 1;
virtual Rational encodingSize(const ConstraintT &constraint)
Class to create the formulas for axioms.
carl::Formula< Poly > FormulaT
carl::MultivariatePolynomial< Rational > Poly
carl::Constraint< Poly > ConstraintT
#define SMTRAT_LOG_DEBUG(channel, msg)