1 /********************* */
2 /*! \file quantifiers_engine.cpp
4 ** Top contributors (to current version):
5 ** Andrew Reynolds, Morgan Deters, Tim King
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2019 by the authors listed in the file AUTHORS
8 ** in the top-level source directory) and their institutional affiliations.
9 ** All rights reserved. See the file COPYING in the top-level source
10 ** directory for licensing information.\endverbatim
12 ** \brief Implementation of quantifiers engine class
15 #include "theory/quantifiers_engine.h"
17 #include "options/quantifiers_options.h"
18 #include "options/uf_options.h"
19 #include "smt/smt_statistics_registry.h"
20 #include "theory/quantifiers/alpha_equivalence.h"
21 #include "theory/quantifiers/anti_skolem.h"
22 #include "theory/quantifiers/conjecture_generator.h"
23 #include "theory/quantifiers/ematching/instantiation_engine.h"
24 #include "theory/quantifiers/fmf/bounded_integers.h"
25 #include "theory/quantifiers/fmf/full_model_check.h"
26 #include "theory/quantifiers/fmf/model_engine.h"
27 #include "theory/quantifiers/inst_propagator.h"
28 #include "theory/quantifiers/inst_strategy_enumerative.h"
29 #include "theory/quantifiers/local_theory_ext.h"
30 #include "theory/quantifiers/quant_conflict_find.h"
31 #include "theory/quantifiers/quant_split.h"
32 #include "theory/quantifiers/quantifiers_rewriter.h"
33 #include "theory/quantifiers/rewrite_engine.h"
34 #include "theory/quantifiers/sygus/synth_engine.h"
35 #include "theory/sep/theory_sep.h"
36 #include "theory/theory_engine.h"
37 #include "theory/uf/equality_engine.h"
40 using namespace CVC4::kind
;
45 class QuantifiersEnginePrivate
48 QuantifiersEnginePrivate()
49 : d_inst_prop(nullptr),
50 d_alpha_equiv(nullptr),
51 d_inst_engine(nullptr),
52 d_model_engine(nullptr),
58 d_lte_part_inst(nullptr),
62 d_anti_skolem(nullptr)
65 ~QuantifiersEnginePrivate() {}
66 //------------------------------ private quantifier utilities
67 /** quantifiers instantiation propagator */
68 std::unique_ptr
<quantifiers::InstPropagator
> d_inst_prop
;
69 //------------------------------ end private quantifier utilities
70 //------------------------------ quantifiers modules
71 /** alpha equivalence */
72 std::unique_ptr
<quantifiers::AlphaEquivalence
> d_alpha_equiv
;
73 /** instantiation engine */
74 std::unique_ptr
<quantifiers::InstantiationEngine
> d_inst_engine
;
76 std::unique_ptr
<quantifiers::ModelEngine
> d_model_engine
;
77 /** bounded integers utility */
78 std::unique_ptr
<quantifiers::BoundedIntegers
> d_bint
;
79 /** Conflict find mechanism for quantifiers */
80 std::unique_ptr
<quantifiers::QuantConflictFind
> d_qcf
;
81 /** rewrite rules utility */
82 std::unique_ptr
<quantifiers::RewriteEngine
> d_rr_engine
;
83 /** subgoal generator */
84 std::unique_ptr
<quantifiers::ConjectureGenerator
> d_sg_gen
;
85 /** ceg instantiation */
86 std::unique_ptr
<quantifiers::SynthEngine
> d_synth_e
;
87 /** lte partial instantiation */
88 std::unique_ptr
<quantifiers::LtePartialInst
> d_lte_part_inst
;
89 /** full saturation */
90 std::unique_ptr
<quantifiers::InstStrategyEnum
> d_fs
;
91 /** counterexample-based quantifier instantiation */
92 std::unique_ptr
<quantifiers::InstStrategyCegqi
> d_i_cbqi
;
93 /** quantifiers splitting */
94 std::unique_ptr
<quantifiers::QuantDSplit
> d_qsplit
;
95 /** quantifiers anti-skolemization */
96 std::unique_ptr
<quantifiers::QuantAntiSkolem
> d_anti_skolem
;
97 //------------------------------ end quantifiers modules
100 * This constructs the above modules based on the current options. It adds
101 * a pointer to each module it constructs to modules. This method sets
102 * needsBuilder to true if we require a strategy-specific model builder
103 * utility, and needsRelDom to true if we require the relevant domain
106 void initialize(QuantifiersEngine
* qe
,
108 std::vector
<QuantifiersModule
*>& modules
,
112 // add quantifiers modules
113 if (options::quantConflictFind() || options::quantRewriteRules())
115 d_qcf
.reset(new quantifiers::QuantConflictFind(qe
, c
));
116 modules
.push_back(d_qcf
.get());
118 if (options::conjectureGen())
120 d_sg_gen
.reset(new quantifiers::ConjectureGenerator(qe
, c
));
121 modules
.push_back(d_sg_gen
.get());
123 if (!options::finiteModelFind() || options::fmfInstEngine())
125 d_inst_engine
.reset(new quantifiers::InstantiationEngine(qe
));
126 modules
.push_back(d_inst_engine
.get());
130 d_i_cbqi
.reset(new quantifiers::InstStrategyCegqi(qe
));
131 modules
.push_back(d_i_cbqi
.get());
132 qe
->getInstantiate()->addRewriter(d_i_cbqi
->getInstRewriter());
134 if (options::ceGuidedInst())
136 d_synth_e
.reset(new quantifiers::SynthEngine(qe
, c
));
137 modules
.push_back(d_synth_e
.get());
139 // finite model finding
140 if (options::finiteModelFind())
142 if (options::fmfBound())
144 d_bint
.reset(new quantifiers::BoundedIntegers(c
, qe
));
145 modules
.push_back(d_bint
.get());
147 d_model_engine
.reset(new quantifiers::ModelEngine(c
, qe
));
148 modules
.push_back(d_model_engine
.get());
149 // finite model finder has special ways of building the model
152 if (options::quantRewriteRules())
154 d_rr_engine
.reset(new quantifiers::RewriteEngine(c
, qe
, d_qcf
.get()));
155 modules
.push_back(d_rr_engine
.get());
157 if (options::ltePartialInst())
159 d_lte_part_inst
.reset(new quantifiers::LtePartialInst(qe
, c
));
160 modules
.push_back(d_lte_part_inst
.get());
162 if (options::quantDynamicSplit() != quantifiers::QUANT_DSPLIT_MODE_NONE
)
164 d_qsplit
.reset(new quantifiers::QuantDSplit(qe
, c
));
165 modules
.push_back(d_qsplit
.get());
167 if (options::quantAntiSkolem())
169 d_anti_skolem
.reset(new quantifiers::QuantAntiSkolem(qe
));
170 modules
.push_back(d_anti_skolem
.get());
172 if (options::quantAlphaEquiv())
174 d_alpha_equiv
.reset(new quantifiers::AlphaEquivalence(qe
));
176 // full saturation : instantiate from relevant domain, then arbitrary terms
177 if (options::fullSaturateQuant() || options::fullSaturateInterleave())
179 d_fs
.reset(new quantifiers::InstStrategyEnum(qe
));
180 modules
.push_back(d_fs
.get());
186 QuantifiersEngine::QuantifiersEngine(context::Context
* c
,
187 context::UserContext
* u
,
190 d_eq_query(new quantifiers::EqualityQueryQuantifiersEngine(c
, this)),
191 d_tr_trie(new inst::TriggerTrie
),
196 d_term_util(new quantifiers::TermUtil(this)),
197 d_term_canon(new expr::TermCanonize
),
198 d_term_db(new quantifiers::TermDb(c
, u
, this)),
199 d_sygus_tdb(nullptr),
200 d_quant_attr(new quantifiers::QuantAttributes(this)),
201 d_instantiate(new quantifiers::Instantiate(this, u
)),
202 d_skolemize(new quantifiers::Skolemize(this, u
)),
203 d_term_enum(new quantifiers::TermEnumeration
),
204 d_conflict_c(c
, false),
208 d_lemmas_produced_c(u
),
211 // d_ierCounter_lc(c),
212 // d_ierCounterLastLc(c),
216 d_presolve_cache_wq(u
),
217 d_presolve_cache_wic(u
)
219 // initialize the private utility
220 d_private
.reset(new QuantifiersEnginePrivate
);
223 d_util
.push_back(d_eq_query
.get());
224 // term util must come before the other utilities
225 d_util
.push_back(d_term_util
.get());
226 d_util
.push_back(d_term_db
.get());
228 if (options::ceGuidedInst()) {
229 d_sygus_tdb
.reset(new quantifiers::TermDbSygus(c
, this));
232 if( options::instPropagate() ){
233 // notice that this option is incompatible with options::qcfAllConflict()
234 d_private
->d_inst_prop
.reset(new quantifiers::InstPropagator(this));
235 d_util
.push_back(d_private
->d_inst_prop
.get());
236 d_instantiate
->addNotify(d_private
->d_inst_prop
->getInstantiationNotify());
240 d_util
.push_back(d_instantiate
.get());
242 d_curr_effort_level
= QuantifiersModule::QEFFORT_NONE
;
244 d_hasAddedLemma
= false;
245 d_useModelEe
= false;
246 //don't add true lemma
247 d_lemmas_produced_c
[d_term_util
->d_true
] = true;
249 Trace("quant-engine-debug") << "Initialize quantifiers engine." << std::endl
;
250 Trace("quant-engine-debug") << "Initialize model, mbqi : " << options::mbqiMode() << std::endl
;
252 if( options::quantEpr() ){
253 Assert( !options::incrementalSolving() );
254 d_qepr
.reset(new quantifiers::QuantEPR
);
258 //allow theory combination to go first, once initially
259 d_ierCounter
= options::instWhenTcFirst() ? 0 : 1;
260 d_ierCounter_c
= d_ierCounter
;
262 d_ierCounterLastLc
= 0;
263 d_inst_when_phase
= 1 + ( options::instWhenPhase()<1 ? 1 : options::instWhenPhase() );
265 bool needsBuilder
= false;
266 bool needsRelDom
= false;
267 d_private
->initialize(this, c
, d_modules
, needsBuilder
, needsRelDom
);
270 d_rel_dom
.reset(new quantifiers::RelevantDomain(this));
271 d_util
.push_back(d_rel_dom
.get());
274 // if we require specialized ways of building the model
276 Trace("quant-engine-debug") << "Initialize model engine, mbqi : " << options::mbqiMode() << " " << options::fmfBound() << std::endl
;
277 if (options::mbqiMode() == quantifiers::MBQI_FMC
278 || options::mbqiMode() == quantifiers::MBQI_TRUST
279 || options::fmfBound())
281 Trace("quant-engine-debug") << "...make fmc builder." << std::endl
;
282 d_model
.reset(new quantifiers::fmcheck::FirstOrderModelFmc(
283 this, c
, "FirstOrderModelFmc"));
284 d_builder
.reset(new quantifiers::fmcheck::FullModelChecker(c
, this));
286 Trace("quant-engine-debug") << "...make default model builder." << std::endl
;
288 new quantifiers::FirstOrderModel(this, c
, "FirstOrderModel"));
289 d_builder
.reset(new quantifiers::QModelBuilder(c
, this));
292 d_model
.reset(new quantifiers::FirstOrderModel(this, c
, "FirstOrderModel"));
296 QuantifiersEngine::~QuantifiersEngine() {}
298 context::Context
* QuantifiersEngine::getSatContext()
300 return d_te
->theoryOf(THEORY_QUANTIFIERS
)->getSatContext();
303 context::UserContext
* QuantifiersEngine::getUserContext()
305 return d_te
->theoryOf(THEORY_QUANTIFIERS
)->getUserContext();
308 OutputChannel
& QuantifiersEngine::getOutputChannel()
310 return d_te
->theoryOf(THEORY_QUANTIFIERS
)->getOutputChannel();
312 /** get default valuation for the quantifiers engine */
313 Valuation
& QuantifiersEngine::getValuation()
315 return d_te
->theoryOf(THEORY_QUANTIFIERS
)->getValuation();
318 const LogicInfo
& QuantifiersEngine::getLogicInfo() const
320 return d_te
->getLogicInfo();
323 EqualityQuery
* QuantifiersEngine::getEqualityQuery() const
325 return d_eq_query
.get();
327 quantifiers::RelevantDomain
* QuantifiersEngine::getRelevantDomain() const
329 return d_rel_dom
.get();
331 quantifiers::QModelBuilder
* QuantifiersEngine::getModelBuilder() const
333 return d_builder
.get();
335 quantifiers::QuantEPR
* QuantifiersEngine::getQuantEPR() const
339 quantifiers::FirstOrderModel
* QuantifiersEngine::getModel() const
341 return d_model
.get();
343 quantifiers::TermDb
* QuantifiersEngine::getTermDatabase() const
345 return d_term_db
.get();
347 quantifiers::TermDbSygus
* QuantifiersEngine::getTermDatabaseSygus() const
349 return d_sygus_tdb
.get();
351 quantifiers::TermUtil
* QuantifiersEngine::getTermUtil() const
353 return d_term_util
.get();
355 expr::TermCanonize
* QuantifiersEngine::getTermCanonize() const
357 return d_term_canon
.get();
359 quantifiers::QuantAttributes
* QuantifiersEngine::getQuantAttributes() const
361 return d_quant_attr
.get();
363 quantifiers::Instantiate
* QuantifiersEngine::getInstantiate() const
365 return d_instantiate
.get();
367 quantifiers::Skolemize
* QuantifiersEngine::getSkolemize() const
369 return d_skolemize
.get();
371 quantifiers::TermEnumeration
* QuantifiersEngine::getTermEnumeration() const
373 return d_term_enum
.get();
375 inst::TriggerTrie
* QuantifiersEngine::getTriggerDatabase() const
377 return d_tr_trie
.get();
380 QuantifiersModule
* QuantifiersEngine::getOwner( Node q
) {
381 std::map
< Node
, QuantifiersModule
* >::iterator it
= d_owner
.find( q
);
382 if( it
==d_owner
.end() ){
389 void QuantifiersEngine::setOwner( Node q
, QuantifiersModule
* m
, int priority
) {
390 QuantifiersModule
* mo
= getOwner( q
);
393 if( priority
<=d_owner_priority
[q
] ){
394 Trace("quant-warn") << "WARNING: setting owner of " << q
<< " to " << ( m
? m
->identify() : "null" ) << ", but already has owner " << mo
->identify() << " with higher priority!" << std::endl
;
399 d_owner_priority
[q
] = priority
;
403 void QuantifiersEngine::setOwner(Node q
, quantifiers::QAttributes
& qa
)
405 if (!qa
.d_rr
.isNull())
407 if (d_private
->d_rr_engine
.get() == nullptr)
409 Trace("quant-warn") << "WARNING : rewrite engine is null, and we have : "
412 // set rewrite engine as owner
413 setOwner(q
, d_private
->d_rr_engine
.get(), 2);
417 if (d_private
->d_synth_e
.get() == nullptr)
419 Trace("quant-warn") << "WARNING : synth engine is null, and we have : "
422 // set synth engine as owner
423 setOwner(q
, d_private
->d_synth_e
.get(), 2);
427 bool QuantifiersEngine::hasOwnership( Node q
, QuantifiersModule
* m
) {
428 QuantifiersModule
* mo
= getOwner( q
);
429 return mo
==m
|| mo
==NULL
;
432 bool QuantifiersEngine::isFiniteBound(Node q
, Node v
) const
434 quantifiers::BoundedIntegers
* bi
= d_private
->d_bint
.get();
435 if (bi
&& bi
->isBound(q
, v
))
439 TypeNode tn
= v
.getType();
440 if (tn
.isSort() && options::finiteModelFind())
444 else if (d_term_enum
->mayComplete(tn
))
451 BoundVarType
QuantifiersEngine::getBoundVarType(Node q
, Node v
) const
453 quantifiers::BoundedIntegers
* bi
= d_private
->d_bint
.get();
456 return bi
->getBoundVarType(q
, v
);
458 return isFiniteBound(q
, v
) ? BOUND_FINITE
: BOUND_NONE
;
461 void QuantifiersEngine::getBoundVarIndices(Node q
,
462 std::vector
<unsigned>& indices
) const
464 Assert(indices
.empty());
465 // we take the bounded variables first
466 quantifiers::BoundedIntegers
* bi
= d_private
->d_bint
.get();
469 bi
->getBoundVarIndices(q
, indices
);
471 // then get the remaining ones
472 for (unsigned i
= 0, nvars
= q
[0].getNumChildren(); i
< nvars
; i
++)
474 if (std::find(indices
.begin(), indices
.end(), i
) == indices
.end())
476 indices
.push_back(i
);
481 bool QuantifiersEngine::getBoundElements(RepSetIterator
* rsi
,
485 std::vector
<Node
>& elements
) const
487 quantifiers::BoundedIntegers
* bi
= d_private
->d_bint
.get();
490 return bi
->getBoundElements(rsi
, initial
, q
, v
, elements
);
495 void QuantifiersEngine::presolve() {
496 Trace("quant-engine-proc") << "QuantifiersEngine : presolve " << std::endl
;
497 for( unsigned i
=0; i
<d_modules
.size(); i
++ ){
498 d_modules
[i
]->presolve();
500 d_term_db
->presolve();
502 //add all terms to database
503 if( options::incrementalSolving() ){
504 Trace("quant-engine-proc") << "Add presolve cache " << d_presolve_cache
.size() << std::endl
;
505 for( unsigned i
=0; i
<d_presolve_cache
.size(); i
++ ){
506 addTermToDatabase( d_presolve_cache
[i
], d_presolve_cache_wq
[i
], d_presolve_cache_wic
[i
] );
508 Trace("quant-engine-proc") << "Done add presolve cache " << std::endl
;
512 void QuantifiersEngine::ppNotifyAssertions(
513 const std::vector
<Node
>& assertions
) {
514 Trace("quant-engine-proc")
515 << "ppNotifyAssertions in QE, #assertions = " << assertions
.size()
516 << " check epr = " << (d_qepr
!= NULL
) << std::endl
;
517 if (options::instLevelInputOnly() && options::instMaxLevel() != -1)
519 for (const Node
& a
: assertions
)
521 quantifiers::QuantAttributes::setInstantiationLevelAttr(a
, 0);
526 for (const Node
& a
: assertions
)
528 d_qepr
->registerAssertion(a
);
530 // must handle sources of other new constants e.g. separation logic
531 // FIXME (as part of project 3) : cleanup
532 sep::TheorySep
* theory_sep
=
533 static_cast<sep::TheorySep
*>(getTheoryEngine()->theoryOf(THEORY_SEP
));
534 theory_sep
->initializeBounds();
535 d_qepr
->finishInit();
537 if (options::ceGuidedInst())
539 quantifiers::SynthEngine
* sye
= d_private
->d_synth_e
.get();
540 for (const Node
& a
: assertions
)
542 sye
->preregisterAssertion(a
);
547 void QuantifiersEngine::check( Theory::Effort e
){
548 CodeTimer
codeTimer(d_statistics
.d_time
);
549 d_useModelEe
= options::quantModelEe() && ( e
>=Theory::EFFORT_LAST_CALL
);
550 // if we want to use the model's equality engine, build the model now
551 if( d_useModelEe
&& !d_model
->isBuilt() ){
552 Trace("quant-engine-debug") << "Build the model." << std::endl
;
553 if (!d_te
->getModelBuilder()->buildModel(d_model
.get()))
555 //we are done if model building was unsuccessful
557 if( d_hasAddedLemma
){
558 Trace("quant-engine-debug") << "...failed." << std::endl
;
564 if( !getActiveEqualityEngine()->consistent() ){
565 Trace("quant-engine-debug") << "Master equality engine not consistent, return." << std::endl
;
568 if (d_conflict_c
.get())
570 if (e
< Theory::EFFORT_LAST_CALL
)
572 // this can happen in rare cases when quantifiers is the first to realize
573 // there is a quantifier-free conflict, for example, when it discovers
574 // disequal and congruent terms in the master equality engine during
575 // term indexing. In such cases, quantifiers reports a "conflicting lemma"
576 // that is, one that is entailed to be false by the current assignment.
577 // If this lemma is not a SAT conflict, we may get another call to full
578 // effort check and the quantifier-free solvers still haven't realized
579 // there is a conflict. In this case, we return, trusting that theory
580 // combination will do the right thing (split on equalities until there is
581 // a conflict at the quantifier-free level).
582 Trace("quant-engine-debug")
583 << "Conflicting lemma already reported by quantifiers, return."
587 // we reported what we thought was a conflicting lemma, but now we have
588 // gotten a check at LAST_CALL effort, indicating that the lemma we reported
589 // was not conflicting. This should never happen, but in production mode, we
590 // proceed with the check.
593 bool needsCheck
= !d_lemmas_waiting
.empty();
594 QuantifiersModule::QEffort needsModelE
= QuantifiersModule::QEFFORT_NONE
;
595 std::vector
< QuantifiersModule
* > qm
;
596 if( d_model
->checkNeeded() ){
597 needsCheck
= needsCheck
|| e
>=Theory::EFFORT_LAST_CALL
; //always need to check at or above last call
598 for (QuantifiersModule
*& mdl
: d_modules
)
600 if (mdl
->needsCheck(e
))
604 //can only request model at last call since theory combination can find inconsistencies
605 if( e
>=Theory::EFFORT_LAST_CALL
){
606 QuantifiersModule::QEffort me
= mdl
->needsModel(e
);
607 needsModelE
= me
<needsModelE
? me
: needsModelE
;
614 d_hasAddedLemma
= false;
615 bool setIncomplete
= false;
617 Trace("quant-engine-debug2") << "Quantifiers Engine call to check, level = " << e
<< ", needsCheck=" << needsCheck
<< std::endl
;
619 //flush previous lemmas (for instance, if was interupted), or other lemmas to process
621 if( d_hasAddedLemma
){
626 if( Trace
.isOn("quant-engine") ){
627 clSet
= double(clock())/double(CLOCKS_PER_SEC
);
628 Trace("quant-engine") << ">>>>> Quantifiers Engine Round, effort = " << e
<< " <<<<<" << std::endl
;
631 if( Trace
.isOn("quant-engine-debug") ){
632 Trace("quant-engine-debug") << "Quantifiers Engine check, level = " << e
<< std::endl
;
633 Trace("quant-engine-debug") << " depth : " << d_ierCounter_c
<< std::endl
;
634 Trace("quant-engine-debug") << " modules to check : ";
635 for( unsigned i
=0; i
<qm
.size(); i
++ ){
636 Trace("quant-engine-debug") << qm
[i
]->identify() << " ";
638 Trace("quant-engine-debug") << std::endl
;
639 Trace("quant-engine-debug") << " # quantified formulas = " << d_model
->getNumAssertedQuantifiers() << std::endl
;
640 if( !d_lemmas_waiting
.empty() ){
641 Trace("quant-engine-debug") << " lemmas waiting = " << d_lemmas_waiting
.size() << std::endl
;
643 Trace("quant-engine-debug") << " Theory engine finished : " << !d_te
->needCheck() << std::endl
;
644 Trace("quant-engine-debug") << " Needs model effort : " << needsModelE
<< std::endl
;
646 if( Trace
.isOn("quant-engine-ee-pre") ){
647 Trace("quant-engine-ee-pre") << "Equality engine (pre-inference): " << std::endl
;
648 debugPrintEqualityEngine( "quant-engine-ee-pre" );
650 if( Trace
.isOn("quant-engine-assert") ){
651 Trace("quant-engine-assert") << "Assertions : " << std::endl
;
652 getTheoryEngine()->printAssertions("quant-engine-assert");
656 Trace("quant-engine-debug") << "Resetting all utilities..." << std::endl
;
657 for (QuantifiersUtil
*& util
: d_util
)
659 Trace("quant-engine-debug2") << "Reset " << util
->identify().c_str()
660 << "..." << std::endl
;
664 if( d_hasAddedLemma
){
667 //should only fail reset if added a lemma
673 if( Trace
.isOn("quant-engine-ee") ){
674 Trace("quant-engine-ee") << "Equality engine : " << std::endl
;
675 debugPrintEqualityEngine( "quant-engine-ee" );
679 Trace("quant-engine-debug") << "Reset model..." << std::endl
;
680 d_model
->reset_round();
683 Trace("quant-engine-debug") << "Resetting all modules..." << std::endl
;
684 for (QuantifiersModule
*& mdl
: d_modules
)
686 Trace("quant-engine-debug2") << "Reset " << mdl
->identify().c_str()
690 Trace("quant-engine-debug") << "Done resetting all modules." << std::endl
;
691 //reset may have added lemmas
693 if( d_hasAddedLemma
){
697 if( e
==Theory::EFFORT_LAST_CALL
){
698 ++(d_statistics
.d_instantiation_rounds_lc
);
699 }else if( e
==Theory::EFFORT_FULL
){
700 ++(d_statistics
.d_instantiation_rounds
);
702 Trace("quant-engine-debug") << "Check modules that needed check..." << std::endl
;
703 for (unsigned qef
= QuantifiersModule::QEFFORT_CONFLICT
;
704 qef
<= QuantifiersModule::QEFFORT_LAST_CALL
;
707 QuantifiersModule::QEffort quant_e
=
708 static_cast<QuantifiersModule::QEffort
>(qef
);
709 d_curr_effort_level
= quant_e
;
710 //build the model if any module requested it
711 if (needsModelE
== quant_e
)
713 if (!d_model
->isBuilt())
715 // theory engine's model builder is quantifier engine's builder if it
717 Assert(!getModelBuilder()
718 || getModelBuilder() == d_te
->getModelBuilder());
719 Trace("quant-engine-debug") << "Build model..." << std::endl
;
720 if (!d_te
->getModelBuilder()->buildModel(d_model
.get()))
725 if (!d_model
->isBuiltSuccess())
730 if( !d_hasAddedLemma
){
732 for (QuantifiersModule
*& mdl
: qm
)
734 Trace("quant-engine-debug") << "Check " << mdl
->identify().c_str()
735 << " at effort " << quant_e
<< "..."
737 mdl
->check(e
, quant_e
);
739 Trace("quant-engine-debug") << "...conflict!" << std::endl
;
743 //flush all current lemmas
746 //if we have added one, stop
747 if( d_hasAddedLemma
){
750 Assert( !d_conflict
);
751 if (quant_e
== QuantifiersModule::QEFFORT_CONFLICT
)
753 if( e
==Theory::EFFORT_FULL
){
754 //increment if a last call happened, we are not strictly enforcing interleaving, or already were in phase
755 if( d_ierCounterLastLc
!=d_ierCounter_lc
|| !options::instWhenStrictInterleave() || d_ierCounter
%d_inst_when_phase
!=0 ){
756 d_ierCounter
= d_ierCounter
+ 1;
757 d_ierCounterLastLc
= d_ierCounter_lc
;
758 d_ierCounter_c
= d_ierCounter_c
.get() + 1;
760 }else if( e
==Theory::EFFORT_LAST_CALL
){
761 d_ierCounter_lc
= d_ierCounter_lc
+ 1;
764 else if (quant_e
== QuantifiersModule::QEFFORT_MODEL
)
766 if( e
==Theory::EFFORT_LAST_CALL
){
767 //sources of incompleteness
768 for (QuantifiersUtil
*& util
: d_util
)
770 if (!util
->checkComplete())
772 Trace("quant-engine-debug") << "Set incomplete because utility "
773 << util
->identify().c_str()
774 << " was incomplete." << std::endl
;
775 setIncomplete
= true;
778 if (d_conflict_c
.get())
780 // we reported a conflicting lemma, should return
781 setIncomplete
= true;
783 //if we have a chance not to set incomplete
784 if( !setIncomplete
){
785 //check if we should set the incomplete flag
786 for (QuantifiersModule
*& mdl
: d_modules
)
788 if (!mdl
->checkComplete())
790 Trace("quant-engine-debug")
791 << "Set incomplete because module "
792 << mdl
->identify().c_str() << " was incomplete."
794 setIncomplete
= true;
798 if( !setIncomplete
){
799 //look at individual quantified formulas, one module must claim completeness for each one
800 for( unsigned i
=0; i
<d_model
->getNumAssertedQuantifiers(); i
++ ){
801 bool hasCompleteM
= false;
802 Node q
= d_model
->getAssertedQuantifier( i
);
803 QuantifiersModule
* qmd
= getOwner( q
);
805 hasCompleteM
= qmd
->checkCompleteFor( q
);
807 for( unsigned j
=0; j
<d_modules
.size(); j
++ ){
808 if( d_modules
[j
]->checkCompleteFor( q
) ){
816 Trace("quant-engine-debug") << "Set incomplete because " << q
<< " was not fully processed." << std::endl
;
817 setIncomplete
= true;
821 Trace("quant-engine-debug2") << "Complete for " << q
<< " due to " << qmd
->identify().c_str() << std::endl
;
826 //if setIncomplete = false, we will answer SAT, otherwise we will run at quant_e QEFFORT_LAST_CALL
827 if( !setIncomplete
){
834 d_curr_effort_level
= QuantifiersModule::QEFFORT_NONE
;
835 Trace("quant-engine-debug") << "Done check modules that needed check." << std::endl
;
836 if( d_hasAddedLemma
){
837 d_instantiate
->debugPrint();
839 if( Trace
.isOn("quant-engine") ){
840 double clSet2
= double(clock())/double(CLOCKS_PER_SEC
);
841 Trace("quant-engine") << "Finished quantifiers engine, total time = " << (clSet2
-clSet
);
842 Trace("quant-engine") << ", added lemma = " << d_hasAddedLemma
;
843 Trace("quant-engine") << std::endl
;
846 Trace("quant-engine-debug2") << "Finished quantifiers engine check." << std::endl
;
848 Trace("quant-engine-debug2") << "Quantifiers Engine does not need check." << std::endl
;
852 if( e
==Theory::EFFORT_LAST_CALL
&& !d_hasAddedLemma
){
854 Trace("quant-engine") << "Set incomplete flag." << std::endl
;
855 getOutputChannel().setIncomplete();
858 d_instantiate
->debugPrintModel();
862 void QuantifiersEngine::notifyCombineTheories() {
863 //if allowing theory combination to happen at most once between instantiation rounds
865 //d_ierCounterLastLc = -1;
868 bool QuantifiersEngine::reduceQuantifier( Node q
) {
869 //TODO: this can be unified with preregistration: AlphaEquivalence takes ownership of reducable quants
870 BoolMap::const_iterator it
= d_quants_red
.find( q
);
871 if( it
==d_quants_red
.end() ){
873 std::map
< Node
, Node
>::iterator itr
= d_quants_red_lem
.find( q
);
874 if( itr
==d_quants_red_lem
.end() ){
875 if (d_private
->d_alpha_equiv
)
877 Trace("quant-engine-red") << "Alpha equivalence " << q
<< "?" << std::endl
;
878 //add equivalence with another quantified formula
879 lem
= d_private
->d_alpha_equiv
->reduceQuantifier(q
);
881 Trace("quant-engine-red") << "...alpha equivalence success." << std::endl
;
882 ++(d_statistics
.d_red_alpha_equiv
);
885 d_quants_red_lem
[q
] = lem
;
890 getOutputChannel().lemma( lem
);
892 d_quants_red
[q
] = !lem
.isNull();
893 return !lem
.isNull();
899 void QuantifiersEngine::registerQuantifierInternal(Node f
)
901 std::map
< Node
, bool >::iterator it
= d_quants
.find( f
);
902 if( it
==d_quants
.end() ){
903 Trace("quant") << "QuantifiersEngine : Register quantifier ";
904 Trace("quant") << " : " << f
<< std::endl
;
905 unsigned prev_lemma_waiting
= d_lemmas_waiting
.size();
906 ++(d_statistics
.d_num_quant
);
907 Assert( f
.getKind()==FORALL
);
908 // register with utilities
909 for (unsigned i
= 0; i
< d_util
.size(); i
++)
911 d_util
[i
]->registerQuantifier(f
);
913 // compute attributes
914 d_quant_attr
->computeAttributes(f
);
916 for (QuantifiersModule
*& mdl
: d_modules
)
918 Trace("quant-debug") << "check ownership with " << mdl
->identify()
919 << "..." << std::endl
;
920 mdl
->checkOwnership(f
);
922 QuantifiersModule
* qm
= getOwner(f
);
923 Trace("quant") << " Owner : " << (qm
== nullptr ? "[none]" : qm
->identify())
925 // register with each module
926 for (QuantifiersModule
*& mdl
: d_modules
)
928 Trace("quant-debug") << "register with " << mdl
->identify() << "..."
930 mdl
->registerQuantifier(f
);
931 // since this is context-independent, we should not add any lemmas during
933 Assert(d_lemmas_waiting
.size() == prev_lemma_waiting
);
935 Trace("quant-debug") << "...finish." << std::endl
;
937 AlwaysAssert(d_lemmas_waiting
.size() == prev_lemma_waiting
);
941 void QuantifiersEngine::preRegisterQuantifier(Node q
)
943 NodeSet::const_iterator it
= d_quants_prereg
.find(q
);
944 if (it
!= d_quants_prereg
.end())
948 Trace("quant-debug") << "QuantifiersEngine : Pre-register " << q
<< std::endl
;
949 d_quants_prereg
.insert(q
);
951 if (reduceQuantifier(q
))
953 // if we can reduce it, nothing left to do
956 // ensure that it is registered
957 registerQuantifierInternal(q
);
958 // register with each module
959 for (QuantifiersModule
*& mdl
: d_modules
)
961 Trace("quant-debug") << "pre-register with " << mdl
->identify() << "..."
963 mdl
->preRegisterQuantifier(q
);
967 Trace("quant-debug") << "...finish pre-register " << q
<< "..." << std::endl
;
970 void QuantifiersEngine::registerPattern( std::vector
<Node
> & pattern
) {
971 for(std::vector
<Node
>::iterator p
= pattern
.begin(); p
!= pattern
.end(); ++p
){
972 std::set
< Node
> added
;
973 getTermDatabase()->addTerm( *p
, added
);
977 void QuantifiersEngine::assertQuantifier( Node f
, bool pol
){
978 if (reduceQuantifier(f
))
980 // if we can reduce it, nothing left to do
985 Node lem
= d_skolemize
->process(f
);
988 if (Trace
.isOn("quantifiers-sk-debug"))
990 Node slem
= Rewriter::rewrite(lem
);
991 Trace("quantifiers-sk-debug")
992 << "Skolemize lemma : " << slem
<< std::endl
;
994 getOutputChannel().lemma(lem
, false, true);
998 // ensure the quantified formula is registered
999 registerQuantifierInternal(f
);
1000 // assert it to each module
1001 d_model
->assertQuantifier(f
);
1002 for (QuantifiersModule
*& mdl
: d_modules
)
1006 addTermToDatabase(d_term_util
->getInstConstantBody(f
), true);
1009 void QuantifiersEngine::addTermToDatabase( Node n
, bool withinQuant
, bool withinInstClosure
){
1010 if( options::incrementalSolving() ){
1011 if( d_presolve_in
.find( n
)==d_presolve_in
.end() ){
1012 d_presolve_in
.insert( n
);
1013 d_presolve_cache
.push_back( n
);
1014 d_presolve_cache_wq
.push_back( withinQuant
);
1015 d_presolve_cache_wic
.push_back( withinInstClosure
);
1018 //only wait if we are doing incremental solving
1019 if( !d_presolve
|| !options::incrementalSolving() ){
1020 std::set
< Node
> added
;
1021 d_term_db
->addTerm(n
, added
, withinQuant
, withinInstClosure
);
1027 d_sygus_tdb
->getEvalUnfold()->registerEvalTerm(n
);
1033 void QuantifiersEngine::eqNotifyNewClass(TNode t
) {
1034 addTermToDatabase( t
);
1037 bool QuantifiersEngine::addLemma( Node lem
, bool doCache
, bool doRewrite
){
1040 lem
= Rewriter::rewrite(lem
);
1042 Trace("inst-add-debug") << "Adding lemma : " << lem
<< std::endl
;
1043 BoolMap::const_iterator itp
= d_lemmas_produced_c
.find( lem
);
1044 if( itp
==d_lemmas_produced_c
.end() || !(*itp
).second
){
1045 //d_curr_out->lemma( lem, false, true );
1046 d_lemmas_produced_c
[ lem
] = true;
1047 d_lemmas_waiting
.push_back( lem
);
1048 Trace("inst-add-debug") << "Added lemma" << std::endl
;
1051 Trace("inst-add-debug") << "Duplicate." << std::endl
;
1055 //do not need to rewrite, will be rewritten after sending
1056 d_lemmas_waiting
.push_back( lem
);
1061 bool QuantifiersEngine::removeLemma( Node lem
) {
1062 std::vector
< Node
>::iterator it
= std::find( d_lemmas_waiting
.begin(), d_lemmas_waiting
.end(), lem
);
1063 if( it
!=d_lemmas_waiting
.end() ){
1064 d_lemmas_waiting
.erase( it
, it
+ 1 );
1065 d_lemmas_produced_c
[ lem
] = false;
1072 void QuantifiersEngine::addRequirePhase( Node lit
, bool req
){
1073 d_phase_req_waiting
[lit
] = req
;
1076 void QuantifiersEngine::markRelevant( Node q
) {
1077 d_model
->markRelevant( q
);
1080 void QuantifiersEngine::setConflict() {
1082 d_conflict_c
= true;
1085 bool QuantifiersEngine::getInstWhenNeedsCheck( Theory::Effort e
) {
1086 Trace("quant-engine-debug2") << "Get inst when needs check, counts=" << d_ierCounter
<< ", " << d_ierCounter_lc
<< std::endl
;
1087 //determine if we should perform check, based on instWhenMode
1088 bool performCheck
= false;
1089 if( options::instWhenMode()==quantifiers::INST_WHEN_FULL
){
1090 performCheck
= ( e
>= Theory::EFFORT_FULL
);
1091 }else if( options::instWhenMode()==quantifiers::INST_WHEN_FULL_DELAY
){
1092 performCheck
= ( e
>= Theory::EFFORT_FULL
) && !getTheoryEngine()->needCheck();
1093 }else if( options::instWhenMode()==quantifiers::INST_WHEN_FULL_LAST_CALL
){
1094 performCheck
= ( ( e
==Theory::EFFORT_FULL
&& d_ierCounter
%d_inst_when_phase
!=0 ) || e
==Theory::EFFORT_LAST_CALL
);
1095 }else if( options::instWhenMode()==quantifiers::INST_WHEN_FULL_DELAY_LAST_CALL
){
1096 performCheck
= ( ( e
==Theory::EFFORT_FULL
&& !getTheoryEngine()->needCheck() && d_ierCounter
%d_inst_when_phase
!=0 ) || e
==Theory::EFFORT_LAST_CALL
);
1097 }else if( options::instWhenMode()==quantifiers::INST_WHEN_LAST_CALL
){
1098 performCheck
= ( e
>= Theory::EFFORT_LAST_CALL
);
1100 performCheck
= true;
1102 if( e
==Theory::EFFORT_LAST_CALL
){
1103 //with bounded integers, skip every other last call,
1104 // since matching loops may occur with infinite quantification
1105 if( d_ierCounter_lc
%2==0 && options::fmfBound() ){
1106 performCheck
= false;
1109 return performCheck
;
1112 quantifiers::UserPatMode
QuantifiersEngine::getInstUserPatMode() {
1113 if( options::userPatternsQuant()==quantifiers::USER_PAT_MODE_INTERLEAVE
){
1114 return d_ierCounter
%2==0 ? quantifiers::USER_PAT_MODE_USE
: quantifiers::USER_PAT_MODE_RESORT
;
1116 return options::userPatternsQuant();
1120 void QuantifiersEngine::flushLemmas(){
1121 if( !d_lemmas_waiting
.empty() ){
1122 //filter based on notify classes
1123 if (d_instantiate
->hasNotify())
1125 unsigned prev_lem_sz
= d_lemmas_waiting
.size();
1126 d_instantiate
->notifyFlushLemmas();
1127 if( prev_lem_sz
!=d_lemmas_waiting
.size() ){
1128 Trace("quant-engine") << "...filtered instances : " << d_lemmas_waiting
.size() << " / " << prev_lem_sz
<< std::endl
;
1131 //take default output channel if none is provided
1132 d_hasAddedLemma
= true;
1133 for( unsigned i
=0; i
<d_lemmas_waiting
.size(); i
++ ){
1134 Trace("qe-lemma") << "Lemma : " << d_lemmas_waiting
[i
] << std::endl
;
1135 getOutputChannel().lemma( d_lemmas_waiting
[i
], false, true );
1137 d_lemmas_waiting
.clear();
1139 if( !d_phase_req_waiting
.empty() ){
1140 for( std::map
< Node
, bool >::iterator it
= d_phase_req_waiting
.begin(); it
!= d_phase_req_waiting
.end(); ++it
){
1141 Trace("qe-lemma") << "Require phase : " << it
->first
<< " -> " << it
->second
<< std::endl
;
1142 getOutputChannel().requirePhase( it
->first
, it
->second
);
1144 d_phase_req_waiting
.clear();
1148 bool QuantifiersEngine::getUnsatCoreLemmas( std::vector
< Node
>& active_lemmas
) {
1149 return d_instantiate
->getUnsatCoreLemmas(active_lemmas
);
1152 bool QuantifiersEngine::getUnsatCoreLemmas( std::vector
< Node
>& active_lemmas
, std::map
< Node
, Node
>& weak_imp
) {
1153 return d_instantiate
->getUnsatCoreLemmas(active_lemmas
, weak_imp
);
1156 void QuantifiersEngine::getInstantiationTermVectors( Node q
, std::vector
< std::vector
< Node
> >& tvecs
) {
1157 d_instantiate
->getInstantiationTermVectors(q
, tvecs
);
1160 void QuantifiersEngine::getInstantiationTermVectors( std::map
< Node
, std::vector
< std::vector
< Node
> > >& insts
) {
1161 d_instantiate
->getInstantiationTermVectors(insts
);
1164 void QuantifiersEngine::getExplanationForInstLemmas(
1165 const std::vector
<Node
>& lems
,
1166 std::map
<Node
, Node
>& quant
,
1167 std::map
<Node
, std::vector
<Node
> >& tvec
)
1169 d_instantiate
->getExplanationForInstLemmas(lems
, quant
, tvec
);
1172 void QuantifiersEngine::printInstantiations( std::ostream
& out
) {
1173 bool printed
= false;
1174 // print the skolemizations
1175 if (d_skolemize
->printSkolemization(out
))
1179 // print the instantiations
1180 if (d_instantiate
->printInstantiations(out
))
1185 out
<< "No instantiations" << std::endl
;
1189 void QuantifiersEngine::printSynthSolution( std::ostream
& out
) {
1190 if (d_private
->d_synth_e
)
1192 d_private
->d_synth_e
->printSynthSolution(out
);
1194 out
<< "Internal error : module for synth solution not found." << std::endl
;
1198 void QuantifiersEngine::getInstantiatedQuantifiedFormulas( std::vector
< Node
>& qs
) {
1199 d_instantiate
->getInstantiatedQuantifiedFormulas(qs
);
1202 void QuantifiersEngine::getInstantiations( std::map
< Node
, std::vector
< Node
> >& insts
) {
1203 d_instantiate
->getInstantiations(insts
);
1206 void QuantifiersEngine::getInstantiations( Node q
, std::vector
< Node
>& insts
) {
1207 d_instantiate
->getInstantiations(q
, insts
);
1210 Node
QuantifiersEngine::getInstantiatedConjunction( Node q
) {
1211 return d_instantiate
->getInstantiatedConjunction(q
);
1214 QuantifiersEngine::Statistics::Statistics()
1215 : d_time("theory::QuantifiersEngine::time"),
1216 d_qcf_time("theory::QuantifiersEngine::time_qcf"),
1217 d_ematching_time("theory::QuantifiersEngine::time_ematching"),
1218 d_num_quant("QuantifiersEngine::Num_Quantifiers", 0),
1219 d_instantiation_rounds("QuantifiersEngine::Rounds_Instantiation_Full", 0),
1220 d_instantiation_rounds_lc("QuantifiersEngine::Rounds_Instantiation_Last_Call", 0),
1221 d_triggers("QuantifiersEngine::Triggers", 0),
1222 d_simple_triggers("QuantifiersEngine::Triggers_Simple", 0),
1223 d_multi_triggers("QuantifiersEngine::Triggers_Multi", 0),
1224 d_multi_trigger_instantiations("QuantifiersEngine::Multi_Trigger_Instantiations", 0),
1225 d_red_alpha_equiv("QuantifiersEngine::Reductions_Alpha_Equivalence", 0),
1226 d_instantiations_user_patterns("QuantifiersEngine::Instantiations_User_Patterns", 0),
1227 d_instantiations_auto_gen("QuantifiersEngine::Instantiations_Auto_Gen", 0),
1228 d_instantiations_guess("QuantifiersEngine::Instantiations_Guess", 0),
1229 d_instantiations_qcf("QuantifiersEngine::Instantiations_Qcf_Conflict", 0),
1230 d_instantiations_qcf_prop("QuantifiersEngine::Instantiations_Qcf_Prop", 0),
1231 d_instantiations_fmf_exh("QuantifiersEngine::Instantiations_Fmf_Exh", 0),
1232 d_instantiations_fmf_mbqi("QuantifiersEngine::Instantiations_Fmf_Mbqi", 0),
1233 d_instantiations_cbqi("QuantifiersEngine::Instantiations_Cbqi", 0),
1234 d_instantiations_rr("QuantifiersEngine::Instantiations_Rewrite_Rules", 0)
1236 smtStatisticsRegistry()->registerStat(&d_time
);
1237 smtStatisticsRegistry()->registerStat(&d_qcf_time
);
1238 smtStatisticsRegistry()->registerStat(&d_ematching_time
);
1239 smtStatisticsRegistry()->registerStat(&d_num_quant
);
1240 smtStatisticsRegistry()->registerStat(&d_instantiation_rounds
);
1241 smtStatisticsRegistry()->registerStat(&d_instantiation_rounds_lc
);
1242 smtStatisticsRegistry()->registerStat(&d_triggers
);
1243 smtStatisticsRegistry()->registerStat(&d_simple_triggers
);
1244 smtStatisticsRegistry()->registerStat(&d_multi_triggers
);
1245 smtStatisticsRegistry()->registerStat(&d_multi_trigger_instantiations
);
1246 smtStatisticsRegistry()->registerStat(&d_red_alpha_equiv
);
1247 smtStatisticsRegistry()->registerStat(&d_instantiations_user_patterns
);
1248 smtStatisticsRegistry()->registerStat(&d_instantiations_auto_gen
);
1249 smtStatisticsRegistry()->registerStat(&d_instantiations_guess
);
1250 smtStatisticsRegistry()->registerStat(&d_instantiations_qcf
);
1251 smtStatisticsRegistry()->registerStat(&d_instantiations_qcf_prop
);
1252 smtStatisticsRegistry()->registerStat(&d_instantiations_fmf_exh
);
1253 smtStatisticsRegistry()->registerStat(&d_instantiations_fmf_mbqi
);
1254 smtStatisticsRegistry()->registerStat(&d_instantiations_cbqi
);
1255 smtStatisticsRegistry()->registerStat(&d_instantiations_rr
);
1258 QuantifiersEngine::Statistics::~Statistics(){
1259 smtStatisticsRegistry()->unregisterStat(&d_time
);
1260 smtStatisticsRegistry()->unregisterStat(&d_qcf_time
);
1261 smtStatisticsRegistry()->unregisterStat(&d_ematching_time
);
1262 smtStatisticsRegistry()->unregisterStat(&d_num_quant
);
1263 smtStatisticsRegistry()->unregisterStat(&d_instantiation_rounds
);
1264 smtStatisticsRegistry()->unregisterStat(&d_instantiation_rounds_lc
);
1265 smtStatisticsRegistry()->unregisterStat(&d_triggers
);
1266 smtStatisticsRegistry()->unregisterStat(&d_simple_triggers
);
1267 smtStatisticsRegistry()->unregisterStat(&d_multi_triggers
);
1268 smtStatisticsRegistry()->unregisterStat(&d_multi_trigger_instantiations
);
1269 smtStatisticsRegistry()->unregisterStat(&d_red_alpha_equiv
);
1270 smtStatisticsRegistry()->unregisterStat(&d_instantiations_user_patterns
);
1271 smtStatisticsRegistry()->unregisterStat(&d_instantiations_auto_gen
);
1272 smtStatisticsRegistry()->unregisterStat(&d_instantiations_guess
);
1273 smtStatisticsRegistry()->unregisterStat(&d_instantiations_qcf
);
1274 smtStatisticsRegistry()->unregisterStat(&d_instantiations_qcf_prop
);
1275 smtStatisticsRegistry()->unregisterStat(&d_instantiations_fmf_exh
);
1276 smtStatisticsRegistry()->unregisterStat(&d_instantiations_fmf_mbqi
);
1277 smtStatisticsRegistry()->unregisterStat(&d_instantiations_cbqi
);
1278 smtStatisticsRegistry()->unregisterStat(&d_instantiations_rr
);
1281 eq::EqualityEngine
* QuantifiersEngine::getMasterEqualityEngine() const
1283 return d_te
->getMasterEqualityEngine();
1286 eq::EqualityEngine
* QuantifiersEngine::getActiveEqualityEngine() const
1289 return d_model
->getEqualityEngine();
1291 return d_te
->getMasterEqualityEngine();
1294 Node
QuantifiersEngine::getInternalRepresentative( Node a
, Node q
, int index
){
1295 bool prevModelEe
= d_useModelEe
;
1296 d_useModelEe
= false;
1297 Node ret
= d_eq_query
->getInternalRepresentative( a
, q
, index
);
1298 d_useModelEe
= prevModelEe
;
1302 void QuantifiersEngine::getSynthSolutions(std::map
<Node
, Node
>& sol_map
)
1304 d_private
->d_synth_e
->getSynthSolutions(sol_map
);
1307 void QuantifiersEngine::debugPrintEqualityEngine( const char * c
) {
1308 eq::EqualityEngine
* ee
= getActiveEqualityEngine();
1309 eq::EqClassesIterator eqcs_i
= eq::EqClassesIterator( ee
);
1310 std::map
< TypeNode
, int > typ_num
;
1311 while( !eqcs_i
.isFinished() ){
1312 TNode r
= (*eqcs_i
);
1313 TypeNode tr
= r
.getType();
1314 if( typ_num
.find( tr
)==typ_num
.end() ){
1318 bool firstTime
= true;
1319 Trace(c
) << " " << r
;
1320 Trace(c
) << " : { ";
1321 eq::EqClassIterator eqc_i
= eq::EqClassIterator( r
, ee
);
1322 while( !eqc_i
.isFinished() ){
1326 Trace(c
) << std::endl
;
1329 Trace(c
) << " " << n
<< std::endl
;
1333 if( !firstTime
){ Trace(c
) << " "; }
1334 Trace(c
) << "}" << std::endl
;
1337 Trace(c
) << std::endl
;
1338 for( std::map
< TypeNode
, int >::iterator it
= typ_num
.begin(); it
!= typ_num
.end(); ++it
){
1339 Trace(c
) << "# eqc for " << it
->first
<< " : " << it
->second
<< std::endl
;
1343 } // namespace theory