CSE 105 THEORY OF COMPUTATION

Similar documents
CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CS 154. Finite Automata, Nondeterminism, Regular Expressions

CSE 105 THEORY OF COMPUTATION

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

CS 154, Lecture 3: DFA NFA, Regular Expressions

CSE 105 THEORY OF COMPUTATION

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages

Finite Automata Part Two

CSE 105 THEORY OF COMPUTATION

CSE 105 Theory of Computation Professor Jeanne Ferrante

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CS 455/555: Finite automata

Equivalence of DFAs and NFAs

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CSE 105 THEORY OF COMPUTATION

Closure under the Regular Operations

Intro to Theory of Computation

CSE 105 THEORY OF COMPUTATION

Unit 6. Non Regular Languages The Pumping Lemma. Reading: Sipser, chapter 1

CISC 4090 Theory of Computation

Theory of Computation (I) Yijia Chen Fudan University

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)

Sri vidya college of engineering and technology

CSE 105 THEORY OF COMPUTATION

CPS 220 Theory of Computation REGULAR LANGUAGES

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata

Languages. A language is a set of strings. String: A sequence of letters. Examples: cat, dog, house, Defined over an alphabet:

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

CSE 105 THEORY OF COMPUTATION

Deterministic Finite Automata (DFAs)

Theory of Computation Lecture 1. Dr. Nahla Belal

CSCI 2670 Introduction to Theory of Computing

CHAPTER 1 Regular Languages. Contents

CSC236 Week 10. Larry Zhang

Theory of computation: initial remarks (Chapter 11)

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Chapter Two: Finite Automata

COM364 Automata Theory Lecture Note 2 - Nondeterminism

Deterministic Finite Automata (DFAs)

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

CS 154 Introduction to Automata and Complexity Theory

Nondeterminism. September 7, Nondeterminism

Lecture 4: More on Regexps, Non-Regular Languages

CS 121, Section 2. Week of September 16, 2013

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont )

CSE 105 THEORY OF COMPUTATION

Decidability and Undecidability

Closure under the Regular Operations

Deterministic Finite Automaton (DFA)

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Properties of Regular Languages. BBM Automata Theory and Formal Languages 1

Finite Automata and Regular languages

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) September,

Deterministic Finite Automata (DFAs)

Lecture 3: Nondeterministic Finite Automata

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Inf2A: Converting from NFAs to DFAs and Closure Properties

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata.

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata

Non-deterministic Finite Automata (NFAs)

acs-04: Regular Languages Regular Languages Andreas Karwath & Malte Helmert Informatik Theorie II (A) WS2009/10

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r

CSC173 Workshop: 13 Sept. Notes

Regular Languages. Problem Characterize those Languages recognized by Finite Automata.

Nondeterministic Finite Automata and Regular Expressions

Theory of computation: initial remarks (Chapter 11)

Fooling Sets and. Lecture 5

Incorrect reasoning about RL. Equivalence of NFA, DFA. Epsilon Closure. Proving equivalence. One direction is easy:

CS:4330 Theory of Computation Spring Regular Languages. Finite Automata and Regular Expressions. Haniel Barbosa

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed

2017/08/31 Chapter 1.2 & 1.3 in Sipser Ø Announcement:

Nondeterministic Finite Automata

Nondeterministic Finite Automata

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

Chapter Five: Nondeterministic Finite Automata

September 11, Second Part of Regular Expressions Equivalence with Finite Aut

Computer Sciences Department

Harvard CS 121 and CSCI E-207 Lecture 4: NFAs vs. DFAs, Closure Properties

Theory of Languages and Automata

Deterministic Finite Automata (DFAs)

What we have done so far

Regular Expressions. Definitions Equivalence to Finite Automata

Transcription:

CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/

Today's learning goals Sipser Section 1.1 Design an automaton that recognizes a given language. Specify each of the components in a formal definition of an automaton. Prove that an automaton recognizes a specific language.

Deterministic finite automaton Sipser p. 35 Def 1.5 Can there be more than one start state in a finite automaton? A. Yes, because of line 4. B. No, because of line 4. C. I don't know

Deterministic finite automaton Sipser p. 35 Def 1.5 How many outgoing arrows from each state? A. May be different number at each state. B. Must be 2. C. Must be Q. D. Must be Σ E. I don't know.

An example Define M = is specified by its table of values: Input in Q x Σ (q1,a) (q2,a) (q3,a) (q4,a) Output in Q q3 q2 q3 q2 Input in Q x Σ (q1,b) (q2,b) (q3,b) (q4,b) where the function δ Output in Q q2 q2 q4 q4 Draw the state diagram for the DFA with this formal definition.

An example What's an example of a length 1 string accepted by this DFA? length 1 string rejected by this DFA? length 2 string accepted by this DFA? length 2 string rejected by this DFA?

An example What's the best description of the language recognized by this DFA? A. Starts with b and ends with a or b B. Starts with a and ends with a or b C. a's followed by b's D. More than one of the above E. I don't know. and using set notation?

An example This DFA recognizes the language of all strings of the form a's followed by b's i.e. { a n b k n,k 1}

An example { a n b k n,k 1} Is this the same as the language described by A. a*b* B. a(ba)*b C. a* U b* D. (aaa)* E. a(a)*b(b)*

Specifying an automaton ( {q1,q2,q3}, {a,b}, δ, q1,? ) What state(s) should be in F so that the language of this machine is { w ab is a substring of w}? A. {q2} B. {q3} C. {q1,q2} D. {q1,q3} E. I don't know.

Specifying an automaton ( {q1,q2,q3}, {a,b}, δ, q1,? ) What state(s) should be in F so that the language of this machine is { w b's never occur after a's in w}? A. {q2} B. {q3} C. {q1,q2} D. {q1,q3} E. I don't know.

Building DFA Typical questions Define a DFA which recognizes the given language L. or Prove that the (given) language L is regular.

Building DFA Example Define a DFA which recognizes { w w has at least 2 a's}

Building DFA Example Define a DFA which recognizes { w w has at most 2 a's}

Building DFA Remember States are our only (computer) memory. Design and pick states with specific roles / tasks in mind. "Have not seen any of desired pattern yet" "Trap state"

Justification? To prove that the DFA we build, M, actually recognizes the language L WTS L(M) = L (1) Is every string accepted by M in L? (2) Is every string from L accepted by M? or contrapositive version: Is every string rejected by M not in L.

A useful (optional) bit of terminology When is a string accepted by a DFA? Computation of M on w: where do we land when start at q 0 and read each symbol of w one-at-a time? δ*( q, w ) = Recursively defined function

Regular languages Sipser p. 35 Def 1.5 DFA M over the alphabet Σ For each string w over Σ, M either accepts w or rejects w The language recognized by M is the set of strings M accepts The language of M is the set of strings M accepts L(M) = { w w is a string over Σ and M accepts w} A language is regular iff there is some finite automaton that recognizes exactly it.

Regular languages: bounds? Is every finite language regular? A. No: some finite languages are regular, and some are not. B. No: there are no finite regular languages. C. Yes: every finite language is regular. D. I don't know.

Building DFA Remember States are our only (computer) memory. Design and pick states with specific roles / tasks in mind. "Have not seen any of desired pattern yet" "Trap state"

Building DFA New strategy Express L in terms of simpler languages use them as building blocks. Example L = { w w does not contain the substring baba } = the complement of the set {w w contains the substring baba}

Building DFA DFA recognizing {w w contains the substring baba} DFA recognizing {w w doesn't contain the substring baba}

Complementation Claim: If A is a regular language over {0,1} *, then so is A aka "the class of regular languages is closed under complementation"

Complementation Claim: If A is a regular language over {0,1} *, then so is A aka "the class of regular languages is closed under complementation" Proof: Let A be a regular language. Then there is a DFA M=(Q,Σ,δ,q0,F) such that L(M) = A. We want to build a DFA whose language is A. Define M' =? Claim of Correctness L(M') = A Proof of claim

Why closure proofs? General technique of proving a new language is regular Stretch the power of the model Puzzle!

Set operations Input set(s) OPERATION Output set Complementation Kleene star Concatenation Union Intersection Set difference

The regular operations Sipser Def 1.23 p. 44 For A, B languages over same alphabet, define: These are operations on sets!

Union Sipser Theorem 1.25 p. 45 Theorem: The class of regular languages over fixed alphabet Σ is closed under the union operation. Proof: What are we proving here? A. For any set A, if A is regular then so is A U A. B. For any sets A and B, if A U B is regular, then so is A. C. For two DFAs M1 and M2, M1 U M2 is regular. D. None of the above. E. I don't know.

Union Sipser Theorem 1.25 p. 45 Theorem: The class of regular languages over fixed alphabet Σ is closed under the union operation. Proof: Let A1, A2 be any two regular languages over Σ. WTS that A1 U A2 is regular. Goal: build a machine that recognizes A1 U A2.

For next time Finish Individual Homework 0 Review quiz 1 Read Individual Homework 1 due Saturday due Sunday (for credit) due Tuesday Pre class-reading for Wednesday: Theorem 1.25, Theorem 1.26