basis is and a are not induction e f is i b oth e and f
play

; (Basis) is; and a are not. (Induction) E + F is i - PDF document

Decision Prop erties of Regular Languages Giv en a (represen tation, e.g., RE, F A, of a) regular language L , what can w e tell ab out L ? Since there are algorithms to con v ert b et w een an y t w o


  1. Decision Prop erties of Regular Languages Giv en a (represen tation, e.g., RE, F A, of a) regular language L , what can w e tell ab out L ? � Since there are algorithms to con v ert b et w een an y t w o represen tations, w e can c ho ose the rep that mak es the test easiest. Mem b ership Is string w in regular language L ? � Cho ose DF A represen tation for L . � Sim ulate the DF A on input w . Emptiness Is L = ; ? � Use DF A represen tation. � Use a graph-reac habilit y algorithm to test if at least one accepting state is reac hable from the start state. Finiteness Is L a �nite language? � Note ev ery �nite language is regular (wh y?), but a regular language is not necessarily �nite. DF A metho d : � Giv en a DF A for L , eliminate all states that are not reac hable from the start state and all states that do not reac h an accepting state. � T est if there are an y cycles in the remaining DF A; if so, L is in�nite, if not, then L is �nite. � RE metho d : Almost, w e can lo ok for a in the RE and sa y its language is in�nite if there is one, �nite if not. Ho w ev er, there are exceptions, e.g. 0 � 1 or 0 ; . Th us: � � ; 1. Find sub expressions equiv alen t to b y: ✦ ; (Basis) is; � and a are not. ✦ (Induction) E + F is i� b oth E and F are; E F is if either E or F are; E � nev er is. ; 2. Eliminate sub expressions equiv alen t to b y: ✦ Replace + or + b y whenev er E F F E F is and isn't. E F ✦ Replace b y whenev er is equiv alen t E � � E to ; . 1

  2. 3. No w, �nd sub expressions that are equiv alen t to � b y: ✦ (Basis) is; a isn't. � ✦ (Induction) E + F is i� b oth E and F are; ditto E F ; E � is i� E is. 4. No w, w e can tell if L ( R ) is in�nite b y lo oking for a sub expression E � suc h that E is not equiv alen t to � . Example Consider ( 0 + 1 ; ) + 1 ; . � � � Step 1: ; (t wice) and 1 ; are sub expressions equiv alen t to ; . � Step 2: 0 � + 1 � remains. � Step 3: only sub expression is equiv alen t to � . � � Since 0 is starred, language is in�nite. Minimization of States � Real goal is testing equiv alence of (reps of ) t w o regular languages. � In teresting fact: DF A's ha v e unique (up to state names) minim um -state equiv alen ts. ✦ But pro of in course reader do esn't quite get to that p oin t. Distingu ish abl e States Key idea: �nd states p and q that are distinguishable b ecause there is some input w that tak es exactly one of p and q to an accepting state. � Basis: an y nonaccepting state is distinguishable from an y accepting state ( w = � ). � Induction: and are distinguishable if there p q is some input sym b ol suc h that ( p; a ) is a � distinguishable from ( q a ). � ; ✦ All other pairs of states are indistinguishable, and can b e merged in to one state. Example (V ery Simple) Consider: 2

  3. 0 Start p q 0 1 1 1 0 r � p is distinguishable from q and r b y basis. Can w e distinguish q from r ? � No string b eginning with 0 w orks, b ecause b oth states go to p , and therefore an y string of the form 0 x tak es and to the same state. q r � No string b eginning with 1 w orks. ✦ T ec hnically , ( q 1) = and ( r 1) = are � ; r � ; q not distinguishable. Th us, induction do es not tell us q and r are distinguishable. ✦ What happ ens is that, starting in either q or r , as long as w e ha v e inputs 1, w e are in one of the accepting states, and when a 0 is read, w e go to the same state forev er after. Constructing the Minim um-S tat e DF A � F or eac h group of indistinguishable states, pic k a \represen tativ e." ✦ Note a group can b e large, e.g., , if all pairs are q ; q ; : : : ; q 1 2 k indistinguishable. ✦ Indistinguishabilit y is transitiv e (wh y?) so indistinguishabilit y partitions states. � If is a represen tativ e, and ( p; a ) = , in p � q minim um -state DF A the transition from p on a is to the represen tativ e of q 's group (to q itself if q is either alone in a group or a represen tativ e). � State state is represen tativ e of the original start state. � Accepting states are represen tativ es of groups of accepting states. ✦ Notice w e could not ha v e a \mixed" (accepting + nonaccepting) group (wh y?). 3

  4. � Delete an y state that is not reac hable from the start state. Example F or the DF A ab o v e, p is in a group b y itself; f q ; r g is the other group. 0 Start p 1 q r 0,1 Wh y Ab o v e Minimizati on Can't b e Beaten Supp ose w e ha v e a DF A A , and w e minim ize it to construct a DF A M . Y et there is another DF A N that accepts the same language as A and M , y et has few er states than M . Pro of con tradiction that this can't happ en: � Run the state-distinguishabilit y pro cess on the states of and together. M N � Start states of and are indistinguishable M N b ecause L ( M ) = L ( N ). � If f p; g are indistinguishable, then their q successors on an y one input sym b ol are also indistinguishable. � Th us, since neither not could ha v e M N an inaccessible state, ev ery state of M is indistinguishable from at least one state of N . � Since N has few er states than M , there are t w o states of M that are indistinguishable from the same state of N , and therefore indistinguishable from eac h other. � But M w as designed so that all its states ar e distinguishable from eac h other. � W e ha v e a con tradiction, so the assumption that exists is wrong, and in fact has as N M few states as an y equiv alen t DF A for A . � In fact (stronger), there m ust b e a 1-1 corresp ondence b et w een the states of an y other minim um -state and the DF A , N M sho wing that the minim um -state DF A for A is unique up to renaming of the states. 4

Recommend


More recommend