Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Nondeterminism Two - Automata and Complexity Theory - Lecture Slides, Slides of Theory of Automata

Some concept of Automata and Complexity Theory are Administrivia, Closure Properties, Context-Free Grammars, Decision Properties, Deterministic Finite Automata, Intractable Problems, More Undecidable Problems. Main points of this lecture are: Nondeterminism Two, Alphabet, Strings, Sketch of Answer, Last Time, Guess, Symbols, Sequence, Accept, Nondeterministic Algorithm

Typology: Slides

2012/2013

Uploaded on 04/29/2013

shamir_69
shamir_69 🇮🇳

5

(4)

66 documents

1 / 19

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Nondeterminism
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Nondeterminism Two - Automata and Complexity Theory - Lecture Slides and more Slides Theory of Automata in PDF only on Docsity!

Nondeterminism

Example from last time

  • Construct a DFA over alphabet {0, 1} that accepts those strings that end in 101
  • Sketch of answer:

0

1

q 0

q 1

q 00

q 10

q 01

q 11

q 000 q 001

q 101

q 111

0 1 0 1

0 1

1

1

1

1

0

Nondeterminism

  • Nondeterminism is the ability to make guesses, which we can later verify
  • Informal nondeterministic algorithm for language of strings that end in 101 : 1. Guess if you are approaching end of input 2. If guess is yes, look for 101 and accept if you see it 3. If guess is no, read one more symbol and go to step 1

Nondeterministic finite automaton

  • This is a kind of automaton that allows you to make guesses
  • Each state can have zero, one, or more transitions out labeled by the same symbol

(^1 0 )

0, 1 q 0 q 1 q 2 q 3

Semantics of guessing

  • State q 1 has no transition labeled 1
  • Upon reading 1 in q 1 , we die; upon reading 0 , we continue to q (^2)

(^1 0 )

0, 1 q 0 q 1 q 2 q 3

Semantics of guessing

  • State q 3 has no transition going out
  • Upon reading anything in q 3 , we die

(^1 0 )

0, 1 q 0 q 1 q 2 q 3

Formal definition

  • A nondeterministic finite automaton (NFA) is a 5-tuple ( Q , Σ, δ, q 0 , F ) where - Q is a finite set of states - Σ is an alphabet - δ: Q × Σ → subsets of Q is a transition function - q 0 ∈ Q is the initial state - FQ is a set of accepting states (or final states).
  • Only difference from DFA is that output of δ is a set of states

Example

(^1 0 )

0, 1 q 0 q 1 q 2 q 3

alphabet Σ = {0, 1} start state Q = {q 0 , q 1 , q 2 , q3} initial state q accepting states F = {q 3 }

states

inputs (^0 ) q 0 q (^1) q (^2)

{q 0 , q 1 }

transition function δ:

q 3

{q0} {q 2 } ∅ ∅

∅ {q 3 } ∅

NFAs are as powerful as DFAs

  • Obviously, an NFA can do everything a DFA can do
  • But can it do more?

NFAs are as powerful as DFAs

  • Obviously, an NFA can do everything a DFA can do
  • But can it do more?
  • Theorem A language L is accepted by some DFA if and only if it is accepted by some NFA.

NO!

Simulation example

(^1 )

0, 1

NFA:^ q 0 q 1 q 2

DFA: q 0 1 q0 or q (^1)

1

q0 or q (^2) 1

0 0 0

General method

NFA DFA

states q 0 , q^1 , …, q n ∅, {q^0 }, {q^1 }, {q^0 ,q^1 }, …, {q^0 ,…,q n } one for each subset of states in the NFA initial state q^0 {q^0 }

transitions δ δ’({q i 1 ,…,q ik },^ a ) = δ(q i 1 , a ) ∪…∪ δ(q ik , a )

accepting states

FQ F ’ = { S :^ S^ contains some state in^ F }

Exercises

  • Construct NFAs for the following languages over the alphabet {a, b, …, z}: - All strings that contain eat or sea or easy - All strings that contain both sea and tea - All strings that do not contain fool