Making the ExtTheory object a private member of Theory.
[cvc5.git] / src / theory / theory.cpp
1 /********************* */
2 /*! \file theory.cpp
3 ** \verbatim
4 ** Top contributors (to current version):
5 ** Tim King, Dejan Jovanovic, Clark Barrett
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2016 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
11 **
12 ** \brief Base for theory interface.
13 **
14 ** Base for theory interface.
15 **/
16
17 #include "theory/theory.h"
18
19 #include <vector>
20 #include <sstream>
21 #include <iostream>
22 #include <string>
23
24 #include "base/cvc4_assert.h"
25 #include "smt/smt_statistics_registry.h"
26 #include "theory/substitutions.h"
27 #include "theory/quantifiers_engine.h"
28
29
30 using namespace std;
31
32 namespace CVC4 {
33 namespace theory {
34
35 /** Default value for the uninterpreted sorts is the UF theory */
36 TheoryId Theory::s_uninterpretedSortOwner = THEORY_UF;
37
38 std::ostream& operator<<(std::ostream& os, Theory::Effort level){
39 switch(level){
40 case Theory::EFFORT_STANDARD:
41 os << "EFFORT_STANDARD"; break;
42 case Theory::EFFORT_FULL:
43 os << "EFFORT_FULL"; break;
44 case Theory::EFFORT_COMBINATION:
45 os << "EFFORT_COMBINATION"; break;
46 case Theory::EFFORT_LAST_CALL:
47 os << "EFFORT_LAST_CALL"; break;
48 default:
49 Unreachable();
50 }
51 return os;
52 }/* ostream& operator<<(ostream&, Theory::Effort) */
53
54
55 Theory::Theory(TheoryId id, context::Context* satContext,
56 context::UserContext* userContext, OutputChannel& out,
57 Valuation valuation, const LogicInfo& logicInfo,
58 std::string name) throw()
59 : d_id(id)
60 , d_instanceName(name)
61 , d_satContext(satContext)
62 , d_userContext(userContext)
63 , d_logicInfo(logicInfo)
64 , d_facts(satContext)
65 , d_factsHead(satContext, 0)
66 , d_sharedTermsIndex(satContext, 0)
67 , d_careGraph(NULL)
68 , d_quantEngine(NULL)
69 , d_extTheory(NULL)
70 , d_checkTime(getFullInstanceName() + "::checkTime")
71 , d_computeCareGraphTime(getFullInstanceName() + "::computeCareGraphTime")
72 , d_sharedTerms(satContext)
73 , d_out(&out)
74 , d_valuation(valuation)
75 , d_proofsEnabled(false)
76 {
77 smtStatisticsRegistry()->registerStat(&d_checkTime);
78 smtStatisticsRegistry()->registerStat(&d_computeCareGraphTime);
79 }
80
81 Theory::~Theory() {
82 smtStatisticsRegistry()->unregisterStat(&d_checkTime);
83 smtStatisticsRegistry()->unregisterStat(&d_computeCareGraphTime);
84
85 delete d_extTheory;
86 }
87
88 TheoryId Theory::theoryOf(TheoryOfMode mode, TNode node) {
89 TheoryId tid = THEORY_BUILTIN;
90 switch(mode) {
91 case THEORY_OF_TYPE_BASED:
92 // Constants, variables, 0-ary constructors
93 if (node.isVar()) {
94 if( node.getKind() == kind::BOOLEAN_TERM_VARIABLE ){
95 tid = THEORY_UF;
96 }else{
97 tid = Theory::theoryOf(node.getType());
98 }
99 }else if (node.isConst()) {
100 tid = Theory::theoryOf(node.getType());
101 } else if (node.getKind() == kind::EQUAL) {
102 // Equality is owned by the theory that owns the domain
103 tid = Theory::theoryOf(node[0].getType());
104 } else {
105 // Regular nodes are owned by the kind
106 tid = kindToTheoryId(node.getKind());
107 }
108 break;
109 case THEORY_OF_TERM_BASED:
110 // Variables
111 if (node.isVar()) {
112 if (Theory::theoryOf(node.getType()) != theory::THEORY_BOOL) {
113 // We treat the variables as uninterpreted
114 tid = s_uninterpretedSortOwner;
115 } else {
116 if( node.getKind() == kind::BOOLEAN_TERM_VARIABLE ){
117 //Boolean vars go to UF
118 tid = THEORY_UF;
119 }else{
120 // Except for the Boolean ones
121 tid = THEORY_BOOL;
122 }
123 }
124 } else if (node.isConst()) {
125 // Constants go to the theory of the type
126 tid = Theory::theoryOf(node.getType());
127 } else if (node.getKind() == kind::EQUAL) { // Equality
128 // If one of them is an ITE, it's irelevant, since they will get replaced out anyhow
129 if (node[0].getKind() == kind::ITE) {
130 tid = Theory::theoryOf(node[0].getType());
131 } else if (node[1].getKind() == kind::ITE) {
132 tid = Theory::theoryOf(node[1].getType());
133 } else {
134 TNode l = node[0];
135 TNode r = node[1];
136 TypeNode ltype = l.getType();
137 TypeNode rtype = r.getType();
138 if( ltype != rtype ){
139 tid = Theory::theoryOf(l.getType());
140 }else {
141 // If both sides belong to the same theory the choice is easy
142 TheoryId T1 = Theory::theoryOf(l);
143 TheoryId T2 = Theory::theoryOf(r);
144 if (T1 == T2) {
145 tid = T1;
146 } else {
147 TheoryId T3 = Theory::theoryOf(ltype);
148 // This is a case of
149 // * x*y = f(z) -> UF
150 // * x = c -> UF
151 // * f(x) = read(a, y) -> either UF or ARRAY
152 // at least one of the theories has to be parametric, i.e. theory of the type is different
153 // from the theory of the term
154 if (T1 == T3) {
155 tid = T2;
156 } else if (T2 == T3) {
157 tid = T1;
158 } else {
159 // If both are parametric, we take the smaller one (arbitrary)
160 tid = T1 < T2 ? T1 : T2;
161 }
162 }
163 }
164 }
165 } else {
166 // Regular nodes are owned by the kind
167 tid = kindToTheoryId(node.getKind());
168 }
169 break;
170 default:
171 Unreachable();
172 }
173 Trace("theory::internal") << "theoryOf(" << mode << ", " << node << ") -> " << tid << std::endl;
174 return tid;
175 }
176
177 void Theory::addSharedTermInternal(TNode n) {
178 Debug("sharing") << "Theory::addSharedTerm<" << getId() << ">(" << n << ")" << endl;
179 Debug("theory::assertions") << "Theory::addSharedTerm<" << getId() << ">(" << n << ")" << endl;
180 d_sharedTerms.push_back(n);
181 addSharedTerm(n);
182 }
183
184 void Theory::computeCareGraph() {
185 Debug("sharing") << "Theory::computeCareGraph<" << getId() << ">()" << endl;
186 for (unsigned i = 0; i < d_sharedTerms.size(); ++ i) {
187 TNode a = d_sharedTerms[i];
188 TypeNode aType = a.getType();
189 for (unsigned j = i + 1; j < d_sharedTerms.size(); ++ j) {
190 TNode b = d_sharedTerms[j];
191 if (b.getType() != aType) {
192 // We don't care about the terms of different types
193 continue;
194 }
195 switch (d_valuation.getEqualityStatus(a, b)) {
196 case EQUALITY_TRUE_AND_PROPAGATED:
197 case EQUALITY_FALSE_AND_PROPAGATED:
198 // If we know about it, we should have propagated it, so we can skip
199 break;
200 default:
201 // Let's split on it
202 addCarePair(a, b);
203 break;
204 }
205 }
206 }
207 }
208
209 void Theory::printFacts(std::ostream& os) const {
210 unsigned i, n = d_facts.size();
211 for(i = 0; i < n; i++){
212 const Assertion& a_i = d_facts[i];
213 Node assertion = a_i;
214 os << d_id << '[' << i << ']' << " " << assertion << endl;
215 }
216 }
217
218 void Theory::debugPrintFacts() const{
219 DebugChannel.getStream() << "Theory::debugPrintFacts()" << endl;
220 printFacts(DebugChannel.getStream());
221 }
222
223 std::hash_set<TNode, TNodeHashFunction> Theory::currentlySharedTerms() const{
224 std::hash_set<TNode, TNodeHashFunction> currentlyShared;
225 for (shared_terms_iterator i = shared_terms_begin(),
226 i_end = shared_terms_end(); i != i_end; ++i) {
227 currentlyShared.insert (*i);
228 }
229 return currentlyShared;
230 }
231
232
233 void Theory::collectTerms(TNode n, set<Node>& termSet) const
234 {
235 if (termSet.find(n) != termSet.end()) {
236 return;
237 }
238 Trace("theory::collectTerms") << "Theory::collectTerms: adding " << n << endl;
239 termSet.insert(n);
240 if (n.getKind() == kind::NOT || n.getKind() == kind::EQUAL || !isLeaf(n)) {
241 for(TNode::iterator child_it = n.begin(); child_it != n.end(); ++child_it) {
242 collectTerms(*child_it, termSet);
243 }
244 }
245 }
246
247
248 void Theory::computeRelevantTerms(set<Node>& termSet, bool includeShared) const
249 {
250 // Collect all terms appearing in assertions
251 context::CDList<Assertion>::const_iterator assert_it = facts_begin(), assert_it_end = facts_end();
252 for (; assert_it != assert_it_end; ++assert_it) {
253 collectTerms(*assert_it, termSet);
254 }
255
256 if (!includeShared) return;
257
258 // Add terms that are shared terms
259 context::CDList<TNode>::const_iterator shared_it = shared_terms_begin(), shared_it_end = shared_terms_end();
260 for (; shared_it != shared_it_end; ++shared_it) {
261 collectTerms(*shared_it, termSet);
262 }
263 }
264
265
266 Theory::PPAssertStatus Theory::ppAssert(TNode in,
267 SubstitutionMap& outSubstitutions)
268 {
269 if (in.getKind() == kind::EQUAL) {
270 // (and (= x t) phi) can be replaced by phi[x/t] if
271 // 1) x is a variable
272 // 2) x is not in the term t
273 // 3) x : T and t : S, then S <: T
274 if (in[0].isVar() && !in[1].hasSubterm(in[0]) &&
275 (in[1].getType()).isSubtypeOf(in[0].getType()) ){
276 outSubstitutions.addSubstitution(in[0], in[1]);
277 return PP_ASSERT_STATUS_SOLVED;
278 }
279 if (in[1].isVar() && !in[0].hasSubterm(in[1]) &&
280 (in[0].getType()).isSubtypeOf(in[1].getType())){
281 outSubstitutions.addSubstitution(in[1], in[0]);
282 return PP_ASSERT_STATUS_SOLVED;
283 }
284 if (in[0].isConst() && in[1].isConst()) {
285 if (in[0] != in[1]) {
286 return PP_ASSERT_STATUS_CONFLICT;
287 }
288 }
289 }
290
291 return PP_ASSERT_STATUS_UNSOLVED;
292 }
293
294 std::pair<bool, Node> Theory::entailmentCheck(
295 TNode lit,
296 const EntailmentCheckParameters* params,
297 EntailmentCheckSideEffects* out) {
298 return make_pair(false, Node::null());
299 }
300
301 ExtTheory* Theory::getExtTheory() {
302 Assert(d_extTheory != NULL);
303 return d_extTheory;
304 }
305
306 void Theory::addCarePair(TNode t1, TNode t2) {
307 if (d_careGraph) {
308 d_careGraph->insert(CarePair(t1, t2, d_id));
309 }
310 }
311
312 void Theory::getCareGraph(CareGraph* careGraph) {
313 Assert(careGraph != NULL);
314
315 Trace("sharing") << "Theory<" << getId() << ">::getCareGraph()" << std::endl;
316 TimerStat::CodeTimer computeCareGraphTime(d_computeCareGraphTime);
317 d_careGraph = careGraph;
318 computeCareGraph();
319 d_careGraph = NULL;
320 }
321
322 void Theory::setQuantifiersEngine(QuantifiersEngine* qe) {
323 Assert(d_quantEngine == NULL);
324 Assert(qe != NULL);
325 d_quantEngine = qe;
326 }
327
328 void Theory::setupExtTheory() {
329 Assert(d_extTheory == NULL);
330 d_extTheory = new ExtTheory(this);
331 }
332
333
334 EntailmentCheckParameters::EntailmentCheckParameters(TheoryId tid)
335 : d_tid(tid) {
336 }
337
338 std::string Theory::getFullInstanceName() const {
339 std::stringstream ss;
340 ss << "theory<" << d_id << ">" << d_instanceName;
341 return ss.str();
342 }
343
344 EntailmentCheckParameters::~EntailmentCheckParameters(){}
345
346 TheoryId EntailmentCheckParameters::getTheoryId() const {
347 return d_tid;
348 }
349
350 EntailmentCheckSideEffects::EntailmentCheckSideEffects(TheoryId tid)
351 : d_tid(tid)
352 {}
353
354 TheoryId EntailmentCheckSideEffects::getTheoryId() const {
355 return d_tid;
356 }
357
358 EntailmentCheckSideEffects::~EntailmentCheckSideEffects() {
359 }
360
361
362 ExtTheory::ExtTheory( Theory * p ) : d_parent( p ),
363 d_ext_func_terms( p->getSatContext() ), d_ci_inactive( p->getUserContext() ),
364 d_lemmas( p->getUserContext() ), d_pp_lemmas( p->getUserContext() ), d_has_extf( p->getSatContext() ){
365 d_true = NodeManager::currentNM()->mkConst( true );
366 }
367
368 //gets all leaf terms in n
369 void ExtTheory::collectVars( Node n, std::vector< Node >& vars, std::map< Node, bool >& visited ) {
370 if( !n.isConst() ){
371 if( visited.find( n )==visited.end() ){
372 visited[n] = true;
373 //treat terms not belonging to this theory as leaf
374 // AJR TODO : should include terms not belonging to this theory (commented below)
375 if( n.getNumChildren()>0 ){//&& Theory::theoryOf(n)==d_parent->getId() ){
376 for( unsigned i=0; i<n.getNumChildren(); i++ ){
377 collectVars( n[i], vars, visited );
378 }
379 }else{
380 vars.push_back( n );
381 }
382 }
383 }
384 }
385
386 //do inferences
387 void ExtTheory::getSubstitutedTerms( int effort, std::vector< Node >& terms, std::vector< Node >& sterms, std::vector< std::vector< Node > >& exp ) {
388 Trace("extt-debug") << "Currently " << d_ext_func_terms.size() << " extended functions." << std::endl;
389 Trace("extt-debug") << "..." << terms.size() << " to reduce." << std::endl;
390 if( !terms.empty() ){
391 //all variables we need to find a substitution for
392 std::vector< Node > vars;
393 std::vector< Node > sub;
394 std::map< Node, std::vector< Node > > expc;
395 for( unsigned i=0; i<terms.size(); i++ ){
396 //do substitution, rewrite
397 Node n = terms[i];
398 std::map< Node, ExtfInfo >::iterator iti = d_extf_info.find( n );
399 Trace("extt-debug") << "Check extf : " << n << std::endl;
400 Assert( iti!=d_extf_info.end() );
401 for( unsigned i=0; i<iti->second.d_vars.size(); i++ ){
402 if( std::find( vars.begin(), vars.end(), iti->second.d_vars[i] )==vars.end() ){
403 vars.push_back( iti->second.d_vars[i] );
404 }
405 }
406 }
407 //get the current substitution for all variables
408 if( d_parent->getCurrentSubstitution( effort, vars, sub, expc ) ){
409 Assert( vars.size()==sub.size() );
410 for( unsigned i=0; i<terms.size(); i++ ){
411 //do substitution
412 Node n = terms[i];
413 Node ns = n.substitute( vars.begin(), vars.end(), sub.begin(), sub.end() );
414 std::vector< Node > expn;
415 if( ns!=n ){
416 //build explanation: explanation vars = sub for each vars in FV( n )
417 std::map< Node, ExtfInfo >::iterator iti = d_extf_info.find( n );
418 Assert( iti!=d_extf_info.end() );
419 for( unsigned j=0; j<iti->second.d_vars.size(); j++ ){
420 Node v = iti->second.d_vars[j];
421 std::map< Node, std::vector< Node > >::iterator itx = expc.find( v );
422 if( itx!=expc.end() ){
423 for( unsigned k=0; k<itx->second.size(); k++ ){
424 if( std::find( expn.begin(), expn.end(), itx->second[k] )==expn.end() ){
425 expn.push_back( itx->second[k] );
426 }
427 }
428 }
429 }
430 }
431 Trace("extt-debug") << " have " << n << " == " << ns << ", exp size=" << expn.size() << "." << std::endl;
432 //add to vector
433 sterms.push_back( ns );
434 exp.push_back( expn );
435 }
436 }else{
437 for( unsigned i=0; i<terms.size(); i++ ){
438 sterms.push_back( terms[i] );
439 }
440 }
441 }
442 }
443
444 bool ExtTheory::doInferencesInternal( int effort, std::vector< Node >& terms, std::vector< Node >& nred, bool batch, bool isRed ) {
445 if( batch ){
446 bool addedLemma = false;
447 if( isRed ){
448 for( unsigned i=0; i<terms.size(); i++ ){
449 Node n = terms[i];
450 Node nr;
451 //TODO: reduction with substitution?
452 int ret = d_parent->getReduction( effort, n, nr );
453 if( ret==0 ){
454 nred.push_back( n );
455 }else{
456 if( !nr.isNull() && n!=nr ){
457 Node lem = NodeManager::currentNM()->mkNode( kind::EQUAL, n, nr );
458 if( sendLemma( lem, true ) ){
459 Trace("extt-lemma") << "ExtTheory : Reduction lemma : " << lem << std::endl;
460 addedLemma = true;
461 }
462 }
463 markReduced( terms[i], ret<0 );
464 }
465 }
466 }else{
467 std::vector< Node > sterms;
468 std::vector< std::vector< Node > > exp;
469 getSubstitutedTerms( effort, terms, sterms, exp );
470 for( unsigned i=0; i<terms.size(); i++ ){
471 bool processed = false;
472 if( sterms[i]!=terms[i] ){
473 Node sr = Rewriter::rewrite( sterms[i] );
474 if( sr.isConst() ){
475 processed = true;
476 markReduced( terms[i] );
477 Node eq = terms[i].eqNode( sr );
478 Node expn = exp[i].size()>1 ? NodeManager::currentNM()->mkNode( kind::AND, exp[i] ) : ( exp[i].size()==1 ? exp[i][0] : d_true );
479 Trace("extt-debug") << "ExtTheory::doInferences : infer : " << eq << " by " << expn << std::endl;
480 Node lem = NodeManager::currentNM()->mkNode( kind::IMPLIES, expn, eq );
481 Trace("extt-debug") << "...send lemma " << lem << std::endl;
482 if( sendLemma( lem ) ){
483 Trace("extt-lemma") << "ExtTheory : Constant rewrite lemma : " << lem << std::endl;
484 addedLemma = true;
485 }
486 }
487 }
488 if( !processed ){
489 nred.push_back( terms[i] );
490 }
491 }
492 }
493 return addedLemma;
494 }else{
495 std::vector< Node > nnred;
496 if( terms.empty() ){
497 for( NodeBoolMap::iterator it = d_ext_func_terms.begin(); it != d_ext_func_terms.end(); ++it ){
498 if( (*it).second && !isContextIndependentInactive( (*it).first ) ){
499 std::vector< Node > nterms;
500 nterms.push_back( (*it).first );
501 if( doInferencesInternal( effort, nterms, nnred, true, isRed ) ){
502 return true;
503 }
504 }
505 }
506 }else{
507 for( unsigned i=0; i<terms.size(); i++ ){
508 std::vector< Node > nterms;
509 nterms.push_back( terms[i] );
510 if( doInferencesInternal( effort, nterms, nnred, true, isRed ) ){
511 return true;
512 }
513 }
514 }
515 return false;
516 }
517 }
518
519 bool ExtTheory::sendLemma( Node lem, bool preprocess ) {
520 if( preprocess ){
521 if( d_pp_lemmas.find( lem )==d_pp_lemmas.end() ){
522 d_pp_lemmas.insert( lem );
523 d_parent->getOutputChannel().lemma( lem, false, true );
524 return true;
525 }
526 }else{
527 if( d_lemmas.find( lem )==d_lemmas.end() ){
528 d_lemmas.insert( lem );
529 d_parent->getOutputChannel().lemma( lem );
530 return true;
531 }
532 }
533 return false;
534 }
535
536 bool ExtTheory::doInferences( int effort, std::vector< Node >& terms, std::vector< Node >& nred, bool batch ) {
537 if( !terms.empty() ){
538 return doInferencesInternal( effort, terms, nred, batch, false );
539 }else{
540 return false;
541 }
542 }
543
544 bool ExtTheory::doInferences( int effort, std::vector< Node >& nred, bool batch ) {
545 std::vector< Node > terms;
546 getActive( terms );
547 return doInferencesInternal( effort, terms, nred, batch, false );
548 }
549
550 bool ExtTheory::doReductions( int effort, std::vector< Node >& terms, std::vector< Node >& nred, bool batch ) {
551 if( !terms.empty() ){
552 return doInferencesInternal( effort, terms, nred, batch, true );
553 }else{
554 return false;
555 }
556 }
557
558 bool ExtTheory::doReductions( int effort, std::vector< Node >& nred, bool batch ) {
559 std::vector< Node > terms;
560 getActive( terms );
561 return doInferencesInternal( effort, terms, nred, batch, true );
562 }
563
564
565 //register term
566 void ExtTheory::registerTerm( Node n ) {
567 if( d_extf_kind.find( n.getKind() )!=d_extf_kind.end() ){
568 if( d_ext_func_terms.find( n )==d_ext_func_terms.end() ){
569 Trace("extt-debug") << "Found extended function : " << n << " in " << d_parent->getId() << std::endl;
570 d_ext_func_terms[n] = true;
571 d_has_extf = n;
572 std::map< Node, bool > visited;
573 collectVars( n, d_extf_info[n].d_vars, visited );
574 }
575 }
576 }
577
578 void ExtTheory::registerTermRec( Node n ) {
579 std::map< Node, bool > visited;
580 registerTermRec( n, visited );
581 }
582
583 void ExtTheory::registerTermRec( Node n, std::map< Node, bool >& visited ) {
584 if( visited.find( n )==visited.end() ){
585 visited[n] = true;
586 registerTerm( n );
587 for( unsigned i=0; i<n.getNumChildren(); i++ ){
588 registerTermRec( n[i], visited );
589 }
590 }
591 }
592
593 //mark reduced
594 void ExtTheory::markReduced( Node n, bool contextDepend ) {
595 registerTerm( n );
596 Assert( d_ext_func_terms.find( n )!=d_ext_func_terms.end() );
597 d_ext_func_terms[n] = false;
598 if( !contextDepend ){
599 d_ci_inactive.insert( n );
600 }
601
602 //update has_extf
603 if( d_has_extf.get()==n ){
604 for( NodeBoolMap::iterator it = d_ext_func_terms.begin(); it != d_ext_func_terms.end(); ++it ){
605 //if not already reduced
606 if( (*it).second && !isContextIndependentInactive( (*it).first ) ){
607 d_has_extf = (*it).first;
608 }
609 }
610
611 }
612 }
613
614 //mark congruent
615 void ExtTheory::markCongruent( Node a, Node b ) {
616 Trace("extt-debug") << "Mark congruent : " << a << " " << b << std::endl;
617 registerTerm( a );
618 registerTerm( b );
619 NodeBoolMap::const_iterator it = d_ext_func_terms.find( b );
620 if( it!=d_ext_func_terms.end() ){
621 if( d_ext_func_terms.find( a )!=d_ext_func_terms.end() ){
622 d_ext_func_terms[a] = d_ext_func_terms[a] && (*it).second;
623 }else{
624 Assert( false );
625 }
626 d_ext_func_terms[b] = false;
627 }else{
628 Assert( false );
629 }
630 }
631
632 bool ExtTheory::isContextIndependentInactive( Node n ) {
633 return d_ci_inactive.find( n )!=d_ci_inactive.end();
634 }
635
636 bool ExtTheory::hasActiveTerm() {
637 return !d_has_extf.get().isNull();
638 }
639
640 //is active
641 bool ExtTheory::isActive( Node n ) {
642 NodeBoolMap::const_iterator it = d_ext_func_terms.find( n );
643 if( it!=d_ext_func_terms.end() ){
644 return (*it).second && !isContextIndependentInactive( n );
645 }else{
646 return false;
647 }
648 }
649 //get active
650 void ExtTheory::getActive( std::vector< Node >& active ) {
651 for( NodeBoolMap::iterator it = d_ext_func_terms.begin(); it != d_ext_func_terms.end(); ++it ){
652 //if not already reduced
653 if( (*it).second && !isContextIndependentInactive( (*it).first ) ){
654 active.push_back( (*it).first );
655 }
656 }
657 }
658
659 void ExtTheory::getActive( std::vector< Node >& active, Kind k ) {
660 for( NodeBoolMap::iterator it = d_ext_func_terms.begin(); it != d_ext_func_terms.end(); ++it ){
661 //if not already reduced
662 if( (*it).first.getKind()==k && (*it).second && !isContextIndependentInactive( (*it).first ) ){
663 active.push_back( (*it).first );
664 }
665 }
666 }
667
668 }/* CVC4::theory namespace */
669 }/* CVC4 namespace */