1 / 20

CSE 105 Theory of Computation

CSE 105 Theory of Computation. Alexander Tsiatas Spring 2012. Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons Attribution- NonCommercial - ShareAlike 3.0 Unported License. Based on a work at http://peerinstruction4cs.org.

della
Download Presentation

CSE 105 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. CSE 105Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Based on a work at http://peerinstruction4cs.org. Permissions beyond the scope of this license may be available at http://peerinstruction4cs.org.

  2. Check Moodle often! ClassBusiness

  3. They have almost no memory! Deterministic Finite AutomataDFA

  4. Formal Definition of a DFA • Did you know you can specify a DFA (not just its language) without drawing a single circle or arrow? • A DFA M1 is defined as a 5-tuple as follows: • M1 = (Q, Σ, δ, q0, F), where: • Q is a finite set of states • Σ is a finite set of characters, the alphabet • δ: Q x Σ -> Q, the transition function • q0, a member of Q, the start state • F, a subset of Q, the accept state(s) • We’ve covered several of these already: Q, Σ, q0, F • Let’s take a closer look at δ NEED TO USE THIS FOR PROOFS---CANNOT MAKE GENERAL STATEMENTS BY DRAWING SPECIFIC EXAMPLES!

  5. δ: Q x Σ -> Q Transition Table • “b’s never appear after a’s” • s • s • s Answer: a

  6. δ: Q x Σ -> Q Transition Table • {w | length(w) is odd} • s • s • s Answer: b

  7. Regular Languages • Mathematical objects so far: • Character or Input symbol: aor ‘a’ • String: ababba or “ababbba” • Alphabet (a set of characters): {a,b} • Language (a set of strings): {w | length(w) is 5} • Now we introduce a particular set of languages: The Regular Languages • A set of sets of strings • NOT the same as a set of sets of sets of characters (string =/= set of characters!)

  8. Regular languages • The set of all languages for which there exists a DFA that recognizes it • How do we know what is in this set? What are the boundaries? • (Remember I said that in this course, we would “Become familiar with the contours of each model’s limitations and powers & prove things about the limitations, about the powers…”)

  9. Deterministic Finite Automata: Finiteness • Deterministic Finite Automata (DFAs) can only recognize finite languages (a language with 0 string or 2 strings or 10 strings or 1,003,078 strings in it), not infinite languages (infinite number of strings in the language) • TRUE • FALSE DFA’s are finite, but languages not necessarily

  10. Deterministic Finite Automata: Uniqueness • Each DFA recognizes a unique language, in other words, no two DFAs recognize the same language. • TRUE • FALSE Have them discuss what the language is if you choose answer choice (a).

  11. Thm. The class of regular languages is closed under the union operation. • What does this mean? • How can we prove this? We talked about the boundaries with our Infinite and Unique slides WRITE: Closure Properties are one way theoreticians think about and describe the boundaries

  12. Closure Properties/”Closed Under” • Which of the of the statements is FALSE? • Integers are closed under addition • Integers are closed under division • Even numbers are closed under addition Answer: b

  13. Closure Properties/”Closed Under” • Which of the of the statements is FALSE? • Real numbers are closed under addition • Real numbers are closed under division • Odd numbers are closed under addition Answer: c

  14. Thm. The class of regular languages is closed under the union operation. • b's never appear after a’s • {w | length(w) is odd} Finish this DFA Have two students each be one DFA---hold up the card of which state they are in---test “bbba” and “bbbaa”

  15. Say that this is for a SPECIFIC example, which doesn’t prove closure, and now we want to extend it to ARBITRARY (ANY) regular languages.

  16. Thm. The class of regular languages is closed under the union operation. Our working example: A generalized proof form: • Given two regular languages L1, L2, with DFAs M1, M2 • M1 = (Q1,Σ,δ1,q01,F1) • M2 = (Q2,Σ,δ2, q02,F2) • We want to construct a DFA M = (Q,Σ,δ, q0,F), s.t.: • Q = Q1 x Q2 • δ = • q0 = • F = • M recognizes L1 U L2 • A DFA recognizes L1 U L2, then L1 U L2 must be regular WHERE DO M1, M2 COME FROM? WHY CAN WE ASSUME THEY EXIST? Finish this DFA

  17. Thm. The class of regular languages is closed under the union operation. Our working example: Finish this DFA A generalized proof form: • Given two regular languages L1, L2, with DFAs M1, M2 • M1 = (Q1,Σ,δ1,q01,F1) • M2 = (Q2,Σ,δ2, q02,F2) • We want to construct a DFA M = (Q,Σ,δ, q0,F), s.t.: • Q = Q1 x Q2 • δ = • q0 = • F = • M recognizes L1 U L2 • A DFA recognizes L1 U L2, then L1 U L2 must be regular • q0 = (r1,q1) • q0 = (q01, q02) • q0 = {(r1,q1)}

  18. Thm. The class of regular languages is closed under the union operation. Our working example: A generalized proof form: • Given two regular languages L1, L2, with DFAs M1, M2 • M1 = (Q1,Σ,δ1,q01,F1) • M2 = (Q2,Σ,δ2, q02,F2) • We want to construct a DFA M = (Q,Σ,δ, q0,F), s.t.: • Q = Q1 x Q2 • δ = • q0 = • F = • M recognizes L1 U L2 • A DFA recognizes L1 U L2, then L1 U L2 must be regular Finish this DFA δ: Q1 x Q2  Q δ: Q1 x Q2 x Σ Q δ((x,y),c) = (δ1(x,c), δ2(y,c)), for c in Σand (x,y) in Q δ((r1,q1),a) = (r2,q2)

  19. Thm. The class of regular languages is closed under the union operation. Our working example: A generalized proof form: • Given two regular languages L1, L2, with DFAs M1, M2 • M1 = (Q1,Σ,δ1,q01,F1) • M2 = (Q2,Σ,δ2, q02,F2) • We want to construct a DFA M = (Q,Σ,δ, q0,F), s.t.: • Q = Q1 x Q2 • δ = • q0 = • F = • M recognizes L1 U L2 • A DFA recognizes L1 U L2, then L1 U L2 must be regular Finish this DFA F = {(r1,q1), (r1,q2), (r2,q1), (r2q2), (r2,q3)} F = F1 x F2 F = F1 U F2 F = {(x,y) in Q | x in F1 or y in F2} None of the above

  20. Final form for your homework/test: Thm. The class of regular languages is closed under the union operation. • Proof: • Given: Two regular languages L1, L2. • Want to show: L1 U L2 is regular. • Because L1 and L2 are regular, we know there exist DFAs M1 = (Q1,Σ,δ1,q01,F1) and M2 = (Q2,Σ,δ2,q02,F2) that recognize L1 and L2. We construct a DFA M = (Q,Σ,δ,q0,F), s.t.: • Q = Q1 x Q2 • δ = • q0 = • F = • M recognizes L1 U L2. • A DFA recognizes L1 U L2, then L1 U L2 is regular. Q.E.D. Could you come up with this, and write it correctly, in a short amount of time on an exam??

More Related