Presentation is loading. Please wait.

Presentation is loading. Please wait.

Recap: Nondeterministic Finite Automaton (NFA) A deterministic finite automaton (NFA) is a 5-tuple (Q, , ,s,F) where: Q is a finite set of elements called.

Similar presentations


Presentation on theme: "Recap: Nondeterministic Finite Automaton (NFA) A deterministic finite automaton (NFA) is a 5-tuple (Q, , ,s,F) where: Q is a finite set of elements called."— Presentation transcript:

1 Recap: Nondeterministic Finite Automaton (NFA) A deterministic finite automaton (NFA) is a 5-tuple (Q, , ,s,F) where: Q is a finite set of elements called states  is a finite input alphabet s  Q called the start state F  Q called the favorable states  : (Q × (   {e}))   (Q) … a1a1 a2a2 Constant!

2 Acceptance of a Word in an NFA A The oracle explanation of NFAs: there is an oracle that always makes the right choice Suppose that while processing a w from state r only by going to state p, a favorable state can be reached. Then, the oracle will choose p p r a q e Acceptance: w is accepted by A if at least one sequence of transformations yields the empty word and end up in an accepting state Oracle will find a path to an accepting state that process all characters only if there is one such path

3 Pushdown Automaton A pushdown automaton is a 6-tuple (Q, , , ,s,F) where: Q is a finite set of elements called states  is a finite input alphabet  is a set of stack symbols s  Q called the start state F  Q called the favorable states  : (Q × (   {e}) × (   {e}) )   ( Q × (   {e}) ) … a1a1 a2a2 Constant! a’ 1 … stack

4 Computation in Pushdown Automata PA = (Q, , , ,s,F) where:  :(Q × (   {e}) × (   {e}) )   ( Q × (   {e}) ) Let (q’,  ))   ((q, , )), it is compute as follows: if: the automaton is in an state q the next character is  The word is on top of the stack Then: pop from top of the stack Jump to the state q’ Push the word  on top of the stack

5 String Accepted by Pushdown Automaton Given a pushdown automaton A, and a string w   *, we say that w is accepted by A if there is a sequence of computations that: begin from the starting state, the word w, and the empty stack terminates in a favorable state and process all characters in w  Note: the stack does not have to be empty at the end The set of all words accepted by an automaton A form the language L(A) accepted or recognized by the automaton.

6 Example Pushdown automaton recognizing {a n b n : n = 0, 1, 2, …}

7 Example Pushdown automaton recognizing L = {ww R : w is in  *}

8 Homework for Friday 12. 2.3 (n), (o) 2.4 (c) 2.6 (b) 2.21 Construct a pushdown automaton for the language of exercise 2.21


Download ppt "Recap: Nondeterministic Finite Automaton (NFA) A deterministic finite automaton (NFA) is a 5-tuple (Q, , ,s,F) where: Q is a finite set of elements called."

Similar presentations


Ads by Google