Skip to content

input letter 0 should not be considered as None in method WordMorphism.is_growing #41275

@seblabbe

Description

@seblabbe

Wolfgang Steiner wrote to me:

J'ai un problème très étrange avec SageMath :
L'évaluation de WordMorphism({0:[0,1],1:[1]}).fixed_point(0) ne termine
pas alors que WordMorphism({1:[1,0],0:[0]}).fixed_point(1) ou
WordMorphism({0:[0,1],1:[1,1]}).fixed_point(0) marche sans problème.
Le problème apparaît donc uniquement quand la lettre du point fixe
s'appelle 0 et l'autre lettre ne croît pas.

Amitiés,
Wolfgang

I confirm this is okay :

sage: m = WordMorphism({1:[1,0],0:[0]})
sage: m.fixed_point(1)
word: 1000000000000000000000000000000000000000...

Exchanging 0 and 1 does this:

sage: m2 = WordMorphism({0:[0,1],1:[1]})
sage: m2.fixed_point(0)           # this hangs !!!

The problem is in the method is_growing :

sage: m.is_growing(0)
False
sage: m.is_growing(1)
True
sage: m2.is_growing(0)         # this should return True
False
sage: m2.is_growing(1)
False

The issue is in this line:


which is supposed to test whether letter is None. But this evaluates to True when letter is 0...

It should be replaced by if letter is None.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions