From f772f276bb8e6e13e8a24a0c94ab2ad351cc72ff Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Sat, 18 Jan 2014 12:13:47 -0600 Subject: [PATCH] Fixed non-termination issue in bounded integers. --- src/theory/quantifiers/bounded_integers.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/theory/quantifiers/bounded_integers.cpp b/src/theory/quantifiers/bounded_integers.cpp index d4faf41fe..5ad4cef92 100644 --- a/src/theory/quantifiers/bounded_integers.cpp +++ b/src/theory/quantifiers/bounded_integers.cpp @@ -104,7 +104,7 @@ Node BoundedIntegers::RangeModel::getNextDecisionRequest() { if (!d_lit_to_pol[it->first]) { rn = rn.negate(); } - Trace("bound-int-dec") << "For " << d_range << ", make decision " << rn << " to make range " << i << std::endl; + Trace("bound-int-dec-debug") << "For " << d_range << ", make decision " << rn << " to make range " << i << std::endl; return rn; } } @@ -312,11 +312,26 @@ void BoundedIntegers::assertNode( Node n ) { } Node BoundedIntegers::getNextDecisionRequest() { - Trace("bound-int-dec") << "bi: Get next decision request?" << std::endl; + Trace("bound-int-dec-debug") << "bi: Get next decision request?" << std::endl; for( unsigned i=0; igetNextDecisionRequest(); if (!d.isNull()) { - return d; + bool polLit = d.getKind()!=NOT; + Node lit = d.getKind()==NOT ? d[0] : d; + bool value; + if( d_quantEngine->getValuation().hasSatValue( lit, value ) ) { + if( value==polLit ){ + Trace("bound-int-dec-debug") << "...already asserted properly." << std::endl; + //already true, we're already fine + }else{ + Trace("bound-int-dec-debug") << "...already asserted with wrong polarity, re-assert." << std::endl; + assertNode( d.negate() ); + i--; + } + }else{ + Trace("bound-int-dec") << "Bounded Integers : Decide " << d << std::endl; + return d; + } } } return Node::null(); -- 2.30.2