finite automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...computers are messy
TRANSCRIPT
![Page 1: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/1.jpg)
Finite AutomataPart One
![Page 2: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/2.jpg)
Computability Theory
![Page 3: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/3.jpg)
What problems can we solve with a computer?
![Page 4: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/4.jpg)
What problems can we solve with a computer?
What kind of computer?
![Page 5: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/5.jpg)
Computers are Messy
http://www.intel.com/design/intarch/prodbref/272713.htm
![Page 6: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/6.jpg)
Computers are Messy
http://www.dharmanitech.com/
![Page 7: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/7.jpg)
Computers are Messy
http://techon.nikkeibp.co.jp/article/HONSHI/20090119/164259/
![Page 8: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/8.jpg)
Computers are Messy
http://en.wikipedia.org/wiki/File:Eniac.jpg
![Page 9: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/9.jpg)
Computers are Messy
That messiness makes it hard to rigorouslysay what we intuitively know to be true:
that, on some fundamental level, different brands of computers or programming
languages are more or less equivalent in what they are capable of doing.
C vs C++
vs Java
vs Python
![Page 10: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/10.jpg)
We need a simpler way of
discussing computing machines.
![Page 11: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/11.jpg)
An automaton (plural: automata) is a mathematical model of a computing device.
![Page 12: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/12.jpg)
Computers are Messy
http://www.intel.com/design/intarch/prodbref/272713.htm
![Page 13: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/13.jpg)
Automata are Clean
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 14: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/14.jpg)
Computers are Messy
http://www.dharmanitech.com/
![Page 15: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/15.jpg)
Automata are Clean
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 16: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/16.jpg)
Computers are Messy
http://techon.nikkeibp.co.jp/article/HONSHI/20090119/164259/
![Page 17: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/17.jpg)
Automata are Clean
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 18: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/18.jpg)
Computers are Messy
http://en.wikipedia.org/wiki/File:Eniac.jpg
![Page 19: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/19.jpg)
Automata are Clean
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 20: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/20.jpg)
Why Build Models?
Mathematical simplicity.
• It is significantly easier to manipulate our abstract models of computers than it is to manipulate actual computers.
Intellectual robustness.
• If we pick our models correctly, we can make broad, sweeping claims about huge classes of real computers by arguing that they're just special cases of our more general models.
![Page 21: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/21.jpg)
Why Build Models?
The models of computation we will explore in this class correspond to different conceptions of what a computer could do.
Finite automata (this week) are an abstraction of computers with finite resource constraints.
Provide upper bounds for the computing machines that we can actually build.
Turing machines (later) are an abstraction of computers with unbounded resources.
Provide upper bounds for what we could ever hope to accomplish.
![Page 22: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/22.jpg)
What problems can we solve with a computer?
![Page 23: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/23.jpg)
What problems can we solve with a computer?
What is a “problem?”
![Page 24: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/24.jpg)
Problems with Problems
Before we can talk about what problems we can solve, we need a formal definition of a “problem.”
We want a definition that
• corresponds to the problems we want to solve,
• captures a large class of problems, and
• is mathematically simple to reason about.
No one definition has all three properties.
![Page 25: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/25.jpg)
Formal Language Theory
![Page 26: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/26.jpg)
Strings
An alphabet is a finite, nonempty set of symbols called characters.
Typically, we use the symbol Σ to refer to an alphabet.
A string over an alphabet Σ is a finite sequence of characters drawn from Σ.
Example: Let Σ = {a, b}. Here are some strings over Σ:
a aabaaabbabaaabaaaabbb abbababba
The empty string has no characters and is denoted ε.
Calling attention to an earlier point: since all strings are finite sequences of characters from Σ, you cannot have a string of infinite length.
![Page 27: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/27.jpg)
Languages
A formal language is a set of strings.
We say that L is a language over Σ if it is a set of strings over Σ.
Example: The language of palindromes over Σ = {a, b, c} is the set
{ε, a, b, c, aa, bb, cc, aaa, aba, aca, bab, … }
The set of all strings composed from letters in Σ is denoted Σ*.
Formally, we say that L is a language over Σ if L ⊆ Σ*.
![Page 28: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/28.jpg)
The Cast of Characters
Languages are sets of strings.
Strings are finite sequences of characters.
Characters are individual symbols.
Alphabets are sets of characters.
Languages
Strings Characters
Alphabets
![Page 29: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/29.jpg)
Strings and Problems
Given a string w, determine whether w ∈ S.
Suppose that L is the language
L = { "a", "b", "c", …, "z" }
This is modeling the problem:
Given a string w, determine whetherw is a single lower-case English letter.
![Page 30: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/30.jpg)
Strings and Problems
Given a string w, determine whether w ∈ S.
Suppose that L is the language
L = { p | p is a legal C++ program }
This is modeling the problem:
Given a string w, determine whetherw is a legal C++ program.
![Page 31: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/31.jpg)
The Model
Fundamental Question: For what languages L can you design an automaton that takes as input a string, then determines whether the string is in L?
The answer depends on the choice of L, the choice of automaton, and the definition of “determines.”
In answering this question, we’ll go through a whirlwind tour of models of computation and see how this seemingly abstract question has very real and powerful consequences.
![Page 32: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/32.jpg)
To Summarize
An automaton is an idealized mathematical computing machine.
A language is a set of strings, a string is a (finite) sequence of characters, and a character is an element of an alphabet.
Goal: Figure out in which cases we can build automata for particular languages.
![Page 33: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/33.jpg)
What problems can we solve with a computer?
![Page 34: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/34.jpg)
Finite Automata
![Page 35: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/35.jpg)
A finite automaton is a simple type of mathematical machine for determining
whether a string is contained within some
language.
![Page 36: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/36.jpg)
Each finite automaton consists of a setof states connected by transitions.
![Page 37: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/37.jpg)
A Simple Finite Automaton
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 38: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/38.jpg)
A Simple Finite Automaton
Each circle represents a state of the automaton.
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 39: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/39.jpg)
A Simple Finite Automaton
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 40: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/40.jpg)
A Simple Finite Automaton
One special state is designated as the start state.
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 41: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/41.jpg)
A Simple Finite Automaton
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 42: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/42.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 43: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/43.jpg)
A Simple Finite Automaton
0 1 0 1 1 0
The automaton is run on an input string and
answers “yes” or “no.”
0 1 0 1 1 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 44: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/44.jpg)
A Simple Finite Automaton
q2q3
0 1 0 1 1 00 1 0 1 1 0
q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 45: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/45.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 46: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/46.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
The automaton can be in one state at a time. It begins in
the start state.
![Page 47: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/47.jpg)
A Simple Finite Automaton
q2q3
0 1 0 1 1 00 1 0 1 1 0
q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 48: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/48.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
The automaton now begins processing characters in the order in which they appear.
![Page 49: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/49.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 50: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/50.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 51: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/51.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q0 q1
q2q3 q2
Each arrow in this diagram represents a transition. The
automaton always follows the transition corresponding to the current symbol being
read.
0
0
0
0
1 1 1 1
start
![Page 52: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/52.jpg)
A Simple Finite Automaton
q2q3
0 1 0 1 1 00 1 0 1 1 0
q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 53: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/53.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 54: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/54.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 55: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/55.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 56: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/56.jpg)
A Simple Finite Automaton
0 1 0 1 1 0
After transitioning, the automaton considers the next symbol in the input.
0 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 57: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/57.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 58: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/58.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 59: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/59.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 60: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/60.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 61: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/61.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 62: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/62.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 63: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/63.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 64: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/64.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 65: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/65.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 66: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/66.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 67: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/67.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 68: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/68.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 69: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/69.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 70: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/70.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 71: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/71.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 72: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/72.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 73: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/73.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 74: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/74.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 75: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/75.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 76: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/76.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 77: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/77.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 78: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/78.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
Now that the automaton has looked at all this input, it can decide whether to say “yes”
or “no.”
![Page 79: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/79.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
The double circle indicates that this state is an accepting state, so the automaton outputs
“yes.”
0
0
0
0
1 1 1 1
start
Now that the automaton has looked at all this input, it can decide whether to say “yes”
or “no.”
![Page 80: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/80.jpg)
A Simple Finite Automaton
0 1 0 1 1 00 1 0 1 1 0
q2q3q3
q0 q1
q2q3 q2
Now that the automaton has looked at all this input, it can decide whether to say “yes”
or “no.”
The double circle indicates that this state is an accepting state, so the automaton outputs
“yes.”
0
0
0
0
1 1 1 1
start
![Page 81: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/81.jpg)
A Simple Finite Automaton
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 82: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/82.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 83: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/83.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 84: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/84.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 85: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/85.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 86: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/86.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 87: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/87.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 88: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/88.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 89: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/89.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 90: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/90.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 91: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/91.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 92: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/92.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 93: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/93.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 94: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/94.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 95: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/95.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 96: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/96.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 97: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/97.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 98: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/98.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 99: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/99.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 100: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/100.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 101: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/101.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 102: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/102.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 103: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/103.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 104: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/104.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 105: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/105.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 106: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/106.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 107: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/107.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 108: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/108.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
This state is not an accepting state (it’s a
rejecting state), so the automaton says “no.”
![Page 109: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/109.jpg)
A Simple Finite Automaton
1 0 1 0 0 0
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
This state is not an accepting state (it’s a
rejecting state), so the automaton says “no.”
![Page 110: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/110.jpg)
A Simple Finite Automaton
q0 q1
q2q3 q2
0
0
0
0
1 1 1 1
start
![Page 111: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/111.jpg)
A Simple Finite Automaton
q0 q1
q2q3 q2
Try it yourself!Does this automaton
accept or reject this string?
1 1 0 1 1 1 0 0
0
0
0
0
1 1 1 1
start
![Page 112: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/112.jpg)
The Story So Far
A finite automaton is a collection of states joined by transitions.
Some state is designated as the start state.
Some number of states are designated as accepting states.
The automaton processes a string by beginning in the start state and following the indicated transitions.
If the automaton ends in an accepting state, it accepts the input.
Otherwise, the automaton rejects the input.
![Page 113: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/113.jpg)
Time-Out For Announcements!
![Page 114: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/114.jpg)
Midterm
• The midterm will become available at 9:30 AM PDT tomorrow (Thursday). All the details you need to know are on a pinned Campuswire post.
• There are no office hours tomorrow. They’ve all been moved to not happen during the midterm.
• You’ve got this!
![Page 115: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/115.jpg)
Back to CS103!
![Page 116: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/116.jpg)
Just Passing Through
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 117: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/117.jpg)
Just Passing Through
q0
q2q1 1 1 0 1
q0
q1
q4q3
0 0
0
0
0
1
1 1
1
1
start
![Page 118: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/118.jpg)
Just Passing Through
q0
q2
q4
q1
q3
1 1 0 1
q4q3
q1
0 0
0
0
0
1
1 1
1
1
start
![Page 119: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/119.jpg)
Just Passing Through
q0
q2
q4
q1
q3
1 1 0 1
q4q3
q1
0 0
0
0
0
1
1 1
1
1
start
![Page 120: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/120.jpg)
Just Passing Through
q0
q2
q4
q1
q3
1 1 0 1
q4q3
q0
0 0
0
0
0
1
1 1
1
1
start
![Page 121: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/121.jpg)
Just Passing Through
q0
q2
q4
q1
q3
1 1 0 1
q4q3
q0
0 0
0
0
0
1
1 1
1
1
start
![Page 122: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/122.jpg)
Just Passing Through
q0
q2
q4
q1
q3
1 1 0 1
q4q3q3
q0
q1
0 0
0
0
0
1
1 1
1
1
start
![Page 123: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/123.jpg)
Just Passing Through
q0
q2
q4
q1
q3
1 1 0 1
q4q3
q0
q1
0 0
0
0
0
1
1 1
1
1
start
![Page 124: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/124.jpg)
Just Passing Through
q0
q2
q4
q1
q3
1 1 0 1
q4q3
q0
q1
0 0
0
0
0
1
1 1
1
1
start
![Page 125: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/125.jpg)
Just Passing Through
q0
q2
q4
q1
q3
1 1 0 1
q4q3
q0
q1
0 0
0
0
0
1
1 1
1
1
start
![Page 126: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/126.jpg)
Just Passing Through
q0
q2
q4
q1
q3
1 1 0 1
q4q3
q0
0 0
0
0
0
1
1 1
1
1
start
![Page 127: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/127.jpg)
Just Passing Through
q0
q2
q4
q1
q3
1 1 0 1
q4q3
q0
0 0
0
0
0
1
1 1
1
1
start
![Page 128: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/128.jpg)
Just Passing Through
q0
q2
q4
q1
q3
1 1 0 1
q4q3
q0
0 0
0
0
0
1
1 1
1
1
start
![Page 129: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/129.jpg)
Just Passing Through
q0
q2
q4
q1
q3
1 1 0 1
q4q3
q0
0 0
0
0
0
1
1 1
1
1
start
![Page 130: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/130.jpg)
A finite automaton does not accept assoon as it enters an accepting state.
A finite automaton accepts if it ends inan accepting state.
![Page 131: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/131.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 132: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/132.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 133: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/133.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 134: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/134.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 135: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/135.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 136: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/136.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 137: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/137.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 138: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/138.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
No matter where we start in the automaton, after seeing two 1's, we end up in accepting state q3.
0 0
0
0
0
1
1 1
1
1
start
![Page 139: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/139.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 140: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/140.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 141: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/141.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 142: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/142.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 143: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/143.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 144: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/144.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 145: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/145.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
No matter where we start in the automaton, after seeing two 0's, we end up in accepting state q4.
0 0
0
0
0
1
1 1
1
1
start
![Page 146: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/146.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 147: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/147.jpg)
What Does This Accept?
q0
q2
q4
q1
q3
This automaton accepts a string in {0, 1}* iff the string ends in 00 or 11.
0 0
0
0
0
1
1 1
1
1
start
![Page 148: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/148.jpg)
The language of an automaton is the
set of strings that it accepts.
If D is an automaton that processes characters from the alphabet Σ, then ℒ(D)
is formally defined as
ℒ(D) = { w ∈ Σ* | D accepts w }
![Page 149: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/149.jpg)
A Small Problem
q0
q1q2
0 0
1
start
![Page 150: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/150.jpg)
A Small Problem
q0
q1q2
0 1 1 00 0
1
start
![Page 151: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/151.jpg)
A Small Problem
q0
q1q2
0 1 1 00 0
1
start
![Page 152: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/152.jpg)
A Small Problem
q0
q1q2
0 1 1 00 0
1
start
![Page 153: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/153.jpg)
A Small Problem
q0
q1q2
0 1 1 00 0
1
start
![Page 154: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/154.jpg)
A Small Problem
q0
q1q2
0 1 1 00 0
1
start
![Page 155: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/155.jpg)
A Small Problem
q0
q1q2
0 1 1 00 0
1
start
![Page 156: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/156.jpg)
A Small Problem
q0
q1q2
0 1 1 00 0
1
start
![Page 157: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/157.jpg)
A Small Problem
q0
q1q2
0 1 1 00 0
1
start
![Page 158: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/158.jpg)
Another Small Problem
q0
q2
q1
start
0, 1
0, 1
0, 1
0
![Page 159: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/159.jpg)
Another Small Problem
q0
q2
0 0 0
q1
0, 1
0, 1
0, 1
0
![Page 160: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/160.jpg)
Another Small Problem
q0
q2
0 0 0
q1
0, 1
0, 1
0, 1
0
![Page 161: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/161.jpg)
Another Small Problem
q0
q2
0 0 0
q1
0, 1
0, 1
0, 1
0
![Page 162: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/162.jpg)
Another Small Problem
q0
q2
0 0 0
q1
0, 1
0, 1
0, 1
0
![Page 163: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/163.jpg)
Another Small Problem
q0
q2
0 0 0
q1
0, 1
0, 1
0, 1
0
![Page 164: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/164.jpg)
Another Small Problem
q0
q2
0 0 0
q1
0, 1
0, 1
0, 1
0
![Page 165: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/165.jpg)
Another Small Problem
q0
q2
0 0 0
q1
0, 1
0, 1
0, 1
0
![Page 166: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/166.jpg)
The Need for Formalism
In order to reason about the limits of what finite automata can and cannot do, we need to formally specify their behavior in all cases.
All of the following need to be defined or disallowed:
What happens if there is no transition out of a state on some input?
What happens if there are multipletransitions out of a state on some input?
![Page 167: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/167.jpg)
DFAs
A DFA is a
• Deterministic
• Finite
• Automaton
DFAs are the simplest type of automaton that we will see in this course.
![Page 168: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/168.jpg)
DFAs
• A DFA is defined relative to some alphabet Σ.
• For each state in the DFA, there must be exactly one transition defined for each symbol in Σ.
• This is the “deterministic” part of DFA.
• There is a unique start state.
• There are zero or more accepting states.
![Page 169: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/169.jpg)
Is this a DFA over {0, 1}?
![Page 170: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/170.jpg)
Is this a DFA over {0, 1}?
q0 q1
q2q3 q2
0
0
0
1 1 1 1
start0
![Page 171: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/171.jpg)
Is this a DFA over {0, 1}?
![Page 172: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/172.jpg)
Is this a DFA over {0, 1}?
q0
q2
q4
q1
q3
0 0
0
0
0
1
1 1
1
1
start
![Page 173: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/173.jpg)
Is this a DFA over {0, 1}?
![Page 174: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/174.jpg)
Is this a DFA over {0, 1}?
q0
q1q2
0 0
1
start
![Page 175: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/175.jpg)
Is this a DFA over {0, 1}?
q0
q1q2
![Page 176: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/176.jpg)
Is this a DFA over {0, 1}?
![Page 177: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/177.jpg)
Is this a DFA over {0, 1}?
q0 q1
q3 q2
start 0, 1
0, 1
0, 1
0, 1
![Page 178: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/178.jpg)
Is this a DFA over {0, 1}?
![Page 179: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/179.jpg)
Is this a DFA over {0, 1}?
q0
q2
q1
0, 1
0, 1
0, 1
0
start
![Page 180: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/180.jpg)
Is this a DFA over {0, 1}?
q0
q2
q1
![Page 181: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/181.jpg)
Is this a DFA?
![Page 182: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/182.jpg)
Is this a DFA?
![Page 183: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/183.jpg)
Is this a DFA?
Drinking Family of Aardvarks
![Page 184: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/184.jpg)
Designing DFAs
At each point in its execution, the DFA can only remember what state it is in.
DFA Design Tip: Build each state to correspond to some piece of information you need to remember.
Each state acts as a “memento” of what you're supposed to do next.
Only finitely many different states means only finitely many different things the machine can remember.
![Page 185: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/185.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}*| the number of b's in w is congruentto two modulo three }
![Page 186: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/186.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}*| the number of b's in w is congruentto two modulo three }
q0
start
![Page 187: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/187.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}*| the number of b's in w is congruentto two modulo three }
q0
a
start
![Page 188: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/188.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}*| the number of b's in w is congruentto two modulo three }
q0 q1
a
b
start
![Page 189: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/189.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}*| the number of b's in w is congruentto two modulo three }
q0 q1
aa
b
start
![Page 190: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/190.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}*| the number of b's in w is congruentto two modulo three }
q0 q1 q2
aa
bb
start
![Page 191: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/191.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}*| the number of b's in w is congruentto two modulo three }
q0 q1 q2
aaa
bb
start
![Page 192: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/192.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}*| the number of b's in w is congruentto two modulo three }
q0 q1 q2
b
aaa
bb
start
![Page 193: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/193.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}*| the number of b's in w is congruentto two modulo three }
q0 q1 q2
b
aaa
bb
start
![Page 194: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/194.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}*| the number of b's in w is congruentto two modulo three }
q0 q1 q2
Each state remembers the
remainder of the number of bs
seen so far modulo three.
b
aaa
bb
start
![Page 195: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/195.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}* | w contains aa as a substring }
![Page 196: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/196.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}* | w contains aa as a substring }
q0
start
![Page 197: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/197.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}* | w contains aa as a substring }
q0
b
start
![Page 198: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/198.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}* | w contains aa as a substring }
q0 q1
a
b
start
![Page 199: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/199.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}* | w contains aa as a substring }
q0 q1
a
b
b
start
![Page 200: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/200.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}* | w contains aa as a substring }
q0 q1 q2
a
b
a
b
start
![Page 201: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/201.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}* | w contains aa as a substring }
q0 q1 q2
a
b
a
b
start
![Page 202: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/202.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}* | w contains aa as a substring }
q0 q1 q2
a
ba, b
a
b
start
![Page 203: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/203.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}* | w contains aa as a substring }
q0 q1 q2
a
ba, b
a
b
start
![Page 204: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/204.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}* | w contains aa as a substring }
q0 q1 q2
a
bΣ
a
b
start
![Page 205: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/205.jpg)
Recognizing Languages with DFAs
L = { w ∈ {a, b}* | w contains aa as a substring }
q0 q1 q2
a
bΣ
a
b
start
![Page 206: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/206.jpg)
More Elaborate DFAs
L = { w ∈ {a, *, /}* | w represents a C-style comment }
Let’s have the a symbol be a placeholder for “some character that isn’t a star or slash.”
Try designing a DFA for comments! Here’s some test cases to help you check your work:
Accepted:
/*a*//**/
/***//*aaa*aaa*/
/*a/a*/
Rejected:
/**/**/a/*aa*/aaa/**/aa
/*//**a/
//aaaa
![Page 207: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/207.jpg)
More Elaborate DFAs
L = { w ∈ {a, *, /}* | w represents a C-style comment }
q1 q2 q3 q4q0
q5
/
*
a
/, a
a, *
/ *
Σ
start
*a, /
Σ
![Page 208: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/208.jpg)
The Regular Languages
![Page 209: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/209.jpg)
A language L is called a regular languageif there exists a DFA D such that ℒ(D) = L.
If L is a language and ℒ(D) = L, we say that D recognizes the language L.
![Page 210: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/210.jpg)
Revisiting a Problem
q0 q1 q2q2
q3
start
0, 1
0, 1
11
0, 1
0
![Page 211: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/211.jpg)
Revisiting a Problem
q0 q1 q2q2
start 11
0, 1
![Page 212: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/212.jpg)
NFAs
An NFA is a
• Nondeterministic
• Finite
• Automaton
Structurally similar to a DFA, butrepresents a fundamental shift in how we'll think about computation.
![Page 213: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/213.jpg)
(Non)determinism
A model of computation is deterministic if at every point in the computation, there is exactly one choice that can make.
The machine accepts if that series of choices leads to an accepting state.
A model of computation is nondeterministic if the computing machine may have multiple decisions that it can make at one point.
The machine accepts if any series of choices leads to an accepting state.
(This sort of nondeterminism is technically called existential nondeterminism, the most philosophical-sounding term we’ll introduce all quarter.)
![Page 214: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/214.jpg)
A Simple NFA
q0 q1 q2q2
q3
start
0, 1
0, 1
11
0, 1
0
![Page 215: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/215.jpg)
A Simple NFA
q0 has two transitions defined on 1!
q0 q1 q2q2
q3
start
0, 1
0, 1
11
0, 1
0
![Page 216: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/216.jpg)
A Simple NFA
0 1 0 1 1
q0 q1 q2q2
q3
start
0, 1
11
0, 1
0
0, 1
![Page 217: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/217.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 218: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/218.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 219: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/219.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 220: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/220.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 221: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/221.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 222: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/222.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 223: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/223.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 224: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/224.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 225: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/225.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 226: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/226.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 227: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/227.jpg)
q1q0q0 q1 q2q2
q3
A Simple NFA
q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 228: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/228.jpg)
q1q0q0 q1 q2q2
q3
A Simple NFA
q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 229: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/229.jpg)
q2q2q1q1q0q0 q2q2
q3
A Simple NFA
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 230: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/230.jpg)
q3
q2q2q2q2q1q1q0q0
q3
A Simple NFA
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 231: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/231.jpg)
q3
q2q2q2q2q1q1q0q0
q3
A Simple NFA
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 232: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/232.jpg)
q3
q2q2q2q2q1q1q0q0
q3
A Simple NFA
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 233: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/233.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 234: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/234.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 235: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/235.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 236: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/236.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 237: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/237.jpg)
q0q0 q1 q2q2
q3
A Simple NFA
q1 q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 238: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/238.jpg)
q1q0q0 q1 q2q2
q3
A Simple NFA
q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 239: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/239.jpg)
q1q0q0 q1 q2q2
q3
A Simple NFA
q2q2
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 240: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/240.jpg)
q2q2q1q1q0q0 q2q2
q3
A Simple NFA
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 241: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/241.jpg)
q2q2q1q1q0q0 q2q2
q3
A Simple NFA
q3
0 1 0 1 1
start
0, 1
11
0, 1
0
0, 1
![Page 242: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/242.jpg)
0 1 0 1 1
q2q2q1q1q0q0 q2q2
q3
A Simple NFA
q3
start
0, 1
11
0, 1
0
0, 1
![Page 243: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/243.jpg)
q0q0 q1 q2q2
A More Complex NFA
q1 q2q2
1 1
0, 1
start
![Page 244: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/244.jpg)
q0q0 q1 q2q2
A More Complex NFA
q1 q2q2
If a NFA needs to make a transition when no transition exists, the automaton dies and
that particular path does not accept.
1 1
0, 1
start
![Page 245: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/245.jpg)
q0q0 q1 q2q2
A More Complex NFA
q1 q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 246: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/246.jpg)
q0q0 q1 q2q2
A More Complex NFA
q1 q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 247: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/247.jpg)
q0q0 q1 q2q2
A More Complex NFA
q1 q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 248: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/248.jpg)
q0q0 q1 q2q2
A More Complex NFA
q1 q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 249: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/249.jpg)
q1q0q0 q1 q2q2
A More Complex NFA
q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 250: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/250.jpg)
q1q0q0 q1 q2q2
A More Complex NFA
q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 251: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/251.jpg)
q1q0q0 q2q2
A More Complex NFA
q2q2
Oh no! There's notransition defined!
0 1 0 1 1
1 1
0, 1
start
![Page 252: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/252.jpg)
q1q1q0q0 q2q2
A More Complex NFA
q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 253: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/253.jpg)
q0q0 q1 q2q2
A More Complex NFA
q1 q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 254: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/254.jpg)
q0q0 q1 q2q2
A More Complex NFA
q1 q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 255: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/255.jpg)
q0q0 q1 q2q2
A More Complex NFA
q1 q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 256: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/256.jpg)
q0q0 q1 q2q2
A More Complex NFA
q1 q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 257: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/257.jpg)
q0q0 q1 q2q2
A More Complex NFA
q1 q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 258: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/258.jpg)
q1q0q0 q1 q2q2
A More Complex NFA
q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 259: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/259.jpg)
q1q0q0 q1 q2q2
A More Complex NFA
q2q2
0 1 0 1 1
1 1
0, 1
start
![Page 260: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/260.jpg)
q2q2q1q1q0q0 q2q2
A More Complex NFA
0 1 0 1 1
1 1
0, 1
start
![Page 261: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/261.jpg)
q2q2q1q1q0q0 q2q2
A More Complex NFA
0 1 0 1 1
1 1
0, 1
start
![Page 262: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/262.jpg)
0 1 0 1 1
q2q2q1q1q0q0 q2q2
A More Complex NFA
1 1
0, 1
start
![Page 263: Finite Automataweb.stanford.edu/class/archive/cs/cs103/cs103.1208...Computers are Messy](https://reader034.vdocuments.us/reader034/viewer/2022043003/5f820af9aeab3309e52f4ce1/html5/thumbnails/263.jpg)
Next Time
DFAs vs NFAs
How do these two models of computation relate?
Regular Languages
A first classification of “problems”.