1 / 22

COSC 3340: Introduction to Theory of Computation

COSC 3340: Introduction to Theory of Computation. University of Houston Dr. Verma Lecture 2. 1st model -- Deterministic Finite Automaton (DFA). Read only Head. Finite Control. DFA (contd.). The DFA has: a finite set of states 1 special state - initial state

Download Presentation

COSC 3340: Introduction to Theory of Computation

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. COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 2 UofH - COSC 3340 - Dr. Verma

  2. 1st model -- Deterministic Finite Automaton (DFA) Read only Head Finite Control UofH - COSC 3340 - Dr. Verma

  3. DFA (contd.) • The DFA has: • a finite set of states • 1 special state - initial state • 0 or more special states - final states • input alphabet • transition table containing (state, symbol) -> next state UofH - COSC 3340 - Dr. Verma

  4. Informally -- How does a DFA work? • An input string is placed on the tape (left-justified). • DFA begins in the start state. • Head placed on leftmost cell. • DFA goes into a loop until the entire string is read. • In each step, DFA consults a transition table and changes state based on (s,) where • s - current state •  - symbol scanned by head UofH - COSC 3340 - Dr. Verma

  5. How does a DFA work? (contd.) • After reading input string, • if DFA state final, input accepted • if DFA state notfinal, input rejected • Language of DFA -- set of all strings accepted by DFA. UofH - COSC 3340 - Dr. Verma

  6. Pictorial representation of DFA (q,σ)->q' UofH - COSC 3340 - Dr. Verma

  7. Example: Diagram of DFA L = {a2n + 1 | n >= 0} • Answer: L = {a, aaa, aaaaa, ...} UofH - COSC 3340 - Dr. Verma

  8. JFLAP Step-By-Step aaa UofH - COSC 3340 - Dr. Verma

  9. JFLAP Step-By-Step aaa UofH - COSC 3340 - Dr. Verma

  10. JFLAP Step-By-Step aaa UofH - COSC 3340 - Dr. Verma

  11. JFLAP Step-By-Step aaa UofH - COSC 3340 - Dr. Verma

  12. Formal definition of DFA • DFA M = (Q, , , s, F) • Where, • Q is finite set of states •  is input alphabet • sQ is initial state • FQ is set of final states • : Q X-> Q UofH - COSC 3340 - Dr. Verma

  13. Formal definition of L(M) • L(M) - Language accepted by M • Define *: • *(q, ) = q • *(q, wσ) = (*(q,w),σ) • Definition: L(M) = { w in *| * (s,w) in F }. UofH - COSC 3340 - Dr. Verma

  14. Example: L(M) = {w in {a,b}* | w contains even no. of a's} UofH - COSC 3340 - Dr. Verma

  15. JFLAP Step-By-Step aa UofH - COSC 3340 - Dr. Verma

  16. JFLAP Step-By-Step aa UofH - COSC 3340 - Dr. Verma

  17. JFLAP Step-By-Step aa UofH - COSC 3340 - Dr. Verma

  18. JFLAP Step-By-Step ab UofH - COSC 3340 - Dr. Verma

  19. JFLAP Step-By-Step ab UofH - COSC 3340 - Dr. Verma

  20. JFLAP Step-By-Step ab UofH - COSC 3340 - Dr. Verma

  21. Given a language, how to define DFA? • Creative process requiring you to: (i) Put yourself in DFA's shoes (ii) Find finite amount of info, based on which string accepted/rejected (iii) From step (ii), determine number of states and then transitions. UofH - COSC 3340 - Dr. Verma

  22. Regular Languages • Definition: A Language is regular iff there is a DFA that accepts it. • Examples: •  • {} • * • {w in {0,1}* | second symbol of w is a 1} Exercise • {w in {0,1}* | second last symbol of w is a 1} Exercise • {w in {0,1}* | w contains 010 as a substring} - (importance?) UofH - COSC 3340 - Dr. Verma

More Related