Tracking the Last Symbol with a Finite State

A small automaton can recognize words ending in a specified symbol by updating its retained state on every step.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a binary rule
  2. Check earlier occurrences
  3. Use the next symbol to replace the previous summary
  4. Verify that earlier accepting visits are irrelevant

Trace a binary rule

Start in nonaccepting state. Reading 1 moves to accepting, while reading 0 moves to nonaccepting, from either state. Word 1010 ends nonaccepting. See states while reading a word.

Check earlier occurrences

A word can contain 1 and still end with 0. An automaton recognizing occurrence anywhere would make its found state persist. Sticky transitions show that alternative state meaning.[1]

Use the next symbol to replace the previous summary

A machine accepting words ending in a can store whether the most recent symbol is a. Reading b moves to the nonaccepting state regardless of the previous state. Reading a moves to accepting. Start nonaccepting so the empty word is rejected. See the empty word.

Input aba
After a: accept-state
After ab: reject-state
After aba: accept-state → final answer accept

Verify that earlier accepting visits are irrelevant

Word ab reaches accepting after its first symbol but finishes outside it. Test that input and the empty word. Extend the state summary only if the language needs a longer suffix.

References

  1. Michael Sipser, Introduction to the Theory of Computation ↩