In
automata theory, an unambiguous finite automaton (UFA) is a
nondeterministic finite automaton (NFA) such that each word has at most one accepting path. Each
deterministic finite automaton (DFA) is an UFA, but not vice versa. DFA, UFA, and NFA recognize exactly the same class of
formal languages.
On the one hand, an NFA can be exponentially smaller than an equivalent DFA. On the other hand, some problems are easily solved on DFAs and not on UFAs. For example, given an automaton ''A'', an automaton ''A'' which accepts the complement of ''A'' can be computed in linear time when ''A'' is a DFA, it is not known whether it can be done in polynomial time for UFA. Hence UFAs are a mix of the worlds of DFA and of NFA; in some cases, they lead to smaller automata than DFA and quicker algorithms than NFA.
Formal definition
An ''
NFA'' is represented formally by a
5-tuple,
.
An ''UFA'' is an NFA such that, for each word
, there exists at most one sequence of states
, in
with the following conditions:
#
# ''r
i+1'' ∈ Δ(''r
i'', ''a
i+1''), for ''i'' = ''0, ..., n−1''
for
#
.
In words, those conditions state that, if
is accepted by
, there is exactly one accepting path, that is, one path from an initial state to a final state, labelled by
.
Example
Let
be the set of words over the
alphabet whose ''n''th last letter is an
. The figures show a DFA and a UFA accepting this language for ''n=2''.

The minimal DFA accepting
has ''2
n'' states, one for each subset of . There is an UFA of
states which accepts
: it guesses the ''n''th last letter, and then verifies that only
letters remain. It is indeed unambiguous as there exists only one ''n''th last letter.
Inclusion, universality, equivalence
Three
PSPACE-hard problems for general NFA belong to
PTIME
In computational complexity theory, P, also known as PTIME or DTIME(''n''O(1)), is a fundamental complexity class. It contains all decision problems that can be solved by a deterministic Turing machine using a polynomial amount of computation time ...
for DFA and are now considered.
Inclusion
It is decidable in polynomial-time whether an UFA's language is a subset of another UFA's language.
Let ''A'' and ''B'' be two UFAs. Let ''L''(''A'') and ''L''(''B'') be the languages accepted by those automata. Then ''L''(''A'')⊆''L''(''B'') if and only if ''L''(''A''∩''B'')=''L''(''A''), where ''A''∩''B'' denotes the Cartesian product automaton, which can be proven to be also unambiguous. Now, ''L''(''A''∩''B'') is a subset of ''L''(''A'') by construction; hence both sets are equal if and only if for each length ''n''∈
, the number of words of length ''n'' in ''L''(''A''∩''B'') is equal to the number of words of length ''n'' in ''L''(''A''). It can be proved that is sufficient to check each ''n'' up to the product of the number of states of ''A'' and ''B''.
The number of words of length ''n'' accepted by an automaton can be computed in polynomial time using
dynamic programming, which ends the proof.
Universality, equivalence
The problem of universality
[i.e.: given a UFA, does it accept every string of Σ*?] and of equivalence,
[i.e.: given two UFAs, do they accept the same set of strings?] also belong to
PTIME
In computational complexity theory, P, also known as PTIME or DTIME(''n''O(1)), is a fundamental complexity class. It contains all decision problems that can be solved by a deterministic Turing machine using a polynomial amount of computation time ...
, by reduction to the inclusion problem.
Checking whether an automaton in unambiguous
For a nondeterministic finite automaton
with
states and an
letter alphabet, it is decidable in time
whether
is unambiguous.
It suffices to use a
fixpoint algorithm
In numerical analysis, fixed-point iteration is a method of computing fixed points of a function.
More specifically, given a function f defined on the real numbers with real values and given a point x_0 in the domain of f, the fixed-point iterat ...
to compute the set of pairs of states ''q'' and ''q' '' such that there exists a word ''w'' which leads both to ''q'' and to ''q' ''. The automaton is unambiguous if and only if there is no such a pair such that both states are accepting. There are ''Θ''(''n''
2) state pairs, and for each pair there are ''m'' letters to consider to resume the fixpoint algorithm, hence the computation time.
Some properties
* The
cartesian product
In mathematics, specifically set theory, the Cartesian product of two sets ''A'' and ''B'', denoted ''A''×''B'', is the set of all ordered pairs where ''a'' is in ''A'' and ''b'' is in ''B''. In terms of set-builder notation, that is
: A\ti ...
of two UFAs is a UFA.
[Christof Löding, ''Unambiguous Finite Automata'', Slide 8]
* The notion of unambiguity extends to
finite state transducers and
weighted automata
In theoretical computer science and formal language theory, a weighted automaton or weighted finite-state machine is a generalization of a finite-state machine in which the edges have weights, for example real numbers or integers. Finite-state ...
. If a finite state transducer ''T'' is unambiguous, then each input word is associated by ''T'' to at most one output word. If a weighted automaton ''A'' is unambiguous, then the set of weight does not need to be a
semiring, instead it suffices to consider a
monoid. Indeed, there is at most one accepting path.
State complexity
Mathematical proofs that every UFA for a language needs a certain number of states were pioneered by Schmidt.
Leung proved that a DFA equivalent to an
-state UFA requires
states in the worst case, and that a UFA equivalent to a finitely ambiguous
[Having finitely many accepting paths for every accepted word.] -state NFA requires
states in the worst case.
Jirásek, Jirásková and Šebej
researched state complexity of basic regular operations on languages represented by UFA. They proved in particular that for every
-state UFA where
, the complement of the language it accepts is accepted by a UFA with at most
states. This result was later improved by Indzhev and Kiefer
to at most
states for all
.
For a one-letter alphabet Okhotin proved that a DFA equivalent to an
-state UFA requires
states in the worst case.
Notes
References
* Christof Löding, ''Unambiguous Finite Automata'', ''Developments in Language Theory'', (2013) pp. 29–30
Slides
{{Formal languages and grammars
Finite automata