import vcsn

"""
Explanation: 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:
- automaton.isaccessible
- automaton.is_coaccessible
- automaton.trim
Examples
End of explanation
"""


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

a.is_trim()

"""
Explanation: The following automaton has useless states: 2 is not accessible, and 3 is not coaccessible.
End of explanation
"""


a.trim()

a.trim().is_trim()

a.accessible()

a.accessible().is_trim()

a.coaccessible()

a.coaccessible().is_trim()

"""
Explanation: Calling trim returns the same automaton, but without any useless states:
End of explanation
"""


