..........................................NEXT PREVIOUS INDEX
L04 Finite State Automaton: An Intro Finite State Machines: Introduction o A finite state machine or automaton (FSM or FSA) can be used to recognize strings. - For each string it accepts or rejects + Ex.: SheepTalk-1: Sheep speak in a language in which - every sentence begins with 'b', - followed by any number of 'a' s (with at least one 'a') + Ex.: Language SheepTalk-1 = { ba, baa, baaa, ... } * An FSA for the above: SheepFSA-1 a ---->--- \ / b a \ / ->-(q0)-->--(q1)-->--((q2)) - States: q0,q1,q2 - Starting state: q0 - Accepting states: q2 - Transitions: + q0 to q1 when input is 'b', + q1 to q2 when input is 'a', + q2 to q2 when input is 'a' * Operating the SheepFSA-1 for a given input - Machine starts in current state q0. - For each symbol in input sentence, machine makes a transition from its current state to next state given by transition. + Ex.1: Operating SheepFSA-1 for input 'baa': * Current-state Remaining-input sentence - q0 baaa - q1 aaa - q2 aa - q2 a - q2 OVER * Finally, machine is in accepting state q2 - Therefore, input is ACCEPTed. + Ex.2: Operating SheepFSA-1 for input: 'b' * Current-state Remaining-input sentence - q0 b - q1 OVER * Input REJECTed because: string is over, but machine not in accepting state. + Ex.3: Operating SheepFSA-1 for input: 'bc' * Current-state Remaining-input sentence - q0 bc - q1 c * Input REJECTed because no transition possible with remaining input 'c'..........................................NEXT PREVIOUS INDEX