Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-08 Thread Ben Hutz
On Friday, September 8, 2017 at 12:37:46 PM UTC-5, David Roe wrote: > > > > On Fri, Sep 8, 2017 at 11:54 AM, Ben Hutz > > wrote: > > Since the consensus is that P(0) etc. is too ambiguous a choice, that is >> now #23806. >> > > I don't think anyone was saying that we should change P(0), just th

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-08 Thread David Roe
On Fri, Sep 8, 2017 at 11:54 AM, Ben Hutz wrote: > Adding coercion for scheme points is now #23805. This just address adding > coercion through _coerce_map_from_ and does *not* allow P(0) == 0. This > ticket does not address P(0) itself. > Cool; I've added some comments there. Since the conse

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-08 Thread Ben Hutz
Adding coercion for scheme points is now #23805. This just address adding coercion through _coerce_map_from_ and does *not* allow P(0) == 0. This ticket does not address P(0) itself. Since the consensus is that P(0) etc. is too ambiguous a choice, that is now #23806. The bug about different

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-08 Thread Eric Gourgoulhon
Le vendredi 8 septembre 2017 11:15:10 UTC+2, Jeroen Demeyer a écrit : > > (I am starting to wonder if I should write a blog post explaining this, > it's not the first time that somebody asks this). > Yes please ! Thank you. Eric. -- You received this message because you are subscribed to th

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-08 Thread Ben Hutz
Thanks for the additional responses. The non-equality of the hash functions is enough to convince me that P(0) == 0 is not worth the "convenience" of this type of coercion. However, just to point out another inconsistency. It seems that coercion is currently violating this hash equality in othe

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-08 Thread Jeroen Demeyer
On 2017-09-07 19:11, Ben Hutz wrote: There does not appear to be an __eq__() operator implemented for scheme points, but it does show up in tab completion in the notebook, but can't tell me where the code is from. Is this an artifact of starting to transition the code to python3. Or this just br

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-08 Thread John Cremona
On 7 September 2017 at 23:34, Nils Bruin wrote: > > What is the argument that makes PP(0) == 0 bad? If PP(0) is allowed, I don't > see how PP(0) == 0 is particularly worse. > > Because PP(AA(0)) and PP(BB(0)) should be different points, so it's not so > clear which one should have precedence. PP(0

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-07 Thread Nils Bruin
What is the argument that makes PP(0) == 0 bad? If PP(0) is allowed, I don't see how PP(0) == 0 is particularly worse. Because PP(AA(0)) and PP(BB(0)) should be different points, so it's not so clear which one should have precedence. PP(0) happens to choose PP(BB(0)). I don't think that's cano

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-07 Thread Ben Hutz
Condensing your example; this behavior is clearly bad sage: PP = ProjectiveSpace(QQ,1) sage: AA = PP.affine_patch(0) sage: BB = PP.affine_patch(1) sage: AA is BB True #??? I don't know of any intention to make AffineSpace globally unique, but I'd need to look through the code to see what ha

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-07 Thread Nils Bruin
On Thursday, September 7, 2017 at 12:10:40 PM UTC-7, Ben Hutz wrote: > > > Ah. I see the difference. I don't think it is unreasonable for P(0) == 0 > to work in dimension 1 as there is a canonical answer. So I would have to > say yes, I'm working on having that coercion work. > I think it is unr

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-07 Thread Ben Hutz
On Thursday, September 7, 2017 at 1:16:12 PM UTC-5, David Roe wrote: > > > > On Thu, Sep 7, 2017 at 2:00 PM, Ben Hutz > > wrote: > > Once you construct P(0), both a and P(0) are in the same parent, so there > are no coercions involved in the test a==P(0). In your branch, what does > sage: a.p

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-07 Thread David Roe
On Thu, Sep 7, 2017 at 2:00 PM, Ben Hutz wrote: > Yes, but *after* implementing the coercion for the homsets I'm getting the > behavior above. The 'a==0' doesn't go through the coecion framework, but > the a==P(0) does. So one returns true and the other false. I'm trying to > figure out why == is

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-07 Thread Ben Hutz
Yes, but *after* implementing the coercion for the homsets I'm getting the behavior above. The 'a==0' doesn't go through the coecion framework, but the a==P(0) does. So one returns true and the other false. I'm trying to figure out why == is not utilizing the coercion/richcmp in that case. You'

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-07 Thread David Roe
On Thu, Sep 7, 2017 at 1:46 PM, Ben Hutz wrote: > Yes, I'm working on the coercion now. > > However, isn't a==0 checking coercion from the parent of a to the parent > of 0. In other words, the homset of rational points on P and QQ. > Yes, I got confused by the notation, since normally in Sage P(

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-07 Thread Ben Hutz
Yes, I'm working on the coercion now. However, isn't a==0 checking coercion from the parent of a to the parent of 0. In other words, the homset of rational points on P and QQ. In dimension 1, there is a canonical coercion, but not in higher dimensions. On Thursday, September 7, 2017 at 12:17:57

Re: [sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-07 Thread David Roe
The reason that a==0 returns false is that there is no coercion map from QQ to P: sage: P.has_coerce_map_from(QQ) False I'm not convinced that there should be a coercion, it's pretty rare that a scheme has a natural map from its base ring. However, it seems like there's also a problem hiding here

[sage-devel] _richcmp_ versus __eq__ for scheme points

2017-09-07 Thread Ben Hutz
I'm working on implementing coercion for scheme points and had a question about how comparison is done. As an explicit example consider the following point P.= ProjectiveSpace (QQ ,1) a=P(0) in particular, the integer 0 is coerced into the projective point (0:1). For comparisons it appears tha