Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 45896
Kernel: Python 3

automaton.factor

An automaton that accepts all the factors (aka subwords) of the words accepted by an automaton.

Algorithm:

  • Every accessible non-initial state is made initial, with weight one.

  • Every coaccessible non-final state is made final, with weight one.

Preconditions:

  • None

Postconditions:

  • Result == aut.prefix().suffix() == aut.suffix().prefix()

Caveat:

  • While semantically sound for Boolean automata, hardly makes sense on weighted automata.

See also:

Examples

import vcsn
%%automaton -s a context = "lan, q" $ -> 0 <2> 0 -> 1 <3>a 1 -> 1 <4>b 1 -> 2 <5>\e 2 -> 3 <6>c 3 -> 4 <7>d 3 -> 5 <8>e 4 -> $ <9> 6 -> 0 <10>A
Image in a Jupyter notebook
a.factor()
Image in a Jupyter notebook