diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2018-08-16 16:46:05 -0700 |
---|---|---|
committer | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2018-08-16 18:46:05 -0500 |
commit | 7fc04bf78c6c20f3711d14425469eef2e0c2cd60 (patch) | |
tree | d9f2e91a52406edf66967faccad550631cd9e4a5 /src/theory/quantifiers/sygus | |
parent | 4e62cdade61514f268b96e78e2f82ad12dfcad07 (diff) |
Move node algorithms to separate file (#2311)
Diffstat (limited to 'src/theory/quantifiers/sygus')
-rw-r--r-- | src/theory/quantifiers/sygus/ce_guided_single_inv.cpp | 26 | ||||
-rw-r--r-- | src/theory/quantifiers/sygus/ce_guided_single_inv_sol.cpp | 16 |
2 files changed, 26 insertions, 16 deletions
diff --git a/src/theory/quantifiers/sygus/ce_guided_single_inv.cpp b/src/theory/quantifiers/sygus/ce_guided_single_inv.cpp index 6a7eb8197..5f5a84a6b 100644 --- a/src/theory/quantifiers/sygus/ce_guided_single_inv.cpp +++ b/src/theory/quantifiers/sygus/ce_guided_single_inv.cpp @@ -14,6 +14,7 @@ **/ #include "theory/quantifiers/sygus/ce_guided_single_inv.h" +#include "expr/node_algorithm.h" #include "options/quantifiers_options.h" #include "theory/arith/arith_msum.h" #include "theory/quantifiers/sygus/sygus_grammar_cons.h" @@ -726,12 +727,14 @@ void TransitionInference::getConstantSubstitution( std::vector< Node >& vars, st // check if it is a variable equality TNode v; Node s; - for( unsigned r=0; r<2; r++ ){ - if( std::find( vars.begin(), vars.end(), slit[r] )!=vars.end() ){ - if (!slit[1 - r].hasSubterm(slit[r])) + for (unsigned r = 0; r < 2; r++) + { + if (std::find(vars.begin(), vars.end(), slit[r]) != vars.end()) + { + if (!expr::hasSubterm(slit[1 - r], slit[r])) { v = slit[r]; - s = slit[1-r]; + s = slit[1 - r]; break; } } @@ -741,13 +744,18 @@ void TransitionInference::getConstantSubstitution( std::vector< Node >& vars, st std::map< Node, Node > msum; if (ArithMSum::getMonomialSumLit(slit, msum)) { - for( std::map< Node, Node >::iterator itm = msum.begin(); itm != msum.end(); ++itm ){ - if( std::find( vars.begin(), vars.end(), itm->first )!=vars.end() ){ + for (std::map<Node, Node>::iterator itm = msum.begin(); + itm != msum.end(); + ++itm) + { + if (std::find(vars.begin(), vars.end(), itm->first) != vars.end()) + { Node veq_c; Node val; int ires = ArithMSum::isolate(itm->first, msum, veq_c, val, EQUAL); - if (ires != 0 && veq_c.isNull() && !val.hasSubterm(itm->first)) + if (ires != 0 && veq_c.isNull() + && !expr::hasSubterm(val, itm->first)) { v = itm->first; s = val; @@ -859,7 +867,8 @@ void TransitionInference::process( Node n ) { }else{ res = NodeManager::currentNM()->mkNode( kind::OR, disjuncts ); } - if( !res.hasBoundVar() ){ + if (!expr::hasBoundVar(res)) + { Trace("cegqi-inv") << "*** inferred " << ( comp_num==1 ? "pre" : ( comp_num==-1 ? "post" : "trans" ) ) << "-condition : " << res << std::endl; d_com[comp_num].d_conjuncts.push_back( res ); if( !const_var.empty() ){ @@ -1076,4 +1085,3 @@ Node TransitionInference::constructFormulaTrace( DetTrace& dt ) { } } //namespace CVC4 - diff --git a/src/theory/quantifiers/sygus/ce_guided_single_inv_sol.cpp b/src/theory/quantifiers/sygus/ce_guided_single_inv_sol.cpp index 44835cc26..2ee120211 100644 --- a/src/theory/quantifiers/sygus/ce_guided_single_inv_sol.cpp +++ b/src/theory/quantifiers/sygus/ce_guided_single_inv_sol.cpp @@ -15,15 +15,16 @@ #include "theory/quantifiers/sygus/ce_guided_single_inv_sol.h" #include "expr/datatype.h" +#include "expr/node_algorithm.h" #include "options/quantifiers_options.h" -#include "theory/quantifiers/sygus/ce_guided_instantiation.h" -#include "theory/quantifiers/sygus/ce_guided_single_inv.h" +#include "theory/quantifiers/ematching/trigger.h" #include "theory/quantifiers/first_order_model.h" #include "theory/quantifiers/quantifiers_attributes.h" +#include "theory/quantifiers/sygus/ce_guided_instantiation.h" +#include "theory/quantifiers/sygus/ce_guided_single_inv.h" #include "theory/quantifiers/sygus/term_database_sygus.h" #include "theory/quantifiers/term_enumeration.h" #include "theory/quantifiers/term_util.h" -#include "theory/quantifiers/ematching/trigger.h" #include "theory/theory_engine.h" using namespace CVC4::kind; @@ -294,11 +295,12 @@ bool CegConjectureSingleInvSol::getAssignEquality( Node eq, std::vector< Node >& Assert( std::find( vars.begin(), vars.end(), eq[r] )==vars.end() ); if( std::find( new_vars.begin(), new_vars.end(), eq[r] )==new_vars.end() ){ Node eqro = eq[r==0 ? 1 : 0 ]; - if (!eqro.hasSubterm(eq[r])) + if (!expr::hasSubterm(eqro, eq[r])) { - Trace("csi-simp-debug") << "---equality " << eq[r] << " = " << eqro << std::endl; - new_vars.push_back( eq[r] ); - new_subs.push_back( eqro ); + Trace("csi-simp-debug") + << "---equality " << eq[r] << " = " << eqro << std::endl; + new_vars.push_back(eq[r]); + new_subs.push_back(eqro); return true; } } |