SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
CADElimination.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../QEQuery.h"
4 
6 #include <smtrat-cad/Settings.h>
10 #include "CAD.h"
11 
12 #include <carl-arith/poly/umvpoly/MultivariatePolynomial.h>
13 #include <carl-arith/core/Relation.h>
14 #include <carl-arith/core/Sign.h>
15 #include <carl-arith/poly/umvpoly/UnivariatePolynomial.h>
16 #include <carl-arith/poly/umvpoly/functions/Factorization.h>
17 #include <carl-formula/model/Model.h>
18 #include <carl-arith/ran/ran.h>
19 
20 #include <algorithm>
21 #include <iostream>
22 #include <map>
23 #include <string>
24 #include <utility>
25 #include <vector>
26 
27 namespace smtrat::qe::cad {
28 
33 };
34 
36 private:
38  std::vector<carl::Variable> mVariables;
39  std::vector<ConstraintT> mConstraints;
40  std::vector<std::pair<QuantifierType, carl::Variable>> mQuantifiers;
41 
42  std::size_t n;
43  std::size_t k;
44 
46 
48 
49  std::map<TreeIT, bool> mTruth;
50  std::map<TreeIT, std::vector<carl::Sign>> mSignature;
51 
52  std::vector<std::pair<TreeIT, TreeIT>> mCauseConflict;
53 
54  std::vector<TreeIT> mTrueSamples;
55  std::vector<TreeIT> mFalseSamples;
57 
58  auto& tree() {
59  return mCAD.getLifting().getTree();
60  }
61  const auto& tree() const {
62  return mCAD.getLifting().getTree();
63  }
64 
65  std::vector<TreeIT> collectChildren(const TreeIT& it) const {
66  std::vector<TreeIT> res;
67  for (auto child = tree().begin_children(it); child != tree().end_children(it); ++child) {
68  res.emplace_back(child);
69  }
70  return res;
71  }
72 
73  void constructCAD();
74  void updateCAD(std::vector<Poly>& polynomials);
75 
76  void simplifyCAD();
77  bool truthBoundaryTest(TreeIT& b, TreeIT& c, TreeIT& d);
78 
79  void computeTruthValues();
80  void computeSignatures();
81 
82  bool isProjectionDefinable();
84 
85  FormulaT constructImplicant(const TreeIT& sample);
87 
88  template<typename T>
89  std::vector<T> computeHittingSet(const std::vector<std::vector<T>>& setOfSets);
90 
91 public:
92  CADElimination(const FormulaT& quantifierFreePart, const QEQuery& quantifiers);
94 };
95 
96 } // namespace smtrat::qe::cad
CADElimination(const FormulaT &quantifierFreePart, const QEQuery &quantifiers)
bool truthBoundaryTest(TreeIT &b, TreeIT &c, TreeIT &d)
std::vector< TreeIT > mTrueSamples
std::vector< std::pair< QuantifierType, carl::Variable > > mQuantifiers
std::map< TreeIT, bool > mTruth
CAD< CADSettings >::TreeIterator TreeIT
void updateCAD(std::vector< Poly > &polynomials)
std::vector< TreeIT > mFalseSamples
std::vector< ConstraintT > mConstraints
std::map< TreeIT, std::vector< carl::Sign > > mSignature
FormulaT constructImplicant(const TreeIT &sample)
std::vector< TreeIT > collectChildren(const TreeIT &it) const
std::vector< carl::Variable > mVariables
std::vector< T > computeHittingSet(const std::vector< std::vector< T >> &setOfSets)
std::vector< std::pair< TreeIT, TreeIT > > mCauseConflict
typename smtrat::cad::LiftingTree< Settings >::Iterator TreeIterator
Definition: CAD.h:14
Incrementality
Definition: Settings.h:7
ProjectionType
Definition: Settings.h:9
std::vector< std::pair< QuantifierType, std::vector< carl::Variable > >> QEQuery
Definition: QEQuery.h:17
carl::Formula< Poly > FormulaT
Definition: types.h:37
carl::Formulas< Poly > FormulasT
Definition: types.h:39
static constexpr smtrat::cad::Incrementality incrementality
static constexpr smtrat::cad::Backtracking backtracking
static constexpr smtrat::cad::ProjectionType projectionOperator