diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2021-03-25 13:17:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-25 18:17:30 +0000 |
commit | 8a3876f74f377817345af405aebfceebc7896059 (patch) | |
tree | 82474f0df4b65274e6fbbb8a2d3f56ec42815a40 /src/theory/quantifiers_engine.cpp | |
parent | f9e3d2dccd5018e07df1c2cd323c5e192b020819 (diff) |
Refactor construction of triggers (#6209)
This PR centralizes our utilities for generating triggers. It also splits the statistics class from quantifiers off from quantifiers engine.
Diffstat (limited to 'src/theory/quantifiers_engine.cpp')
-rw-r--r-- | src/theory/quantifiers_engine.cpp | 61 |
1 files changed, 7 insertions, 54 deletions
diff --git a/src/theory/quantifiers_engine.cpp b/src/theory/quantifiers_engine.cpp index 0155eb05a..17a76468c 100644 --- a/src/theory/quantifiers_engine.cpp +++ b/src/theory/quantifiers_engine.cpp @@ -19,8 +19,6 @@ #include "options/smt_options.h" #include "options/uf_options.h" #include "smt/smt_engine_scope.h" -#include "smt/smt_statistics_registry.h" -#include "theory/quantifiers/ematching/trigger_trie.h" #include "theory/quantifiers/equality_query.h" #include "theory/quantifiers/first_order_model.h" #include "theory/quantifiers/fmf/first_order_model_fmc.h" @@ -32,13 +30,11 @@ #include "theory/quantifiers/quantifiers_registry.h" #include "theory/quantifiers/quantifiers_rewriter.h" #include "theory/quantifiers/quantifiers_state.h" +#include "theory/quantifiers/quantifiers_statistics.h" #include "theory/quantifiers/relevant_domain.h" #include "theory/quantifiers/skolemize.h" -#include "theory/quantifiers/term_enumeration.h" #include "theory/quantifiers/term_registry.h" -#include "theory/quantifiers/term_util.h" #include "theory/theory_engine.h" -#include "theory/uf/equality_engine.h" using namespace std; using namespace CVC4::kind; @@ -59,7 +55,6 @@ QuantifiersEngine::QuantifiersEngine( d_pnm(pnm), d_qreg(qr), d_treg(tr), - d_tr_trie(new quantifiers::inst::TriggerTrie), d_model(d_treg.getModel()), d_quants_prereg(qstate.getUserContext()), d_quants_red(qstate.getUserContext()) @@ -137,11 +132,6 @@ quantifiers::TermDb* QuantifiersEngine::getTermDatabase() const { return d_treg.getTermDatabase(); } - -quantifiers::inst::TriggerTrie* QuantifiersEngine::getTriggerDatabase() const -{ - return d_tr_trie.get(); -} /// !!!!!!!!!!!!!! void QuantifiersEngine::presolve() { @@ -186,7 +176,8 @@ void QuantifiersEngine::ppNotifyAssertions( } void QuantifiersEngine::check( Theory::Effort e ){ - CodeTimer codeTimer(d_statistics.d_time); + quantifiers::QuantifiersStatistics& stats = d_qstate.getStats(); + CodeTimer codeTimer(stats.d_time); Assert(d_qstate.getEqualityEngine() != nullptr); if (!d_qstate.getEqualityEngine()->consistent()) { @@ -332,9 +323,9 @@ void QuantifiersEngine::check( Theory::Effort e ){ } if( e==Theory::EFFORT_LAST_CALL ){ - ++(d_statistics.d_instantiation_rounds_lc); + ++(stats.d_instantiation_rounds_lc); }else if( e==Theory::EFFORT_FULL ){ - ++(d_statistics.d_instantiation_rounds); + ++(stats.d_instantiation_rounds); } Trace("quant-engine-debug") << "Check modules that needed check..." << std::endl; for (unsigned qef = QuantifiersModule::QEFFORT_CONFLICT; @@ -511,7 +502,7 @@ bool QuantifiersEngine::reduceQuantifier( Node q ) { id = InferenceId::QUANTIFIERS_REDUCE_ALPHA_EQ; if( !lem.isNull() ){ Trace("quant-engine-red") << "...alpha equivalence success." << std::endl; - ++(d_statistics.d_red_alpha_equiv); + ++(d_qstate.getStats().d_red_alpha_equiv); } } d_quants_red_lem[q] = lem; @@ -535,7 +526,7 @@ void QuantifiersEngine::registerQuantifierInternal(Node f) Trace("quant") << "QuantifiersEngine : Register quantifier "; Trace("quant") << " : " << f << std::endl; size_t prev_lemma_waiting = d_qim.numPendingLemmas(); - ++(d_statistics.d_num_quant); + ++(d_qstate.getStats().d_num_quant); Assert(f.getKind() == FORALL); // register with utilities for (unsigned i = 0; i < d_util.size(); i++) @@ -666,44 +657,6 @@ void QuantifiersEngine::getSkolemTermVectors( d_qim.getSkolemize()->getSkolemTermVectors(sks); } -QuantifiersEngine::Statistics::Statistics() - : d_time("theory::QuantifiersEngine::time"), - d_qcf_time("theory::QuantifiersEngine::time_qcf"), - d_ematching_time("theory::QuantifiersEngine::time_ematching"), - d_num_quant("QuantifiersEngine::Num_Quantifiers", 0), - d_instantiation_rounds("QuantifiersEngine::Rounds_Instantiation_Full", 0), - d_instantiation_rounds_lc( - "QuantifiersEngine::Rounds_Instantiation_Last_Call", 0), - d_triggers("QuantifiersEngine::Triggers", 0), - d_simple_triggers("QuantifiersEngine::Triggers_Simple", 0), - d_multi_triggers("QuantifiersEngine::Triggers_Multi", 0), - d_red_alpha_equiv("QuantifiersEngine::Reductions_Alpha_Equivalence", 0) -{ - smtStatisticsRegistry()->registerStat(&d_time); - smtStatisticsRegistry()->registerStat(&d_qcf_time); - smtStatisticsRegistry()->registerStat(&d_ematching_time); - smtStatisticsRegistry()->registerStat(&d_num_quant); - smtStatisticsRegistry()->registerStat(&d_instantiation_rounds); - smtStatisticsRegistry()->registerStat(&d_instantiation_rounds_lc); - smtStatisticsRegistry()->registerStat(&d_triggers); - smtStatisticsRegistry()->registerStat(&d_simple_triggers); - smtStatisticsRegistry()->registerStat(&d_multi_triggers); - smtStatisticsRegistry()->registerStat(&d_red_alpha_equiv); -} - -QuantifiersEngine::Statistics::~Statistics(){ - smtStatisticsRegistry()->unregisterStat(&d_time); - smtStatisticsRegistry()->unregisterStat(&d_qcf_time); - smtStatisticsRegistry()->unregisterStat(&d_ematching_time); - smtStatisticsRegistry()->unregisterStat(&d_num_quant); - smtStatisticsRegistry()->unregisterStat(&d_instantiation_rounds); - smtStatisticsRegistry()->unregisterStat(&d_instantiation_rounds_lc); - smtStatisticsRegistry()->unregisterStat(&d_triggers); - smtStatisticsRegistry()->unregisterStat(&d_simple_triggers); - smtStatisticsRegistry()->unregisterStat(&d_multi_triggers); - smtStatisticsRegistry()->unregisterStat(&d_red_alpha_equiv); -} - Node QuantifiersEngine::getNameForQuant(Node q) const { return d_qreg.getNameForQuant(q); |