3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-26 13:06:05 +00:00

Dedup quot_rem and lshr too

This commit is contained in:
Jakob Rath 2022-11-07 15:25:05 +01:00
parent 2953b1c093
commit e7c77a22ab
4 changed files with 71 additions and 40 deletions

View file

@ -29,6 +29,16 @@ namespace polysat {
using op_constraint_args_hash = obj_hash<op_constraint_args>;
using op_constraint_expr_map = map<op_constraint_args, pvar, op_constraint_args_hash, op_constraint_args_eq>;
op_constraint_expr_map op_constraint_expr;
using quot_rem_args = std::optional<std::pair<pdd, pdd>>; // NOTE: this is only wrapped in optional because table2map requires a default constructor
using quot_rem_args_eq = default_eq<quot_rem_args>;
struct quot_rem_args_hash {
unsigned operator()(quot_rem_args const& args) const {
return args ? combine_hash(args->first.hash(), args->second.hash()) : 0;
}
};
using quot_rem_expr_map = map<quot_rem_args, std::pair<pvar, pvar>, quot_rem_args_hash, quot_rem_args_eq>;
quot_rem_expr_map quot_rem_expr;
};
// Manage constraint lifetime, deduplication, and connection to boolean variables/literals.
@ -100,6 +110,10 @@ namespace polysat {
signed_constraint lshr(pdd const& p, pdd const& q, pdd const& r);
signed_constraint band(pdd const& p, pdd const& q, pdd const& r);
std::pair<pdd, pdd> quot_rem(pdd const& a, pdd const& b);
pdd lshr(pdd const& p, pdd const& q);
pdd bnot(pdd const& p);
pdd band(pdd const& p, pdd const& q);
pdd bor(pdd const& p, pdd const& q);