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:

Examples

In [1]:
import vcsn
In [2]:
%%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 -> $
%3 I0 0 0 I0->0 F2 1 1 0->1 a|aa 1->1 a|a 2 2 1->2 aa|a 2->F2

This transducer is a partial identity.

In [3]:
a.is_partial_identity()
Out[3]:
True

However, the following transducer is not a partial identity, as it maps aaa to aaaa.

In [4]:
%%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 -> $
%3 I0 0 0 I0->0 F3 1 1 0->1 a|aa 2 2 0->2 aa|a 3 3 1->3 aa|aa 2->3 aa|aa 3->F3
In [5]:
a.is_partial_identity()
Out[5]:
False