Re: Efficient interval representation



* Tim Frink:
Hi,

I've a basic question. Let's assume I want to statically
analyze a program using abstract interpretation. I want
to represent an unsigned char variable in its abstract
form using intervals. Further, let's assume that the variable
is represented by the interval <10..255> at some point
of the program (program under analysis is a C source, so the
data type unsigned char has a bit length of 8).

When I now add a constant to that value, let's say <5..5>, I have a wrap-around. IMHO, there are not two ways how to
represent the result:
a) again <0..255>. However, here I have a loss of precision since the values <5..14> are actually not possible in the
sum
b) the result is represented by two intervals: <0..4> and <15..255>. This form fosters precision since just
feasible values are given

The first representation has the advantage that I keep the
number of intervals small (just one interval for each
variable) but loose precision so that I probably get high
overestimations the longer the analysis proceeds. On the
other hand, the second representation keeps the calculations
precise but the computation complexity increases and might
end up in a state explosion that becomes too complex to compute.

What is done in practice in such a case?

I don't understand why on Earth you'd want to do interval arithmetic analysis on integers.

But given that, and assuming arithmetic modulo 256, if you start with the interval <10..255>, and add 5, then you have the interval <15..260> which is congruent to <15..4>. You just have to keep in mind (and possibly also represent) that this is modulo 256. So on top of not understanding why you'd want to do this, I don't understand the technical problem either: I see no technical problem whatsoever, unless you have as a requirement to not be able to represent the intervals you want to represent, in which case the situation would be hopeless.


One idea to handle this trade-off between complexity and precision
that comes into my mind might be to define the number of maximal intervals for each variable (if further intervals are required they must be somehow merged with the present results to not exceed the
max. #intervals).

I don't see the /problem/.

Cheers, & hth.,

- Alf

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
.



Relevant Pages

  • Efficient interval representation
    ... analyze a program using abstract interpretation. ... data type unsigned char has a bit length of 8). ... here I have a loss of precision ... The first representation has the advantage that I keep the ...
    (comp.theory)
  • Efficient interval representation
    ... analyze a program using abstract interpretation. ... data type unsigned char has a bit length of 8). ... here I have a loss of precision ... The first representation has the advantage that I keep the ...
    (comp.programming)
  • Re: The spinoza papers: design of the extra-precision number object 2
    ... doesnt terminate, which cause practical problems, e.g in representation ... that we have an exact number. ... Limiting the precision doesn't change this claim. ... including quantum uncertainty represented as ...
    (comp.programming)
  • Re: more than 16 significant figures
    ... >> Java specifies IEEE 754-1985 representation for floating point. ... It specifies 53 bits of precision for doubles, ... one non-significant bit results in a value with two non-significant ... loss of any extended precision available to the hardware. ...
    (comp.lang.java.programmer)
  • Re: Maths error
    ... quantities delivers the exact decimal result, /provided/ that precision is ... they both lose info when rounding does occur. ... All forms of fp are subject to representation and rounding errors. ... precision is set high enough to retain all the input digits. ...
    (comp.lang.python)