ArticleslgStudy

science

Two-way finite automaton

Two-way 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 Two-way finite automaton rather than just read about it. In short: In computer science, in particular in automata theory, a two-way finite automaton is a finite automaton that is allowed to re-read its input. Two-way deterministic finite automaton A two-way deterministic finite automaton (2DFA) is an abstract machine, a generalized version of the deterministic finite automaton (DFA) which can revisit characters already processed.

Key takeaways

  • Two-way 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 Two-way finite automaton to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Two-way finite automaton from memory before moving on to harder problems.

Reference excerpt

In computer science, in particular in automata theory, a two-way finite automaton is a finite automaton that is allowed to re-read its input.

Two-way deterministic finite automaton A two-way deterministic finite automaton (2DFA) is an abstract machine, a generalized version of the deterministic finite automaton (DFA) which can revisit characters already processed. As in a DFA, there are a finite number of states with transitions between them based on the current character, but each transition is also labelled with a value indicating whether the machine will move its position in the input to the left, right, or stay at the same position. Equivalently, 2DFAs can be seen as read-only Turing machines with no work tape, only a read-only input tape. 2DFAs were introduced in a seminal 1959 paper by Rabin and Scott, who proved them to have equivalent power to one-way DFAs. That is, any formal language which can be recognized by a 2DFA can be recognized by a DFA which only examines and consumes each character in order. Since DFAs are obviously a special case of 2DFAs, this implies that both kinds of machines recognize precisely the class of regular languages. However, the equivalent DFA for a 2DFA may require exponentially many states, making 2DFAs a much more practical representation for algorithms for some common problems. 2DFAs are also equivalent to read-only Turing machines that use only a constant amount of space on their work tape, since any constant amount of information can be incorporated into the finite control state via a product construction (a state for each combination of work tape state and control state).

Formal description Formally, a two-way deterministic finite automaton can be described by the following 8-tuple: M = ( Q , Σ , L , R , δ , s , t , r ) {\displaystyle M=(Q,\Sigma ,L,R,\delta ,s,t,r)} where

Q {\displaystyle Q} is the finite, non-empty set of states

Σ {\displaystyle \Sigma } is the finite, non-empty set of input symbols

L {\displaystyle L} is the left endmarker

R {\displaystyle R} is the right endmarker

δ : Q × ( Σ ∪ { L , R } ) → Q × { l e f t , r i g h t } {\displaystyle \delta :Q\times (\Sigma \cup \{L,R\})\rightarrow Q\times \{\mathrm {left,right} \}}

s {\displaystyle s} is the start state

t {\displaystyle t} is the end state

r {\displaystyle r} is the reject state In addition, the following two conditions must also be satisfied:

For all q ∈ Q {\displaystyle q\in Q}

δ ( q , L ) = ( q ′ , r i g h t ) {\displaystyle \delta (q,L)=(q^{\prime },\mathrm {right} )} for some q ′ ∈ Q {\displaystyle q^{\prime }\in Q}

δ ( q , R ) = ( q ′ , l e f t ) {\displaystyle \delta (q,R)=(q^{\prime },\mathrm {left} )} for some q ′ ∈ Q {\displaystyle q^{\prime }\in Q}

It says that there must be some transition possible when the pointer reaches either end of the input word.

For all symbols σ ∈ Σ ∪ { L } {\displaystyle \sigma \in \Sigma \cup \{L\}}

δ ( t , σ ) = ( t , R ) {\displaystyle \delta (t,\sigma )=(t,R)}

δ ( r , σ ) = ( r , R ) {\displaystyle \delta (r,\sigma )=(r,R)}

δ ( t , R ) = ( t , L ) {\displaystyle \delta (t,R)=(t,L)}

δ ( r , R ) = ( r , L ) {\displaystyle \delta (r,R)=(r,L)}

It says that once the automaton reaches the accept or reject state, it stays in there forever and the pointer goes to the right most symbol and cycles there infinitely.

Two-way nondeterministic finite automaton A two-way nondeterministic finite automaton (2NFA) may have multiple transitions defined in the same configuration. Its transition function is

δ : Q × ( Σ ∪ { L , R } ) → 2 Q × { l e f t , r i g h t } {\displaystyle \delta :Q\times (\Sigma \cup \{L,R\})\rightarrow 2^{Q\times \{\mathrm {left,right} \}}} . Like a standard one-way NFA, a 2NFA accepts a string if at least one of the possible computations is accepting. Like the 2DFAs, the 2NFAs also accept only regular languages.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Two-way finite automaton

Start with the simplest possible case. Write down what Two-way 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 Two-way 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 Two-way 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 Two-way finite automaton

In research
Two-way 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 Two-way 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
Two-way 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 Two-way 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 “Two-way finite automaton” →

Affiliate

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

How to study Two-way finite automaton in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Two-way 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 Two-way finite automaton out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Two-way finite automaton in simple terms?

In computer science, in particular in automata theory, a two-way finite automaton is a finite automaton that is allowed to re-read its input. Two-way deterministic finite automaton A two-way deterministic finite automaton (2DFA) is an abstract machine, a generalized version of the deterministic fin…

Why does Two-way 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 Two-way 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 Two-way finite automaton.

Tags

  • Finite-state machines

Keep exploring