Introduction to the Theory of Computation - PowerPoint PPT Presentation

About This Presentation
Title:

Introduction to the Theory of Computation

Description:

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 ... – PowerPoint PPT presentation

Number of Views:30
Avg rating:3.0/5.0
Slides: 20
Provided by: Joh7
Category:

less

Transcript and Presenter's Notes

Title: Introduction to the Theory of Computation


1
Introduction to the Theory of Computation
  • John Paxton
  • Montana State University
  • Summer 2003

2
Textbook
  • Introduction to the Theory of Computation
  • Michael Sipser
  • PWS Publishing Company
  • 1997

3
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 the
    theatre."

4
Chapter 1 Regular Languages
  • Very simple model of computation

5
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.

6
Example 1
0
1
1
q0
q1
0
7
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?

8
Formal Definition
  • A finite automaton is a 5-tuple (Q, S, d, q0, F)
    where
  • Q is a finite set called the states
  • S is a finite set called the alphabet
  • d Q x S ? Q is the transition function
  • q0 Î Q is the start state
  • F Í Q is the set of accept states

9
Example 1 Formal Definition
  • Q q0, q1
  • S 0, 1
  • F q1
  • d




0 1
q0 q0 q1
q1 q0 q1
10
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

11
Acceptance
  • Let M (Q, S, d, q0, F) be a finite automaton
    and w w1w2 wn be a string over the alphabet S.
    Then M accepts w if a sequence of states
    r0r1rn exists in Q with the following three
    conditions
  • r0 q0
  • d(ri, wi1) ri1 for 0 lt i lt n 1
  • rn Î F

12
Regular Language
  • A language is called a regular language if some
    finite automaton recognizes it.

13
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 gt 0.

14
Regular Operations
  • Union A U B x x Î A or x Î B
  • Concatenation A B xy x Î A
    and y Î B
  • Star A x1x2xk k gt 0 and xi Î A

15
Theorem
  • The class of regular languages is closed under
    the union operation.
  • In other words, if A1 and A2 are regular
    languages, so is A1 U A2.

16
Proof
  • M1 (Q1, S, d1, q1, F1)
  • M2 (Q2, S, d2, q2, F2)
  • Construct M (Q, S, d, q0, F)

17
Proof (by construction)
  • Q (r1, r2) r1 Î Q1 and r2 Î Q2
  • q0 (q1, q2)
  • F (r1, r2) r1 Î F1 or r2 Î F2
  • d((r1,r2), a) (d1 (r1, a), d2 (r2, a) )

18
Exercise
  • Use the preceding construction to construct a FSA
    that accepts the union of L(A1) w w ends in
    1 and L(A2) w w contains the substring
    00

19
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!
Write a Comment
User Comments (0)
About PowerShow.com