* Decouple sygus term database and term database.
* Clang format
* Fix include
#include "theory/quantifiers/term_database.h"
-#include "expr/datatype.h"
#include "options/base_options.h"
#include "options/quantifiers_options.h"
-#include "options/datatypes_options.h"
#include "options/uf_options.h"
-#include "theory/quantifiers/ce_guided_instantiation.h"
-#include "theory/quantifiers/first_order_model.h"
-#include "theory/quantifiers/fun_def_engine.h"
#include "theory/quantifiers/quantifiers_attributes.h"
-#include "theory/quantifiers/rewrite_engine.h"
-#include "theory/quantifiers/theory_quantifiers.h"
-#include "theory/quantifiers/trigger.h"
-#include "theory/quantifiers/term_database_sygus.h"
#include "theory/quantifiers/term_util.h"
+#include "theory/quantifiers/trigger.h"
#include "theory/quantifiers_engine.h"
#include "theory/theory_engine.h"
d_ops.push_back(op);
d_op_map[op].push_back( n );
added.insert( n );
-
- if( d_quantEngine->getTermDatabaseSygus() ){
- d_quantEngine->getTermDatabaseSygus()->registerEvalTerm( n );
- }
}
}else{
setTermInactive( n );
void TermDbSygus::registerEvalTerm( Node n ) {
if( options::sygusDirectEval() ){
if( n.getKind()==APPLY_UF && !n.getType().isBoolean() ){
- Trace("sygus-eager") << "TermDbSygus::eager: Register eval term : " << n
- << std::endl;
TypeNode tn = n[0].getType();
if( tn.isDatatype() ){
const Datatype& dt = ((DatatypeType)(tn).toType()).getDatatype();
if( dt.isSygus() ){
Node f = n.getOperator();
- Trace("sygus-eager") << "...the evaluation function is : " << f << std::endl;
if( n[0].getKind()!=APPLY_CONSTRUCTOR ){
- d_evals[n[0]].push_back( n );
- TypeNode tn = n[0].getType();
- Assert( tn.isDatatype() );
- const Datatype& dt = ((DatatypeType)(tn).toType()).getDatatype();
- Node var_list = Node::fromExpr( dt.getSygusVarList() );
- Assert( dt.isSygus() );
- d_eval_args[n[0]].push_back( std::vector< Node >() );
- bool isConst = true;
- for( unsigned j=1; j<n.getNumChildren(); j++ ){
- d_eval_args[n[0]].back().push_back( n[j] );
- if( !n[j].isConst() ){
- isConst = false;
+ if (d_eval_processed.find(n) == d_eval_processed.end())
+ {
+ Trace("sygus-eager")
+ << "TermDbSygus::eager: Register eval term : " << n
+ << std::endl;
+ d_eval_processed.insert(n);
+ d_evals[n[0]].push_back(n);
+ TypeNode tn = n[0].getType();
+ Assert(tn.isDatatype());
+ const Datatype& dt = ((DatatypeType)(tn).toType()).getDatatype();
+ Node var_list = Node::fromExpr(dt.getSygusVarList());
+ Assert(dt.isSygus());
+ d_eval_args[n[0]].push_back(std::vector<Node>());
+ bool isConst = true;
+ for (unsigned j = 1; j < n.getNumChildren(); j++)
+ {
+ d_eval_args[n[0]].back().push_back(n[j]);
+ if (!n[j].isConst())
+ {
+ isConst = false;
+ }
}
+ d_eval_args_const[n[0]].push_back(isConst);
+ Node a = getAnchor(n[0]);
+ d_subterms[a][n[0]] = true;
}
- d_eval_args_const[n[0]].push_back( isConst );
- Node a = getAnchor( n[0] );
- d_subterms[a][n[0]] = true;
}
}
}
#ifndef __CVC4__THEORY__QUANTIFIERS__TERM_DATABASE_SYGUS_H
#define __CVC4__THEORY__QUANTIFIERS__TERM_DATABASE_SYGUS_H
+#include <unordered_set>
+
#include "theory/quantifiers/sygus_explain.h"
#include "theory/quantifiers/term_database.h"
//for eager instantiation
// TODO (as part of #1235) move some of these functions to sygus_explain.h
private:
+ /** the set of evaluation terms we have already processed */
+ std::unordered_set<Node, NodeHashFunction> d_eval_processed;
std::map< Node, std::map< Node, bool > > d_subterms;
std::map< Node, std::vector< Node > > d_evals;
std::map< Node, std::vector< std::vector< Node > > > d_eval_args;
std::set< Node > added;
d_term_db->addTerm(n, added, withinQuant, withinInstClosure);
- //added contains also the Node that just have been asserted in this branch
- if( d_quant_rel ){
- for( std::set< Node >::iterator i=added.begin(), end=added.end(); i!=end; i++ ){
- if( !withinQuant ){
+ if (!withinQuant)
+ {
+ if (d_sygus_tdb)
+ {
+ d_sygus_tdb->registerEvalTerm(n);
+ }
+
+ // added contains also the Node that just have been asserted in this
+ // branch
+ if (d_quant_rel)
+ {
+ for (std::set<Node>::iterator i = added.begin(), end = added.end();
+ i != end;
+ i++)
+ {
d_quant_rel->setRelevance( i->getOperator(), 0 );
}
}