#include "theory/quantifiers/term_util.h"
#include "theory/rewriter.h"
#include "theory/theory_model.h"
+#include "theory/theory_state.h"
using namespace CVC4;
using namespace CVC4::kind;
#include "theory/quantifiers/cegqi/inst_strategy_cegqi.h"
#include "theory/quantifiers/first_order_model.h"
#include "theory/quantifiers/quantifiers_attributes.h"
-#include "theory/quantifiers/quantifiers_rewriter.h"
+#include "theory/quantifiers/quantifiers_state.h"
#include "theory/quantifiers/term_database.h"
#include "theory/quantifiers/term_util.h"
#include "theory/quantifiers_engine.h"
#include "theory/quantifiers/quantifiers_attributes.h"
#include "theory/quantifiers/quantifiers_rewriter.h"
#include "theory/quantifiers/term_database.h"
+#include "theory/quantifiers/term_registry.h"
#include "theory/quantifiers/term_util.h"
#include "theory/quantifiers_engine.h"
#include "theory/rewriter.h"
InstStrategyCegqi::InstStrategyCegqi(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr)
- : QuantifiersModule(qs, qim, qr, qe),
+ QuantifiersRegistry& qr,
+ TermRegistry& tr)
+ : QuantifiersModule(qs, qim, qr, tr, qe),
d_irew(new InstRewriterCegqi(this)),
d_cbqi_set_quant_inactive(false),
d_incomplete_check(false),
QuantifiersModule::QEffort InstStrategyCegqi::needsModel(Theory::Effort e)
{
- size_t nquant = d_quantEngine->getModel()->getNumAssertedQuantifiers();
+ size_t nquant = d_treg.getModel()->getNumAssertedQuantifiers();
for (size_t i = 0; i < nquant; i++)
{
- Node q = d_quantEngine->getModel()->getAssertedQuantifier( i );
+ Node q = d_treg.getModel()->getAssertedQuantifier(i);
if (doCbqi(q))
{
return QEFFORT_STANDARD;
d_incomplete_check = false;
d_active_quant.clear();
//check if any cbqi lemma has not been added yet
- for( unsigned i=0; i<d_quantEngine->getModel()->getNumAssertedQuantifiers(); i++ ){
- Node q = d_quantEngine->getModel()->getAssertedQuantifier( i );
+ FirstOrderModel* fm = d_treg.getModel();
+ size_t nquant = fm->getNumAssertedQuantifiers();
+ for (size_t i = 0; i < nquant; i++)
+ {
+ Node q = fm->getAssertedQuantifier(i);
//it is not active if it corresponds to a rewrite rule: we will process in rewrite engine
if( doCbqi( q ) ){
- if( d_quantEngine->getModel()->isQuantifierActive( q ) ){
+ if (fm->isQuantifierActive(q))
+ {
d_active_quant[q] = true;
Debug("cegqi-debug") << "Check quantified formula " << q << "..." << std::endl;
Node cel = getCounterexampleLiteral(q);
Trace("cegqi-warn") << "CBQI WARNING: Bad decision on CE Literal." << std::endl;
}else{
Trace("cegqi") << "Inactive : " << q << std::endl;
- d_quantEngine->getModel()->setQuantifierActive( q, false );
+ fm->setQuantifierActive(q, false);
d_cbqi_set_quant_inactive = true;
d_active_quant.erase( q );
}
InstStrategyCegqi(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr);
+ QuantifiersRegistry& qr,
+ TermRegistry& tr);
~InstStrategyCegqi();
/** whether to do counterexample-guided instantiation for quantifier q */
#include "theory/quantifiers/skolemize.h"
#include "theory/quantifiers/term_database.h"
#include "theory/quantifiers/term_enumeration.h"
-#include "theory/quantifiers/term_registry.h"
#include "theory/quantifiers/term_util.h"
#include "theory/quantifiers_engine.h"
#include "theory/rewriter.h"
ConjectureGenerator::ConjectureGenerator(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr)
- : QuantifiersModule(qs, qim, qr, qe),
+ QuantifiersRegistry& qr,
+ TermRegistry& tr)
+ : QuantifiersModule(qs, qim, qr, tr, qe),
d_notify(*this),
d_uequalityEngine(
d_notify, qs.getSatContext(), "ConjectureGenerator::ee", false),
}
bool ConjectureGenerator::isHandledTerm( TNode n ){
- return d_quantEngine->getTermDatabase()->isTermActive(n)
+ return getTermDatabase()->isTermActive(n)
&& inst::TriggerTermInfo::isAtomicTrigger(n)
&& (n.getKind() != APPLY_UF || n.getOperator().getKind() != SKOLEM);
}
d_ue_canon.clear();
d_thm_index.clear();
std::vector< Node > provenConj;
- quantifiers::FirstOrderModel* m = d_quantEngine->getModel();
+ quantifiers::FirstOrderModel* m = d_treg.getModel();
for( unsigned i=0; i<m->getNumAssertedQuantifiers(); i++ ){
Node q = m->getAssertedQuantifier( i );
Trace("thm-db-debug") << "Is " << q << " a relevant theorem?" << std::endl;
{
isSubsume = true;
//set inactive (will be ignored by other modules)
- d_quantEngine->getModel()->setQuantifierActive( q, false );
+ m->setQuantifierActive(q, false);
}
else
{
if( n.getNumChildren()>0 ){
Trace("sg-gt-enum-debug") << "Get enumerate uf terms " << n << " (" << num
<< ")" << std::endl;
- TermEnumeration* te = d_quantEngine->getTermRegistry().getTermEnumeration();
+ TermEnumeration* te = d_treg.getTermEnumeration();
// below, we do a fair enumeration of vectors vec of indices whose sum is
// 1,2,3, ...
std::vector< int > vec;
ConjectureGenerator(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr);
+ QuantifiersRegistry& qr,
+ TermRegistry& tr);
~ConjectureGenerator();
/* needs check */
QuantifiersInferenceManager& qim,
QuantifiersRegistry& qr,
TermRegistry& tr)
- : QuantifiersModule(qs, qim, qr, qe),
+ : QuantifiersModule(qs, qim, qr, tr, qe),
d_instStrategies(),
d_isup(),
d_i_ag(),
#include "theory/quantifiers/fmf/model_engine.h"
#include "theory/quantifiers/term_enumeration.h"
#include "theory/quantifiers/term_util.h"
-#include "theory/quantifiers_engine.h"
#include "theory/theory_engine.h"
using namespace CVC4;
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
QuantifiersRegistry& qr,
+ TermRegistry& tr,
DecisionManager* dm)
- : QuantifiersModule(qs, qim, qr, qe), d_dm(dm)
+ : QuantifiersModule(qs, qim, qr, tr, qe), d_dm(dm)
{
}
getBounds( f, v, rsi, l, u );
Trace("bound-int-rsi") << "Get value in model for..." << l << " and " << u << std::endl;
if( !l.isNull() ){
- l = d_quantEngine->getModel()->getValue( l );
+ l = d_treg.getModel()->getValue(l);
}
if( !u.isNull() ){
- u = d_quantEngine->getModel()->getValue( u );
+ u = d_treg.getModel()->getValue(u);
}
Trace("bound-int-rsi") << "Value is " << l << " ... " << u << std::endl;
return;
Trace("bound-int-rsi") << "Get value in model for..." << sr << std::endl;
Assert(!expr::hasFreeVar(sr));
Node sro = sr;
- sr = d_quantEngine->getModel()->getValue(sr);
+ sr = d_treg.getModel()->getValue(sr);
// if non-constant, then sr does not occur in the model, we fail
if (!sr.isConst())
{
#include "context/context.h"
#include "expr/attribute.h"
#include "theory/decision_strategy.h"
+#include "theory/quantifiers/quant_bound_inference.h"
namespace CVC4 {
namespace theory {
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
QuantifiersRegistry& qr,
+ TermRegistry& tr,
DecisionManager* dm);
virtual ~BoundedIntegers();
ModelEngine::ModelEngine(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr)
- : QuantifiersModule(qs, qim, qr, qe),
+ QuantifiersRegistry& qr,
+ TermRegistry& tr)
+ : QuantifiersModule(qs, qim, qr, tr, qe),
d_incomplete_check(true),
d_addedLemmas(0),
d_triedLemmas(0),
ModelEngine(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr);
+ QuantifiersRegistry& qr,
+ TermRegistry& tr);
virtual ~ModelEngine();
public:
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
QuantifiersRegistry& qr,
+ TermRegistry& tr,
RelevantDomain* rd)
- : QuantifiersModule(qs, qim, qr, qe), d_rd(rd), d_fullSaturateLimit(-1)
+ : QuantifiersModule(qs, qim, qr, tr, qe), d_rd(rd), d_fullSaturateLimit(-1)
{
}
void InstStrategyEnum::presolve()
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
QuantifiersRegistry& qr,
+ TermRegistry& tr,
RelevantDomain* rd);
~InstStrategyEnum() {}
/** Presolve */
QuantConflictFind::QuantConflictFind(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr)
- : QuantifiersModule(qs, qim, qr, qe),
+ QuantifiersRegistry& qr,
+ TermRegistry& tr)
+ : QuantifiersModule(qs, qim, qr, tr, qe),
d_conflict(qs.getSatContext(), false),
d_true(NodeManager::currentNM()->mkConst<bool>(true)),
d_false(NodeManager::currentNM()->mkConst<bool>(false)),
QuantConflictFind(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr);
+ QuantifiersRegistry& qr,
+ TermRegistry& tr);
/** register quantifier */
void registerQuantifier(Node q) override;
**/
#include "theory/quantifiers/quant_module.h"
-#include "theory/quantifiers/inst_match.h"
-#include "theory/quantifiers/term_database.h"
-#include "theory/quantifiers/term_util.h"
-#include "theory/quantifiers_engine.h"
using namespace CVC4::kind;
quantifiers::QuantifiersState& qs,
quantifiers::QuantifiersInferenceManager& qim,
quantifiers::QuantifiersRegistry& qr,
+ quantifiers::TermRegistry& tr,
QuantifiersEngine* qe)
- : d_quantEngine(qe), d_qstate(qs), d_qim(qim), d_qreg(qr)
+ : d_quantEngine(qe), d_qstate(qs), d_qim(qim), d_qreg(qr), d_treg(tr)
{
}
quantifiers::TermDb* QuantifiersModule::getTermDatabase() const
{
- return d_quantEngine->getTermDatabase();
+ return d_treg.getTermDatabase();
}
quantifiers::QuantifiersState& QuantifiersModule::getState()
#include "theory/quantifiers/quantifiers_inference_manager.h"
#include "theory/quantifiers/quantifiers_registry.h"
#include "theory/quantifiers/quantifiers_state.h"
+#include "theory/quantifiers/term_registry.h"
#include "theory/theory.h"
#include "theory/uf/equality_engine.h"
QuantifiersModule(quantifiers::QuantifiersState& qs,
quantifiers::QuantifiersInferenceManager& qim,
quantifiers::QuantifiersRegistry& qr,
+ quantifiers::TermRegistry& tr,
QuantifiersEngine* qe);
virtual ~QuantifiersModule() {}
/** Presolve.
protected:
/** pointer to the quantifiers engine that owns this module */
QuantifiersEngine* d_quantEngine;
- /** The state of the quantifiers engine */
+ /** Reference to the state of the quantifiers engine */
quantifiers::QuantifiersState& d_qstate;
- /** The quantifiers inference manager */
+ /** Reference to the quantifiers inference manager */
quantifiers::QuantifiersInferenceManager& d_qim;
- /** The quantifiers registry */
+ /** Reference to the quantifiers registry */
quantifiers::QuantifiersRegistry& d_qreg;
+ /** Reference to the term registry */
+ quantifiers::TermRegistry& d_treg;
}; /* class QuantifiersModule */
} // namespace theory
QuantDSplit::QuantDSplit(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr)
- : QuantifiersModule(qs, qim, qr, qe), d_added_split(qs.getUserContext())
+ QuantifiersRegistry& qr,
+ TermRegistry& tr)
+ : QuantifiersModule(qs, qim, qr, tr, qe), d_added_split(qs.getUserContext())
{
}
QuantDSplit(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr);
+ QuantifiersRegistry& qr,
+ TermRegistry& tr);
/** determine whether this quantified formula will be reduced */
void checkOwnership(Node q) override;
/* whether this module needs to check this round */
// add quantifiers modules
if (options::quantConflictFind())
{
- d_qcf.reset(new QuantConflictFind(qe, qs, qim, qr));
+ d_qcf.reset(new QuantConflictFind(qe, qs, qim, qr, tr));
modules.push_back(d_qcf.get());
}
if (options::conjectureGen())
{
- d_sg_gen.reset(new ConjectureGenerator(qe, qs, qim, qr));
+ d_sg_gen.reset(new ConjectureGenerator(qe, qs, qim, qr, tr));
modules.push_back(d_sg_gen.get());
}
if (!options::finiteModelFind() || options::fmfInstEngine())
}
if (options::cegqi())
{
- d_i_cbqi.reset(new InstStrategyCegqi(qe, qs, qim, qr));
+ d_i_cbqi.reset(new InstStrategyCegqi(qe, qs, qim, qr, tr));
modules.push_back(d_i_cbqi.get());
qim.getInstantiate()->addRewriter(d_i_cbqi->getInstRewriter());
}
if (options::sygus())
{
- d_synth_e.reset(new SynthEngine(qe, qs, qim, qr));
+ d_synth_e.reset(new SynthEngine(qe, qs, qim, qr, tr));
modules.push_back(d_synth_e.get());
}
// finite model finding
if (options::fmfBound())
{
- d_bint.reset(new BoundedIntegers(qe, qs, qim, qr, dm));
+ d_bint.reset(new BoundedIntegers(qe, qs, qim, qr, tr, dm));
modules.push_back(d_bint.get());
}
if (options::finiteModelFind() || options::fmfBound())
{
- d_model_engine.reset(new ModelEngine(qe, qs, qim, qr));
+ d_model_engine.reset(new ModelEngine(qe, qs, qim, qr, tr));
modules.push_back(d_model_engine.get());
Trace("quant-init-debug")
<< "Initialize model engine, mbqi : " << options::mbqiMode() << " "
}
if (options::quantDynamicSplit() != options::QuantDSplitMode::NONE)
{
- d_qsplit.reset(new QuantDSplit(qe, qs, qim, qr));
+ d_qsplit.reset(new QuantDSplit(qe, qs, qim, qr, tr));
modules.push_back(d_qsplit.get());
}
if (options::quantAlphaEquiv())
if (options::fullSaturateQuant() || options::fullSaturateInterleave())
{
d_rel_dom.reset(new RelevantDomain(qe, qr));
- d_fs.reset(new InstStrategyEnum(qe, qs, qim, qr, d_rel_dom.get()));
+ d_fs.reset(new InstStrategyEnum(qe, qs, qim, qr, tr, d_rel_dom.get()));
modules.push_back(d_fs.get());
}
if (options::sygusInst())
{
- d_sygus_inst.reset(new SygusInst(qe, qs, qim, qr));
+ d_sygus_inst.reset(new SygusInst(qe, qs, qim, qr, tr));
modules.push_back(d_sygus_inst.get());
}
}
#include "theory/quantifiers/quantifiers_attributes.h"
#include "theory/quantifiers/sygus/term_database_sygus.h"
#include "theory/quantifiers/term_util.h"
-#include "theory/quantifiers_engine.h"
using namespace CVC4::kind;
using namespace std;
SynthEngine::SynthEngine(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr)
- : QuantifiersModule(qs, qim, qr, qe),
- d_tds(qe->getTermDatabaseSygus()),
+ QuantifiersRegistry& qr,
+ TermRegistry& tr)
+ : QuantifiersModule(qs, qim, qr, tr, qe),
+ d_tds(tr.getTermDatabaseSygus()),
d_conj(nullptr),
d_sqp(qe)
{
SynthEngine(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr);
+ QuantifiersRegistry& qr,
+ TermRegistry& tr);
~SynthEngine();
/** presolve
*
SygusInst::SygusInst(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr)
- : QuantifiersModule(qs, qim, qr, qe),
+ QuantifiersRegistry& qr,
+ TermRegistry& tr)
+ : QuantifiersModule(qs, qim, qr, tr, qe),
d_ce_lemma_added(qs.getUserContext()),
d_global_terms(qs.getUserContext()),
d_notified_assertions(qs.getUserContext())
d_active_quant.clear();
d_inactive_quant.clear();
- FirstOrderModel* model = d_quantEngine->getModel();
+ FirstOrderModel* model = d_treg.getModel();
uint32_t nasserted = model->getNumAssertedQuantifiers();
for (uint32_t i = 0; i < nasserted; ++i)
if (quant_e != QEFFORT_STANDARD) return;
- FirstOrderModel* model = d_quantEngine->getModel();
+ FirstOrderModel* model = d_treg.getModel();
Instantiate* inst = d_qim.getInstantiate();
- TermDbSygus* db = d_quantEngine->getTermDatabaseSygus();
+ TermDbSygus* db = d_treg.getTermDatabaseSygus();
SygusExplain syexplain(db);
NodeManager* nm = NodeManager::currentNM();
options::SygusInstMode mode = options::sygusInstMode();
/* Generate counterexample lemma for 'q'. */
NodeManager* nm = NodeManager::currentNM();
- TermDbSygus* db = d_quantEngine->getTermDatabaseSygus();
+ TermDbSygus* db = d_treg.getTermDatabaseSygus();
/* For each variable x_i of \forall x_i . P[x_i], create a fresh datatype
* instantiation constant ic_i with type types[i] and wrap each ic_i in
SygusInst(QuantifiersEngine* qe,
QuantifiersState& qs,
QuantifiersInferenceManager& qim,
- QuantifiersRegistry& qr);
+ QuantifiersRegistry& qr,
+ TermRegistry& tr);
~SygusInst() = default;
bool needsCheck(Theory::Effort e) override;