automaton.is_trim

Whether all its states are useful, i.e., accessible and coaccessible.

Preconditions:

  • None

Postconditions:

  • Result = aut.is_accessible and aut.is_coaccessible

See also:

Examples


In [1]:
import vcsn


The following automaton has useless states: 2 is not accessible, and 3 is not coaccessible.


In [2]:
%%automaton a
context = "lal_char(abc), b"
$ -> 0
0 -> 1 a
1 -> $
2 -> 0 a
1 -> 3 a


%3 I0 0 0 I0->0 F1 1 1 0->1 a 1->F1 3 3 1->3 a 2 2 2->0 a

In [3]:
a.is_trim()


Out[3]:
False

Calling trim returns the same automaton, but without any useless states:


In [4]:
a.trim()


Out[4]:
%3 I0 0 0 I0->0 F1 1 1 0->1 a 1->F1

In [5]:
a.trim().is_trim()


Out[5]:
True

In [6]:
a.accessible()


Out[6]:
%3 I0 0 0 I0->0 F1 1 1 0->1 a 1->F1 3 3 1->3 a

In [7]:
a.accessible().is_trim()


Out[7]:
False

In [8]:
a.coaccessible()


Out[8]:
%3 I0 0 0 I0->0 F1 1 1 0->1 a 1->F1 2 2 2->0 a

In [9]:
a.coaccessible().is_trim()


Out[9]:
False