L 8 regular languages 2 More decision properties
- Slides: 26
L 8 regular languages 2 More decision properties
Product DFAs (p-DFA) 0 L A 1 [A, C] B 0, 1 1 1 0 0 [A, D] 1 0 1 M C 0 0 1 [B, C] 0 [B, D] D 1 States of p-DFA(L, M) are ordered pairs [q(L), r(M)] Start state is pair [start(L), start(M)] δ([q(L), r(M)], a) = [δL(q, a), δM(r, a)] Accepting states designed for specific purpose 2
Product DFAs (p-DFA) on next quiz 0 L A 1 [A, C] B 0, 1 1 1 0 0 [A, D] 1 0 1 M C 0 0 1 [B, C] 0 [B, D] D 1 For next quiz, know how to construct states of a product DFA and how to calculate transitions between states. 3
Are languages L and M equivalent? Design p-DFA for equivalence decision • Let DFAs of L and M have sets of states Q and R, respectively. • Product DFA has set of states Q R (all ordered pairs [q, r] with q in Q and r in R) • Let accepting states of p-DFA be [q(L), r(M)] such that exactly one of q(L) and r(M) is an accepting state of its own DFA. • p-DFA accepts string w iff w is in exactly one of the languages L and M. • p-DFA’s language is empty iff L = M. • Apply emptiness decision algorithm to p-DFA 4
p-DFA for equivalence decision 0 L A 1 [A, C] B 0, 1 1 1 0 0 [A, D] 1 0 1 M C 0 1 [B, C] 0 [B, D] D What are the accepting states for this purpose? 5
p-DFA with accepting states designed for equivalence decision algorithm 0 0 L A 1 B [A, C] 0, 1 1 1 0 [A, D] 1 0 0 1 M C 0 1 0 D 1 [B, C] [B, D] Why not [A, D] and [B, C] for accepting states? Is L(p-DFA) empty? Are L and M equivalent? 6
Containment decision algorithm Given regular languages L and M, is L M? Define the accepting states of p-DFA such that q(L) is accepting, and r(M) is not in their respective DFAs p-DFA accepts strings in L but not in M p-DFA’s language is empty iff L M 7
p-DFA for containment decision 0 A L 1 [A, C] B 0, 1 1 1 0 0 [A, D] 1 0 1 M C 0 1 [B, C] 0 [B, D] D What are the accepting states for this purpose? Is L M ? 8
p-DFA for containment algorithm L 0 0 A 1 B [A, C] 0, 1 1 1 0 [A, D] 1 0 1 M C 0 1 0 D 1 [B, C] 0 [B, D] The only accepting state is unreachable. Containment holds L(DFA 1) L(DFA 2) 9
Minimum-size decision property • Is there a DFA representation of L with fewer states? • Proof by construction of the minimum-state DFA (ms -DFA) • Construct ms-DFA by merging indistinguishable states • States A and B are indistinguishable if d˄ (A, w) = d˄(B, w) for all w in L(DFA) • Find indistinguishable states by enumerating all distinguishable states 10
Finding distinguishable states • Construct a table of all distinct pairs of states in DFA. (states are different and ordered) • For an n-state DFA, table contains n(n-1)/2 distinct pairs. • States in a distinct pair are distinguishable if there is a string in L(DFA) that takes exactly one of the states to an accepting state. • ms-DFA decision algorithm is a recursion on the length of the shortest string that can identify distinguishable states. 11
Construction of ms-DFA Basis: Mark all distinct ordered pair for which exactly one member is an accepting state. (e is a distinguishing string). Recursion: Mark pair [q, r] if there is some input symbol a such that [d(q, a), d(r, a)] is marked. (a is distinguishing for [q, r]). After considering all single-character strings, if no more marks are possible, then the states in unmarked pairs are indistinguishable. Merge the states in indistinguishable pairs 12
Eliminate Unreachable States Combining indistinguishable states could leave us with unreachable states in the “minimum-state” DFA. If present, remove all states that are not reachable from the start state. 13
Assignment 10: Exercise 4. 4. 1 (b) Text pp 165 -166. Construct the transition table of the ms-DFA of the DFA with transition table shown below. 0 1 AB A BA C CD B *D D A ED F FG E GF G HGD n(n-1)/2=(8)(7)/2=28 Test each of 28 distinct ordered pair for distinguishability. Combine indistinguishable pairs. Eliminate unreachable states. 14
ms-DFA construction worked in class 0 AB BD CD DD ED *F D *G D 1 C E F G G C G n(n-1)/2=(7)(6)/2=21 Test each of 21 distinct ordered pair for distinguishability. Combine indistinguishable pairs. Eliminate unreachable states. 15
All states are reachable from A 0 AB BD CD DD ED *F D *G D 1 C E F G G C G 0 AB BD CD DD *F D *G D 1 C D F G C G From A reach B and C B reach D C reach F D reach G 17
ms-DFA construction worked in class 0 AB BD CD DD ED *F D *G D 1 C E F G G C G 0 AB BD CD DD *F D *G D 1 C D F G ms-DFA C G This result could be expected from the transition table. More common result is a closed set of distinct pairs that indicate a group of indistinguishable states. Example: Ex 4. 4. 2 text pp 165 -166 18
Another example: Ex 4. 4. 2 pp 165 -166 How many distinct ordered pairs? 0 AB BC *C D DE EF *F G GH HI *I A 1 E F H H I B B C E 19
Another example: Ex 4. 4. 2 pp 165 -166 n(n-1)/2=(9)(8)/2=36 0 AB BC *C D DE EF *F G GH HI *I A 1 E F H H I B B C E After systematic investigation of distinct ordered pairs, the following pairs have not been marked: [A, D], [A, G], [B, E], [B, H], [C, F], [C, I], [D, G], [E, H], and [F, I]. Set is closed under 0 and 1 Merge these states and label by letters in the pair What is the new transition table? 20
Ex 4. 4. 2 pp 165 -166: transition table with merged states from pairs of indistinguishable states AD AG BE BH * CF * CI DG EH *FI What is wrong with the states in this new transition table? What is the solution? 21
A indistinguishable from D and G indistinguishable from each other. Similar for BE, BH and EH Similar for CF, CI and FI AD AG BE BH CF CI DG EH *FI Merge AD and AG, label ADG Merge BE and BH, label BEH Merge CF and CI, label CFI Label DG as ADG Label EH as BEH Label FI as CFI 0 1 ADG BEH *CFI How do we test the correctness of this labeling scheme? 22
Is the ms-DFA closed under 0 and 1? 0 AB BC *C D DE EF *F G GH HI *I A 1 E F H H I B B C E ADG->BEH under 0 ADG->EHB=BEH under 1 BEH->CFI under 0 BEH->FIC=CFI under 1 CFI->DGA=ADG under 0 CFI->HBE=BEH under 1 0 1 ADG BEH BEH CFI * CFI ADG BEH 23
Recall the chessboard NFA 1 2 3 4 5 6 7 8 9 S 1 2 3 4 5 6 7 8 * 9 r 2, 4 4, 6 2, 8 2, 4, 6, 8 2, 8 4, 6 6, 8 b 5 1, 3, 5 5 1, 5, 7 1, 3, 7, 9 3, 5, 9 5 5, 7, 9 5 25
Equivalent DFA by subset lazy construction {1} {2, 4} {5} {2, 4, 6, 8} {1, 3, 5, 7} * {1, 3, 7, 9} * {1, 3, 5, 7, 9} r {2, 4} {2, 4, 6, 8} {2, 4, 6, 8} b {5} {1, 3, 5, 7} {1, 3, 7, 9} {1, 3, 5, 7, 9} {5} {1, 3, 5, 7, 9} r AB BD CD DD ED *F D *G D b C E F G G C G renamed Find the ms-DFA 26
- More more more i want more more more more we praise you
- More more more i want more more more more we praise you
- Decision properties of regular languages
- Decision properties of regular language
- Decision properties of regular languages
- Decision properties of regular languages
- Regular grammars generate regular languages.
- Closure under intersection
- Properties of regular languages
- Right linear grammar
- Decision properties of context free languages
- Closure and decision properties of context free languages
- Decision properties of context free languages
- Closure and decision properties of context free languages
- Objectives of decision making
- Dividend decision in financial management
- Pumping lemma non regular languages examples
- Regular and irregular languages
- Proof by contradiction
- How many sides pentagon
- Attributes of polygons
- Regular expressions
- Regular language properties
- Properties of regular language
- Decision tree and decision table
- The more you take the more you leave behind
- The more you study the more you learn