3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-11-09 23:52:02 +00:00

Multiply by inverse to detect more parity constraints

This commit is contained in:
Clemens Eisenhofer 2023-02-18 14:15:51 +01:00
parent ae70a8e9f0
commit e8b4875a17
3 changed files with 21 additions and 9 deletions

View file

@ -764,9 +764,9 @@ namespace polysat {
if (a_parity > 0) {
shift = s.lshr(a1, a1.manager().mk_val(a_parity));
signed_constraint least_parity = s.parity_at_least(a1, a_parity);
signed_constraint shift_right_left = s.eq(rational::power_of_two(a_parity) * shift, a1);
s.add_clause(~least_parity, shift_right_left, true);
//signed_constraint least_parity = s.parity_at_least(a1, a_parity);
//signed_constraint shift_right_left = s.eq(rational::power_of_two(a_parity) * shift, a1);
//s.add_clause(~least_parity, shift_right_left, true);
// s.add_clause(~shift_right_left, least_parity, true); Might be interesting as well [although not needed]; needs to consider special case 0
// [nsb cr: this pre-condition is already implied from the parity explanations]
// precondition.insert_eval(~shift_right_left);
@ -778,7 +778,6 @@ namespace polysat {
LOG("pseudo inverse: " << a_pi);
LOG("-b: " << (-b));
LOG("shifted a" << shift);
LOG("Forced elimination: " << a_pi * (-b) * shift + b1);
return { a_pi * (-b) * shift + b1, true };
#endif
}