Re: [sage-combinat-devel] Re: Infinite binary words -- Category of uncountable sets

2013-12-03 Thread Nathann Cohen
Yoo !!

 You can still iterate over *some* elements.

Indeed. My problem with Words(2) is the following :

- If you iterate on it, you just get finite words
- Words(2).random_element() breaks right now, which is fixed in #12867.
There are two patches there, but if you use mine  call to random_element()
gives you an infinite binary word in return (which I find totally cool).

And so it feels weird to have Word(2).__iter__ only give you finite words,
while (let's face it) most binary words are infinite :-

 You can't iterate over all
 elements, but so what? Neither can you iterate on a computer over all
 elements of an infinite but countable set, nor is it feasible to iterate
 over all elements of finite but very large sets.

Well, so aren't you saying that it is vain to implement the set of infinite
words in Sage ? We will never use them, after all !

To me it makes sense to refuse to iterate on an uncountable set. I mean,
for as long as there is an easy alternative to represent the words you can
actually iterate on, i.e. the list of finite binary words !

Or just for fun we could write something like :
def __iter__():
while True:
yield self.random_element()

:-P

Nathann

P.S. : Oh, by the way 
sage: Word([1,2]) in Words(2)
False

-- 
You received this message because you are subscribed to the Google Groups 
sage-combinat-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-combinat-devel.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sage-combinat-devel] Re: Infinite binary words -- Category of uncountable sets

2013-12-03 Thread Volker Braun
On Tuesday, December 3, 2013 1:33:45 PM UTC, Nathann Cohen wrote:

 - If you iterate on it, you just get finite words


So? If you iterate over ZZ you never get numbers  10^20.

The rest of your email is just pointing out that there is no uniform 
probability measure on infinite sets. Again, so what? And how is that 
different from the case of countable but infinite sets?

-- 
You received this message because you are subscribed to the Google Groups 
sage-combinat-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-combinat-devel.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sage-combinat-devel] Re: Infinite binary words -- Category of uncountable sets

2013-12-03 Thread Nathann Cohen
 - If you iterate on it, you just get finite words

Well, first there *IS* a bug there :

sage: Words(3,finite=False)[1]
word: 1

This word is finite while I asked for the set of infinite words. The patch
at #12867 fixes it by refusing to return the first element (no iteration).

So for a start, the set of infinite words should not return finite words,
either through __iter__ or through .random_element() (which is the case
right now). Though I think we agree on that.

 So? If you iterate over ZZ you never get numbers  10^20.

Well, that's the difference between maths and implemented stuff. Do you
think we should return infinity when asked for the cardinality or N, or R
? You will never list infinitely many, and you will never use more than
2^50 I guess. So why do we return +oo ?
That's only maths.
And I felt like somehow, iterating over a set of elements should only be
possible when this set is countable.

 The rest of your email is just pointing out that there is no uniform
 probability measure on infinite sets.

Well. I actually implemented a random_element method in #12867 for infinite
words on a finite alphabet. It returns an infinite word, each of whose
letter is randomly and uniformly taken. I think that it makes sense.

  Again, so what? And how is that
 different from the case of countable but infinite sets?

Well. I always assumed that we should only implement a random_element()
method when it was somehow uniform ? Otherwise let's write random_element =
an_element and solve the problem forever :-P

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
sage-combinat-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-combinat-devel.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sage-combinat-devel] Re: Infinite binary words -- Category of uncountable sets

2013-12-03 Thread Volker Braun
On Tuesday, December 3, 2013 1:56:53 PM UTC, Nathann Cohen wrote:

 Well. I always assumed that we should only implement a random_element() 
 method when it was somehow uniform ? 


Two fun paradoxes that are in that rabbit hole:

http://en.wikipedia.org/wiki/Bertrand_paradox_(probability)
http://en.wikipedia.org/wiki/Borel%E2%80%93Kolmogorov_paradox

-- 
You received this message because you are subscribed to the Google Groups 
sage-combinat-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-combinat-devel.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sage-combinat-devel] Re: Infinite binary words -- Category of uncountable sets

2013-12-03 Thread Nathann Cohen
 Two fun paradoxes that are in that rabbit hole:

 http://en.wikipedia.org/wiki/Bertrand_paradox_(probability)
 http://en.wikipedia.org/wiki/Borel%E2%80%93Kolmogorov_paradox

Hey, I never claimed it was the unique answer. I'm just saying that
anybody who asks Sage for a random binary word word could not expect
anything else but that.

And that it is actually a pretty cool feature. If you need to generate
random elements from the set [1,'hey', 'thing'] now you can do :

for e in Words([1,'hey', 'thing']).random_element():
   print e

That's coool :-P

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
sage-combinat-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-combinat-devel.
For more options, visit https://groups.google.com/groups/opt_out.