Octagonal_Shape::affine_image too imprecise?

Octagonal_Shape::affine_image seems a bit too imprecise when treating assignments of the form Y = -Y + c.
Here's the code involved:
// Here `w_coeff == -denominator'. // Remove the binary constraints on `var'. forget_binary_octagonal_constraints(var_id); const Row_Iterator m_begin = matrix.row_begin(); Row_Iterator m_iter = m_begin + n_var; N& m_v_cv = (*m_iter)[n_var+1]; ++m_iter; N& m_cv_v = (*m_iter)[n_var]; // Swap the unary constraints on `var'. std::swap(m_v_cv, m_cv_v); // Strong closure is not preserved. reset_strongly_closed(); if (b != 0) { // Translate the unary constraints on `var', // adding or subtracting the value `b/denominator'. PPL_DIRTY_TEMP(N, d); div_round_up(d, b, denominator); mul_2exp_assign_r(d, d, 1, ROUND_UP); add_assign_r(m_cv_v, m_cv_v, d, ROUND_UP); PPL_DIRTY_TEMP(N, minus_d); div_round_up(minus_d, b, minus_den); mul_2exp_assign_r(minus_d, minus_d, 1, ROUND_UP); add_assign_r(m_v_cv, m_v_cv, minus_d, ROUND_UP); } incremental_strong_closure_assign(var); }
This approach that discards all old binary constraints on the assigned variable looks a little too naive to me. Consider for instance this assigment sequence:
X = Y; Y = -Y;
The octagonal domain will not be able to deduce X + Y = 0 as I would expect. A similar problem probably exists for BD Shapes.

Il 18/10/2010 15:22, FABIO BOSSI ha scritto:
Octagonal_Shape::affine_image seems a bit too imprecise when treating assignments of the form Y = -Y + c.
[...]
This approach that discards all old binary constraints on the assigned variable looks a little too naive to me. Consider for instance this assigment sequence:
X = Y; Y = -Y;
The octagonal domain will not be able to deduce X + Y = 0 as I would expect.
Right, we had a useless precision loss. I have just committed in an improved version.
A similar problem probably exists for BD Shapes.
I don't think BD shapes are affected. Sign-symmetry ( + translation ) maps sum constraints into difference constraints and difference constraints into sum constraints; in either case, the source constraint or the destination constraint can not be encoded in a BD_Shape.
Enea.
participants (2)
-
Enea Zaffanella
-
FABIO BOSSI