Introduction to the Theory of Computation John Paxton
- Slides: 19
Introduction to the Theory of Computation John Paxton Montana State University Summer 2003
Textbook Introduction to the Theory of Computation Michael Sipser PWS Publishing Company 1997
Humor • One night, Bill Clinton was awakened by George Washington's ghost in the White House. Clinton saw him and asked, "George, what is the best thing I could do to help the country? " "Set an honest and honorable example, just as I did, " advised George. The next night, the ghost of Thomas Jefferson moved through the dark bedroom. "Tom, what is the best thing I could do to help the country? " Clinton asked. "Cut taxes and reduce the size of government, " advised Tom. Clinton didn't sleep well the next night, and saw another figure moving in the shadows. It was Abraham Lincoln's ghost. "Abe, what is the best thing I could do to help the country? " Clinton asked. "Go to theatre. "
Chapter 1: Regular Languages • Very simple model of computation
1. 1 Finite Automaton • A finite state automaton (FSA) is a very simple model of computation. • Studying an FSA allows us to better understand more complex models of computation. • An FSA can be used in a compiler to tokenize the input.
Example 1 0 1 1 q 0 q 1 0
Example 1 Questions • What is the start state? • What is the set of accept states? • What sequence of states are gone through on input 0111001? • Is the empty string input (e) accepted?
Formal Definition A finite automaton is a 5 -tuple (Q, S, d, q 0, F) where 1. Q is a finite set called the states 2. S is a finite set called the alphabet 3. d : Q x S Q is the transition function 4. q 0 Î Q is the start state 5. F Í Q is the set of accept states
Example 1 Formal Definition • • Q = { q 0, q 1 } S = {0, 1} F = { q 1 } d 0 1 q 0 q 1
Language of Machine M • L(M) = A where A is the set of all strings that machine M accepts. • L(Example 1) = { w | w ends in a 1 } • M “recognizes” A
Acceptance Let M = (Q, S, d, q 0, F) be a finite automaton and w = w 1 w 2 …wn be a string over the alphabet S. Then M “accepts” w if a sequence of states r 0 r 1…rn exists in Q with the following three conditions: 1. r 0 = q 0 2. d(ri, wi+1) = ri+1 for 0 <= i <= n – 1 3. rn Î F
Regular Language A language is called a “regular language” if some finite automaton recognizes it.
Exercises • Design a finite automaton that recognizes the regular language of all strings that contain the string 001 as a substring. The alphabet is {0, 1, 2}. • Design a finite automaton that recognizes all binary numbers that are multiples of 3. • Design a finite automaton that recognizes all binary strings with a 1 in the kth position where k > 0.
Regular Operations • Union A U B = { x | x Î A or x Î B} • Concatenation A B = { xy | x Î A and y Î B} • Star A* = {x 1 x 2…xk | k >= 0 and xi Î A}
Theorem The class of regular languages is closed under the union operation. In other words, if A 1 and A 2 are regular languages, so is A 1 U A 2.
Proof • M 1 = (Q 1, S, d 1, q 1, F 1) • M 2 = (Q 2, S, d 2, q 2, F 2) • Construct M = (Q, S, d, q 0, F)
Proof (by construction) • • Q = {(r 1, r 2) | r 1 Î Q 1 and r 2 Î Q 2 q 0 = (q 1, q 2) F = {(r 1, r 2) | r 1 Î F 1 or r 2 Î F 2} d((r 1, r 2), a) = (d 1 (r 1, a), d 2 (r 2, a) )
Exercise • Use the preceding construction to construct a FSA that accepts the union of L(A 1) = { w | w ends in 1 } and L(A 2) = { w | w contains the substring 00 }
More Theorems • The class of regular languages is closed under the concatenation operation. • The class of regular languages is closed under the star operation. • Proofs: easier with the concept of nondeterminism!
- Fish morphology worksheet answers
- Autumn vinciquerra
- Donna paxton
- Sipser, m: introduction to the theory of computation
- Cosc 3340
- Common lisp a gentle introduction to symbolic computation
- Theory of computation
- Graph transition
- Types of languages in theory of computation
- Theory of computation
- Ambiguity
- Theory of computation
- Diagonalization method in theory of computation
- Anbn pda
- Theory of computation quiz
- Computation
- Nfa theory of computation
- The theory of computation
- Cs 3102
- Who is not subject to withholding tax on compensation