Download presentation

Presentation is loading. Please wait.

Published byPrincess Piggott Modified about 1 year ago

1
CS480(Prasad)L9FSA1 Finite State Automata

2
CS480(Prasad)L9FSA2 Formal Specification of Languages Generators Context-free Grammars Regular Expressions Recognizers Parsers, Push-down Automata Finite State Automata FSA is a mechanism to recognize a set of valid inputs before carrying out an action. FSA is a notation for describing a family of language recognition algorithms.

3
CS480(Prasad)L9FSA3 OP Parity Problem EP

4
CS480(Prasad)L9FSA4 Basic Features Consumes the entire input string. Remembers the parity of the bit string by abstracting from the number of 1s in the string. Finite amount of memory required for this purpose. Observe that counting requires unbounded memory, while computing the parity requires very small and fixed amount of memory. Accepts/Rejects the input in a deterministic fashion.

5
CS480(Prasad)L9FSA5 State Indicates the status of the machine after consuming some portion of the input. Summarizes the history of the computation that is relevant to the future course of action. Initial / Start State Final / Accepting state State Transition Even ParityOdd Parity 1 0

6
CS480(Prasad)L9FSA6 Q: Finite set of states Finite Alphabet : Transition function total function from Qx to Q : Initial/Start State F : Set of final/accepting state Deterministic Finite State Automaton (DFA)

7
CS480(Prasad)L9FSA7 Operation of the machine Read the current letter of input under the tape head. Transit to a new state depending on the current input and the current state, as dictated by the transition function. Halt after consuming the entire input. 001 Input Tape Finite Control

8
CS480(Prasad)L9FSA8 Machine configuration: Yields relation: Language: Associating Language with the DFA

9
CS480(Prasad)L9FSA9 Examples

10
CS480(Prasad)L9FSA10 Set of strings over {a,b} that contain bb Design states by parititioning *. Strings containing bb q2 Strings not containing bb –Strings that end in b q1 –Strings that do not end in b q0 –Initial state: q0 –Final state: q2

11
CS480(Prasad)L9FSA11 q2 State Diagram and Table q0q1 a b a b a b ab q0 q1 q0q2

12
CS480(Prasad)L9FSA12 q0q2 Strings over {a,b} that do not contain bb q1 a b a b a b ab q0 q1 q0q2

13
CS480(Prasad)L9FSA13 DFA for the complement of L given DFA for L Let M = (Q, , ,q0,F) be a DFA. Then, M’ = (Q, , ,q0,Q - F) is a DFA with L(M’) = * - L(M). Implication: Languages associated with DFAs are closed under complementation. (Recall that languages associated with regular expressions are closed under union, concatenation, and Kleene Star operations, by definition.)

14
CS480(Prasad)L9FSA14 Strings over {a,b} containing even number of a’s and odd number of b’s. ** EaOa EbOb Eb b b b b aa a a [Oa,Ob] [Ea,Eb][Ea,Ob] [Oa,Eb]

15
CS480(Prasad)L9FSA15 (ab)*c ** valid prefix invalid prefix end_a a b b a,b,c a,cc Err Eb Ea Ec end_bend_c a,b,c a c b

16
CS480(Prasad)L9FSA16 (ab)*c ** valid prefix invalid prefix end_a a b b a,b,c a,cc Err Eb Ea Ec end_bend_c a,b,c

17
CS480(Prasad)L9FSA17 Nondeterministic Finite Automata qi qj qk q qiqj aa a DFA NFA a

18
CS480(Prasad)L9FSA18 How do we associate a language with an NFA? Every DFA is an NFA. However, does non- determinism make NFAs strictly more expressive (powerful) than DFAs? DFA: Unique computation for a given string NFA: Accept if there exists an accepting computation

19
CS480(Prasad)L9FSA19 q2 NFA State Diagram (Strings over {a,b} ending in bb) q0q1 a bb ab q0{q0}{q0,q1} q1 {q2} q2 b

20
CS480(Prasad)L9FSA20 Halts in accepting state after consuming the input. Halts in non-accepting state after consuming the input.

21
CS480(Prasad)L9FSA21 NFA State Diagram (a U b)* bb (a U b)* q2q0q1 a bb b b a q2q0q1 a bb b a a DFA

22
CS480(Prasad)L9FSA22 NFA for (a U b)* (aa U bb) (a U b)* q2q0q1 a aa b b a q22q11 bb b a

23
CS480(Prasad)L9FSA23 Introducing -transitions into NFA A -transition causes the machine to change its state non-deterministically, without consuming any input.

24
CS480(Prasad)L9FSA24 Closure Properties of NFA- s M1 M M2 LL L(M1) U L(M2) LL L(M1) L(M2) L L(M)*

25
CS480(Prasad)L9FSA25 a0 a1 b1 a2 b2 a3 b3 a aaa b bbb … … a3 b3 an bn This construction cannot be generalized to recognize because the machine will have infinite number of states. bbb

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google