จำนวน สถานะ NUMBER OF STATES
ประเด็นที่ สนใจ The number of distinct states the finite state machine needs in order to recognize a language is related to the number of distinct strings that must be distinguished from each other. NUMBER OF STATES
นิยาม Let L be a language in *. Two strings x and y in * are distinguishable with respect to L if there is a string z in * so that exactly one of the strings xz and yz is in L. The string z is said to distinguish x and y with respect to L. DISTINGUISHABLE สามารถแยกความ แตกต่างได้ NUMBER OF STATES
นิยาม Let L be a language in *. Two strings x and y in * are distinguishable with respect to L if L/x ≠ L/y where L/x = { z * | xz L } L/y = { z * | yz L }. DISTINGUISHABLE สามารถแยกความ แตกต่างได้ NUMBER OF STATES
Let = { 0, 1 }. Let L be the language associated with (0+1)*10. Two strings x= and y= 010 in *. Since there is a string z= 0 in * such that xz = is in L but yz = 0100 is not in L, x and y are distinguishable with respect to L. We may say that x and y are indistinguishable with respect to L if there is no such string z. The strings 0 and 100 are indistinguishable with respect to L. EXAMPLE DISTINGUISHABLE สามารถแยกความ แตกต่างได้ NUMBER OF STATES
Suppose that L *, and M = (Q, ,q 0,A, ). If x and y are two strings in * for which *(q 0,x) = *(q 0,y) then x and y are indistinguishable with respective to L. Note: *(q 0,x)= q j means that there is a path from q 0 to q j with respect to x: *(q 0,x) = ((… ( (q 0,x 1 ),x 2 ),…),x j ) = q j where x = x 1 x 2 …x j. LEMMA NUMBER OF STATES จำนวนสถานะ
Suppose that L *, and M = (Q, ,q 0,A, ). If x and y are two strings in * for which *(q 0,x) = *(q 0,y) then x and y are indistinguishable with respective to L. Note: *(q 0,x)= q j means that there is a path from q 0 to q j with respect to x: *(q 0,x) = ((… ( (q 0,x 1 ),x 2 ),…),x j ) = q j where x = x 1 x 2 …x j. LEMMA NUMBER OF STATES จำนวนสถานะ Proof: Let z be any string in *. Consider xz and yz, We have that*(q 0,xz) = *(*(q 0,x),z) *(q 0,yz) = *(*(q 0,y),z). Then *(q 0,xz) = *(q 0,yz). Two strings xz and yz are either both in L or both not in L. Therefore, x and y are indistinguishable with respect to L.QED. NUMBER OF STATES
Suppose that L *, and for some positive integer n, there are n strings in *, any two of which are distinguishable with respect to L. Then there can be no finite state machine recognizing L with fewer than n states. Proof: Suppose x 1,x 2,…,x n strings are distinguishable with respect to L. Assume that M is a finite state machine with fewer than n states. By the pigeonhole principle, the state *(q 0,x 1 ), *(q 0,x 2 ),…*(q 0,x n ) cannot all be distinct, so for some ij *(q 0,x i )=*(q 0,x j ). Since x i and x j are distinguishable with respect to L, it follows from Lemma that M cannot recognize L. QED. THEOREM NUMBER OF STATES จำนวนสถานะ
Let ={0,1}, and let L n * L n ={x| |x| n and the n th character from the right in x is 1}. For instance, n = 2, all words accepted by L 2 is of the form (1+0)*1(0+1). 1 1 EXAMPLE NUMBER OF STATES จำนวนสถานะ
Let ={0,1}, and let L n * L n ={x| |x| n and the n th character from the right in x is 1}. For instance, n = 2, all words accepted by L 2 is of the form (1+0)*1(0+1). NUMBER OF STATES จำนวนสถานะ EXAMPLE NUMBER OF STATES
Let ={0,1}, and let L n * L n ={x| |x| n and the n th character from the right in x is 1}. For instance, n = 2, all words accepted by L 2 is of the form (1+0)*1(0+1). NUMBER OF STATES จำนวนสถานะ EXAMPLE NUMBER OF STATES
Let ={0,1}, and let L n * L n ={x| |x| n and the n th character from the right in x is 1}. For instance, n = 2, all words accepted by L 2 is of the form (1+0)*1(0+1). NUMBER OF STATES จำนวนสถานะ EXAMPLE NUMBER OF STATES
Let ={0,1}, and let L n * L n ={x| |x| n and the n th character from the right in x is 1}. For instance, n = 2, all words accepted by L 2 is of the form (1+0)*1(0+1). NUMBER OF STATES จำนวนสถานะ EXAMPLE NUMBER OF STATES
(1+0)*1(0+1) NUMBER OF STATES จำนวนสถานะ EXAMPLE NUMBER OF STATES
PALINDROME language over the alphabet {0,1} cannot be accepted by any finite automaton. Proof: Any two strings in {0,1}* are distinguishable with respect to PALINDROME language.QED. EXAMPLE For two strings, and Rejected accepted THEOREM NUMBER OF STATES จำนวนสถานะ
7 กราฟการ ส่งผ่าน TRANSITION GRAPHS
วัตถุประสงค์ More powerful machine: read one or more letters of input string at a time q2q2 b q3q3 b q0q0 q1q1 ab a baab aba b TRANSITION GRAPHS
A transition graph (abbreviated TG) is a 5-tuple (Q, , q 0, , A) where •Q means a finite set of states. • is a finite input alphabet. •q 0 Q named Initial state. •A Q, A is the set of all accepted states. • is a function from Q * to P(Q), called transition function. นิยาม TRANSITION GRAPHS กราฟการส่งผ่าน
aa b b b b Language associated with this TG is (aa+b)*bbb. TRANSITION GRAPHS กราฟการส่งผ่าน EXAMPLE TRANSITION GRAPHS