summaryrefslogtreecommitdiff
path: root/src/theory/quantifiers_engine.cpp
diff options
context:
space:
mode:
authorajreynol <andrew.j.reynolds@gmail.com>2016-08-31 17:44:42 -0500
committerajreynol <andrew.j.reynolds@gmail.com>2016-09-01 09:46:59 -0500
commit2cadfe31cfddaff7eff4cd220273d0bab3d2792d (patch)
tree5a519bf9fe2da10e03ec2a4faf167c09ae1792f7 /src/theory/quantifiers_engine.cpp
parent07c4b6c27aac497c74695dd559adfee0d9e8e83f (diff)
Updates to cbqi. New strategy --cbqi-nested-qe to do qe on nested quantifiers during instantiation. Decide on innermost ce lits first, register nested counterexample lemmas eagerly.
Diffstat (limited to 'src/theory/quantifiers_engine.cpp')
-rw-r--r--src/theory/quantifiers_engine.cpp44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/theory/quantifiers_engine.cpp b/src/theory/quantifiers_engine.cpp
index 603f6f5fd..57eb375d3 100644
--- a/src/theory/quantifiers_engine.cpp
+++ b/src/theory/quantifiers_engine.cpp
@@ -141,7 +141,7 @@ QuantifiersEngine::QuantifiersEngine(context::Context* c, context::UserContext*
d_rel_dom = NULL;
d_builder = NULL;
- d_trackInstLemmas = options::proof() && options::trackInstLemmas();
+ d_trackInstLemmas = options::cbqiNestedQE() || ( options::proof() && options::trackInstLemmas() );
d_total_inst_count_debug = 0;
//allow theory combination to go first, once initially
@@ -627,6 +627,7 @@ void QuantifiersEngine::notifyCombineTheories() {
}
bool QuantifiersEngine::reduceQuantifier( Node q ) {
+ //TODO: this can be unified with preregistration: AlphaEquivalence takes ownership of reducable quants
BoolMap::const_iterator it = d_quants_red.find( q );
if( it==d_quants_red.end() ){
Node lem;
@@ -733,7 +734,7 @@ void QuantifiersEngine::assertQuantifier( Node f, bool pol ){
//register the quantifier, assert it to each module
if( registerQuantifier( f ) ){
d_model->assertQuantifier( f );
- for( int i=0; i<(int)d_modules.size(); i++ ){
+ for( unsigned i=0; i<d_modules.size(); i++ ){
d_modules[i]->assertNode( f );
}
addTermToDatabase( d_term_db->getInstConstantBody( f ), true );
@@ -1138,6 +1139,9 @@ bool QuantifiersEngine::addInstantiation( Node q, std::vector< Node >& terms, bo
Assert( d_term_db->d_vars[q].size()==terms.size() );
Node body = getInstantiation( q, d_term_db->d_vars[q], terms, doVts ); //do virtual term substitution
Node orig_body = body;
+ if( options::cbqiNestedQE() && d_i_cbqi ){
+ body = d_i_cbqi->doNestedQE( q, terms, body, doVts );
+ }
body = quantifiers::QuantifiersRewriter::preprocess( body, true );
Trace("inst-debug") << "...preprocess to " << body << std::endl;
@@ -1443,6 +1447,42 @@ void QuantifiersEngine::getInstantiations( std::map< Node, std::vector< Node > >
}
}
+void QuantifiersEngine::getInstantiations( Node q, std::vector< Node >& insts ) {
+ if( options::incrementalSolving() ){
+ std::map< Node, inst::CDInstMatchTrie* >::iterator it = d_c_inst_match_trie.find( q );
+ if( it!=d_c_inst_match_trie.end() ){
+ std::vector< Node > active_lemmas;
+ it->second->getInstantiations( insts, it->first, this, false, active_lemmas );
+ }
+ }else{
+ std::map< Node, inst::InstMatchTrie >::iterator it = d_inst_match_trie.find( q );
+ if( it!=d_inst_match_trie.end() ){
+ std::vector< Node > active_lemmas;
+ it->second.getInstantiations( insts, it->first, this, false, active_lemmas );
+ }
+ }
+}
+
+Node QuantifiersEngine::getInstantiatedConjunction( Node q ) {
+ std::vector< Node > insts;
+ getInstantiations( q, insts );
+ if( insts.empty() ){
+ return NodeManager::currentNM()->mkConst(true);
+ }else{
+ Node ret;
+ if( insts.size()==1 ){
+ ret = insts[0];
+ }else{
+ ret = NodeManager::currentNM()->mkNode( kind::AND, insts );
+ }
+ //have to remove q, TODO: avoid this in a better way
+ TNode tq = q;
+ TNode tt = d_term_db->d_true;
+ ret = ret.substitute( tq, tt );
+ return ret;
+ }
+}
+
QuantifiersEngine::Statistics::Statistics()
: d_time("theory::QuantifiersEngine::time"),
d_num_quant("QuantifiersEngine::Num_Quantifiers", 0),
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback