Finite State Automata: Examples

CS390, Spring 2024

Last modified: Jan 3, 2023
Contents:

Abstract

This lesson presents a series of sample problems designed to familiarize the reader with common patterns and styles of writing FAs, as well as with the use of the Automat tool for creating, editing, and testing automata.

1 Automat

Automat is a online tool that allows you to edit and manipulate formal languages in a variety of forms, beginning with the form we have introduced in this module, finite automata.

Automat lets you create, edit, & view automata. It can simulate “running” an automaton on inputs that you supply.

Automat can be useful to you as a means of studying some of the automata discussed in your textbook. To facilitate this, I will offer links to many of the examples from the textbook that you can download and run.

Whenever I ask you to create automata or other formal languages for a quiz or exam, you will be provided with a link to the Automat editor and must use that link to prepare and submit your answer.

  1. Go to Automat now and click the Help button.
  2. In the starting help page, click For Students and read sections:
    • Creating and Editing an FA
    • Saving Your Work
    • Testing an FA
  3. Here is an FSA over the alphabet $\{0, 1\}$, the set of binary numbers. Given a non-empty input string, it accepts only states representing a binary number that is evenly divisible by 3.

    Try running this FSA on the inputs:

    • 0
    • 1
    • 10
    • 11
    • 100
    • 101
    • 110
    • 111
    • 1110
    • 1111
    • 11110

    Use the both the Step and Finish controls until you are comfortable with both.

  4. Exercise 2.2.5 in your text suggests drawing a number of FAs. Pick a few of them and create them in Automat. Run a handful of inputs through each one to convince yourself that you have done so correctly.

2 Sample Problems

Try to solve these on your own, first, then check my answer. If you don’t see where I got my answer from, the videos will walk you through my thought process. If you want to check my answer, links to my automata are provided.

2.1 Basic Patterns

Design an FSA to recognize the language consisting of…

  1. the string 101

    Reveal
  2. all strings beginning with 101

    Can you modify the previous automaton to recognize the language of all strings over {0,1} that begin with 101?

  3. all strings ending with 101

    Can you modify the automaton got {101} to recognize the set of all strings ending in 101?

  4. all strings containing 101

    Can you modify the previous automaton to recognize the set of strings that contain 101 at any position?

2.2 Combining Smaller Machines into Larger Ones

2.2.1 Sequencing

Putting two FSAs together in a sequence is, roughly speaking, accomplished by “merging” each final state of the first FSA with the starting state of the second one. If the first has multiple final states, you may need to attach multiple copies of the second FSA.

Design an FSA to recognize the language consisting of…

  1. all strings beginning with and ending with 101

2.2.2 Alternation (Choice)

Often much trickier.

Design an FSA to recognize the language consisting of…

  1. strings beginning with 101 or 110

2.2.3 Repetition

Design an FSA to recognize the language consisting of…

  1. all strings containing 1 or more repetitions of 101

    Reveal
  2. all strings containing 0 or more repetitions of 101

    Reveal
  3. all strings composed of 1 or more (non-overlapping) occurrences of 101

    Reveal
  4. all strings composed of 0 or more occurrences of 101

  5. all strings that do not contain 101

  6. all strings containing exactly one occurrence of 101

2.2.4 Final Note

The combinations get easier when we have NFAs.

3 Moving on: Submitting Automata in Self-Assessments and Tests

In the upcoming self-assessments, quizzes, and exams, you will often be asked to submit an FSA or, in coming weeks, other kinds of automata.

When you encounter these questions in Canvas, you will generally see a small button like this:

Editor embedded within the question.

Prepare your automaton in the Automat language editor, save it to get its unique URL, and paste that URL into the response area as your submission.

Read Automat help on:

3.1 Grade Reports

If you are in a Self-assessment, you can request a Grade Report. In quizzes and exams, the instructor or TA who grades your submissions will provide a link ta grade report.