1 / 122

Example

Example. Find a DTM that computes the language L = { a n b n : n ≥ 0}. High level program: Repeat Erase an a. Pass along the rest of as. Erase a b Pass along the rest of bs . Go to the beginning of the input.

penda
Download Presentation

Example

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. Example • Find a DTM that computes the language L = {anbn : n ≥ 0}. High level program: • Repeat • Erase an a. • Pass along the rest of as. • Erase a b • Pass along the rest of bs. • Go to the beginning of the input. • Until either the whole input is erased (accept) or you find unmatched as or bs (reject).

  2. Example • Find a DTM that computes the language L = {anbn : n ≥ 0}. Answer: a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  3. Testing Test the machine for several possible inputs to see if it works as it should. Test inputs: • ε (it should accept) • aaabbb (it should accept) • aaabb (it should reject) • aabbb (it should reject) • aabba (it should reject)

  4. Test input: ε … … a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  5. Test input: ε … … a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  6. Test input: aaabbb … … a a a b b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  7. Test input: aaabbb … … x a a b b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  8. Test input: aaabbb … … x a a b b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  9. Test input: aaabbb … … x a a b b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  10. Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  11. Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  12. Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  13. Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  14. Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  15. Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  16. Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  17. Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  18. Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  19. Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  20. Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  21. Test input: aaabbb … … x a a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  22. Test input: aaabbb … … x x a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  23. Test input: aaabbb … … x x a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  24. Test input: aaabbb … … x x a x b b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  25. Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  26. Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  27. Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  28. Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  29. Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  30. Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  31. Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  32. Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  33. Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  34. Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  35. Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  36. Test input: aaabbb … … x x a x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  37. Test input: aaabbb … … x x x x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  38. Test input: aaabbb … … x x x x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  39. Test input: aaabbb … … x x x x x b a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  40. Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  41. Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  42. Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  43. Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  44. Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  45. Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  46. Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  47. Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  48. Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  49. Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

  50. Test input: aaabbb … … x x x x x x a → a , R x → x , R x → x, R b → b , R a → x, R b → x, R q0 q1 q2 □ → □ , R □ → □ , L □ → □ , R qf q3 a → a , L b → b , L x → x , L

More Related