2 * File: CNFerModule.cpp
3 * Author: Florian Corzilius
5 * Created on 02. May 2012, 20:53
8 #include "CNFerModule.h"
10 #include <carl-formula/formula/functions/CNF.h>
14 CNFerModule::CNFerModule( const ModuleInput* _formula, Conditionals& _conditionals, Manager* const _manager ):
15 PModule( _formula, _conditionals, _manager )
19 CNFerModule::~CNFerModule(){}
21 Answer CNFerModule::checkCore()
23 auto receivedSubformula = firstUncheckedReceivedSubformula();
24 while( receivedSubformula != rReceivedFormula().end() )
27 * Add the currently considered formula of the received constraint as clauses
28 * to the passed formula.
30 FormulaT formulaToAssertInCnf = carl::to_cnf(receivedSubformula->formula());
31 if( formulaToAssertInCnf.type() == carl::FormulaType::TRUE )
35 else if( formulaToAssertInCnf.type() == carl::FormulaType::FALSE )
37 receivedFormulasAsInfeasibleSubset( receivedSubformula );
42 if( formulaToAssertInCnf.type() == carl::FormulaType::AND )
44 for( const FormulaT& subFormula : formulaToAssertInCnf.subformulas() )
46 #ifdef SMTRAT_DEVOPTION_Statistics
47 mStatistics.addClauseOfSize( subFormula.size() );
49 addSubformulaToPassedFormula( subFormula, receivedSubformula->formula() );
54 #ifdef SMTRAT_DEVOPTION_Statistics
55 mStatistics.addClauseOfSize( receivedSubformula->formula().size() );
57 addSubformulaToPassedFormula( formulaToAssertInCnf, receivedSubformula->formula() );
62 //No given formulas is SAT but only if no other run was before
63 if( rPassedFormula().empty() && solverState() == UNKNOWN )
69 #ifdef SMTRAT_DEVOPTION_Statistics
70 carl::carlVariables _vars;
71 rPassedFormula().gatherVariables(_vars);
72 mStatistics.nrOfArithVariables() = _vars.arithmetic().size();
73 mStatistics.nrOfBoolVariables() = _vars.boolean().size();
75 Answer a = runBackends();
79 getInfeasibleSubsets();