automaton.add(aut,algo="auto")¶Build an automaton whose behavior is the sum of the behaviors of the input automata.
The algorithm has to be one of these:
"auto": default parameter, same as "standard" if parameters fit the standard preconditions, "general" otherwise."deterministic": deterministic sum of two deterministic automata."general": general addition or union, no additional preconditions."standard": standard addition.Preconditions:
"determistic": both automata have to be determinism."standard": automaton has to be standard.Postconditions:
"standard": the result automaton is standard.If algo is "deterministic" and the weightset is Boolean, a more efficient algorithm based on the conjunction is used.
import vcsn
ctx = vcsn.context('lal_char, b')
aut = lambda e: ctx.expression(e).standard()
Sum of standard automata.
aut('a') + aut('b')
aut('a').add(aut('b'), "general")
Sum of non standard automata.
%%automaton -s a
context = "lal_char, q"
$ -> 0
1 -> 0 b
0 -> 1 a
1 -> $ <2>
a+a
Sum of deterministic automata.
aut('ab').add(aut('ac'), algo='deterministic')