Skip to content

Commit 66384d6

Browse files
committed
Optimise propositional encoding of object_size
Avoid creating equalities over the postponed bitvector when the object literals trivially aren't equal, and directly encode bitwise equality when the object literals are trivially equal (and stop searching for a matching object). In all other cases, avoid unnecessary Tseitin variables to encode the postponed bitvector equality.
1 parent 40cdf93 commit 66384d6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/solvers/flattening/bv_pointers.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,9 +957,26 @@ void bv_pointerst::do_postponed(
957957
PRECONDITION(size_bv.size() == postponed.bv.size());
958958

959959
literalt l1=bv_utils.equal(bv, saved_bv);
960+
if(l1.is_true())
961+
{
962+
for(std::size_t i = 0; i < postponed.bv.size(); ++i)
963+
prop.set_equal(postponed.bv[i], size_bv[i]);
964+
break;
965+
}
966+
else if(l1.is_false())
967+
continue;
968+
#define COMPACT_OBJECT_SIZE_EQ
969+
#ifndef COMPACT_OBJECT_SIZE_EQ
960970
literalt l2=bv_utils.equal(postponed.bv, size_bv);
961971

962972
prop.l_set_to_true(prop.limplies(l1, l2));
973+
#else
974+
for(std::size_t i = 0; i < postponed.bv.size(); ++i)
975+
{
976+
prop.lcnf({!l1, !postponed.bv[i], size_bv[i]});
977+
prop.lcnf({!l1, postponed.bv[i], !size_bv[i]});
978+
}
979+
#endif
963980
}
964981
}
965982
else

0 commit comments

Comments
 (0)