Math 2.0

Computer science Definition

Two-way finite automaton

Builds on AlphabetStringDeterministic finite automatonRegular language

Definition

Let Σ\Sigma be an alphabet and let ⊢,⊣\vdash, \dashv be two symbols not in Σ\Sigma, the left and right end markers. A two-way deterministic finite automaton (2DFA) is a tuple A=(Q,Σ,δ,s,t,r)A = (Q, \Sigma, \delta, s, t, r) where:

  1. QQ is a finite set of states, and s,t,r∈Qs, t, r \in Q are the start, accept and reject states, with t≠rt \ne r;
  2. δ ⁣:Q×(Σ∪{⊢,⊣})→Q×{L,R}\delta \colon Q \times (\Sigma \cup \set{\vdash, \dashv}) \to Q \times \set{L, R} is the transition function;
  3. for every state qq, δ(q,⊢)\delta(q, \vdash) has the form (q′,R)(q', R) and δ(q,⊣)\delta(q, \dashv) has the form (q′,L)(q', L), so the head never leaves the marked input.

On an input string w=a1⋯anw = a_1 \cdots a_n, the tape holds a0a1⋯anan+1a_0 a_1 \cdots a_n a_{n+1} with a0=⊢a_0 = {\vdash} and an+1=⊣a_{n+1} = {\dashv}. A configuration is a pair (q,i)(q, i) with q∈Qq \in Q and 0≤i≤n+10 \le i \le n + 1; it starts at (s,0)(s, 0). If q∉{t,r}q \notin \set{t, r} and δ(q,ai)=(q′,D)\delta(q, a_i) = (q', D), the next configuration is (q′,i−1)(q', i - 1) when D=LD = L and (q′,i+1)(q', i + 1) when D=RD = R. The computation stops when it enters tt or rr. The 2DFA accepts ww when the computation enters tt; it rejects ww when it enters rr or never stops.

Remarks

Example: over Σ={a,b}\Sigma = \set{a, b}, a 2DFA can accept the words whose last letter is aa. It moves right in state ss until it reads ⊣\dashv, and then moves left once into a state cc. In state cc it goes to tt if it reads aa, and to rr otherwise. Non-example: a rule δ(q,⊣)=(q′,R)\delta(q, \dashv) = (q', R) breaks clause 3, since it would move the head beyond the right end marker. Every DFA gives a 2DFA that always moves right and decides at ⊣\dashv. Conversely, the language accepted by a 2DFA is always a regular language, so 2DFAs and DFAs have the same power. The nondeterministic version, 2NFA, also accepts exactly the regular languages.

Reading path

To understand this page from the ground up, read these 5 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Alphabet concept
  2. Deterministic finite automaton concept
  3. Regular language concept
  4. String concept
  5. Two-way finite automaton definition

Further reading

  1. Web https://en.wikipedia.org/wiki/Two-way_finite_automaton
About this page
TagXMVN03292H
URIm2://XMVN03292H
Kinddefinition
WritingW0 stub
MSC68Q45
DefinesTwo-way finite automaton
UsesAlphabet, String, Deterministic finite automaton, Regular language
Changed3 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)
  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.