MA/CSSE 474 Theory of Computation Nondeterminism NFSMs.

Slides:



Advertisements
Similar presentations
CMPS 3223 Theory of Computation
Advertisements

Pushdown Automata Chapter 12. Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2) Say yes or no,
Pushdown Automata Chapter 12. Recognizing Context-Free Languages We need a device similar to an FSM except that it needs more power. The insight: Precisely.
Pushdown Automata Part II: PDAs and CFG Chapter 12.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
61 Nondeterminism and Nodeterministic Automata. 62 The computational machine models that we learned in the class are deterministic in the sense that the.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
MA/CSSE 474 Theory of Computation
Finite State Machines Chapter 5. Languages and Machines.
CMPS 3223 Theory of Computation
Deterministic Finite State Machines Chapter 5. Languages and Machines 2.
Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers.
1 Unit 1: Automata Theory and Formal Languages Readings 1, 2.2, 2.3.
Pushdown Automata (PDA) Intro
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
MA/CSSE 474 Theory of Computation DFSM Canonical Form Proof of NDFSM  DFSM ALGORITHM (as much as we have time for) This version includes the "answers"
1 Course Overview PART I: overview material 1Introduction 2Language processors (tombstone diagrams, bootstrapping) 3Architecture of a compiler PART II:
Pushdown Automata Part I: PDAs Chapter Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2)
MA/CSSE 474 Theory of Computation Decision Problems DFSMs.
Computability Review homework. Regular Operations. Nondeterministic machines. NFSM = FSM Homework: By hand, build FSM version of specific NFSM. Try to.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
MA/CSSE 474 Theory of Computation Regular Expressions Intro.
Regular Expressions Chapter 6 1. Regular Languages Regular Language Regular Expression Finite State Machine L Accepts 2.
PushDown Automata. What is a stack? A stack is a Last In First Out data structure where I only have access to the last element inserted in the stack.
TM Design Macro Language D and SD MA/CSSE 474 Theory of Computation.
Modeling Computation: Finite State Machines without Output
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Nondeterministic Finite State Machines Chapter 5.
Finite State Machines Chapter 5. Languages and Machines.
Pushdown Automata Chapter 12. Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2) Say yes or no,
MA/CSSE 474 Theory of Computation Decision Problems, Continued DFSMs.
MA/CSSE 474 Theory of Computation Regular Expressions Intro.
Theory of Computation Automata Theory Dr. Ayman Srour.
WELCOME TO A JOURNEY TO CS419 Dr. Hussien Sharaf Dr. Mohammad Nassef Department of Computer Science, Faculty of Computers and Information, Cairo University.
Lecture Three: Finite Automata Finite Automata, Lecture 3, slide 1 Amjad Ali.
Normal Forms (Chomsky and Greibach) Pushdown Automata (PDA) Intro PDA examples MA/CSSE 474 Theory of Computation.
Finite Automata.
Nondeterminism The Chinese University of Hong Kong Fall 2011
MA/CSSE 474 Decision Problems Languages, Machines, Computation
Chapter 2 Finite Automata
Pushdown Automata.
Pushdown Automata.
(Universal Turing Machine)
MA/CSSE 474 Decision Problems about Regular Languages
Hierarchy of languages
Principles of Computing – UFCFA3-30-1
COSC 3340: Introduction to Theory of Computation
NFAs and Transition Graphs
Finite Automata Reading: Chapter 2.
4b Lexical analysis Finite Automata
MA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation Computation FSM Intro.
CSE 105 theory of computation
4b Lexical analysis Finite Automata
MA/CSSE 474 Theory of Computation
Pushdown Automata (PDA) Part 2
More on showing L non-regular
MA/CSSE 474 Theory of Computation
CSC312 Automata Theory Transition Graphs Lecture # 9
Minimize # states in a DFSM
Computability Catch up last lecture. Turing machines. Variations
NFAs and Transition Graphs
MA/CSSE 474 Theory of Computation
More About Nondeterminism
MA/CSSE 474 Theory of Computation
Presentation transcript:

MA/CSSE 474 Theory of Computation Nondeterminism NFSMs

Your Questions? Previous class days' material Reading Assignments HW1 solutions HW3 or HW4 problems Anything else

More DFSM Examples

The Missing Letter Language Let  = {a, b, c, d}. Let LMissing = {w  * : there is a symbol ai   that does not appear in w}. Try to make a DFSM for LMissing: How many states are needed? Expressed in first-order logic, LMissing = {w* : ∃a (∀x,y*(w ≠ xay))} Animated! (two slides) Don't do animation until they have time to think Try it deterministically. Ask them to ponder it and suggest how we might to it

NondeterminisM

Nondeterminism A nondeterministic machine M in a given state, looking at a given symbol (and with a given symbol on top of the stack if it is a PDA), may have a choice of several possible moves that it can make. If there is a move that leads toward eventual acceptance, M makes that move. Together on the board, draw the diagram for this PDA.

Necessary Nondeterminism? As you saw in the homework, a PDA is a FSM plus a stack. Given a string in {a, b}*, is it in PalEven = {wwR : w {a,b}*}}? PDA Choice: Continue pushing, or start popping? This language can be accepted by a nondeterministic PDA but not by any deterministic one.

Nondeterministic value-added? Ability to recognize additional languages? FSM: no PDA : yes TM: no Sometimes easier to design a nondeterministic machine for a particular language? Yes for all three machine types We will prove these later

Nondeterministic FSM

Definition of an NDFSM M = (K, , , s, A), where: K is a finite set of states  is an alphabet s  K is the initial state A  K is the set of accepting states, and  is the transition relation. It is a finite subset of (K  (  {}))  K Another way to present it:  : (K  (  {}))  2K

Acceptance by an NDFSM An NDFSM M accepts a string w iff there exists some path along which w can take M to some element of A. The language accepted by M, denoted L(M), is the set of all strings accepted by M.

Sources of Nondeterminism Two sources: Transitions labeled epsilon Multiple transitions out of the same state that are labeled by the same alphabet symbol.

Optional Substrings L = {w  {a, b}* : w is made up of an optional a followed by aa followed by zero or more b’s}.

Multiple Sublanguages L = {w  {a, b}* : w = aba or |w| is even}.

The Missing Letter Language Let  = {a, b, c, d}. Let LMissing = {w : there is a symbol ai   that does not appear in w}

Pattern Matching L = {w  {a, b, c}* : x, y  {a, b, c}* (w = x abcabb y)}. A DFSM: An NDFSM:

Pattern Matching: Multiple Keywords L = {w  {a, b}* : x, y  {a, b}* ((w = x abbaa y)  (w = x baba y))}. Note that states q4 and q8 could be combined.

Checking from the End L = {w  {a, b}* : the fourth character from the end is a}

Another Pattern Matching Example L = {w  {0, 1}* : w is the binary encoding of a positive integer that is divisible by 16 or is odd}

Another NDFSM This is a good example for practice later L1= {w  {a, b}*: aa occurs in w} L2= {x  {a, b}*: bb occurs in x} L3= L1  L2 M1 = M2= M3= This is a good example for practice later

Analyzing Nondeterministic FSMs Does this FSM accept: baaba Remember: we just have to find one accepting path.

Simulating Nondeterministic FSMs Two approaches: • Explore a search tree: • Follow all paths in parallel

Dealing with  Transitions The epsilon closure of a state: eps(q) = {p  K : (q, w) |-*M (p, w)}. eps(q) is the closure of {q} under the relation {(p, r) : there is a transition (p, , r)  }. Algorithm for computing eps(q): result = {q} while there exists some p  result and some r  result and some transition (p, , r)   do: Insert r into result return result

Calculate eps(q) for each state q result = {q}. While there exists some p  result and some r  result and some transition (p, , r)   do: result = result  { r } Return result. Try it on bbacb. Put this slide on transparency, and algorithm on PowerPoint.

Simulating a NDFSM ndfsmsimulate(M: NDFSM, w: string) = current-state = eps(s). While any input symbols in w remain to be read do: c = get-next-symbol(w). next-state = . For each state q in current-state do: For each state p such that (q, c, p)   do: next-state = next-state  eps(p). current-state = next-state. If current-state contains any states in A, accept. Else reject. Do it for the previous 8-state machine, with string bbabc Do it for the previous 8-state machine, with input bbabc