Download presentation

Presentation is loading. Please wait.

Published byBaylee Hanes Modified over 2 years ago

1
Size matters! Minimizing DFAs

2
Minimising states = Minimising cost Minimising number of states = Minimising number of memory cells (hardware size) = Minimising cost (Computing time is not minimised by this process.) D CLK Q Q’ reset input pulse (“1”s) Use this first before inputting anything Bulb remains glowing if no. of 1s inputted so far is odd A simple hardware to realize the DFA shown 12 evenodd 1 1 DFA that checks if the number of 1’s is even or odd

3
To glow or not to glow--- that is the question What do we mean by “minimising a DFA”? 0123 a abb Fed with a given string, a DFA could exhibit only TWO kinds of behaviour: {“bulb glows”, “bulb doesn’t glow”}. Details like which particular state the machine finally settles in do not count. “bulb glows”: The machine finds itself in one of the final states after consuming the entire string. “bulb doesn’t glow”: The machine finds itself in one of the non-final states after consuming the entire string. We eliminate (strike out) a few states from the DFA and yet are able to retain its (original) “behaviour”—the same set of strings are accepted/rejected as before.

4
Minimizing states: The idea It’s simple: locate those states that are indistinguishable from (equivalent to) one another; they can all be replaced by one common “representative” (state).

5
s1 Indistinguishable states s2 w M s2 : Start machine M in state s 2 M s1 : Start machine M in state s 1 Consider a machine M= ( Q, ∑, δ, DFA_start, F ) with states s 1 and s 2. s 1 and s 2 are indistinguishable if both M s1 and M s2 exhibit the same kind of behaviour for each input string w ε Σ*: given an input w, either both machines accept w (glow) or both of them don’t (no glow). I.e., either (i) delta_bar ( s 1, w ) є F, delta_bar ( s 2, w ) є F or (ii) delta_bar ( s 1, w ) є Q \ F, delta_bar ( s 2, w ) є Q \ F, for every w є Σ*. (s 1, s 2 are said to be k -indistinguishable, if the above holds for any w of length k.)

6
Tracking down indistinguishable states We try to group together indistinguishable states, proceeding step-by-step: We first group together states that are “ indistinguishable ” when only very short strings (say, of length k ) are considered as input; then we gradually refine such a grouping to form newer groups that remain “ indistinguishable ” even when we allow slightly longer strings (say, of length k +1) as input. We continue till we arrive at groups of (literally) indistinguishable states. Non-final statesFinal states “indistinguishable” when only strings of length 0 (i.e., ε) are considered

7
Tracking down indistinguishable states s1s1 s2s2 δ (s 1, a ) δ (s 2, a ) final / non-final pool of states strings of length k a a strings of length k+ 1 k- indistinguishable ↔ (k +1)-indistinguishable Lemma: s 1 and s 2 are ( k +1)-indistinguishable iff for each a ε Σ, δ ( s 1, a ) and δ ( s 2, a ) are k -indistinguishable.

8
Tracking down indistinguishable states Stage I Indistinguishable by ε Stage II Indistinguishable not just by ε, but also by strings of length 1 a b a b “pool” of non- final states “pool” of final states States p and q will remain members of a group (i.e., p and q are upto-( k +1)-indistinguishabe*) iff: (i)p and q were members of the same group in the previous step (i.e., p and q are “upto- k -indistinguishabe”), AND (ii)δ ( p, c ) and δ ( p, c ), for each c ε ∑, both belong to the same group (of the previous step) (i.e., they are “upto- k -indistinguishable”) (see lemma on previous slide) p q * s 1 and s 2 are said to be upto- k -indistinguishable if they are x -indistinguishable for x = 0 to k.

9
Tracking down indistinguishable states “pool” of non- final states “pool” of final states Stage I Stage II Indistinguishable by ε Indistinguishable not just by ε, but also by strings of length 1 p q a b a b We stop this “refinement” process when we can’t refine any further, i.e. the members of each and every group remain (stubbornly) unchanged. The members (states) in a group at this stage are literally indistinguishable (by any string). (We can now choose a common representative for states in the same group.)

10
PROOF (as to why, after reaching the “final stage”, the states in each group are indistinguishable by ANY string): Tracking down indistinguishable states In the final stage, clearly, the states in each group are upto-k-indistinguishable (for some k); also, they (the states in each group) automatically qualify as upto-(k+1)-indistinguishable states, which in turn makes them upto-(k+1)+1-indistinguishable and so on (see lemma in previous slide). This forms an inductive proof for the fact that they are indistinguishable by strings of any length k.

11
An example 1 a a b 3 a 2 b L = {a x | x є {a, b}*} 4 a b b

12
{1, 2} non-finalfinal {3, 4}Stage I δ(1, a) = 3 (group 2) δ(2, a) = 2 (group 1) δ(3, a) = 3 (group 2) δ(4, a) = 3 (group 2) δ(3, b) = 4 (group 2) δ(4, b) = 4 (group 2) {1}{3, 4}Stage II δ(3, a) = 3 (group 3) δ(4, a) = 3 (group 3) δ(3, b) = 4 (group 3) δ(4, b) = 4 (group 3) {2} {1}{3, 4}Stage III δ(3, a) = 3 (group 3) δ(4, a) = 3 (group 3) δ(3, b) = 4 (group 3) δ(4, b) = 4 (group 3) {2} No further splitting is possible different groups choose a common representative 3 Eliminate state 4 from the original DFA; any transition going to state 4 should now go to state 3 in the original DFA. An example same group

13
1 a a b 3 a 2 b b An example L = {a x | x є {a, b}*} Minimized DFA:

Similar presentations

OK

LECTURE 5 Scanning. SYNTAX ANALYSIS We know from our previous lectures that the process of verifying the syntax of the program is performed in two stages:

LECTURE 5 Scanning. SYNTAX ANALYSIS We know from our previous lectures that the process of verifying the syntax of the program is performed in two stages:

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on hindu religion song Store window display ppt online Ppt on balanced diet Ppt on email etiquettes presentation high school Ppt on producers consumers and decomposers poem Ppt on eisenmenger syndrome definition Ppt on transportation in plants for class 10 Ppt on id ego superego iceberg Dot matrix display ppt online Ppt on air pollution in hindi