On Sep 20, 2007, at 5:39 PM, Rick DeNatale wrote:

> On 9/20/07, Xavier Noria <fxn / hashref.com> wrote:
>
>> On the other hand note that the definition of Range does not imply
>> the collection is finite, given suitables #<=> and #succ a range can
>> represent an enumeration of the rationals in [0, 1].
>
> True in theory, but, I wonder just how you would code succ so as to
> return the NEXT rational!?

Of course that won't happen in practice, but since we were  
speculating about a possible definition of length for ranges I  
thought that comment was needed for the reply to be complete.

The non-constructive argument goes like this (you say it is true so I  
guess you already know this):

Let f be a bijection between the rationals in the open interval (0,  
1) and N. Such a bijection exists because Q is numerable. For any f 
(n) = q define q.succ to be f(n+1). For any given f(n) = q, f(m) = p  
in (0, 1) define q <=> p iff n <=> m.

I have seen explicit bijections between Q and N, I guess a  
programmable .succ could be given.

To complete the reasoning about the closed interval [0, 1], define 0  
<=> q and q <=> 1 to be -1 for any q in (0, 1), and define 0.succ to  
be f(0). 1.succ can be any arbitrary value, when you compute the  
length iterating over a collection max.succ is not used anyway.

I've written that off the top of my head but I think it is correct.

-- fxn