while (a=b()) ... infinite sets digression

Paul Duffin pduffin at mailserver.hursley.ibm.com
Thu May 20 11:39:33 EDT 1999


Blake Winton wrote:
> 
> On Wed 19 May, Chad Netzer <chad at vision.arc.nasa.gov> wrote:
> In comp.lang.python, you wrote:
> >Greg Ewing wrote:
> >> Chad Netzer wrote:
> >In fact, both are probably Aleph-1 sets which means they are larger than
> >the set of integers...  I'm out of my area, here, so I'll let it go at
> >that. ;)
> 
> Hmmm...  I can't quite believe that, since there is an obvious mapping
> from the set of all strings to the set of all integers.  (Think base n,
> where n=the number of possible characters.)  I suppose this assumes a
> less-than-infinite number of characters, but I can only think of about
> 104 different characters, so the total must be finite, right?  :)
> 

I know that the set of all lists (x y) where x and y can be any integer
is just as large as the set of integers. Use the mapping.

0 - (0 0)
1 - (1 0)
2 - (0 1)
3 - (2 0)
4 - (1 1)
5 - (0 2)

And also for lists of length 3 (x y z), 4, 5, 6 .... infinity.

If you treat each integer in the list as a different character then 
a list is basically a string.

Therefore even if you have an infinite alphabet the set of strings you
can make from this is still only as large as the set of integers.

Isn't infinity strange.

-- 
Paul Duffin
DT/6000 Development	Email: pduffin at hursley.ibm.com
IBM UK Laboratories Ltd., Hursley Park nr. Winchester
Internal: 7-246880	International: +44 1962-816880




More information about the Python-list mailing list