Fix relevant domain for datatypes, fixes bug 824.
authorajreynol <andrew.j.reynolds@gmail.com>
Thu, 15 Jun 2017 15:49:51 +0000 (10:49 -0500)
committerajreynol <andrew.j.reynolds@gmail.com>
Thu, 15 Jun 2017 15:49:51 +0000 (10:49 -0500)
src/theory/quantifiers/inst_strategy_e_matching.cpp
src/theory/quantifiers/relevant_domain.cpp

index a197e057efb598a329e32a3451f100ee4f461235..2cef4f6a1a1b88459fa3401fb782b6c00106ea21 100644 (file)
@@ -671,7 +671,9 @@ bool FullSaturation::process( Node f, bool fullEffort ){
         Trace("inst-alg") << "-> Ground term instantiate " << f << "..." << std::endl;
       }
       Assert( rd!=NULL );
+      Trace("inst-alg-debug") << "Compute relevant domain..." << std::endl;
       rd->compute();
+      Trace("inst-alg-debug") << "...finished" << std::endl;
       unsigned final_max_i = 0;
       std::vector< unsigned > maxs;
       std::vector< bool > max_zero;
index f7bac23e2ec378c0861664dd04d146a8906c294f..63231dec7fc60f2ccf8ed339c24ad94a16a7e654 100644 (file)
@@ -152,6 +152,7 @@ void RelevantDomain::compute(){
 }
 
 void RelevantDomain::computeRelevantDomain( Node q, Node n, bool hasPol, bool pol ) {
+  Trace("rel-dom-debug") << "Compute relevant domain " << n << "..." << std::endl;
   Node op = d_qe->getTermDatabase()->getMatchOperator( n );
   for( unsigned i=0; i<n.getNumChildren(); i++ ){
     if( !op.isNull() ){
@@ -191,6 +192,7 @@ void RelevantDomain::computeRelevantDomain( Node q, Node n, bool hasPol, bool po
       }
     }
   }
+  Trace("rel-dom-debug") << "...finished Compute relevant domain " << n << std::endl;
 }
 
 void RelevantDomain::computeRelevantDomainOpCh( RDomain * rf, Node n ) {
@@ -238,43 +240,45 @@ void RelevantDomain::computeRelevantDomainLit( Node q, bool hasPol, bool pol, No
         d_rel_dom_lit[hasPol][pol][n].d_rd[1] = NULL;
       }else{
         //solve the inequality for one/two variables, if possible
-        std::map< Node, Node > msum;
-        if( QuantArith::getMonomialSumLit( n, msum ) ){
-          Node var;
-          Node var2;
-          bool hasNonVar = false;
-          for( std::map< Node, Node >::iterator it = msum.begin(); it != msum.end(); ++it ){
-            if( !it->first.isNull() && it->first.getKind()==INST_CONSTANT ){
-              if( var.isNull() ){
-                var = it->first;
-              }else if( var2.isNull() ){
-                var2 = it->first;
+        if( n[0].getType().isReal() ){
+          std::map< Node, Node > msum;
+          if( QuantArith::getMonomialSumLit( n, msum ) ){
+            Node var;
+            Node var2;
+            bool hasNonVar = false;
+            for( std::map< Node, Node >::iterator it = msum.begin(); it != msum.end(); ++it ){
+              if( !it->first.isNull() && it->first.getKind()==INST_CONSTANT ){
+                if( var.isNull() ){
+                  var = it->first;
+                }else if( var2.isNull() ){
+                  var2 = it->first;
+                }else{
+                  hasNonVar = true;
+                }
               }else{
                 hasNonVar = true;
               }
-            }else{
-              hasNonVar = true;
             }
-          }
-          if( !var.isNull() ){
-            if( var2.isNull() ){
-              //single variable solve
-              Node veq_c;
-              Node val;
-              int ires = QuantArith::isolate( var, msum, veq_c, val, n.getKind() );
-              if( ires!=0 ){
-                if( veq_c.isNull() ){
-                  r_add = val;
-                  varLhs = (ires==1);
-                  d_rel_dom_lit[hasPol][pol][n].d_rd[0] = getRDomain( q, var.getAttribute(InstVarNumAttribute()), false );
-                  d_rel_dom_lit[hasPol][pol][n].d_rd[1] = NULL;
+            if( !var.isNull() ){
+              if( var2.isNull() ){
+                //single variable solve
+                Node veq_c;
+                Node val;
+                int ires = QuantArith::isolate( var, msum, veq_c, val, n.getKind() );
+                if( ires!=0 ){
+                  if( veq_c.isNull() ){
+                    r_add = val;
+                    varLhs = (ires==1);
+                    d_rel_dom_lit[hasPol][pol][n].d_rd[0] = getRDomain( q, var.getAttribute(InstVarNumAttribute()), false );
+                    d_rel_dom_lit[hasPol][pol][n].d_rd[1] = NULL;
+                  }
                 }
+              }else if( !hasNonVar ){
+                //merge the domains
+                d_rel_dom_lit[hasPol][pol][n].d_rd[0] = getRDomain( q, var.getAttribute(InstVarNumAttribute()), false );
+                d_rel_dom_lit[hasPol][pol][n].d_rd[1] = getRDomain( q, var2.getAttribute(InstVarNumAttribute()), false );
+                d_rel_dom_lit[hasPol][pol][n].d_merge = true;
               }
-            }else if( !hasNonVar ){
-              //merge the domains
-              d_rel_dom_lit[hasPol][pol][n].d_rd[0] = getRDomain( q, var.getAttribute(InstVarNumAttribute()), false );
-              d_rel_dom_lit[hasPol][pol][n].d_rd[1] = getRDomain( q, var2.getAttribute(InstVarNumAttribute()), false );
-              d_rel_dom_lit[hasPol][pol][n].d_merge = true;
             }
           }
         }