Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_primitive of WordMorphism is broken #8095

Closed
seblabbe opened this issue Jan 27, 2010 · 10 comments
Closed

is_primitive of WordMorphism is broken #8095

seblabbe opened this issue Jan 27, 2010 · 10 comments

Comments

@seblabbe
Copy link
Contributor

Let us define the following morphism over 3 letters:

sage: substitution=WordMorphism('a->b,b->ac,c->a')

Then we get

sage: substitution.is_primitive()
False

but also

sage: (substitution^2).is_primitive()
True

expected behaviour:

See the description of ".is_primitive()":
Returns True if self is primitive.
A morphism ϕ is primitive if there exists an positive integer k such
that for all α∈Σ, ϕk(α) contains all the letters of Σ.

So, if a morphism is primitive, so are all its powers. And if there is
a power which is primitive, so is the morphism itself. In the example
above, both outputs should be "True".

This was reported here (via 'Report a problem'):

http://groups.google.com/group/sage-combinat-devel/browse_thread/thread/5ed1186c229e7343?hl=en

CC: @sagetrac-abmasse

Component: combinatorics

Author: Sébastien Labbé

Reviewer: Alexandre Blondin Massé

Merged: sage-4.3.2.alpha1

Issue created by migration from https://trac.sagemath.org/ticket/8095

@seblabbe seblabbe added this to the sage-4.3.2 milestone Jan 27, 2010
@seblabbe seblabbe self-assigned this Jan 27, 2010
@seblabbe

This comment has been minimized.

@seblabbe
Copy link
Contributor Author

comment:2

I just posted a patch which solves the described problem. The solution uses the following algorithm:

ALGORITHM: 
 
   Let `m` be the incidence matrix of a endomorphism on a monoid  
   of `d` letters. The endomorphism is primitive if and only if 
   there exists `k` such that `1 \leq k \leq (d-1)^2+1` and `m^k`  
   contains no zero. 

Are we sure this is true? Is there a proof of that somewhere?

@seblabbe
Copy link
Contributor Author

Attachment: trac_8095_wordmorph_is_primitive-sl.patch.gz

tested on sage-4.3.1

@seblabbe
Copy link
Contributor Author

comment:4

I found a reference for the above statement (Automatic sequences of Allouche and Shallit).

@sagetrac-abmasse
Copy link
Mannequin

sagetrac-abmasse mannequin commented Jan 29, 2010

Author: slabbe

@sagetrac-abmasse
Copy link
Mannequin

sagetrac-abmasse mannequin commented Jan 29, 2010

comment:5

Tested on sage-4.3.1 as well and it works.
It fixes the reported problem as well.
All tests passed when running ``sage -t morphism.py".
Positive review.

@sagetrac-abmasse
Copy link
Mannequin

sagetrac-abmasse mannequin commented Jan 29, 2010

Reviewer: abmasse

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Jan 30, 2010

Changed reviewer from abmasse to Alexandre Blondin Massé

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Jan 30, 2010

Changed author from slabbe to Sébastien Labbé

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Jan 30, 2010

Merged: sage-4.3.2.alpha1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant