cse 311 foundations of computing
play

cse 311: foundations of computing Fall 2015 Lecture 22: Finite - PowerPoint PPT Presentation

cse 311: foundations of computing Fall 2015 Lecture 22: Finite state machines review: finite state machines States Transitions on inputs Start state and final states The language recognized by a machine is the set of strings that


  1. cse 311: foundations of computing Fall 2015 Lecture 22: Finite state machines

  2. review: finite state machines • States • Transitions on inputs • Start state and final states • The language recognized by a machine is the set of strings that reach a final state State 0 1 0 0 s 0 s 0 s 1 1 1 1 s 0 s 1 s 2 s 3 s 1 s 0 s 2 s 2 s 0 s 3 s 3 s 3 s 3 0,1 0

  3. applications of FSMs (aka finite automata) • Implementation of regular expression matching in programs like grep • Control structures for sequential logic in digital circuits • Algorithms for communication and cache-coherence protocols – Each agent runs its own FSM • Design specifications for reactive systems – Components are communicating FSMs

  4. applications of FSMs (aka finite automata) • Formal verification of systems – Is an unsafe state reachable? • Computer games – FSMs provide worlds to explore – Character AI • Minimization algorithms for FSMs can be extended to more general models used in – Text prediction – Speech recognition

  5. waka waka

  6. tcp

  7. what language does this machine recognize? 1 s 0 s 1 1 0 0 0 0 1 s 2 s 3 1

  8. can we recognize these languages with DFAs?  • ∅ • • ∑ * { x ∊ {0,1}* : len(x) > 1} •

  9. strings over {0, 1, 2}* M 1 : Strings with an even number of 2’s s 0 s 1 M 2 : Strings where the sum of digits mod 3 is 0 t 1 t 0 t 2

  10. both: even number of 2’s and sum mod 3 = 0 s 1 t 0 s 0 t 1 s 0 t 0 s 1 t 1 s 1 t 2 s 0 t 2

  11. DFA that accepts strings of a’s, b’s, c’s with no more than 3 a’s

  12. FSM that accepts binary strings with a 1 three positions from the end

  13. 3 bit shift register “ Remember the last three bits ” 1 011 001 0 1 1 1 1 1 010 101 111 000 1 0 0 0 1 0 0 0 100 110 0

  14. 0 1 0 1 0 1 0 1 11 10 00 01 1 1 1 1 0 0 0 0 1 011 001 0 1 1 1 1 1 010 101 111 000 1 0 0 0 1 0 0 0 100 110 0

  15. FSMs with output “Tug -of- war” Input Output State L R s 1 s 1 s 2 Beep s 2 s 1 s 3 s 3 s 2 s 4 s 4 s 3 s 5 s 5 s 4 s 5 Beep R R R R S 1 S 5 L R S 2 S 4 S 3 [Beep] [Beep] L L L L

  16. vending machine We’re only making $5.50/hour writing regular expressions. Let’s design a vending machine. “He does not think like normal people, and as a result his tests are quite difficult. His lectures are amusing and get the material across, but his office hours are not always too helpful. Beware the vending machine final. ” Vending spec: Enter 15 cents in dimes or nickels Press S or B for a candy bar

  17. vending machine v0.1 D D N N, D N 0 5 10 15 B, S Basic transitions on N (nickel), D (dime), B (butterfinger), S (snickers)

  18. vending machine v0.2 0 D N 15 D D B 0’ S N 5 N 10 N [B] D 15’ [N] B S N D 0 ” [S] Adding output to states: N – Nickel, S – Snickers, B – Butterfinger

  19. vending machine v1.0 B,S 0 D N 15 B,S B,S B,S D D B D 0 ’ S N 5 N 10 N N [B] D 15’ [N] B N S D B,S N D 0 ” N 15 ” B [S] [D] S D Adding additional “unexpected” transitions

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend