Re: inexactness vs. exactness William D Clinger 26 Jul 2005 17:57 UTC

I doubt whether pseudo-mathematical arguments are really helpful,
but one way to discourage them is to enumerate the fallacies on
which they are based.

On 21 July 2005, Aubrey Jaffer wrote:

> You are suggesting that an implementation in which inexact numbers are
> not neighborhoods can conform to R5RS.  I will show that this is
> impossible.

On 22 July (but delayed until 24 July in this archive), I paraphrased
Jaffer's statement above as

> Aubrey Jaffer claims to have proved that the language of
> the R5RS not only regards inexact numbers as neighborhoods,
> but that no other interpretations of the R5RS are tenable.

On 24 July, Jaffer quoted the first part of my paraphrase and wrote:

> No, it claims that inexact numbers are in one-to-one correspondence
> with neighborhoods around their nominal values.

If that was all Jaffer was claiming, then he misspoke when he
denied that "an implementation in which inexact numbers are not
neighborhoods can conform to R5RS".  Indeed, if that was all
Jaffer was claiming, then his alleged proofs are needlessly
complex, and he should not object to the simpler interpretation
that identifies all finite inexact complex values z with the
mathematical closed neighborhood consisting of z itself and
nothing else.

I offered to enumerate Jaffer's errors of logic if anyone remains
convinced by Jaffer's first alleged proof.  Responding to that,
Jaffer wrote:

> Yes I would.  I have appended a detailed proof of the first part
> (finite number of inexacts).

I take this to mean that he remains convinced by his first alleged
proof, and also wants me to identify the errors in it and also in
his new "detailed proof".

Sensible people can stop reading now.  What follows is only for
those who remain convinced by Jaffer's alleged proofs.

                                * * *

>From Jaffer's first alleged proof:

> If real inexacts are not neighborhoods, then they correspond to single
> mathematical numbers (points).

This has no basis in logic, mathematics, or the R5RS.  One might
as well say that if real inexacts are not neighborhoods, then they
correspond to real numbers, or to grains of sand.

> The number of inexact numbers possible in this hypothetical system is
> either finite or not.

The number of inexact numbers that are possible in the system
described by the R5RS is potentially infinite, but is finite
in most implementations.  In what follows, Jaffer goes back
and forth between speaking of the potential infinity described
by the R5RS, and the finite cardinality implemented in most
implementations.  That made it easier for him to appear to
deduce his invalid conclusions.

> Finite number of inexacts:
>
>   There are an infinite number of possible continuous formulas (Scheme
>   procedures) yielding distinct values when applied to inexact
>   arguments.

Here Jaffer appears to identify "continuous formulas" with Scheme
procedures, which is nonsense.  Perhaps he means only that there
are infinitely many Scheme procedures that, if interpreted over
the mathematical reals instead of the inexact reals (which have
a discrete topology in most implementations), would represent
continuous functions.

> If the number of possible inexact numbers is finite,

Which is not true.  The number of possible inexact numbers is
potentially infinite.  We may therefore disregard the rest of
this paragraph in Jaffer's alleged proof.

> Infinite number of inexacts:
>
>   There are an infinite number of possible formulas (Scheme
>   procedures) involving transcendental functions yielding distinct
>   values when applied to inexact arguments.

The "transcendental functions" is a red herring.

It is true that there are an infinite number of possible formulas
(or Scheme procedures, for that matter).  If we are talking about
mathematical formulas, then there are infinitely many formulas
that represent infinitely many different functions over the real
or complex numbers.

If we are talking about Scheme procedures, however, then they
represent only a potential infinity of different functions over
Scheme's inexact numbers.  In most implementations of Scheme,
the Scheme procedures represent only finitely many different
functions.

Jaffer then quotes the R5RS's admonishment in Section 6.2.2 that,
for inexact arithmetic, "it is the duty of each implementation to
make the result as close as practical to the mathematically ideal
result".  From that he pretends to infer:

> By R5RS 6.2.2, if a transcendental function returns an approximate
> result, then it must map to the nearest inexact number.

This is nonsense on several levels.  For starters, what does "map
to" mean?  If Jaffer thinks the R5RS requires transcendental
functions such as ASIN to return the inexact number that is nearest
to the mathematically ideal result, then he's just wrong.  The R5RS
contains no such requirement, nor do the relevant IEEE standards
for floating point arithmetic.  To me, "as close as practical" here
means that implementations have a duty to implement library functions
that are as accurate as the state of the art permits, consistent with
reasonable efficiency.  Jaffer may have a different interpretation,
but his interpretation is no more authoritative than mine.

On the basis of the hogwash already cited, Jaffer concludes that

> So, not only is it proved that:
>
> * Scheme inexact real numbers correspond to real neighborhoods;

He has proved no such thing.

He goes on to say:

> applying the same logic to exact numbers proves that:
>
> * it is not possible to create a real number representation with total
>   order (comparisons) which is exact for all transcendental functions.

Someone should tell Dedekind and Cauchy.

I think what Jaffer is trying to say is that it is not possible to
create a representation for real numbers that is exact for all
transcendental functions (once again, the "transcendental" is a
red herring) for which the ordering predicate is decidable.  That
is a true fact, but it is independent of Jaffer's arguments.  He
would have done better just to state it up front, without bothering
to give his pseudo-proofs.

Yet Jaffer claims that

> The proof above makes this no longer a matter of opinion.

Following this howler, Jaffer makes some legitimate criticisms
of the R5RS, pointing out several portability problems.

                                * * *

Jaffer's first proof actually stated the proposition that he was
allegedly proving, but (as quoted near the beginning of this long
post) he no longer claims to claim that proposition.

Jaffer's new "detailed proof" never states the proposition it is
alleged to prove, so it's a little hard to tell where Jaffer's
back-pedalling ends and his new "detailed proof" begins.  I will
therefore content myself with pointing out several errors in his
presentation.

> Given:
>
> {a} A R5RS-compliant implementation has a finite number greater
>     than 1 of inexact number equivalence classes under the
>     transitive R5RS predicate `='.

That is certainly true in most R5RS-compliant implementations,
but is not true of all conceivable R5RS-compliant implementations.

> {b} That implementation contains an inexact number class #i1.0
>     such that
>
>     (eqv? #i1.0 (string->number "1.0"))

What does it mean for that implementation to contain an inexact
number class #i1.0 such that (eqv? #i1.0 (string->number "1.0"))?

Maybe he means that the implementation contains an inexact number,
namely #i1.0, that satisfies (eqv? #i1.0 (string->number "1.0")),
and the "inexact number class" was just a way for Jaffer to assume
the conclusion he has yet to prove.

>From what he writes later, however, I think he actually means
that Jaffer's mind can construct the mathematical class

    { x | x is an inexact number in the implementations and
          (eqv? x (string->number "1.0")) }

That is a fact about Jaffer's mind and about mathematics, but
says nothing about the implementation.  Jaffer would have done
better to show that the inexact numbers are partitioned by the
classes defined in this way, substituting various strings for
"1.0"---that at least would have said something about the
implementation---but he did not do so.

> {d} for any inexact number x:
>
>     (= x #i1.0) if-and-only-if (zero? (- x #i1.0))

The R5RS does not actually require this, but I suspect it is true
of most inexact numbers in most implementations.

> Because the implementation has a finite number (> 1) of distinct
> (under `=') inexact numbers classes {a},

Jaffer has not shown this, but I think he means that there are
only a finite number of distinct classes that can be formed by
substituting a string for s in

    { x | x is an inexact number and (= x (string->number s)) }

The R5RS does not require this, and implementations in which it
is not true are conceivable, but it is true in most systems.

We have to wade through a lot of definitions before we reach the
next non sequitur:

> Consider the mathematical sequence indexed by positive integer k:
>
>   E[k] = 1 + (-1/10)^k                                          {e}
>
>   0.9, 1.01, 0.999, 1.0001, 0.99999, 1.000001, ...
>
> E[k+2] is strictly between E[k] and E[k+1] {e}.                 {f}
>
> The limit of E[k] as k tends to infinity is 1 {e}.              {g}
>
> Let S[k] be the string containing a decimal representation of
> E[k].  That sequence begins:                                    {h}
>
>   "0.9", "1.01", "0.999", "1.0001", "0.99999", "1.000001", ...
>
> Let I[k] be (STRING->NUMBER S[k]) {c,h}.                        {i}
>
> Because the implementation has a finite number (> 1) of distinct
> (under `=') inexact numbers classes {a}, the lower bound, L[1],
> of the distance between #i1.0 and members of any other inexact
> number class must be a nonzero {a,d}.                           {j}
>
> Thus there must exist an integer j such that (abs (- E[k] 1))
> is less than L[1]/4 for all k > j {f,g,i,j}.                    {k}
>
> I[k] must be #i1.0 for k > j, because no other inexact number
> class can be closer {c,j}; and because STRING->NUMBER of the
> string representation of the limiting value, "1.0", is #i1.0
> {b,g,k}.                                                        {l}

That last paragraph does not follow.  Nothing in the R5RS rules
out an implementation in which both of the following are true:

  *  for all odd k, (eqv? (string->number S[k]) .9)
  *  for all even k, (eqv? (string->number S[k]) 1.1)

> Thus the projection of mathematical numbers between E[j] and
> E[j+1] into inexact number classes is #i1.0.

Even if Jaffer's reasoning were not flawed, all he would have
proved is that he can use #i1.0 as a name for

  { x | x is an inexact number and (= x (string->number "#i1.0")) }

Note, however, that Jaffer has not proved that this class is
an open neighborhood of 1.0 in any sense.  In particular, he
has not proved the following claim:

> Note that the neighborhood between E[j] and E[j+1] is a subset
> of the full neighborhood which STRING->NUMBER maps to inexact
> number class #i1.0.

Finally, Jaffer writes:

> There was nothing special about #i1.0 in this proof.

Indeed.  With any other inexact number, Jaffer's alleged proof
would have been just as invalid.

Will