-
-
Notifications
You must be signed in to change notification settings - Fork 697
Open
Labels
Description
Sage considers Words("ab") as different from Words("ba"). As a consequence the following word morphism is not an endomorphism
sage: s = WordMorphism('a->ba,b->a', domain=Words('ab'), codomain=Words('ba'))
sage: s.is_endomorphism()
False
In particular, sage complains about it in method such as
sage: s.is_primitive()
Traceback (most recent call last):
...
TypeError: self (=a->ab, b->a) is not an endomorphism
However, it does not complain when it comes to composition which looks like a bug to me since it breaks functoriality of incidence matrix
sage: s * s
WordMorphism: a->abb, b->b
sage: (s * s).incidence_matrix() == s.incidence_matrix() * s.incidence_matrix()
False