#19619: Simplify words.py
-------------------------------------+-------------------------------------
Reporter: vdelecroix | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.10
Component: combinatorics | Resolution:
Keywords: | Merged in:
Authors: Vincent Delecroix | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vdelecroix/19619 | fc24b013baa42774d80d1aef9d03009d676329fe
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Description changed by vdelecroix:
Old description:
> Currently we have too many parent for words:
> - for finite and infinite words (`Words_all`, `Words_over_alphabet`,
> `Words_over_OrderedAlphabet`)
> - finite words (`FiniteWords_over_OrderedAlphabet`)
> - infinite words (`InfiniteWords_over_OrderedAlphabet`)
> - words of fixed length (`FiniteWords_length_k_over_OrderedAlphabet` and
> `Words_n`)
>
> This lead to subtle bug like
> {{{
> sage: W = Words([0,1], finite=False, infinite=True)
> sage: u = W.an_element()
> sage: u[2:5].parent() # a finite word !!
> Infinite Words over {0, 1}
> }}}
>
> The proposal of this ticket is to have only three classes:
> - `FiniteWords`
> - `Words_n`: words of length `n` (as a slice of the one before)
> - `InfiniteWords` (or `FullShift`)
> The parent `FiniteWords` should hence have a method `.shift()` that
> return the associated shift (e.g `u ** Infinity` will belong there).
> Similarly, the parent `InfiniteWords` should have a method `.factors()`
> that return the set of factors (and finite slices will belong there).
New description:
Currently we have too many parent for words:
- for finite and infinite words (`Words_all`, `Words_over_alphabet`,
`Words_over_OrderedAlphabet`)
- finite words (`FiniteWords_over_OrderedAlphabet`)
- infinite words (`InfiniteWords_over_OrderedAlphabet`)
- words of fixed length (`FiniteWords_length_k_over_OrderedAlphabet` and
`Words_n`)
This lead to subtle bug like
{{{
sage: W = Words([0,1], finite=False, infinite=True)
sage: u = W.an_element()
sage: u[2:5].parent() # a finite word !!
Infinite Words over {0, 1}
}}}
The proposal of this ticket is to have only four classes:
- `FiniteWords`
- `Words_n`: words of length `n` (as a slice of the one before)
- `InfiniteWords` (or `FullShift`)
- `FiniteAndInfiniteWords`
The parent `FiniteWords` should hence have a method `.shift()` that return
the associated shift (e.g `u ** Infinity` will belong there). Similarly,
the parent `InfiniteWords` should have a method `.factors()` that return
the set of factors (and finite slices will belong there).
We also:
- deprecate `size_of_alphabet` and `has_letter`
- use a bit more of categories in `lyndon_word.py`
- use more often `Word_char` if possible
- implement a better iterator for periodic points that avoids computing
huge power of the morphism (that is not always doable)
--
--
Ticket URL: <http://trac.sagemath.org/ticket/19619#comment:3>
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.
For more options, visit https://groups.google.com/d/optout.