diff options
author | mudathirmahgoub <mudathirmahgoub@gmail.com> | 2020-10-04 15:10:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-04 15:10:24 -0500 |
commit | 13cf41801f8f2bac538cb45d53ae7427916041a7 (patch) | |
tree | 78e82b56e92004991890943ba5da863e6af3538f /src/theory/sep | |
parent | d662d3321a46aac61973f7a90341ea870c0b1171 (diff) |
Remove subtyping for sets theory (#5179)
This PR removes subtyping for sets theory due to issues like #4502, #4507 and #4631.
Changes:
Add SingletonOp for singletons to specify the type of the single element in the set.
Add mkSingleton to the solver to enable the user to pass the sort of the single element.
Update smt and cvc parsers to use mkSingleton when the kind is SINGLETON
Diffstat (limited to 'src/theory/sep')
-rw-r--r-- | src/theory/sep/theory_sep.cpp | 20 | ||||
-rw-r--r-- | src/theory/sep/theory_sep_rewriter.cpp | 4 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/theory/sep/theory_sep.cpp b/src/theory/sep/theory_sep.cpp index 578d5faba..b18ae5b95 100644 --- a/src/theory/sep/theory_sep.cpp +++ b/src/theory/sep/theory_sep.cpp @@ -412,7 +412,8 @@ void TheorySep::reduceFact(TNode atom, bool polarity, TNode fact) } else if (satom.getKind() == SEP_PTO) { - Node ss = nm->mkNode(SINGLETON, satom[0]); + // TODO(project##230): Find a safe type for the singleton operator + Node ss = nm->mkSingleton(satom[0].getType(), satom[0]); if (slbl != ss) { conc = slbl.eqNode(ss); @@ -1341,7 +1342,7 @@ Node TheorySep::mkUnion( TypeNode tn, std::vector< Node >& locs ) { for( unsigned i=0; i<locs.size(); i++ ){ Node s = locs[i]; Assert(!s.isNull()); - s = NodeManager::currentNM()->mkNode( kind::SINGLETON, s ); + s = NodeManager::currentNM()->mkSingleton(tn, s); if( u.isNull() ){ u = s; }else{ @@ -1512,12 +1513,14 @@ Node TheorySep::instantiateLabel( Node n, Node o_lbl, Node lbl, Node lbl_v, std: //check if this pto reference is in the base label, if not, then it does not need to be added as an assumption Assert(d_label_model.find(o_lbl) != d_label_model.end()); Node vr = d_valuation.getModel()->getRepresentative( n[0] ); - Node svr = NodeManager::currentNM()->mkNode( kind::SINGLETON, vr ); + // TODO(project##230): Find a safe type for the singleton operator + Node svr = NodeManager::currentNM()->mkSingleton(vr.getType(), vr); bool inBaseHeap = std::find( d_label_model[o_lbl].d_heap_locs_model.begin(), d_label_model[o_lbl].d_heap_locs_model.end(), svr )!=d_label_model[o_lbl].d_heap_locs_model.end(); Trace("sep-inst-debug") << "Is in base (non-instantiating) heap : " << inBaseHeap << " for value ref " << vr << " in " << o_lbl << std::endl; std::vector< Node > children; if( inBaseHeap ){ - Node s = NodeManager::currentNM()->mkNode( kind::SINGLETON, n[0] ); + // TODO(project##230): Find a safe type for the singleton operator + Node s = NodeManager::currentNM()->mkSingleton(n[0].getType(), n[0]); children.push_back( NodeManager::currentNM()->mkNode( kind::SEP_LABEL, NodeManager::currentNM()->mkNode( kind::SEP_PTO, n[0], n[1] ), s ) ); }else{ //look up value of data @@ -1529,8 +1532,10 @@ Node TheorySep::instantiateLabel( Node n, Node o_lbl, Node lbl, Node lbl_v, std: }else{ Trace("sep-inst-debug") << "Data for " << vr << " was not specified, do not add condition." << std::endl; } - } - children.push_back( NodeManager::currentNM()->mkNode( kind::EQUAL, NodeManager::currentNM()->mkNode( kind::SINGLETON, n[0] ), lbl_v ) ); + } + // TODO(project##230): Find a safe type for the singleton operator + Node singleton = NodeManager::currentNM()->mkSingleton(n[0].getType(), n[0]); + children.push_back(singleton.eqNode(lbl_v)); Node ret = children.empty() ? NodeManager::currentNM()->mkConst( true ) : ( children.size()==1 ? children[0] : NodeManager::currentNM()->mkNode( kind::AND, children ) ); Trace("sep-inst-debug") << "Return " << ret << std::endl; return ret; @@ -1650,7 +1655,8 @@ void TheorySep::computeLabelModel( Node lbl ) { }else{ tt = itm->second; } - Node stt = NodeManager::currentNM()->mkNode( kind::SINGLETON, tt ); + // TODO(project##230): Find a safe type for the singleton operator + Node stt = NodeManager::currentNM()->mkSingleton(tt.getType(), tt); Trace("sep-process-debug") << "...model : add " << tt << " for " << u << " in lbl " << lbl << std::endl; d_label_model[lbl].d_heap_locs.push_back( stt ); } diff --git a/src/theory/sep/theory_sep_rewriter.cpp b/src/theory/sep/theory_sep_rewriter.cpp index 87a849a78..78837508e 100644 --- a/src/theory/sep/theory_sep_rewriter.cpp +++ b/src/theory/sep/theory_sep_rewriter.cpp @@ -102,7 +102,9 @@ RewriteResponse TheorySepRewriter::postRewrite(TNode node) { switch (node.getKind()) { case kind::SEP_LABEL: { if( node[0].getKind()==kind::SEP_PTO ){ - Node s = NodeManager::currentNM()->mkNode( kind::SINGLETON, node[0][0] ); + // TODO(project##230): Find a safe type for the singleton operator + Node s = NodeManager::currentNM()->mkSingleton(node[0][0].getType(), + node[0][0]); if( node[1]!=s ){ Node c1 = node[1].eqNode( s ); Node c2 = NodeManager::currentNM()->mkNode( kind::SEP_LABEL, NodeManager::currentNM()->mkNode( kind::SEP_PTO, node[0][0], node[0][1] ), s ); |