Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 3

Introduction to DFAs: Components and 5-Tuple Definition

Recommended resources

Welcome to our third lesson. In the previous sessions, we established a formal vocabulary for discussing computation—alphabets, strings, and languages—and explored how to construct new languages from existing ones using the regular operations of union, concatenation, and Kleene star.

So far, we have only described languages as static sets of strings. Today, we take a major step forward by introducing our first computational model: a machine that can process input and decide whether a string belongs to a language. This lesson introduces the Deterministic Finite Automaton (DFA). Our goal is to formally define a DFA as a 5-tuple and understand the precise role of each of its five components. This forms the bedrock for the entire field of automata theory.

From Intuition to a Formal Model

At its core, a finite automaton is an abstract machine with a very limited memory. It reads an input string one character at a time, moving from one state to another based on the character it reads. When it reaches the end of the string, its final state determines whether the string is "accepted" or "rejected."

You can think of this like a simple flowchart or a board game where each space is a state, and the input string tells you which path to take. Let's watch a segment from an MIT OpenCourseWare lecture that introduces this concept using a visual representation called a state diagram.

1. Introduction, Finite Automata, Regular Expressions

This video introduces the concept of a finite automaton using a state diagram. Professor Sipser explains the components visually (states, transitions, start state, accepting states) and demonstrates how the machine processes an input string.

Watch the segment from starting off with an example. Pay attention to the components of the diagram and how the machine follows the arrows based on the input symbols 0 and 1 to land on either an "accept" or "reject" state.

The state diagram is an excellent tool for intuition. However, to analyze these machines with mathematical precision—which is essential for proving their capabilities and limitations—we need a formal definition. A picture can be ambiguous; a mathematical description is not.


The Formal Definition of a DFA

As you've seen in your studies of mathematics, formal definitions are the foundation of any rigorous theory. In computability theory, a Deterministic Finite Automaton (DFA) is formally defined as a 5-tuple. This is simply a collection of five mathematical objects that, together, completely specify the machine.

A DFA, let's call it , is defined as , where:

  1. is a finite set of states. These are the "nodes" or "circles" in the state diagram. The machine's memory is limited to knowing which one of these states it is currently in.
  2. is a finite set called the alphabet. This defines the set of all possible input symbols, which we discussed in our first lesson. These are the labels on the arrows in the diagram.
  3. is the transition function. This is the "program" of the machine. It takes two arguments: a state and an input symbol, and it returns the single state to which the machine moves. Its formal signature is . The "deterministic" in DFA comes from the fact that for any given state and any input symbol, there is exactly one possible next state.
  4. is the start state. This is the state where the machine begins its computation for any input. In a diagram, it's typically indicated by an arrow pointing to it from nowhere.
  5. is the set of accepting states (or final states). If the machine is in one of these states after reading the entire input string, the string is accepted. Otherwise, it is rejected. These are the "double circles" in the diagram.

To solidify your understanding of this formal structure, please read the following section from a set of lecture notes from the University of Illinois.

Deterministic Finite Automata (DFAs)

This document provides a clear and rigorous presentation of DFAs. The section on the formal definition lays out the 5-tuple and its components.

Please read the section titled "Formal definition of DFA" (slide 12). This presents the same 5-tuple definition we just discussed.


Dissecting the 5-Tuple

Let's take a closer look at each component, especially the transition function, which is the heart of the automaton's logic. The following video provides an excellent breakdown of the 5-tuple, explaining the role of each part and the nature of the transition function as a "total function."

How do we formally define a DFA?

This video from Easy Theory methodically explains the five formal parts of a DFA. It pays special attention to the transition function, clarifying why its domain is Q × Σ and its codomain is Q, and what it means for it to be a "total function."

Watch from specify a DFA here. Focus on how each of the five components (Q, Σ, δ, q₀, F) is defined and what it represents. The explanation of the transition function delta as a total function is particularly important for understanding determinism.

The concept of as a total function is critical. It means that for every state in and every symbol in , there is a defined transition. The machine can never get "stuck" because it doesn't know what to do. This is the essence of determinism.


A Complete Example: Diagram and Formalism

Now, let's tie the visual diagram and the formal 5-tuple together using a complete example. The image below shows a DFA named , its state diagram, and its complete formal description.

A state diagram for a DFA named M1, along with its corresponding formal 5-tuple definition. This illustrates the one-to-one mapping between the visual representation and the mathematical formalism.

Let's break down how the diagram maps to the formal definition provided in the image:

  1. : This set directly corresponds to the three circles labeled , , and in the diagram.
  2. : This is the alphabet of the machine. You can see that all the transition arrows are labeled with either a 0 or a 1.
  3. : The transition function is described by the table. Each entry in the table corresponds to an arrow in the diagram. For example, the entry for row , column 1 is . This corresponds to the arrow from state to labeled 1. Formally, we write . Likewise, the arrow from to labeled 0 corresponds to the table entry .
  4. is the start state: This is represented by the arrow entering that doesn't come from any other state.
  5. : This set contains all the accepting states. In the diagram, is the only state drawn with a double circle, signifying it is an accepting state.

This single example encapsulates everything we've covered. The diagram provides an intuitive picture, while the 5-tuple provides the precise, unambiguous definition required for rigorous analysis.


Conclusion

In this lesson, we have introduced our first model of computation, the Deterministic Finite Automaton. We moved from an intuitive, visual understanding via state diagrams to the robust, mathematical formalism required for the theory.

The key takeaways are:

  • A DFA is a simple machine that processes strings and either accepts or rejects them.
  • It is formally defined by a 5-tuple: .
  • These five components specify the machine's states, its input alphabet, its transition function (its "rules"), its start state, and its accepting states.
  • The "deterministic" nature of a DFA stems from its transition function , which dictates exactly one next state for any given state and input symbol.

In our next lesson, we will formalize the process of computation itself. We will define precisely what it means for a DFA to "accept" a string by extending the transition function to operate on entire strings, not just single symbols. This will allow us to formally define the language recognized by a DFA.