Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

variables and interval interpretation (was: about emp)



On 2013-02-19 11:12:54 -0500, Michel Hack wrote:
> In the set-based flavor it is easy to stick to the strict set-based
> interpretation, where an interval is precisely the entire set of reals
> represented by it, and in that model, x**2, and x*y where y happens to
> have the same value (as an interval) as x, lead to the same result.

No, they don't. Concerning the P1788 functions:

  sqr([-1,1]) = { sqr(x) | x in [-1,1] } = [0,1]

  [-1,1] * [-1,1] = { x * y | x in [-1,1] and y in [-1,1] } = [-1,1]

However xx*xx and xx*yy would have the same value if xx = yy.

> The question then becomes:  do we want to have a mechanism to allow a
> programmer to state that a single-value-in-a-range interpretation is
> desired?

Note that the difference between "variable = entire set of reals
represented by it" and the single-value-in-a-range interpretation
is visible only when a "variable" occurs twice in an expression.
This also means that the concept of expression and variable should
be specified.

> (1)  The single-scalar interpretation never gives a wider result than the
>      set interpretation, so the latter is ALWAYS valid (if not tightest).
> 
> (2)  The single-scalar interpretation requires tagging, implicit or explicit,
>      to denote that multiple instances (necessary to write an expression in
>      a given syntactic environment) refer to the same entity.
> 
> (3)  Implicit tagging is nearly impossible in some languages, and still
>      difficult in others.  Fortran, which passes arguments by reference
>      instead of by value, has an easier job than C, for example.  But it
>      is still tricky:  Assignment creates a new reference; one would have
>      to use EQUIVALENCE instead -- and there is no general agreement on
>      how common subexpressions are to be interpreted in this context.
> 
> So, do we want to introduce an explicit tagging mechanism?  (This would
> immediately "solve" the 17-byte problem!)

You should also consider the decorations. With the current spec,
the concept of real-valued functions is needed (see §8.8.2). So,
the question is when the code is

  r = x * x;

what function you can have (I suppose that only the implementation
can specify that).

r = f(x) with f(x) = x^2 ?

r = g(x,x) with g(x,y) = x * y ?

Otherwise, to avoid this kind of choice, one needs a different spec
for the decorations (e.g. only strict propagation rules).

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)