24. FA's

24. FA's - Maggie Johnson CS103B Handout #24 Finite...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Maggie Johnson Handout #24 CS103B Finite Automata Key Topics Some Regular Expression Practice Introduction Finite Automata Non-deterministic Finite Automata _______________________________________________________________________________ Some Regular Expression Practice Define a regular expression for { δ , aa, ba, aaaa, aaba, baba, . ..} Give a set of characteristics for strings generated by a(ba + a)*b What is the shortest string of a's and b's not in the language corresponding to the regular expression b*(abb*)*a*? Describe as simply as possible the language defined by a*b(a*ba*b)*a* (b + ab)*(a + ab)* Introduction Several children's games fit the following description: Pieces are set up on a playing board; dice are thrown (or a wheel is spun) and a number is generated at random. Based on the generated number, the pieces on the board are rearranged specified by the rules of the game. Then, another child throws or spins and rearranges the pieces again. There is no skill or choice involved - the entire game is based on the values of the random numbers. Consider all possible positions of the pieces on the board and call them states . We begin with the initial state of the starting positions of the pieces on the board. The game then changes from one state to another based on the value of the random number. For each possible number, there is one and only one resulting state given the input of the number, and the prior state. This continues until one player wins and the game is over. This is called a final state . Now consider a very simple computer with an input device, a processor, some memory and an output device. We want to calculate 3 + 4, so we write a simple list of instructions and feed them into the machine one at a time (e.g., STORE 3 TO X; STORE 4 TO Y; LOAD X; ADD Y; WRITE TO OUTPUT). Each instruction is executed as it is read. If all goes well, the machine outputs '7' and terminates execution. This process is similar to the board game. The state of the machine changes after each instruction is executed, and each state is completely determined by the prior state and the input instruction (thus this machine is defined as deterministic ). No choice or skill is involved; no knowledge of the state of the machine four instructions ago is needed. The machine simply starts at an initial state, changes from state to state based on the instruction and the prior state, and reaches the final state of writing '7'. Finite Automata
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A general model (of which the previous two examples are instances) of this type of machine is called a Finite Automaton ; 'finite' because the number of states and the alphabet of input symbols is finite; automaton because the structure or machine (as it is more commonly called) is deterministic, i.e., the change of state is completely governed by the input. A
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/01/2011 for the course CS 103B taught by Professor Sahami,m during the Winter '08 term at Stanford.

Page1 / 7

24. FA's - Maggie Johnson CS103B Handout #24 Finite...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online