1 / 46

nskinfo && nsksofttch Department of nskinfo-i education

www.nskinfo.com && www.nsksofttch.com Department of nskinfo-i education. CS2303-THEORY OF COMPUTATION. An Introduction to Automata Theory. Components of computer Science. Computer Science (systematized body of knowledge concerning computation). Fundamental ideas + Computing models.

pepin
Télécharger la présentation

nskinfo && nsksofttch Department of nskinfo-i education

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. www.nskinfo.com && www.nsksofttch.comDepartment of nskinfo-i education CS2303-THEORY OF COMPUTATION An Introduction to Automata Theory

  2. Components of computer Science • Computer Science • (systematized body of knowledge concerning computation) • Fundamental ideas + Computing models • Hardware + software + application of theory to design • Theoretical Computer Science

  3. Branches in TCS… Theoretical Computer Science(Twin branches) • Automata Theory • Formal Languages Had beginning from diff. fields • Biology – neuron nets • Electronics – switching circuits • Logic – natural languages Notion of automaton originated from neuron nets and switching circuits in mind – mid 30’s [Allan Turing] Notion of formal languages originated from logic, linguistics – late 50’s [Noam Chomsky]

  4. Automata Theory Automaton – abstract mathematical model for computing Turing Machine – hypothetical model – Allen Turing – 1936 – Mathematical formulation to perform complex calculations, functions, etc. • Proceeds in discrete steps (as events occur in discrete steps – clock!) • Describes completely structure and behavior • Highest end of complexity and power Other simpler modelsFinite state Automaton(FSA), Mealy Machine, Moore Machine, Pushdown Automata(PDA), Linear Bounded Automaton (LBA)

  5. Finite State Machines • Also called Finite Automata (or Finite State Automaton FSA) • These are Machines having a finite number of states.

  6. Example1 – On/Off Button • Finite automata are the most simple (language accepting) machine that is not just a finite list of words. • The machine reads the input string only once, after which it immediately accepts or rejects it. There is no write possibility. Think On/Off button, elevator door, etc.

  7. Example1 – On/Off Button States Transition Rules The On/Off button accepts the language {Pushn| n is odd} The corresponding automation is… Push On Off Push Rejecting State Starting State Accepting State

  8. Example1 – On/Off Button Transition of States State diagram Push On Off Push

  9. Example2 – Goat in a boat !! • Man with wolf, goat and cabbage is on left side of a river • Has a small rowboat, just big enough for him & one other thing • Can’t leave goat and wolf together • Can’t leave goat and cabbage together • Can he get them to right side

  10. Example2 – Goat in a boat !! • Current state is list of what things are on which side of river • All are left • Man and goat on right • All on right (desired state) MWGC - WC - MG - MWGC

  11. Example2 – Goat in a boat !! • We’ll indicate with arrows the changes between states Letter indicating what happened g – man took goat c – man took cabbage w – man took wolf m – man went alone g MWGC - WC - MG

  12. Example2 – Goat in a boat !! Transition in both ways g MWGC - WC - MG g

  13. Example2 – Goat in a boat !! Dangerous ! We will avoid those dangerous attempts ! c MWGC - WG - MC

  14. Example2 – Goat in a boat !! g MWGC - WC - MG g - MWGC

  15. m m c G - MWC MWC - G m m w w c Start W - MGC C - MWG g g g g g MWGC - - MWGC MG - WC WC - MG g WGM - C MGC - W g g c w c w

  16. m m c m m w w c Start g g g g g g g g c w c w

  17. States and inputs involved States Input Start state Transition(mapping from state to state on input)

  18. Finite State Automaton - FSA • An FSA consists of • A set of “states” • “Control” moves from state to state in response to some ‘input” • Deterministic Automaton • The machine is in only state at a given time. • Non-deterministic Automaton • The machine can be in multiple state at a given time

  19. Finite State Automaton - FSA FSA, • Finite set of states, Q • Start state, • Set of transitions from one state to another Occur on input from alphabet • Exactly one transition out of each state for each symbol in • A subset of final state,

  20. We denote a run in the following way r : s0 s1 . . . sn-2 sn-1 sn Set of runs of x is denoted as r(x) L(M) = { x  X* : run of x ends in F} where M is a finite state automata xn-1 x1 x2 xn x3

  21. Finite State AutomataDeterministic Type Transition rules States 1 1 0 0 0,1 Starting State Accepting States

  22. Finite State AutomataDeterministic Type 1 0 0,1 0 1

  23. Finite State AutomataNon Deterministic Type 0,1 0 1

  24. m m c G - MWC MWC - G m m w w c Start W - MGC C - MWG g g g g g MWGC - - MWGC WG - MC WC - MG g WGM - C MGC - W g g c w c w

  25. FSA to Recognize alphanumeric on a token b s Key: d – digit, b – blank, s – other symbol B b Start b,d d,b,s NG d S OK b s OK d s d s

  26. FSA to Recognize only Numeric token _12 b s Key: d – digit, b – blank, s – other symbol B b Start b,d NG d,b,s d S OK b s OK d s d s

  27. FSA to Recognize only Numeric token _12 b s Key: d – digit, b – blank, s – other symbol B b Start b,d NG d,b,s d S OK b s OK d s d s

  28. FSA to Recognize only Numeric token _12 b s Key: d – digit, b – blank, s – other symbol B b Start b,d NG d,b,s d S OK b s OK d s d s

  29. FSA to Recognize token _12 b s Key: d – digit, b – blank, s – other symbol B b Start b,d NG d,b,s d S OK b s OK d s d s

  30. FSA to Recognize only Numeric token _12 b s Key: d – digit, b – blank, s – other symbol B b Start b,d NG d,b,s d S OK b s OK d s d s Accept !

  31. How about alphanumeric…? (_z34) _z34 b s Key: d – digit, b – blank, s – other symbol B b Start b,d d,b,s NG d S OK b s OK d s d s

  32. How about alphanumeric…? (_z34) _z34 b s Key: d – digit, b – blank, s – other symbol B b Start b,d d,b,s NG d S OK b s OK d s d s

  33. How about alphanumeric…? (_z34) _z34 b s Key: d – digit, b – blank, s – other symbol B b Start b,d d,b,s NG d S OK b s OK d s d s

  34. How about alphanumeric…? (_z34) _z34 b s Key: d – digit, b – blank, s – other symbol B b Start b,d d,b,s NG d S OK b s OK d s d s

  35. How about alphanumeric…? (_z34) _z34 b s Key: d – digit, b – blank, s – other symbol B b Start b,d d,b,s NG d S OK b s OK d s d s FAIL !

  36. FSA to Recognize Integers (1___) 1___ b s Key: d – digit, b – blank, s – other symbol B b Start b,d d,b,s NG d S OK b s OK d s d s

  37. FSA to Recognize Integers (1___) 1___ b s Key: d – digit, b – blank, s – other symbol B b Start b,d d,b,s NG d S OK b s OK d s d s

  38. FSA to Recognize Integers (1___) 1___ b s Key: d – digit, b – blank, s – other symbol B b Start b,d d,b,s NG d S OK b s OK d s d s

  39. FSA to Recognize Integers (1___) 1___ b s Key: d – digit, b – blank, s – other symbol B b Start b,d d,b,s NG d S OK b s OK d s d s

  40. FSA to Recognize Integers (1___) 1___ b s Key: d – digit, b – blank, s – other symbol B b Start b,d d,b,s NG d S OK b s OK d s d s Accept !

  41. Transition Table

  42. Example X = {a, b} S = {q0, q1} z0 = q0 F = {q1} a a b q0 q1 b

  43. X = { a, b } S = { q0 , q1 } z0 = q0 F = { q1 } L(M) = A*b* Example a, b b q0 b q1

  44. Example  = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} 0,3,6,9 1, 4,7 q1 0,3,6,9 q0 2,5,8 1, 4,7 1, 4,7 2,5,8 2,5,8 q2 0,3,6,9

  45. Language L  X* isregularif there exists a finite state automata M such that L = L(M) Result For each regular language there exists a deterministic finite state automata M such that L = L(M).

  46. Thank You

More Related