SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
PNFerModule.cpp
Go to the documentation of this file.
1 #include "PNFerModule.h"
2 
3 #include <carl-formula/formula/functions/PNF.h>
4 
5 namespace smtrat {
6 PNFerModule::PNFerModule(const ModuleInput* _formula, Conditionals& _conditionals, Manager* const _manager)
7  : PModule(_formula, _conditionals, _manager) {
8 }
9 
11 
13  FormulaT input(rReceivedFormula());
14  FormulaT pnf;
15  if ((carl::PROP_CONTAINS_QUANTIFIER_EXISTS <= input.properties()) || (carl::PROP_CONTAINS_QUANTIFIER_FORALL <= input.properties())) {
16  auto [prefix, matrix] = carl::to_pnf(input);
17  auto contains_forall = std::find_if(prefix.begin(), prefix.end(), [](const auto& e) { return e.first == carl::Quantifier::FORALL; }) != prefix.end();
18  if (contains_forall) {
19  SMTRAT_LOG_TRACE("smtrat.pnf", "Contains quantifiers after PNFing.");
20  pnf = carl::to_formula(prefix, matrix);
21  } else {
22  SMTRAT_LOG_TRACE("smtrat.pnf", "Simplifying to quantifier-free formula.");
23  pnf = matrix;
24  }
25  } else {
26  SMTRAT_LOG_TRACE("smtrat.pnf", "Already quantifier-free.");
27  pnf = input;
28  }
29 
30  if (pnf.type() == carl::FormulaType::FALSE) {
32  return UNSAT;
33  } else {
34  addSubformulaToPassedFormula(pnf, input);
35  }
36 
37  if (rPassedFormula().empty() && solverState() == UNKNOWN) {
38  return SAT;
39  } else {
40  Answer a = runBackends();
41  if (a == UNSAT) {
43  }
44  return a;
45  }
46 }
47 } // namespace smtrat
Base class for solvers.
Definition: Manager.h:34
The input formula a module has to consider for it's satisfiability check.
Definition: ModuleInput.h:131
void generateTrivialInfeasibleSubset()
Stores the trivial infeasible subset being the set of received formulas.
Definition: Module.h:909
std::pair< ModuleInput::iterator, bool > addSubformulaToPassedFormula(const FormulaT &_formula)
Adds the given formula to the passed formula with no origin.
Definition: Module.h:873
Answer solverState() const
Definition: Module.h:388
const ModuleInput & rReceivedFormula() const
Definition: Module.h:439
const ModuleInput & rPassedFormula() const
Definition: Module.h:455
void getInfeasibleSubsets()
Copies the infeasible subsets of the passed formula.
Definition: Module.cpp:596
virtual Answer runBackends()
Definition: PModule.h:80
PNFerModule(const ModuleInput *, Conditionals &, Manager *const =NULL)
Definition: PNFerModule.cpp:6
Answer checkCore()
Checks the received formula for consistency.
Definition: PNFerModule.cpp:12
DNF to_formula(const datastructures::PolyPool &pool, carl::Variable main_var, const datastructures::SymbolicInterval &c)
Converts a datastructures::SymbolicInterval to a DNF.
std::vector< T > prefix(const std::vector< T > vars, std::size_t prefixSize)
Definition: utils.h:349
Class to create the formulas for axioms.
carl::Formula< Poly > FormulaT
Definition: types.h:37
Answer
An enum with the possible answers a Module can give.
Definition: types.h:57
@ SAT
Definition: types.h:57
@ UNSAT
Definition: types.h:57
@ UNKNOWN
Definition: types.h:57
std::vector< std::atomic_bool * > Conditionals
A vector of atomic bool pointers.
Definition: types.h:17
#define SMTRAT_LOG_TRACE(channel, msg)
Definition: logging.h:36