SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
PseudoBoolNormalizer.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <optional>
5 
6 namespace smtrat {
8  public:
9  /**
10  *
11  * Modifies the constraint in-place and returns an additional boolean formula
12  *
13  * Consider -4x <= 2
14  *
15  * This is equivalent to -4*(1 - not x) <= 2 iff. -4 + 4 not x <= 2 iff 4 not x <= 6
16  * Since we can not represent this negation in the constraint itself we add a variable y and get
17  * y <-> not x and 4 y <= 6
18  *
19  * In this particular case we can later on remove y again since the constraint is trivially satisfied.
20  *
21  */
22  std::pair<std::optional<FormulaT>, ConstraintT> normalize(const ConstraintT& constraint);
23 
24  /**
25  * returns all variable substitutions done by this normalizer instance. An entry {x: y} correlates to the boolean expression
26  * y <-> not x
27  *
28  * Useful if all occurences of the substituted variable should be substituted as well or in general when the correlation is needed.
29  */
30  std::map<carl::Variable, carl::Variable>& substitutedVariables() { return mVariablesCache;}
31 
32 
33  ConstraintT trim(const ConstraintT& constraint);
34 
35  private:
36  std::map<carl::Variable, carl::Variable> mVariablesCache;
37 
38  std::pair<std::optional<FormulaT>, ConstraintT> removePositiveCoeff(const ConstraintT& constraint);
39 
40  ConstraintT gcd(const ConstraintT& constraint);
41 
43 
44  bool trimmable(const ConstraintT& constraint);
45 
46 
47  };
48 }
std::pair< std::optional< FormulaT >, ConstraintT > normalize(const ConstraintT &constraint)
Modifies the constraint in-place and returns an additional boolean formula.
ConstraintT trim(const ConstraintT &constraint)
std::pair< std::optional< FormulaT >, ConstraintT > removePositiveCoeff(const ConstraintT &constraint)
ConstraintT normalizeLessConstraint(const ConstraintT &constraint)
bool trimmable(const ConstraintT &constraint)
ConstraintT gcd(const ConstraintT &constraint)
std::map< carl::Variable, carl::Variable > mVariablesCache
std::map< carl::Variable, carl::Variable > & substitutedVariables()
returns all variable substitutions done by this normalizer instance.
Class to create the formulas for axioms.
carl::Constraint< Poly > ConstraintT
Definition: types.h:29