Progress on if-then-else



On 2013-03-07, Henry Baker <hbaker1 at pipeline.com> wrote:

> Using my range analysis program:
>
> Given: sqrt(1-sqr(x))
>
> where sqr(x) is x^2, we conclude that the result is in the range [0,1],
> and x must be in the range [-1,1].

OK, makes sense (given that it's assumed here that the domain of sqrt is
[0, inf).

> Given: sqrt(1-x*x)
>
> we conclude that the result is in the range [0,inf), and x must be in
> the range (minf,inf).

I don't get it. If x > 1, then x*x > 1, and then 1 - x*x is outside the
range of sqrt. Why is it OK for x*x to be > 1 in this case, and not in
the previous one?

> [Note that x*x is not the same as x^2, because x*x is a binary operation
> on two arguments that happen to be the same ranges, while x^2 is a unary
> operation on a single range.]

I dunno. I don't see how an analysis of an expression is possible if a
single name can represent different things. If the operands of "*" are
two different things, why is that not represented by x*y ?

> Given: (if x>0 then sqrt(1-x*x) else sqrt(1-x*x))
>
> we conclude that the result is in the range [0,1], and x must be in
> the range (minf,inf).

Here we have something like "if foo then bar else bar". How can that be
anything other than bar identically? Yet in this case the result is
something different from the previous one.

> Given: (exp(x)+exp(-x))/2 = 3
>
> we conclude that x is in the range (-30/17, 30/17), which is pretty good,
> considering we don't know about acosh() !

I'm not following. How does one derive that conclusion?

best

Robert Dodier