#8920: Factor code between words's alphabets and sets/enumerated sets/ordered 
sets
------------------------------------------------------+---------------------
       Reporter:  hivert                              |         Owner:  
sage-combinat   
           Type:  defect                              |        Status:  
needs_review    
       Priority:  major                               |     Milestone:  
sage-5.7        
      Component:  combinatorics                       |    Resolution:          
        
       Keywords:  Words, Sets, Cernay2012             |   Work issues:          
        
Report Upstream:  N/A                                 |     Reviewers:  Travis 
Scrimshaw
        Authors:  Vincent Delecroix, Stepan Starosta  |     Merged in:          
        
   Dependencies:  #13801                              |      Stopgaps:          
        
------------------------------------------------------+---------------------

Comment (by tscrim):

 Hey Stepan and Vincent,

 Replying to [comment:13 tscrim]:
 > - I'm still uncomfortable with the change to `is_endomorphism()` since I
 would (naively) expect the map `a->a, b->aa, c->aaa` be an endomorphism.
 The problem is word morphism automatically sets the codomain based on the
 image. As for the mathematics, yes, if it is a proper subset, it is not an
 endomorphism, but it naturally extends to one. I believe that having
 anything that is naturally extendable to an endomorphism should be
 considered an endomorphism by sage via the coercion model. Also in case
 you're worried, the above morphism worked with composition.
 >
 >   If a third party agrees with the changes in the patch, then I would
 add a warning to `is_endomorphism()` and/or to `WordMorphism` about
 defining endomorphisms and add the tests
 > {{{
 > sage: w = WordMorphism('a->a,b->aa,c->aaa', codomain=Words('abc'))
 > sage: w.is_endomorphism()
 > True
 > sage: w2 = WordMorphism('a->a,b->aa,c->aaa')
 > sage: w == w2
 > False
 > }}}
 >   However there is one problem with this, and that is `w == w2` returns
 `True`. Thus the equality operator will need to be changed to reflect the
 dependency on the codomain.

 I talked with Nicolas about this, and he agreed with the changes in your
 patch, but also said we needed to change the `==` operator to check the
 codomain (in particular, we don't want a map `f` to be surjective and `g`
 to not be and compare equal because `g` has a larger codomain). This might
 be a more general problem, and I'll take a look at it today and let you
 know what I find.

 Best,[[BR]]
 Travis

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8920#comment:14>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to