ArticleslgStudy

science

Nondeterministic finite automaton

Nondeterministic finite automaton is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Nondeterministic finite automaton rather than just read about it. In short: In automata theory, a finite-state machine is called a deterministic finite automaton (DFA), if each of its transitions is uniquely determined by its source state and input symbol, and reading an input symbol is required for each state transition. A nondeterministic finite automaton (NFA), or nondeterministic finite-state machine, does not need to obey these restrictions.

Nondeterministic finite automaton — main illustration
Nondeterministic finite automaton — illustration

Key takeaways

  • Nondeterministic finite automaton belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Nondeterministic finite automaton to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Nondeterministic finite automaton from memory before moving on to harder problems.

Reference excerpt

In automata theory, a finite-state machine is called a deterministic finite automaton (DFA), if

each of its transitions is uniquely determined by its source state and input symbol, and reading an input symbol is required for each state transition. A nondeterministic finite automaton (NFA), or nondeterministic finite-state machine, does not need to obey these restrictions. In particular, every DFA is also an NFA. Sometimes the term NFA is used in a narrower sense, referring to an NFA that is not a DFA, but not in this article. Using the subset construction algorithm, each NFA can be translated to an equivalent DFA; i.e., a DFA recognizing the same formal language. Like DFAs, NFAs only recognize regular languages. NFAs were introduced in 1959 by Michael O. Rabin and Dana Scott, who also showed their equivalence to DFAs. NFAs are used in the implementation of regular expressions: Thompson's construction is an algorithm for compiling a regular expression to an NFA that can efficiently perform pattern matching on strings. Conversely, Kleene's algorithm can be used to convert an NFA into a regular expression (whose size is generally exponential in the input automaton). NFAs have been generalized in multiple ways, e.g., nondeterministic finite automata with ε-moves, finite-state transducers, pushdown automata, alternating automata, ω-automata, and probabilistic automata. Besides the DFAs, other known special cases of NFAs are unambiguous finite automata (UFA) and self-verifying finite automata (SVFA).

Informal introduction There are at least two equivalent ways to describe the behavior of an NFA. The first way makes use of the nondeterminism in the name of an NFA. For each input symbol, the NFA transitions to a new state until all input symbols have been consumed. In each step, the automaton nondeterministically "chooses" one of the applicable transitions. If there exists at least one "lucky run", i.e. some sequence of choices leading to an accepting state after completely consuming the input, it is accepted. Otherwise, i.e. if no choice sequence at all can consume all the input and lead to an accepting state, the input is rejected. In the second way, the NFA consumes a string of input symbols, one by one. In each step, whenever two or more transitions are applicable, it "clones" itself into appropriately many copies, each one following a different transition. If no transition is applicable, the current copy is in a dead end, and it "dies". If, after consuming the complete input, any of the copies is in an accept state, the input is accepted, else, it is rejected.

Formal definition For a more elementary introduction of the formal definition, see automata theory.

Automaton An NFA is represented formally by a 5-tuple,

( Q , Σ , δ , q 0 , F ) {\displaystyle (Q,\Sigma ,\delta ,q_{0},F)} , consisting of

a finite set of states Q {\displaystyle Q} , a finite set of input symbols called the alphabet Σ {\displaystyle \Sigma } , a transition function δ {\displaystyle \delta } : Q × Σ → P ( Q ) {\displaystyle Q\times \Sigma \rightarrow {\mathcal {P}}(Q)} , an initial (or start) state q 0 ∈ Q {\displaystyle q_{0}\in Q} , and a set of accepting (or final) states F ⊆ Q {\displaystyle F\subseteq Q} . Here, P ( Q ) {\displaystyle {\mathcal {P}}(Q)} denotes the power set of Q {\displaystyle Q} .

Recognized language Given an NFA M = ( Q , Σ , δ , q 0 , F ) {\displaystyle M=(Q,\Sigma ,\delta ,q_{0},F)} , its recognized language is denoted by L ( M ) {\displaystyle L(M)} , and is defined as the set of all strings over the alphabet Σ {\displaystyle \Sigma } that are accepted by M {\displaystyle M} . Loosely corresponding to the above informal explanations, there are several equivalent formal definitions of a string w = a 1 a 2 . . . a n {\displaystyle w=a_{1}a_{2}...a_{n}} being accepted by M {\displaystyle M} :

w {\displaystyle w} is accepted if a sequence of states, r 0 , r 1 , . . . , r n {\displaystyle r_{0},r_{1},...,r_{n}} , exists in Q {\displaystyle Q} such that:

r 0 = q 0 {\displaystyle r_{0}=q_{0}}

… excerpt ends here. Continue reading the full article.

Illustrations

Nondeterministic finite automaton: The state diagram for M. It is not deterministic since in state p reading a 1 can lead to p or to q.
The state diagram for M. It is not deterministic since in state p reading a 1 can lead to p or to q.
Nondeterministic finite automaton: All possible runs of M on input string "10"
All possible runs of M on input string "10"
Nondeterministic finite automaton: All possible runs of M on input string "1011".Arc label: input symbol, node label: state, @media screen{html.skin-theme-clientpref-night .mw-parser-output div:not(.notheme)>.tmp-color,html.skin-theme-clientpref-night .mw-parser-output p>.tmp-color,html.skin-theme-clientpref-night .mw-parser-output table:not(.notheme) .tmp-color{color:inherit!important}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output div:not(.notheme)>.tmp-color,html.skin-theme-clientpref-os .mw-parser-output p>.tmp-color,html.skin-theme-clientpref-os .mw-parser-output table:not(.notheme) .tmp-color{color:inherit!important}}green: start state, red: accepting state(s).


InputState sequence
1011

1pq?

2pppq?

3ppppq
All possible runs of M on input string "1011".Arc label: input symbol, node label: state, @media screen{html.skin-theme-clientpref-night .mw-parser-output div:not(.notheme)>.tmp-color,html.skin-theme-clientpref-night .mw-parser-output p>.tmp-color,html.skin-theme-clientpref-night .mw-parser-output table:not(.notheme) .tmp-color{color:inherit!important}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output div:not(.notheme)>.tmp-color,html.skin-theme-clientpref-os .mw-parser-output p>.tmp-color,html.skin-theme-clientpref-os .mw-parser-output table:not(.notheme) .tmp-color{color:inherit!important}}green: start state, red: accepting state(s). InputState sequence 1011 1pq? 2pppq? 3ppppq
Nondeterministic finite automaton: The state diagram for M
The state diagram for M
Nondeterministic finite automaton: Composed NFA accepting the union of the languages of some given NFAs N(s) and N(t). For an input string w in the language union, the composed automaton follows an ε-transition from q to the start state (left colored circle) of an appropriate subautomaton — N(s) or N(t) — which, by following w, may reach an accepting state (right colored circle); from there, state f can be reached by another ε-transition. Due to the ε-transitions, the composed NFA is properly nondeterministic even if both N(s) and N(t) were DFAs; vice versa, constructing a DFA for the union language (even of two DFAs) is much more complicated.
Composed NFA accepting the union of the languages of some given NFAs N(s) and N(t). For an input string w in the language union, the composed automaton follows an ε-transition from q to the start state (left colored circle) of an appropriate subautomaton — N(s) or N(t) — which, by following w, may reach an accepting state (right colored circle); from there, state f can be reached by another ε-transition. Due to the ε-transitions, the composed NFA is properly nondeterministic even if both N(s) and N(t) were DFAs; vice versa, constructing a DFA for the union language (even of two DFAs) is much more complicated.

Worked examples

Example 1 — a first encounter with Nondeterministic finite automaton

Start with the simplest possible case. Write down what Nondeterministic finite automaton claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Nondeterministic finite automaton before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Nondeterministic finite automaton ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Nondeterministic finite automaton

In research
Nondeterministic finite automaton appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Nondeterministic finite automaton in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Nondeterministic finite automaton is common in secondary-school and first-year university syllabi. It links to neighbouring topics Finite-state machines, so understanding it makes those chapters shorter.
In everyday life
Look for Nondeterministic finite automaton outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Nondeterministic finite automaton” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Nondeterministic finite automaton in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Nondeterministic finite automaton means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Nondeterministic finite automaton out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Nondeterministic finite automaton in simple terms?

In automata theory, a finite-state machine is called a deterministic finite automaton (DFA), if each of its transitions is uniquely determined by its source state and input symbol, and reading an input symbol is required for each state transition. A nondeterministic finite automaton (NFA), or nonde…

Why does Nondeterministic finite automaton matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Nondeterministic finite automaton?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Nondeterministic finite automaton.

Tags

  • Finite-state machines

Keep exploring