Nondeterministi Automt vs Deterministi Automt We lerned tht NFA is onvenient model for showing the reltionships mong regulr grmmrs, FA, nd regulr expressions, nd designing them. However, we know tht n NFA is oneptul model tht nnot diretly e uilt euse of the nondeterministi trnsition. Then wht out ll the NFA tht pper in the exmples nd proofs? Are those nondeterministi utomt remin s theoretil model tht nnot ring down to the rel world? For ontext-free lnguges, there re lnguges tht n only e reognized y NPDA, for exmple {xx R x {, } * }. As fr s PDA re onerned, NPDA re stritly more powerful thn DPDA. For LBA, it is open prolem. (Looks like the spe restrition is too muh for DLBA to do the sme omputtion s n NLBA does.) For TM, ny prolem tht n e solved y n NTM n lso e solved y DTM y tring every possile trnsition of n NTM omputtion using its unlimited spe ville. 98
Fortuntely, for NFA there is strightforwrd wy to trnsform them into DFA. (Atully it is sed on the sme ide tht we used to eliminte ε- trnsitions.) The si ide is to onsider the set of sttes tht n e rehle y trnsition s single stte in deterministi trnsition. The following exmple will e enough to understnd the tehnique. (We ssume tht the utomton hs no ε-trnsitions.) strt 1, 2,, strt {,1,2}, {2} {1,2} () An NFA () Converted DFA Notie tht the stte with lel {, 1, 2} is from the set of sttes given y the nondeterministi trnsition δ(, ) = {, 1, 2}. Also notie tht ny stte whose lel ontins n epting stte is defined s n epting stte in the deterministi mhine. 99
Minimiztion Tehnique for DFA The numer of sttes of n utomton hs diret ffet to the size of the mhine relizing the utomton. Hene, it is very importnt to redue the numer of sttes, if possile. For PDA, LBA nd TM, it is very diffiult prolem to redue the numer of sttes. However, for DFA there is very effiient lgorithm for minimizing the numer of sttes of given DFA. Figure () elow is prt of the stte trnsition grph of DFA M = ( Q, Σ, δ, q, F ), where Σ = {, }. Clerly, for every w Σ *, δ( q 3, w ) is in n epting stte if nd only if δ( q 4, w ) is. Hene, we n merge q 3 nd q 4 into single stte s shown in Figure () without ffeting the lnguge of the mhine. q 1 q 3 q 1 q 34 q 2 q 4 q 2 Figure () Figure () 1
Stte Redution y Prtitioning We sy two sttes p nd q re equivlent (or indistinguishle), if, for every string w Σ *, trnsition δ( p, w ) ends in n epting stte if nd only if δ( q, w) does. In the preeding slide sttes q 3 nd q 4 re equivlent. There re effiient lgorithms ville for omputing the sets of equivlent sttes of given DFA. The following exmple shows proedure using the set prtitioning tehnique. The tehnique is similr to one tht they use for prtitioning people into groups (eh hving ertin preferenes) sed on their responses to questionnire. The following two slides show the detiled steps for omputing equivlent stte sets of the DFA in Figure () nd onstruting the redued DFA shown in Figure (). 1 2 Figure () A DFA 3 4 5, 1,2 3 4,5 Figure () Redued DFA, 11
Stte Redution y Prtitioning(ont ed) Step : Prtition the sttes ording to epting/non-epting. P 1 P 2 { 3, 4, 5 } {, 1, 2 } Figure () Initil prtition For stte q nd symol t, let P i e the response of q on t, if δ(q, t) enters stte in P i. Ste: Get the response of eh stte for eh input symol. Notie tht Sttes 3 nd show different responses from the ones of the other sttes in the sme set. P 1 P 2 p 2 fi fi {3, 4, 5 } {, 1, 2 } fi fl fl fl fi fl fl fl p 2 p 2 Figure () Reord responses for eh input symol 12
Step 2: Prtition the sets ording to the responses, nd go to Ste until no prtition ours. P 11 P 12 P 21 P 22 1 1 2 2 {4, 5} {3} {1, 2} {} 1 1 1 1 Figure () Prtition the set, nd reord responses for eh input symol No further prtition is possile for the sets P 11 nd P 21. So the finl prtition results re s follows. {4, 5} {3} {1, 2} {} (d) Finl prtition 13