automaton.complement

Produce an automaton that accepts the complement of the language of the input automaton.

Precondition:

  • the labelset is free
  • the weightset is $\mathbb{B}$
  • the automaton is complete
  • the automaton is deterministic

Postcondition:

  • Result.is_complete()
  • Result.is_deterministic()

See also:

Examples


In [1]:
import vcsn
b = vcsn.context('lal_char(abc), b')

In [2]:
a = b.expression('a+b').standard().determinize().complete()
a


Out[2]:
%3 I0 0 0 I0->0 F1 F2 1 1 0->1 a 2 2 0->2 b 3 3 0->3 c 1->F1 1->3 [^] 2->F2 2->3 [^] 3->3 [^]

The prefix operator ~ invokes complement().


In [3]:
~a


Out[3]:
%3 I0 0 0 I0->0 F0 F3 0->F0 1 1 0->1 a 2 2 0->2 b 3 3 0->3 c 1->3 [^] 2->3 [^] 3->F3 3->3 [^]

In [4]:
c = a.complement()
c


Out[4]:
%3 I0 0 0 I0->0 F0 F3 0->F0 1 1 0->1 a 2 2 0->2 b 3 3 0->3 c 1->3 [^] 2->3 [^] 3->F3 3->3 [^]

In [5]:
a.shortest(2)


Out[5]:
$\mathit{a} \oplus \mathit{b}$

In [6]:
c.shortest(10)


Out[6]:
$\varepsilon \oplus \mathit{c} \oplus \mathit{aa} \oplus \mathit{ab} \oplus \mathit{ac} \oplus \mathit{ba} \oplus \mathit{bb} \oplus \mathit{bc} \oplus \mathit{ca} \oplus \mathit{cb}$