Ensure heap disjointness in sep refinements.
authorajreynol <andrew.j.reynolds@gmail.com>
Thu, 7 Jul 2016 22:14:56 +0000 (17:14 -0500)
committerajreynol <andrew.j.reynolds@gmail.com>
Thu, 7 Jul 2016 22:14:56 +0000 (17:14 -0500)
src/theory/sep/theory_sep.cpp
test/regress/regress0/sep/Makefile.am
test/regress/regress0/sep/split-find-unsat.smt2
test/regress/regress0/sep/wand-false.smt2 [new file with mode: 0644]
test/regress/regress0/sep/wand-nterm-simp2.smt2
test/regress/regress0/sep/wand-simp-sat2.smt2

index be0af4929024504b5d3d00f6dd3b06501e565e2c..d9416fbc6578115bee6cea566736745f50dec36e 100644 (file)
@@ -747,8 +747,7 @@ void TheorySep::check(Effort e) {
                   pol_atom = atom.negate();
                 }
                 lemc.push_back( pol_atom );
-                //TODO: add disjointness assumption
-                
+
                 //lemc.push_back( s_lbl.eqNode( o_b_lbl_mval ).negate() );
                 //lemc.push_back( NodeManager::currentNM()->mkNode( kind::SUBSET, o_b_lbl_mval, s_lbl ).negate() );
                 lemc.insert( lemc.end(), conc.begin(), conc.end() );
@@ -1165,11 +1164,40 @@ Node TheorySep::instantiateLabel( Node n, Node o_lbl, Node lbl, Node lbl_v, std:
             return Node::null();
           }
         }
+        Node empSet = NodeManager::currentNM()->mkConst(EmptySet(rtn.toType()));
         if( n.getKind()==kind::SEP_STAR ){
+          //disjoint contraints
+          Node vsu;
+          std::vector< Node > vs;
+          for( std::map< int, Node >::iterator itl = d_label_map[n][lbl].begin(); itl != d_label_map[n][lbl].end(); ++itl ){
+            Node sub_lbl = itl->second;
+            Node lbl_mval = d_label_model[sub_lbl].getValue( rtn );
+            for( unsigned j=0; j<vs.size(); j++ ){
+              children.push_back( NodeManager::currentNM()->mkNode( kind::INTERSECTION, lbl_mval, vs[j] ).eqNode( empSet ) );
+            }
+            vs.push_back( lbl_mval );
+            if( vsu.isNull() ){
+              vsu = lbl_mval;
+            }else{
+              vsu = NodeManager::currentNM()->mkNode( kind::UNION, vsu, lbl_mval );
+            }
+          }
+          children.push_back( vsu.eqNode( lbl ) );
+          
+          //return the lemma
           Assert( children.size()>1 );
           return NodeManager::currentNM()->mkNode( kind::AND, children );      
         }else{
-          return NodeManager::currentNM()->mkNode( kind::OR, children[0].negate(), children[1] );
+          std::vector< Node > wchildren;
+          //disjoint constraints
+          Node sub_lbl_0 = d_label_map[n][lbl][0];
+          Node lbl_mval_0 = d_label_model[sub_lbl_0].getValue( rtn );
+          wchildren.push_back( NodeManager::currentNM()->mkNode( kind::INTERSECTION, lbl_mval_0, lbl ).eqNode( empSet ).negate() );
+          
+          //return the lemma
+          wchildren.push_back( children[0].negate() );
+          wchildren.push_back( children[1] );
+          return NodeManager::currentNM()->mkNode( kind::OR, wchildren );
         }
       }else{
         //nested star/wand, label it and return
index 9744cae99deda0f09f12807a7ecd94011e534da9..d72e02d975874274c00aaeb24bdb0cb60ae9528b 100644 (file)
@@ -54,7 +54,8 @@ TESTS =       \
   wand-0526-sat.smt2 \
   quant_wand.smt2 \
   fmf-nemp-2.smt2 \
-  trees-1.smt2
+  trees-1.smt2 \
+  wand-false.smt2
 
 
 FAILING_TESTS =
index 54530cbf4dff709d27e52dd6875a04c79856ea1e..1731174faee5c31526ee642c01b3d0061f9211a1 100644 (file)
@@ -1,7 +1,7 @@
 ; COMMAND-LINE: --no-check-models
-; EXPECT: sat
+; EXPECT: unsat
 (set-logic ALL_SUPPORTED)
-(set-info :status sat)
+(set-info :status unsat)
 
 (declare-const x Int)
 (declare-const y Int)
diff --git a/test/regress/regress0/sep/wand-false.smt2 b/test/regress/regress0/sep/wand-false.smt2
new file mode 100644 (file)
index 0000000..642c0a8
--- /dev/null
@@ -0,0 +1,7 @@
+; COMMAND-LINE: --no-check-models
+; EXPECT: sat
+(set-logic ALL_SUPPORTED)
+(set-info :status sat)
+(declare-fun x () Int)
+(assert (wand (pto x x) false))
+(check-sat)
index 69305e95c5704b946e59115763a378ad08972de1..c317e87364fd1aa57fbd5a8cf30d372968ab31d6 100644 (file)
@@ -1,6 +1,7 @@
 ; COMMAND-LINE: --no-check-models
-; EXPECT: unsat
+; EXPECT: sat
 (set-logic ALL_SUPPORTED)
+(set-info :status sat)
 (declare-fun x () Int)
 (assert (wand (pto x 1) (emp x)))
 (check-sat)
index ebc115fdd2704f20143144c8c35c1eb0a2ad953c..059e91317d7b3504748665e8e08c9cc01c8f7fbc 100755 (executable)
@@ -1,6 +1,7 @@
 ; COMMAND-LINE: --no-check-models
-; EXPECT: unsat
+; EXPECT: sat
 (set-logic ALL_SUPPORTED)
+(set-info :status sat)
 (declare-fun x () Int)
 (assert (wand (pto x 1) (pto x 3)))
 (check-sat)