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-2018 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/arrays/theory_arrays.h"
21 #include "theory/datatypes/theory_datatypes.h"
22 #include "theory/quantifiers/alpha_equivalence.h"
23 #include "theory/quantifiers/anti_skolem.h"
24 #include "theory/quantifiers/cegqi/ceg_t_instantiator.h"
25 #include "theory/quantifiers/cegqi/inst_strategy_cbqi.h"
26 #include "theory/quantifiers/conjecture_generator.h"
27 #include "theory/quantifiers/ematching/inst_strategy_e_matching.h"
28 #include "theory/quantifiers/ematching/instantiation_engine.h"
29 #include "theory/quantifiers/ematching/trigger.h"
30 #include "theory/quantifiers/equality_infer.h"
31 #include "theory/quantifiers/equality_query.h"
32 #include "theory/quantifiers/first_order_model.h"
33 #include "theory/quantifiers/fmf/ambqi_builder.h"
34 #include "theory/quantifiers/fmf/bounded_integers.h"
35 #include "theory/quantifiers/fmf/full_model_check.h"
36 #include "theory/quantifiers/fmf/model_engine.h"
37 #include "theory/quantifiers/inst_propagator.h"
38 #include "theory/quantifiers/inst_strategy_enumerative.h"
39 #include "theory/quantifiers/instantiate.h"
40 #include "theory/quantifiers/local_theory_ext.h"
41 #include "theory/quantifiers/quant_conflict_find.h"
42 #include "theory/quantifiers/quant_epr.h"
43 #include "theory/quantifiers/quant_relevance.h"
44 #include "theory/quantifiers/quant_split.h"
45 #include "theory/quantifiers/quantifiers_attributes.h"
46 #include "theory/quantifiers/quantifiers_rewriter.h"
47 #include "theory/quantifiers/relevant_domain.h"
48 #include "theory/quantifiers/rewrite_engine.h"
49 #include "theory/quantifiers/skolemize.h"
50 #include "theory/quantifiers/sygus/ce_guided_instantiation.h"
51 #include "theory/quantifiers/sygus/sygus_eval_unfold.h"
52 #include "theory/quantifiers/sygus/term_database_sygus.h"
53 #include "theory/quantifiers/term_database.h"
54 #include "theory/quantifiers/term_enumeration.h"
55 #include "theory/quantifiers/term_util.h"
56 #include "theory/sep/theory_sep.h"
57 #include "theory/theory_engine.h"
58 #include "theory/uf/equality_engine.h"
59 #include "theory/uf/theory_uf.h"
60 #include "theory/uf/theory_uf_strong_solver.h"
64 using namespace CVC4::kind
;
65 using namespace CVC4::context
;
66 using namespace CVC4::theory
;
67 using namespace CVC4::theory::inst
;
69 QuantifiersEngine::QuantifiersEngine(context::Context
* c
,
70 context::UserContext
* u
,
73 d_quant_attr(new quantifiers::QuantAttributes(this)),
74 d_instantiate(new quantifiers::Instantiate(this, u
)),
75 d_skolemize(new quantifiers::Skolemize(this, u
)),
76 d_term_enum(new quantifiers::TermEnumeration
),
77 d_conflict_c(c
, false),
81 d_lemmas_produced_c(u
),
84 // d_ierCounter_lc(c),
85 // d_ierCounterLastLc(c),
89 d_presolve_cache_wq(u
),
90 d_presolve_cache_wic(u
)
93 d_eq_query
= new quantifiers::EqualityQueryQuantifiersEngine( c
, this );
94 d_util
.push_back( d_eq_query
);
96 // term util must come first
97 d_term_util
= new quantifiers::TermUtil(this);
98 d_util
.push_back(d_term_util
);
100 d_term_db
= new quantifiers::TermDb( c
, u
, this );
101 d_util
.push_back( d_term_db
);
103 if (options::ceGuidedInst()) {
104 d_sygus_tdb
= new quantifiers::TermDbSygus(c
, this);
109 if( options::instPropagate() ){
110 // notice that this option is incompatible with options::qcfAllConflict()
111 d_inst_prop
= new quantifiers::InstPropagator( this );
112 d_util
.push_back( d_inst_prop
);
113 d_instantiate
->addNotify(d_inst_prop
->getInstantiationNotify());
118 if( options::inferArithTriggerEq() ){
119 d_eq_inference
= new quantifiers::EqualityInference( c
, options::inferArithTriggerEqExp() );
121 d_eq_inference
= NULL
;
124 d_util
.push_back(d_instantiate
.get());
126 d_tr_trie
= new inst::TriggerTrie
;
127 d_curr_effort_level
= QuantifiersModule::QEFFORT_NONE
;
129 d_hasAddedLemma
= false;
130 d_useModelEe
= false;
131 //don't add true lemma
132 d_lemmas_produced_c
[d_term_util
->d_true
] = true;
134 Trace("quant-engine-debug") << "Initialize quantifiers engine." << std::endl
;
135 Trace("quant-engine-debug") << "Initialize model, mbqi : " << options::mbqiMode() << std::endl
;
137 if( options::relevantTriggers() ){
138 d_quant_rel
= new quantifiers::QuantRelevance(false);
139 d_util
.push_back(d_quant_rel
);
144 if( options::quantEpr() ){
145 Assert( !options::incrementalSolving() );
146 d_qepr
= new quantifiers::QuantEPR
;
154 d_inst_engine
= NULL
;
157 d_anti_skolem
= NULL
;
159 d_model_engine
= NULL
;
163 d_lte_part_inst
= NULL
;
164 d_alpha_equiv
= NULL
;
170 //allow theory combination to go first, once initially
171 d_ierCounter
= options::instWhenTcFirst() ? 0 : 1;
172 d_ierCounter_c
= d_ierCounter
;
174 d_ierCounterLastLc
= 0;
175 d_inst_when_phase
= 1 + ( options::instWhenPhase()<1 ? 1 : options::instWhenPhase() );
177 bool needsBuilder
= false;
178 bool needsRelDom
= false;
179 //add quantifiers modules
180 if( options::quantConflictFind() || options::quantRewriteRules() ){
181 d_qcf
= new quantifiers::QuantConflictFind( this, c
);
182 d_modules
.push_back( d_qcf
);
184 if( options::conjectureGen() ){
185 d_sg_gen
= new quantifiers::ConjectureGenerator( this, c
);
186 d_modules
.push_back( d_sg_gen
);
188 if( !options::finiteModelFind() || options::fmfInstEngine() ){
189 d_inst_engine
= new quantifiers::InstantiationEngine( this );
190 d_modules
.push_back( d_inst_engine
);
192 if( options::cbqi() ){
193 d_i_cbqi
= new quantifiers::InstStrategyCegqi( this );
194 d_modules
.push_back( d_i_cbqi
);
195 if( options::cbqiBv() ){
196 // if doing instantiation for BV, need the inverter class
197 d_bv_invert
= new quantifiers::BvInverter
;
200 if( options::ceGuidedInst() ){
201 d_ceg_inst
= new quantifiers::CegInstantiation( this, c
);
202 d_modules
.push_back( d_ceg_inst
);
203 //needsBuilder = true;
205 //finite model finding
206 if( options::finiteModelFind() ){
207 if( options::fmfBound() ){
208 d_bint
= new quantifiers::BoundedIntegers( c
, this );
209 d_modules
.push_back( d_bint
);
211 d_model_engine
= new quantifiers::ModelEngine( c
, this );
212 d_modules
.push_back( d_model_engine
);
213 //finite model finder has special ways of building the model
216 if( options::quantRewriteRules() ){
217 d_rr_engine
= new quantifiers::RewriteEngine( c
, this );
218 d_modules
.push_back(d_rr_engine
);
220 if( options::ltePartialInst() ){
221 d_lte_part_inst
= new quantifiers::LtePartialInst( this, c
);
222 d_modules
.push_back( d_lte_part_inst
);
224 if( options::quantDynamicSplit()!=quantifiers::QUANT_DSPLIT_MODE_NONE
){
225 d_qsplit
= new quantifiers::QuantDSplit( this, c
);
226 d_modules
.push_back( d_qsplit
);
228 if( options::quantAntiSkolem() ){
229 d_anti_skolem
= new quantifiers::QuantAntiSkolem( this );
230 d_modules
.push_back( d_anti_skolem
);
232 if( options::quantAlphaEquiv() ){
233 d_alpha_equiv
= new quantifiers::AlphaEquivalence( this );
235 //full saturation : instantiate from relevant domain, then arbitrary terms
236 if( options::fullSaturateQuant() || options::fullSaturateInterleave() ){
237 d_fs
= new quantifiers::InstStrategyEnum(this);
238 d_modules
.push_back( d_fs
);
243 d_rel_dom
= new quantifiers::RelevantDomain( this );
244 d_util
.push_back( d_rel_dom
);
247 // if we require specialized ways of building the model
249 Trace("quant-engine-debug") << "Initialize model engine, mbqi : " << options::mbqiMode() << " " << options::fmfBound() << std::endl
;
250 if( options::mbqiMode()==quantifiers::MBQI_FMC
|| options::mbqiMode()==quantifiers::MBQI_FMC_INTERVAL
||
251 options::mbqiMode()==quantifiers::MBQI_TRUST
|| options::fmfBound() ){
252 Trace("quant-engine-debug") << "...make fmc builder." << std::endl
;
253 d_model
= new quantifiers::fmcheck::FirstOrderModelFmc( this, c
, "FirstOrderModelFmc" );
254 d_builder
= new quantifiers::fmcheck::FullModelChecker( c
, this );
255 }else if( options::mbqiMode()==quantifiers::MBQI_ABS
){
256 Trace("quant-engine-debug") << "...make abs mbqi builder." << std::endl
;
257 d_model
= new quantifiers::FirstOrderModelAbs( this, c
, "FirstOrderModelAbs" );
258 d_builder
= new quantifiers::AbsMbqiBuilder( c
, this );
260 Trace("quant-engine-debug") << "...make default model builder." << std::endl
;
261 d_model
= new quantifiers::FirstOrderModelIG( this, c
, "FirstOrderModelIG" );
262 d_builder
= new quantifiers::QModelBuilderDefault( c
, this );
265 d_model
= new quantifiers::FirstOrderModelIG( this, c
, "FirstOrderModelIG" );
269 QuantifiersEngine::~QuantifiersEngine()
271 delete d_alpha_equiv
;
276 delete d_model_engine
;
277 delete d_inst_engine
;
287 delete d_eq_inference
;
291 delete d_lte_part_inst
;
295 delete d_anti_skolem
;
299 EqualityQuery
* QuantifiersEngine::getEqualityQuery() { return d_eq_query
; }
301 context::Context
* QuantifiersEngine::getSatContext()
303 return d_te
->theoryOf(THEORY_QUANTIFIERS
)->getSatContext();
306 context::UserContext
* QuantifiersEngine::getUserContext()
308 return d_te
->theoryOf(THEORY_QUANTIFIERS
)->getUserContext();
311 OutputChannel
& QuantifiersEngine::getOutputChannel()
313 return d_te
->theoryOf(THEORY_QUANTIFIERS
)->getOutputChannel();
315 /** get default valuation for the quantifiers engine */
316 Valuation
& QuantifiersEngine::getValuation()
318 return d_te
->theoryOf(THEORY_QUANTIFIERS
)->getValuation();
321 const LogicInfo
& QuantifiersEngine::getLogicInfo() const
323 return d_te
->getLogicInfo();
326 QuantifiersModule
* QuantifiersEngine::getOwner( Node q
) {
327 std::map
< Node
, QuantifiersModule
* >::iterator it
= d_owner
.find( q
);
328 if( it
==d_owner
.end() ){
335 void QuantifiersEngine::setOwner( Node q
, QuantifiersModule
* m
, int priority
) {
336 QuantifiersModule
* mo
= getOwner( q
);
339 if( priority
<=d_owner_priority
[q
] ){
340 Trace("quant-warn") << "WARNING: setting owner of " << q
<< " to " << ( m
? m
->identify() : "null" ) << ", but already has owner " << mo
->identify() << " with higher priority!" << std::endl
;
345 d_owner_priority
[q
] = priority
;
349 bool QuantifiersEngine::hasOwnership( Node q
, QuantifiersModule
* m
) {
350 QuantifiersModule
* mo
= getOwner( q
);
351 return mo
==m
|| mo
==NULL
;
354 bool QuantifiersEngine::isFiniteBound( Node q
, Node v
) {
355 if( getBoundedIntegers() && getBoundedIntegers()->isBoundVar( q
, v
) ){
358 TypeNode tn
= v
.getType();
359 if( tn
.isSort() && options::finiteModelFind() ){
362 else if (d_term_enum
->mayComplete(tn
))
370 void QuantifiersEngine::presolve() {
371 Trace("quant-engine-proc") << "QuantifiersEngine : presolve " << std::endl
;
372 for( unsigned i
=0; i
<d_modules
.size(); i
++ ){
373 d_modules
[i
]->presolve();
375 d_term_db
->presolve();
377 //add all terms to database
378 if( options::incrementalSolving() ){
379 Trace("quant-engine-proc") << "Add presolve cache " << d_presolve_cache
.size() << std::endl
;
380 for( unsigned i
=0; i
<d_presolve_cache
.size(); i
++ ){
381 addTermToDatabase( d_presolve_cache
[i
], d_presolve_cache_wq
[i
], d_presolve_cache_wic
[i
] );
383 Trace("quant-engine-proc") << "Done add presolve cache " << std::endl
;
387 void QuantifiersEngine::ppNotifyAssertions(
388 const std::vector
<Node
>& assertions
) {
389 Trace("quant-engine-proc")
390 << "ppNotifyAssertions in QE, #assertions = " << assertions
.size()
391 << " check epr = " << (d_qepr
!= NULL
) << std::endl
;
392 if ((options::instLevelInputOnly() && options::instMaxLevel() != -1) ||
394 for (unsigned i
= 0; i
< assertions
.size(); i
++) {
395 if (options::instLevelInputOnly() && options::instMaxLevel() != -1) {
396 quantifiers::QuantAttributes::setInstantiationLevelAttr(assertions
[i
],
399 if (d_qepr
!= NULL
) {
400 d_qepr
->registerAssertion(assertions
[i
]);
403 if (d_qepr
!= NULL
) {
404 // must handle sources of other new constants e.g. separation logic
406 sep::TheorySep
* theory_sep
=
407 static_cast<sep::TheorySep
*>(getTheoryEngine()->theoryOf(THEORY_SEP
));
408 theory_sep
->initializeBounds();
409 d_qepr
->finishInit();
414 void QuantifiersEngine::check( Theory::Effort e
){
415 CodeTimer
codeTimer(d_statistics
.d_time
);
416 d_useModelEe
= options::quantModelEe() && ( e
>=Theory::EFFORT_LAST_CALL
);
417 // if we want to use the model's equality engine, build the model now
418 if( d_useModelEe
&& !d_model
->isBuilt() ){
419 Trace("quant-engine-debug") << "Build the model." << std::endl
;
420 if( !d_te
->getModelBuilder()->buildModel( d_model
) ){
421 //we are done if model building was unsuccessful
423 if( d_hasAddedLemma
){
424 Trace("quant-engine-debug") << "...failed." << std::endl
;
430 if( !getActiveEqualityEngine()->consistent() ){
431 Trace("quant-engine-debug") << "Master equality engine not consistent, return." << std::endl
;
434 if (d_conflict_c
.get())
436 if (e
< Theory::EFFORT_LAST_CALL
)
438 // this can happen in rare cases when quantifiers is the first to realize
439 // there is a quantifier-free conflict, for example, when it discovers
440 // disequal and congruent terms in the master equality engine during
441 // term indexing. In such cases, quantifiers reports a "conflicting lemma"
442 // that is, one that is entailed to be false by the current assignment.
443 // If this lemma is not a SAT conflict, we may get another call to full
444 // effort check and the quantifier-free solvers still haven't realized
445 // there is a conflict. In this case, we return, trusting that theory
446 // combination will do the right thing (split on equalities until there is
447 // a conflict at the quantifier-free level).
448 Trace("quant-engine-debug")
449 << "Conflicting lemma already reported by quantifiers, return."
453 // we reported what we thought was a conflicting lemma, but now we have
454 // gotten a check at LAST_CALL effort, indicating that the lemma we reported
455 // was not conflicting. This should never happen, but in production mode, we
456 // proceed with the check.
459 bool needsCheck
= !d_lemmas_waiting
.empty();
460 QuantifiersModule::QEffort needsModelE
= QuantifiersModule::QEFFORT_NONE
;
461 std::vector
< QuantifiersModule
* > qm
;
462 if( d_model
->checkNeeded() ){
463 needsCheck
= needsCheck
|| e
>=Theory::EFFORT_LAST_CALL
; //always need to check at or above last call
464 for (QuantifiersModule
*& mdl
: d_modules
)
466 if (mdl
->needsCheck(e
))
470 //can only request model at last call since theory combination can find inconsistencies
471 if( e
>=Theory::EFFORT_LAST_CALL
){
472 QuantifiersModule::QEffort me
= mdl
->needsModel(e
);
473 needsModelE
= me
<needsModelE
? me
: needsModelE
;
480 d_hasAddedLemma
= false;
481 bool setIncomplete
= false;
483 Trace("quant-engine-debug2") << "Quantifiers Engine call to check, level = " << e
<< ", needsCheck=" << needsCheck
<< std::endl
;
485 //flush previous lemmas (for instance, if was interupted), or other lemmas to process
487 if( d_hasAddedLemma
){
492 if( Trace
.isOn("quant-engine") ){
493 clSet
= double(clock())/double(CLOCKS_PER_SEC
);
494 Trace("quant-engine") << ">>>>> Quantifiers Engine Round, effort = " << e
<< " <<<<<" << std::endl
;
497 if( Trace
.isOn("quant-engine-debug") ){
498 Trace("quant-engine-debug") << "Quantifiers Engine check, level = " << e
<< std::endl
;
499 Trace("quant-engine-debug") << " depth : " << d_ierCounter_c
<< std::endl
;
500 Trace("quant-engine-debug") << " modules to check : ";
501 for( unsigned i
=0; i
<qm
.size(); i
++ ){
502 Trace("quant-engine-debug") << qm
[i
]->identify() << " ";
504 Trace("quant-engine-debug") << std::endl
;
505 Trace("quant-engine-debug") << " # quantified formulas = " << d_model
->getNumAssertedQuantifiers() << std::endl
;
506 if( !d_lemmas_waiting
.empty() ){
507 Trace("quant-engine-debug") << " lemmas waiting = " << d_lemmas_waiting
.size() << std::endl
;
509 Trace("quant-engine-debug") << " Theory engine finished : " << !d_te
->needCheck() << std::endl
;
510 Trace("quant-engine-debug") << " Needs model effort : " << needsModelE
<< std::endl
;
512 if( Trace
.isOn("quant-engine-ee-pre") ){
513 Trace("quant-engine-ee-pre") << "Equality engine (pre-inference): " << std::endl
;
514 debugPrintEqualityEngine( "quant-engine-ee-pre" );
516 if( Trace
.isOn("quant-engine-assert") ){
517 Trace("quant-engine-assert") << "Assertions : " << std::endl
;
518 getTheoryEngine()->printAssertions("quant-engine-assert");
522 Trace("quant-engine-debug") << "Resetting all utilities..." << std::endl
;
523 for (QuantifiersUtil
*& util
: d_util
)
525 Trace("quant-engine-debug2") << "Reset " << util
->identify().c_str()
526 << "..." << std::endl
;
530 if( d_hasAddedLemma
){
533 //should only fail reset if added a lemma
539 if( Trace
.isOn("quant-engine-ee") ){
540 Trace("quant-engine-ee") << "Equality engine : " << std::endl
;
541 debugPrintEqualityEngine( "quant-engine-ee" );
545 Trace("quant-engine-debug") << "Reset model..." << std::endl
;
546 d_model
->reset_round();
549 Trace("quant-engine-debug") << "Resetting all modules..." << std::endl
;
550 for (QuantifiersModule
*& mdl
: d_modules
)
552 Trace("quant-engine-debug2") << "Reset " << mdl
->identify().c_str()
556 Trace("quant-engine-debug") << "Done resetting all modules." << std::endl
;
557 //reset may have added lemmas
559 if( d_hasAddedLemma
){
563 if( e
==Theory::EFFORT_LAST_CALL
){
564 //if effort is last call, try to minimize model first
565 //uf::StrongSolverTheoryUF * ufss = ((uf::TheoryUF*)getTheoryEngine()->theoryOf( THEORY_UF ))->getStrongSolver();
566 //if( ufss && !ufss->minimize() ){ return; }
567 ++(d_statistics
.d_instantiation_rounds_lc
);
568 }else if( e
==Theory::EFFORT_FULL
){
569 ++(d_statistics
.d_instantiation_rounds
);
571 Trace("quant-engine-debug") << "Check modules that needed check..." << std::endl
;
572 for (unsigned qef
= QuantifiersModule::QEFFORT_CONFLICT
;
573 qef
<= QuantifiersModule::QEFFORT_LAST_CALL
;
576 QuantifiersModule::QEffort quant_e
=
577 static_cast<QuantifiersModule::QEffort
>(qef
);
578 d_curr_effort_level
= quant_e
;
579 //build the model if any module requested it
580 if (needsModelE
== quant_e
)
582 if (!d_model
->isBuilt())
584 // theory engine's model builder is quantifier engine's builder if it
586 Assert(!d_builder
|| d_builder
== d_te
->getModelBuilder());
587 Trace("quant-engine-debug") << "Build model..." << std::endl
;
588 if (!d_te
->getModelBuilder()->buildModel(d_model
))
593 if (!d_model
->isBuiltSuccess())
598 if( !d_hasAddedLemma
){
600 for (QuantifiersModule
*& mdl
: qm
)
602 Trace("quant-engine-debug") << "Check " << mdl
->identify().c_str()
603 << " at effort " << quant_e
<< "..."
605 mdl
->check(e
, quant_e
);
607 Trace("quant-engine-debug") << "...conflict!" << std::endl
;
611 //flush all current lemmas
614 //if we have added one, stop
615 if( d_hasAddedLemma
){
618 Assert( !d_conflict
);
619 if (quant_e
== QuantifiersModule::QEFFORT_CONFLICT
)
621 if( e
==Theory::EFFORT_FULL
){
622 //increment if a last call happened, we are not strictly enforcing interleaving, or already were in phase
623 if( d_ierCounterLastLc
!=d_ierCounter_lc
|| !options::instWhenStrictInterleave() || d_ierCounter
%d_inst_when_phase
!=0 ){
624 d_ierCounter
= d_ierCounter
+ 1;
625 d_ierCounterLastLc
= d_ierCounter_lc
;
626 d_ierCounter_c
= d_ierCounter_c
.get() + 1;
628 }else if( e
==Theory::EFFORT_LAST_CALL
){
629 d_ierCounter_lc
= d_ierCounter_lc
+ 1;
632 else if (quant_e
== QuantifiersModule::QEFFORT_MODEL
)
634 if( e
==Theory::EFFORT_LAST_CALL
){
635 //sources of incompleteness
636 for (QuantifiersUtil
*& util
: d_util
)
638 if (!util
->checkComplete())
640 Trace("quant-engine-debug") << "Set incomplete because utility "
641 << util
->identify().c_str()
642 << " was incomplete." << std::endl
;
643 setIncomplete
= true;
646 if (d_conflict_c
.get())
648 // we reported a conflicting lemma, should return
649 setIncomplete
= true;
651 //if we have a chance not to set incomplete
652 if( !setIncomplete
){
653 //check if we should set the incomplete flag
654 for (QuantifiersModule
*& mdl
: d_modules
)
656 if (!mdl
->checkComplete())
658 Trace("quant-engine-debug")
659 << "Set incomplete because module "
660 << mdl
->identify().c_str() << " was incomplete."
662 setIncomplete
= true;
666 if( !setIncomplete
){
667 //look at individual quantified formulas, one module must claim completeness for each one
668 for( unsigned i
=0; i
<d_model
->getNumAssertedQuantifiers(); i
++ ){
669 bool hasCompleteM
= false;
670 Node q
= d_model
->getAssertedQuantifier( i
);
671 QuantifiersModule
* qmd
= getOwner( q
);
673 hasCompleteM
= qmd
->checkCompleteFor( q
);
675 for( unsigned j
=0; j
<d_modules
.size(); j
++ ){
676 if( d_modules
[j
]->checkCompleteFor( q
) ){
684 Trace("quant-engine-debug") << "Set incomplete because " << q
<< " was not fully processed." << std::endl
;
685 setIncomplete
= true;
689 Trace("quant-engine-debug2") << "Complete for " << q
<< " due to " << qmd
->identify().c_str() << std::endl
;
694 //if setIncomplete = false, we will answer SAT, otherwise we will run at quant_e QEFFORT_LAST_CALL
695 if( !setIncomplete
){
702 d_curr_effort_level
= QuantifiersModule::QEFFORT_NONE
;
703 Trace("quant-engine-debug") << "Done check modules that needed check." << std::endl
;
704 if( d_hasAddedLemma
){
705 d_instantiate
->debugPrint();
707 if( Trace
.isOn("quant-engine") ){
708 double clSet2
= double(clock())/double(CLOCKS_PER_SEC
);
709 Trace("quant-engine") << "Finished quantifiers engine, total time = " << (clSet2
-clSet
);
710 Trace("quant-engine") << ", added lemma = " << d_hasAddedLemma
;
711 Trace("quant-engine") << std::endl
;
714 Trace("quant-engine-debug2") << "Finished quantifiers engine check." << std::endl
;
716 Trace("quant-engine-debug2") << "Quantifiers Engine does not need check." << std::endl
;
720 if( e
==Theory::EFFORT_LAST_CALL
&& !d_hasAddedLemma
){
722 Trace("quant-engine") << "Set incomplete flag." << std::endl
;
723 getOutputChannel().setIncomplete();
726 d_instantiate
->debugPrintModel();
730 void QuantifiersEngine::notifyCombineTheories() {
731 //if allowing theory combination to happen at most once between instantiation rounds
733 //d_ierCounterLastLc = -1;
736 bool QuantifiersEngine::reduceQuantifier( Node q
) {
737 //TODO: this can be unified with preregistration: AlphaEquivalence takes ownership of reducable quants
738 BoolMap::const_iterator it
= d_quants_red
.find( q
);
739 if( it
==d_quants_red
.end() ){
741 std::map
< Node
, Node
>::iterator itr
= d_quants_red_lem
.find( q
);
742 if( itr
==d_quants_red_lem
.end() ){
744 Trace("quant-engine-red") << "Alpha equivalence " << q
<< "?" << std::endl
;
745 //add equivalence with another quantified formula
746 lem
= d_alpha_equiv
->reduceQuantifier( q
);
748 Trace("quant-engine-red") << "...alpha equivalence success." << std::endl
;
749 ++(d_statistics
.d_red_alpha_equiv
);
752 d_quants_red_lem
[q
] = lem
;
757 getOutputChannel().lemma( lem
);
759 d_quants_red
[q
] = !lem
.isNull();
760 return !lem
.isNull();
766 void QuantifiersEngine::registerQuantifierInternal(Node f
)
768 std::map
< Node
, bool >::iterator it
= d_quants
.find( f
);
769 if( it
==d_quants
.end() ){
770 Trace("quant") << "QuantifiersEngine : Register quantifier ";
771 Trace("quant") << " : " << f
<< std::endl
;
772 unsigned prev_lemma_waiting
= d_lemmas_waiting
.size();
773 ++(d_statistics
.d_num_quant
);
774 Assert( f
.getKind()==FORALL
);
775 // register with utilities
776 for (unsigned i
= 0; i
< d_util
.size(); i
++)
778 d_util
[i
]->registerQuantifier(f
);
780 // compute attributes
781 d_quant_attr
->computeAttributes(f
);
783 for (QuantifiersModule
*& mdl
: d_modules
)
785 Trace("quant-debug") << "check ownership with " << mdl
->identify()
786 << "..." << std::endl
;
787 mdl
->checkOwnership(f
);
789 QuantifiersModule
* qm
= getOwner(f
);
790 Trace("quant") << " Owner : " << (qm
== nullptr ? "[none]" : qm
->identify())
792 // register with each module
793 for (QuantifiersModule
*& mdl
: d_modules
)
795 Trace("quant-debug") << "register with " << mdl
->identify() << "..."
797 mdl
->registerQuantifier(f
);
798 // since this is context-independent, we should not add any lemmas during
800 Assert(d_lemmas_waiting
.size() == prev_lemma_waiting
);
802 // TODO (#2020): remove this
803 Node ceBody
= d_term_util
->getInstConstantBody(f
);
804 Trace("quant-debug") << "...finish." << std::endl
;
806 AlwaysAssert(d_lemmas_waiting
.size() == prev_lemma_waiting
);
810 void QuantifiersEngine::preRegisterQuantifier(Node q
)
812 NodeSet::const_iterator it
= d_quants_prereg
.find(q
);
813 if (it
!= d_quants_prereg
.end())
817 Trace("quant-debug") << "QuantifiersEngine : Pre-register " << q
<< std::endl
;
818 d_quants_prereg
.insert(q
);
820 if (reduceQuantifier(q
))
822 // if we can reduce it, nothing left to do
825 // ensure that it is registered
826 registerQuantifierInternal(q
);
827 // register with each module
828 for (QuantifiersModule
*& mdl
: d_modules
)
830 Trace("quant-debug") << "pre-register with " << mdl
->identify() << "..."
832 mdl
->preRegisterQuantifier(q
);
836 Trace("quant-debug") << "...finish pre-register " << q
<< "..." << std::endl
;
839 void QuantifiersEngine::registerPattern( std::vector
<Node
> & pattern
) {
840 for(std::vector
<Node
>::iterator p
= pattern
.begin(); p
!= pattern
.end(); ++p
){
841 std::set
< Node
> added
;
842 getTermDatabase()->addTerm( *p
, added
);
846 void QuantifiersEngine::assertQuantifier( Node f
, bool pol
){
847 if (reduceQuantifier(f
))
849 // if we can reduce it, nothing left to do
854 Node lem
= d_skolemize
->process(f
);
857 if (Trace
.isOn("quantifiers-sk-debug"))
859 Node slem
= Rewriter::rewrite(lem
);
860 Trace("quantifiers-sk-debug")
861 << "Skolemize lemma : " << slem
<< std::endl
;
863 getOutputChannel().lemma(lem
, false, true);
867 // ensure the quantified formula is registered
868 registerQuantifierInternal(f
);
869 // assert it to each module
870 d_model
->assertQuantifier(f
);
871 for (QuantifiersModule
*& mdl
: d_modules
)
875 addTermToDatabase(d_term_util
->getInstConstantBody(f
), true);
878 void QuantifiersEngine::propagate( Theory::Effort level
){
879 CodeTimer
codeTimer(d_statistics
.d_time
);
883 Node
QuantifiersEngine::getNextDecisionRequest( unsigned& priority
){
884 unsigned min_priority
= 0;
886 for( unsigned i
=0; i
<d_modules
.size(); i
++ ){
887 Node n
= d_modules
[i
]->getNextDecisionRequest( priority
);
888 if( !n
.isNull() && ( dec
.isNull() || priority
<min_priority
) ){
890 min_priority
= priority
;
896 void QuantifiersEngine::addTermToDatabase( Node n
, bool withinQuant
, bool withinInstClosure
){
897 if( options::incrementalSolving() ){
898 if( d_presolve_in
.find( n
)==d_presolve_in
.end() ){
899 d_presolve_in
.insert( n
);
900 d_presolve_cache
.push_back( n
);
901 d_presolve_cache_wq
.push_back( withinQuant
);
902 d_presolve_cache_wic
.push_back( withinInstClosure
);
905 //only wait if we are doing incremental solving
906 if( !d_presolve
|| !options::incrementalSolving() ){
907 std::set
< Node
> added
;
908 d_term_db
->addTerm(n
, added
, withinQuant
, withinInstClosure
);
914 d_sygus_tdb
->getEvalUnfold()->registerEvalTerm(n
);
917 // added contains also the Node that just have been asserted in this
921 for (std::set
<Node
>::iterator i
= added
.begin(), end
= added
.end();
925 d_quant_rel
->setRelevance( i
->getOperator(), 0 );
932 void QuantifiersEngine::eqNotifyNewClass(TNode t
) {
933 addTermToDatabase( t
);
934 if( d_eq_inference
){
935 d_eq_inference
->eqNotifyNewClass( t
);
939 void QuantifiersEngine::eqNotifyPreMerge(TNode t1
, TNode t2
) {
940 if( d_eq_inference
){
941 d_eq_inference
->eqNotifyMerge( t1
, t2
);
945 void QuantifiersEngine::eqNotifyPostMerge(TNode t1
, TNode t2
) {
949 void QuantifiersEngine::eqNotifyDisequal(TNode t1
, TNode t2
, TNode reason
) {
951 // d_qcf->assertDisequal( t1, t2 );
955 bool QuantifiersEngine::addLemma( Node lem
, bool doCache
, bool doRewrite
){
958 lem
= Rewriter::rewrite(lem
);
960 Trace("inst-add-debug") << "Adding lemma : " << lem
<< std::endl
;
961 BoolMap::const_iterator itp
= d_lemmas_produced_c
.find( lem
);
962 if( itp
==d_lemmas_produced_c
.end() || !(*itp
).second
){
963 //d_curr_out->lemma( lem, false, true );
964 d_lemmas_produced_c
[ lem
] = true;
965 d_lemmas_waiting
.push_back( lem
);
966 Trace("inst-add-debug") << "Added lemma" << std::endl
;
969 Trace("inst-add-debug") << "Duplicate." << std::endl
;
973 //do not need to rewrite, will be rewritten after sending
974 d_lemmas_waiting
.push_back( lem
);
979 bool QuantifiersEngine::removeLemma( Node lem
) {
980 std::vector
< Node
>::iterator it
= std::find( d_lemmas_waiting
.begin(), d_lemmas_waiting
.end(), lem
);
981 if( it
!=d_lemmas_waiting
.end() ){
982 d_lemmas_waiting
.erase( it
, it
+ 1 );
983 d_lemmas_produced_c
[ lem
] = false;
990 void QuantifiersEngine::addRequirePhase( Node lit
, bool req
){
991 d_phase_req_waiting
[lit
] = req
;
994 bool QuantifiersEngine::addSplit( Node n
, bool reqPhase
, bool reqPhasePol
){
995 n
= Rewriter::rewrite( n
);
996 Node lem
= NodeManager::currentNM()->mkNode( OR
, n
, n
.notNode() );
997 if( addLemma( lem
) ){
998 Debug("inst") << "*** Add split " << n
<< std::endl
;
1004 bool QuantifiersEngine::addSplitEquality( Node n1
, Node n2
, bool reqPhase
, bool reqPhasePol
){
1005 //Assert( !areEqual( n1, n2 ) );
1006 //Assert( !areDisequal( n1, n2 ) );
1007 Node fm
= NodeManager::currentNM()->mkNode( EQUAL
, n1
, n2
);
1008 return addSplit( fm
);
1011 bool QuantifiersEngine::addEPRAxiom( TypeNode tn
) {
1013 Assert( !options::incrementalSolving() );
1014 if( d_qepr
->isEPR( tn
) && !d_qepr
->hasEPRAxiom( tn
) ){
1015 Node lem
= d_qepr
->mkEPRAxiom( tn
);
1016 Trace("quant-epr") << "EPR lemma for " << tn
<< " : " << lem
<< std::endl
;
1017 getOutputChannel().lemma( lem
);
1023 void QuantifiersEngine::markRelevant( Node q
) {
1024 d_model
->markRelevant( q
);
1027 void QuantifiersEngine::setConflict() {
1029 d_conflict_c
= true;
1032 bool QuantifiersEngine::getInstWhenNeedsCheck( Theory::Effort e
) {
1033 Trace("quant-engine-debug2") << "Get inst when needs check, counts=" << d_ierCounter
<< ", " << d_ierCounter_lc
<< std::endl
;
1034 //determine if we should perform check, based on instWhenMode
1035 bool performCheck
= false;
1036 if( options::instWhenMode()==quantifiers::INST_WHEN_FULL
){
1037 performCheck
= ( e
>= Theory::EFFORT_FULL
);
1038 }else if( options::instWhenMode()==quantifiers::INST_WHEN_FULL_DELAY
){
1039 performCheck
= ( e
>= Theory::EFFORT_FULL
) && !getTheoryEngine()->needCheck();
1040 }else if( options::instWhenMode()==quantifiers::INST_WHEN_FULL_LAST_CALL
){
1041 performCheck
= ( ( e
==Theory::EFFORT_FULL
&& d_ierCounter
%d_inst_when_phase
!=0 ) || e
==Theory::EFFORT_LAST_CALL
);
1042 }else if( options::instWhenMode()==quantifiers::INST_WHEN_FULL_DELAY_LAST_CALL
){
1043 performCheck
= ( ( e
==Theory::EFFORT_FULL
&& !getTheoryEngine()->needCheck() && d_ierCounter
%d_inst_when_phase
!=0 ) || e
==Theory::EFFORT_LAST_CALL
);
1044 }else if( options::instWhenMode()==quantifiers::INST_WHEN_LAST_CALL
){
1045 performCheck
= ( e
>= Theory::EFFORT_LAST_CALL
);
1047 performCheck
= true;
1049 if( e
==Theory::EFFORT_LAST_CALL
){
1050 //with bounded integers, skip every other last call,
1051 // since matching loops may occur with infinite quantification
1052 if( d_ierCounter_lc
%2==0 && options::fmfBound() ){
1053 performCheck
= false;
1056 return performCheck
;
1059 quantifiers::UserPatMode
QuantifiersEngine::getInstUserPatMode() {
1060 if( options::userPatternsQuant()==quantifiers::USER_PAT_MODE_INTERLEAVE
){
1061 return d_ierCounter
%2==0 ? quantifiers::USER_PAT_MODE_USE
: quantifiers::USER_PAT_MODE_RESORT
;
1063 return options::userPatternsQuant();
1067 void QuantifiersEngine::flushLemmas(){
1068 if( !d_lemmas_waiting
.empty() ){
1069 //filter based on notify classes
1070 if (d_instantiate
->hasNotify())
1072 unsigned prev_lem_sz
= d_lemmas_waiting
.size();
1073 d_instantiate
->notifyFlushLemmas();
1074 if( prev_lem_sz
!=d_lemmas_waiting
.size() ){
1075 Trace("quant-engine") << "...filtered instances : " << d_lemmas_waiting
.size() << " / " << prev_lem_sz
<< std::endl
;
1078 //take default output channel if none is provided
1079 d_hasAddedLemma
= true;
1080 for( unsigned i
=0; i
<d_lemmas_waiting
.size(); i
++ ){
1081 Trace("qe-lemma") << "Lemma : " << d_lemmas_waiting
[i
] << std::endl
;
1082 getOutputChannel().lemma( d_lemmas_waiting
[i
], false, true );
1084 d_lemmas_waiting
.clear();
1086 if( !d_phase_req_waiting
.empty() ){
1087 for( std::map
< Node
, bool >::iterator it
= d_phase_req_waiting
.begin(); it
!= d_phase_req_waiting
.end(); ++it
){
1088 Trace("qe-lemma") << "Require phase : " << it
->first
<< " -> " << it
->second
<< std::endl
;
1089 getOutputChannel().requirePhase( it
->first
, it
->second
);
1091 d_phase_req_waiting
.clear();
1095 bool QuantifiersEngine::getUnsatCoreLemmas( std::vector
< Node
>& active_lemmas
) {
1096 return d_instantiate
->getUnsatCoreLemmas(active_lemmas
);
1099 bool QuantifiersEngine::getUnsatCoreLemmas( std::vector
< Node
>& active_lemmas
, std::map
< Node
, Node
>& weak_imp
) {
1100 return d_instantiate
->getUnsatCoreLemmas(active_lemmas
, weak_imp
);
1103 void QuantifiersEngine::getInstantiationTermVectors( Node q
, std::vector
< std::vector
< Node
> >& tvecs
) {
1104 d_instantiate
->getInstantiationTermVectors(q
, tvecs
);
1107 void QuantifiersEngine::getInstantiationTermVectors( std::map
< Node
, std::vector
< std::vector
< Node
> > >& insts
) {
1108 d_instantiate
->getInstantiationTermVectors(insts
);
1111 void QuantifiersEngine::getExplanationForInstLemmas(
1112 const std::vector
<Node
>& lems
,
1113 std::map
<Node
, Node
>& quant
,
1114 std::map
<Node
, std::vector
<Node
> >& tvec
)
1116 d_instantiate
->getExplanationForInstLemmas(lems
, quant
, tvec
);
1119 void QuantifiersEngine::printInstantiations( std::ostream
& out
) {
1120 bool printed
= false;
1121 // print the skolemizations
1122 if (d_skolemize
->printSkolemization(out
))
1126 // print the instantiations
1127 if (d_instantiate
->printInstantiations(out
))
1132 out
<< "No instantiations" << std::endl
;
1136 void QuantifiersEngine::printSynthSolution( std::ostream
& out
) {
1138 d_ceg_inst
->printSynthSolution( out
);
1140 out
<< "Internal error : module for synth solution not found." << std::endl
;
1144 void QuantifiersEngine::getInstantiatedQuantifiedFormulas( std::vector
< Node
>& qs
) {
1145 d_instantiate
->getInstantiatedQuantifiedFormulas(qs
);
1148 void QuantifiersEngine::getInstantiations( std::map
< Node
, std::vector
< Node
> >& insts
) {
1149 d_instantiate
->getInstantiations(insts
);
1152 void QuantifiersEngine::getInstantiations( Node q
, std::vector
< Node
>& insts
) {
1153 d_instantiate
->getInstantiations(q
, insts
);
1156 Node
QuantifiersEngine::getInstantiatedConjunction( Node q
) {
1157 return d_instantiate
->getInstantiatedConjunction(q
);
1160 QuantifiersEngine::Statistics::Statistics()
1161 : d_time("theory::QuantifiersEngine::time"),
1162 d_qcf_time("theory::QuantifiersEngine::time_qcf"),
1163 d_ematching_time("theory::QuantifiersEngine::time_ematching"),
1164 d_num_quant("QuantifiersEngine::Num_Quantifiers", 0),
1165 d_instantiation_rounds("QuantifiersEngine::Rounds_Instantiation_Full", 0),
1166 d_instantiation_rounds_lc("QuantifiersEngine::Rounds_Instantiation_Last_Call", 0),
1167 d_triggers("QuantifiersEngine::Triggers", 0),
1168 d_simple_triggers("QuantifiersEngine::Triggers_Simple", 0),
1169 d_multi_triggers("QuantifiersEngine::Triggers_Multi", 0),
1170 d_multi_trigger_instantiations("QuantifiersEngine::Multi_Trigger_Instantiations", 0),
1171 d_red_alpha_equiv("QuantifiersEngine::Reductions_Alpha_Equivalence", 0),
1172 d_instantiations_user_patterns("QuantifiersEngine::Instantiations_User_Patterns", 0),
1173 d_instantiations_auto_gen("QuantifiersEngine::Instantiations_Auto_Gen", 0),
1174 d_instantiations_guess("QuantifiersEngine::Instantiations_Guess", 0),
1175 d_instantiations_qcf("QuantifiersEngine::Instantiations_Qcf_Conflict", 0),
1176 d_instantiations_qcf_prop("QuantifiersEngine::Instantiations_Qcf_Prop", 0),
1177 d_instantiations_fmf_exh("QuantifiersEngine::Instantiations_Fmf_Exh", 0),
1178 d_instantiations_fmf_mbqi("QuantifiersEngine::Instantiations_Fmf_Mbqi", 0),
1179 d_instantiations_cbqi("QuantifiersEngine::Instantiations_Cbqi", 0),
1180 d_instantiations_rr("QuantifiersEngine::Instantiations_Rewrite_Rules", 0)
1182 smtStatisticsRegistry()->registerStat(&d_time
);
1183 smtStatisticsRegistry()->registerStat(&d_qcf_time
);
1184 smtStatisticsRegistry()->registerStat(&d_ematching_time
);
1185 smtStatisticsRegistry()->registerStat(&d_num_quant
);
1186 smtStatisticsRegistry()->registerStat(&d_instantiation_rounds
);
1187 smtStatisticsRegistry()->registerStat(&d_instantiation_rounds_lc
);
1188 smtStatisticsRegistry()->registerStat(&d_triggers
);
1189 smtStatisticsRegistry()->registerStat(&d_simple_triggers
);
1190 smtStatisticsRegistry()->registerStat(&d_multi_triggers
);
1191 smtStatisticsRegistry()->registerStat(&d_multi_trigger_instantiations
);
1192 smtStatisticsRegistry()->registerStat(&d_red_alpha_equiv
);
1193 smtStatisticsRegistry()->registerStat(&d_instantiations_user_patterns
);
1194 smtStatisticsRegistry()->registerStat(&d_instantiations_auto_gen
);
1195 smtStatisticsRegistry()->registerStat(&d_instantiations_guess
);
1196 smtStatisticsRegistry()->registerStat(&d_instantiations_qcf
);
1197 smtStatisticsRegistry()->registerStat(&d_instantiations_qcf_prop
);
1198 smtStatisticsRegistry()->registerStat(&d_instantiations_fmf_exh
);
1199 smtStatisticsRegistry()->registerStat(&d_instantiations_fmf_mbqi
);
1200 smtStatisticsRegistry()->registerStat(&d_instantiations_cbqi
);
1201 smtStatisticsRegistry()->registerStat(&d_instantiations_rr
);
1204 QuantifiersEngine::Statistics::~Statistics(){
1205 smtStatisticsRegistry()->unregisterStat(&d_time
);
1206 smtStatisticsRegistry()->unregisterStat(&d_qcf_time
);
1207 smtStatisticsRegistry()->unregisterStat(&d_ematching_time
);
1208 smtStatisticsRegistry()->unregisterStat(&d_num_quant
);
1209 smtStatisticsRegistry()->unregisterStat(&d_instantiation_rounds
);
1210 smtStatisticsRegistry()->unregisterStat(&d_instantiation_rounds_lc
);
1211 smtStatisticsRegistry()->unregisterStat(&d_triggers
);
1212 smtStatisticsRegistry()->unregisterStat(&d_simple_triggers
);
1213 smtStatisticsRegistry()->unregisterStat(&d_multi_triggers
);
1214 smtStatisticsRegistry()->unregisterStat(&d_multi_trigger_instantiations
);
1215 smtStatisticsRegistry()->unregisterStat(&d_red_alpha_equiv
);
1216 smtStatisticsRegistry()->unregisterStat(&d_instantiations_user_patterns
);
1217 smtStatisticsRegistry()->unregisterStat(&d_instantiations_auto_gen
);
1218 smtStatisticsRegistry()->unregisterStat(&d_instantiations_guess
);
1219 smtStatisticsRegistry()->unregisterStat(&d_instantiations_qcf
);
1220 smtStatisticsRegistry()->unregisterStat(&d_instantiations_qcf_prop
);
1221 smtStatisticsRegistry()->unregisterStat(&d_instantiations_fmf_exh
);
1222 smtStatisticsRegistry()->unregisterStat(&d_instantiations_fmf_mbqi
);
1223 smtStatisticsRegistry()->unregisterStat(&d_instantiations_cbqi
);
1224 smtStatisticsRegistry()->unregisterStat(&d_instantiations_rr
);
1227 eq::EqualityEngine
* QuantifiersEngine::getMasterEqualityEngine(){
1228 return d_te
->getMasterEqualityEngine();
1231 eq::EqualityEngine
* QuantifiersEngine::getActiveEqualityEngine() {
1233 return d_model
->getEqualityEngine();
1235 return d_te
->getMasterEqualityEngine();
1239 Node
QuantifiersEngine::getInternalRepresentative( Node a
, Node q
, int index
){
1240 bool prevModelEe
= d_useModelEe
;
1241 d_useModelEe
= false;
1242 Node ret
= d_eq_query
->getInternalRepresentative( a
, q
, index
);
1243 d_useModelEe
= prevModelEe
;
1247 void QuantifiersEngine::getSynthSolutions(std::map
<Node
, Node
>& sol_map
)
1249 d_ceg_inst
->getSynthSolutions(sol_map
);
1252 void QuantifiersEngine::debugPrintEqualityEngine( const char * c
) {
1253 eq::EqualityEngine
* ee
= getActiveEqualityEngine();
1254 eq::EqClassesIterator eqcs_i
= eq::EqClassesIterator( ee
);
1255 std::map
< TypeNode
, int > typ_num
;
1256 while( !eqcs_i
.isFinished() ){
1257 TNode r
= (*eqcs_i
);
1258 TypeNode tr
= r
.getType();
1259 if( typ_num
.find( tr
)==typ_num
.end() ){
1263 bool firstTime
= true;
1264 Trace(c
) << " " << r
;
1265 Trace(c
) << " : { ";
1266 eq::EqClassIterator eqc_i
= eq::EqClassIterator( r
, ee
);
1267 while( !eqc_i
.isFinished() ){
1271 Trace(c
) << std::endl
;
1274 Trace(c
) << " " << n
<< std::endl
;
1278 if( !firstTime
){ Trace(c
) << " "; }
1279 Trace(c
) << "}" << std::endl
;
1282 Trace(c
) << std::endl
;
1283 for( std::map
< TypeNode
, int >::iterator it
= typ_num
.begin(); it
!= typ_num
.end(); ++it
){
1284 Trace(c
) << "# eqc for " << it
->first
<< " : " << it
->second
<< std::endl
;