#include "smt/smt_statistics_registry.h"
#include "theory/arith/arith_utilities.h"
#include "theory/arith/constraint.h"
-#include "theory/quantifiers/equality_infer.h"
#include "options/arith_options.h"
namespace CVC4 {
: d_inConflict(c),
d_raiseConflict(raiseConflict),
d_notify(*this),
- d_eq_infer(),
- d_eqi_counter(0, c),
d_keepAlive(c),
d_propagatations(c),
d_explanationMap(c),
d_ee.addFunctionKind(kind::NONLINEAR_MULT);
d_ee.addFunctionKind(kind::EXPONENTIAL);
d_ee.addFunctionKind(kind::SINE);
- //module to infer additional equalities based on normalization
- if( options::sNormInferEq() ){
- d_eq_infer.reset(new quantifiers::EqualityInference(c, true));
- d_true = NodeManager::currentNM()->mkConst( true );
- }
}
ArithCongruenceManager::~ArithCongruenceManager() {}
d_acm.propagate(t1.eqNode(t2));
}
void ArithCongruenceManager::ArithCongruenceNotify::eqNotifyNewClass(TNode t) {
- d_acm.eqNotifyNewClass(t);
}
void ArithCongruenceManager::ArithCongruenceNotify::eqNotifyPreMerge(TNode t1, TNode t2) {
}
void ArithCongruenceManager::ArithCongruenceNotify::eqNotifyPostMerge(TNode t1, TNode t2) {
- d_acm.eqNotifyPostMerge(t1,t2);
}
void ArithCongruenceManager::ArithCongruenceNotify::eqNotifyDisequal(TNode t1, TNode t2, TNode reason) {
}
}
}
-void ArithCongruenceManager::eqNotifyNewClass(TNode t) {
- if( d_eq_infer ){
- d_eq_infer->eqNotifyNewClass(t);
- fixpointInfer();
- }
-}
-void ArithCongruenceManager::eqNotifyPostMerge(TNode t1, TNode t2) {
- if( d_eq_infer ){
- d_eq_infer->eqNotifyMerge(t1, t2);
- fixpointInfer();
- }
-}
-
Node ArithCongruenceManager::explain(TNode external){
Trace("arith-ee") << "Ask for explanation of " << external << std::endl;
Node internal = externalToInternal(external);
d_ee.addTriggerTerm(x, THEORY_ARITH);
}
-bool ArithCongruenceManager::fixpointInfer() {
- if( d_eq_infer ){
- while(! inConflict() && d_eqi_counter.get()<d_eq_infer->getNumPendingMerges() ) {
- Trace("snorm-infer-eq-debug") << "Processing " << d_eqi_counter.get() << " / " << d_eq_infer->getNumPendingMerges() << std::endl;
- Node eq = d_eq_infer->getPendingMerge( d_eqi_counter.get() );
- Trace("snorm-infer-eq") << "ArithCongruenceManager : Infer by normalization : " << eq << std::endl;
- if( !d_ee.areEqual( eq[0], eq[1] ) ){
- Node eq_exp = d_eq_infer->getPendingMergeExplanation( d_eqi_counter.get() );
- Trace("snorm-infer-eq") << " explanation : " << eq_exp << std::endl;
- //regress explanation
- std::vector<TNode> assumptions;
- if( eq_exp.getKind()==kind::AND ){
- for( unsigned i=0; i<eq_exp.getNumChildren(); i++ ){
- explain( eq_exp[i], assumptions );
- }
- }else if( eq_exp.getKind()==kind::EQUAL ){
- explain( eq_exp, assumptions );
- }else{
- //eq_exp should be true
- Assert(eq_exp == d_true);
- }
- Node req_exp;
- if( assumptions.empty() ){
- req_exp = d_true;
- }else{
- std::set<TNode> assumptionSet;
- assumptionSet.insert(assumptions.begin(), assumptions.end());
- if( assumptionSet.size()==1 ){
- req_exp = assumptions[0];
- }else{
- NodeBuilder<> conjunction(kind::AND);
- enqueueIntoNB(assumptionSet, conjunction);
- req_exp = conjunction;
- }
- }
- Trace("snorm-infer-eq") << " regressed explanation : " << req_exp << std::endl;
- d_ee.assertEquality( eq, true, req_exp );
- d_keepAlive.push_back( req_exp );
- }else{
- Trace("snorm-infer-eq") << "...already equal." << std::endl;
- }
- d_eqi_counter = d_eqi_counter.get() + 1;
- }
- }
- return inConflict();
-}
-
}/* CVC4::theory::arith namespace */
}/* CVC4::theory namespace */
}/* CVC4 namespace */
};
ArithCongruenceNotify d_notify;
- /** module for shostak normalization, d_eqi_counter is how many pending merges
- * in d_eq_infer we have processed */
- std::unique_ptr<quantifiers::EqualityInference> d_eq_infer;
- context::CDO<unsigned> d_eqi_counter;
- Node d_true;
-
context::CDList<Node> d_keepAlive;
/** Store the propagations. */
void enqueueIntoNB(const std::set<TNode> all, NodeBuilder<>& nb);
Node explainInternal(TNode internal);
-
- void eqNotifyNewClass(TNode t);
- void eqNotifyPostMerge(TNode t1, TNode t2);
public:
ArithCongruenceManager(context::Context* satContext, ConstraintDatabase&, SetupLiteralCallBack, const ArithVariables&, RaiseEqualityEngineConflict raiseConflict);
void addSharedTerm(Node x);
-
- /** process inferred equalities based on Shostak normalization */
- bool fixpointInfer();
eq::EqualityEngine * getEqualityEngine() { return &d_ee; }
regress1/quantifiers/anti-sk-simp.smt2
regress1/quantifiers/ari118-bv-2occ-x.smt2
regress1/quantifiers/arith-rec-fun.smt2
- regress1/quantifiers/arith-snorm.smt2
regress1/quantifiers/array-unsat-simp3.smt2
regress1/quantifiers/bi-artm-s.smt2
regress1/quantifiers/bignum_quant.smt2
regress1/nl/NAVIGATION2.smt2
# sat or unknown in different builds
regress1/nl/issue3307.smt2
+ # no longer support snorm option
+ regress1/quantifiers/arith-snorm.smt2
# ajreynol: different error messages on production and debug:
regress1/quantifiers/macro-subtype-param.smt2
# times out with competition build: