Re: [prolog-standard] Re: log10/1, log/2, min/2, and max/2

From: Richard A. O'Keefe <>
Date: Tue, 21 Nov 2006 16:54:05 +1300 (NZDT)

I have to leave in a few minutes, and the Department is closed tomorrow
for a funeral, so I don't have time to reply at once in full to
Joachim Schimpf's <> important contribution to this

I am very fond of interval arithmetic, which is supported in the Fortran
compiler I sometimes use. I was disappointed that INTERVAL didn't make
it into F95 (nor, I think F04). But I don't buy his argument, for a very
important reason.

Actually, two reasons.

First, max/2 and min/2 are part of the algebra of LATTICES. They are
not about arithmetic, they are about ORDERING. And when we look at
intervals, we see that they form a PARTIAL order, not a total order.

So when we

        Consider the comparison of two reals, whose values are not very
        precisely known, but which are both in the vicinity of 1:
        ?- X is max(0.9__1.0, 0.8__1.1).
        X = 0.9__1.1
        Yes (0.00s cpu)
we see very clearly that the answer should be *NO*: NEITHER of the
arguments is greater than the other, so the maximum is simply undefined.

Obviously you *can* define an operation
    f (LB1,UB1) (LB2,UB2) = (LB1 `max` LB2, UB1 `max` UB2)
and just as obviously it *will* satisfy the usual axioms for \/
considered by itself, BUT it won't satisfy the usual axioms relating
max and min to < and >.

Nothing stops someone defining "max" and "min" componentwise for
complex numbers, and those definitions would also satisfy the usual
associativity, commutativity, and idempotence axioms, and even the
usual axioms relating /\ and \/ to each other. But they would NOT
satisfy the usual axioms relating /\ and \/ to < <= > >= , because
complex numbers just don't satisfy the ordered field axioms.

(By the way, I have been arguing for the last 20 years or more that
we ought to allow underscores inside numbers to make them readable,
as Ada and some other languages do. It's rather upsetting to see
underscores used for separating the bounds of an interval.)

        Because of the fuzziness, we don't really know which argument is
        the larger one,

Which is why you are actually talking about a *different* operation.

        The most precise result we can deliver is _not_ identical to
        any of the arguments, it is a combination of information from
        the arguments. With selection semantics, we would have to
        raise an exception.
For *this* operation, yes, of course. That's the only reasonable thing
to do. I think you may have forgotten the mathmatical distinction
between a "maximum" and a "meet". I have been talking about the
"maximum" of a set (which must be exactly an element of that set);
you are talking about a "meet".

        If we subscribe to the view that a float is an inaccurate
        representation of a real that lies somewhere in the vicinity of
        the float,

I don't, for fairly obvious and practical reasons.
prolog-standard mailing list
Received on Mon Jul 14 2008 - 13:01:03 EST

This archive was generated by hypermail 2.2.0 : Wed Sep 08 2010 - 23:28:17 EST