import vcsn

%%automaton --strip a
context = "lat<law_char(abc),law_char(abc)>, b"
$ -> 0
0 -> 1 a|aa
1 -> 1 a|a
1 -> 2 aa|a
2 -> $

"""
Explanation: automaton.is_partial_identity
Whether the automaton is a partial identity, i.e. each (accepted) input is transduced to itself.
Precondition:
- The automaton is transducer.
- The two tapes have the same labelset.
See also:
- automaton.partial_identity
Examples
End of explanation
"""


a.is_partial_identity()

"""
Explanation: This transducer is a partial identity.
End of explanation
"""


%%automaton --strip a
context = "lat<law_char(a),law_char(a)>, b"
$ -> 0
0 -> 1 a|aa
0 -> 2 aa|a
1 -> 3 aa|aa
2 -> 3 aa|aa
3 -> $

a.is_partial_identity()

"""
Explanation: However, the following transducer is not a partial identity, as it maps aaa to aaaa.
End of explanation
"""


