introduction to the theory of computation n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Introduction to the Theory of Computation PowerPoint Presentation
Download Presentation
Introduction to the Theory of Computation

Loading in 2 Seconds...

play fullscreen
1 / 30

Introduction to the Theory of Computation - PowerPoint PPT Presentation


  • 124 Views
  • Uploaded on

Introduction to the Theory of Computation. John Paxton Montana State University Summer 2003. Humor.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Introduction to the Theory of Computation' - iden


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
introduction to the theory of computation

Introduction to the Theory of Computation

John Paxton

Montana State University

Summer 2003

humor
Humor
  • A busload of politicians were driving down a country road when, all of a sudden, the bus ran off the road and crashed into a tree in an old farmer's field. The old farmer, after seeing what had happened, went over to investigate. He then proceeded to dig a hole to bury the politicians.       A few days later the local sheriff came out, saw the crashed bus, and asked the old farmer where all the politicians had gone.       The old farmer said he had buried them.       The sheriff asked the old farmer, "Were they all dead?"       The old farmer replied, "Well, some of them said they weren't, but you know how them politicians lie."
1 2 nondeterminism
1.2 Nondeterminism
  • In a nondeterministic machine, several choices might exist at a given point instead of only one.
example 2
Example 2

0

q0

q2

0, e

1

q1

example 3
Example 3
  • Write an NDFA that recognizes the language consisting of all strings over {0, 1} containing a 1 in the third position from the end.
example 31
Example 3

0,1

1

0,1

q3

q2

q0

q1

0,1

exercises
Exercises
  • Give a 3 state NFA that accepts the language: zero or more 0s, followed by zero or more ones, followed by zero or more 0s followed by a 0.
  • Give a 1 state NFA that accepts the language {e}.
formal definition
Formal Definition

A nondeterministic 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 Se P(Q) is the transition function
  • q0 Î Q is the start state
  • F Í Q is the set of accept states
slide9
P(Q)
  • The power set of states
  • Consider Q = { q0, q1, q2 }
  • Then P(Q) = { {}, {q0}, {q1}, {q2}, {q0, q1}, {q0, q2}, {q1, q2}, {q0, q1, q2} }
example 32
Example 3
  • Q = {q0, q1, q2, q3}
  • S = {0, 1}
  • q0
  • F = {q3}
acceptance
Acceptance

Let N = (Q, S, d, q0, F) be an NFA and w = w1w2 …wn be a string over the alphabet S. Then N “accepts” w if a sequence of states r0r1…rn exists in Q with the following three conditions:

  • r0 = q0
  • ri+1 Î d(ri, wi+1) for 0 <= i <= n – 1
  • rn Î F
theorem
Theorem
  • Every nondeterministic finite automaton has an equivalent deterministic finite automaton.
proof
Proof
  • Part 1
  • Given a deterministic finite automaton, there is an equivalent nondeterministic finite automaton.
  • Proof. Trivial!
proof1
Proof
  • Part II.
  • Given a nondeterministic finite automaton, there is an equivalent deterministic finite automaton.
  • Proof. A bit harder …
proof by construction
Proof by Construction
  • Let N = (Q, S, d, q0, F)
  • Construct M = (Q’, S, d’, q0’, F’)
  • Q’ = P(Q)
  • q0’ = E [ {q0} ]
proof by construction1
Proof by Construction
  • F’ = {R Î Q’ | R contains an accept state in N}
  • For R Î Q’ and a ÎS, let d’(R, a) = {q Î Q | q Î E[d(r, a)] for some r Î R}
convert example 2
Convert Example 2

{q1, q2}

0

1

{q0, q1}

1

{q2}

exercise
Exercise
  • Convert the following NFA into an equivalent DFA.

e

q0

q1

a

a

a,b

q2

b

theorems
Theorems
  • The class of regular languages is closed under the union operation.
  • The class of regular languages is closed under the concatenation operation.
  • The class of regular languages is closed under the star operation.
closure under union
Closure Under Union
  • Note: we already proved this once using DFAs.
  • However, using NFAs, the proof is even easier so we will do it again!
closure under union1
Closure Under Union
  • Let N1 = (Q1, S, d1, q1, F1)
  • Let N2 = (Q2, S, d2, q2, F2)
  • Construct N = (Q, S, d, q0, F)
  • Q = q0 U Q1 U Q2
closure under union2
Closure Under Union
  • F = F1 U F2
  • d(q, a) =d1(q, a) if q Î Q1d2(q, a) if q Î Q2 {q1, q2} if q = q0 and a = e {} if q = q0 and a <> e
exercises1
Exercises
  • Draw a picture that graphically displays how the preceding proof works.
  • Draw an NFA that accepts the union of {w | w begins with a 1 and ends with a 0} and {w | w contains at least three 1s}
closure under concatenation
Closure Under Concatenation
  • Let N1 = (Q1, S, d1, q1, F1)
  • Let N2 = (Q2, S, d2, q2, F2)
  • Construct N = (Q, S, d, q0, F)
  • Q = Q1 U Q2
closure under concatenation1
Closure Under Concatenation
  • q0 = q1
  • F = F2
  • d(q, a) =d1(q, a) if q Î Q1 and !(q Î F1)d1(q, a) if q Î F1 and a <> ed1(q, a) U {q2} if q Î F1 and a = ed2(q, a) if q Î Q2
exercises2
Exercises
  • Draw a picture that graphically displays how the preceding proof works.
  • Draw an NFA that accepts the concatenation of {w | w begins with a 1 and ends with a 0} and {w | w contains at least three 1s}
closure under star
Closure Under Star
  • Let N1 = (Q1, S, d1, q1, F1)
  • Construct N = (Q, S, d, q0, F)
  • Q = {q0} U Q1
  • F = {q0} U F1
closure under star1
Closure Under Star

d(q, a) =

d1(q, a) if q Î Q1 and !(q Î F1)

d1(q, a) if q Î F1 and a <> e

d1(q, a) U {q1} if q Î F1 and a = e

{q1} if q = q0 and a = e

{} if q = q0 and a <> e

exercises3
Exercises
  • Draw a picture that graphically displays how the preceding proof works.
  • Draw an NFA that accepts the star of {w | w begins with a 1 and ends with a 0}.