CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.

Slides:



Advertisements
Similar presentations
Chapter Three: Closure Properties for Regular Languages
Advertisements

CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
Introducing DFA Formal Description Using Peer Instruction Cynthia Bailey Lee UCSD 2011 Theory of Computation Peer Instruction Lecture Slides by Dr. Cynthia.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Finite Automata CPSC 388 Ellen Walker Hiram College.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
CS5371 Theory of Computation
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 Languages and Finite Automata or how to talk to machines...
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 1 Regular Languages Contents Finite Automata (FA or DFA) definitions, examples,
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (Section 1.1: DFA’s) David Martin With some modifications.
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
Introduction to Finite Automata Adapted from the slides of Stanford CS154.
1.Defs. a)Finite Automaton: A Finite Automaton ( FA ) has finite set of ‘states’ ( Q={q 0, q 1, q 2, ….. ) and its ‘control’ moves from state to state.
Finite Automata Costas Busch - RPI.
Costas Busch - LSU1 Non-Deterministic Finite Automata.
Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (Section 1.2: NFA’s) David Martin With some modifications.
Nondeterminism (Deterministic) FA required for every state q and every symbol  of the alphabet to have exactly one arrow out of q labeled . What happens.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
CSCI 2670 Introduction to Theory of Computing August 24, 2005.
REGULAR LANGUAGES.
1 Unit 1: Automata Theory and Formal Languages Readings 1, 2.2, 2.3.
Theory of Computation 1 Theory of Computation Peer Instruction Lecture Slides by Dr. Cynthia Lee, UCSD are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Theory of Computation 1 Theory of Computation Peer Instruction Lecture Slides by Dr. Cynthia Lee, UCSD are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Formal Definition of Computation Let M = (Q, ∑, δ, q 0, F) be a finite automaton and let w = w 1 w w n be a string where each wi is a member of the.
Deterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.2)
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
August 23, 2005 CSCI 2670 Introduction to Theory of Computing August 23, 2005.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
Equivalence with FA * Any Regex can be converted to FA and vice versa, because: * Regex and FA are equivalent in their descriptive power ** Regular language.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Finite Automata A simple model of computation. 2 Finite Automata2 Outline Deterministic finite automata (DFA) –How a DFA works.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Lecture #4 Thinking of designing an abstract machine acts as finite automata. Advanced Computation Theory.
Lecture #5 Advanced Computation Theory Finite Automata.
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
Costas Busch - LSU1 Deterministic Finite Automata And Regular Languages.
Theory of Computation Automata Theory Dr. Ayman Srour.
Fall 2004COMP 3351 Finite Automata. Fall 2004COMP 3352 Finite Automaton Input String Output String Finite Automaton.
CSE 105 theory of computation
CSCI 2670 Introduction to Theory of Computing
Languages.
Lecture2 Regular Language
Non Deterministic Automata
CSE 105 Theory of Computation
CSE 105 theory of computation
THEORY OF COMPUTATION Lecture One: Automata Theory Automata Theory.
COSC 3340: Introduction to Theory of Computation
Non Deterministic Automata
Chapter 1 Regular Language
CSE 105 theory of computation
CSE 105 theory of computation
Presentation transcript:

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 Permissions beyond the scope of this license may be available at

CLASS BUSINESS Check Moodle often! 2

DETERMINISTIC FINITE AUTOMATA DFA They have almost no memory! 3

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 M 1 is defined as a 5-tuple as follows: M 1 = (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 δ 4 NEED TO USE THIS FOR PROOFS---CANNOT MAKE GENERAL STATEMENTS BY DRAWING SPECIFIC EXAMPLES!

a) s b) s c) s δ: Q x Σ -> Q Transition Table “b’s never appear after a’s” ab q1q2q1 q2 q3 ab q1q2q1 q2q3 q2q3 ab q1 q2 q3q2 q3 5 Answer: a

a) s b) s c) s δ: Q x Σ -> Q Transition Table {w | length(w) is odd} ab q1 q2 q1q2 ab q1q2 q1 ab q2 6 Answer: b

Regular Languages Mathematical objects so far: – Character or Input symbol: a or ‘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!) 7

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…”) 8

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) a)TRUE b)FALSE 9 DFA’s are finite, but languages not necessarily

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

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

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

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

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 14 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.

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

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

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

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

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. Final form for your homework/test: Could you come up with this, and write it correctly, in a short amount of time on an exam??