Critical CS Questions

Similar documents
Computational Models - Lecture 1 1

Time Magazine (1984)

Computational Models: Class 1

Computational Models #1

Non-Deterministic Finite Automata

CHAPTER 1 Regular Languages. Contents

CPS 220 Theory of Computation REGULAR LANGUAGES

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

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

UNIT-III REGULAR LANGUAGES

What we have done so far

Introduction to Languages and Computation

Computational Models Lecture 2 1

Computational Models Lecture 2 1

Computational Models - Lecture 3

CISC 4090 Theory of Computation

Computational Models - Lecture 4

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

CS 154. Finite Automata, Nondeterminism, Regular Expressions

Theory of Languages and Automata

Nondeterministic Finite Automata

Theory of Computation (I) Yijia Chen Fudan University

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

Homework. Staff. Happy and fruitful New Year. Welcome to CS105. (Happy New Year) שנה טובה. Meeting Times.

Computer Sciences Department

Computational Models: Class 3

COM364 Automata Theory Lecture Note 2 - Nondeterminism

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

Theory of Computation (II) Yijia Chen Fudan University

Computational Models - Lecture 5 1

CS 154, Lecture 3: DFA NFA, Regular Expressions

CS 455/555: Finite automata

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

Sri vidya college of engineering and technology

Applied Computer Science II Chapter 1 : Regular Languages

Chapter Five: Nondeterministic Finite Automata

UNIT-I. Strings, Alphabets, Language and Operations

Proofs, Strings, and Finite Automata. CS154 Chris Pollett Feb 5, 2007.

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

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

Lecture 3: Nondeterministic Finite Automata

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular OctoberExpressions

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Finite Automata. Seungjin Choi

Computational Models: Class 5

Computational Models - Lecture 4 1

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

Finite Automata. BİL405 - Automata Theory and Formal Languages 1

front pad rear pad door

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

Equivalence of DFAs and NFAs

Languages, regular languages, finite automata

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

Inf2A: Converting from NFAs to DFAs and Closure Properties

Proving languages to be nonregular

Closure under the Regular Operations

Computational Models - Lecture 3 1

CS243, Logic and Computation Nondeterministic finite automata

Intro to Theory of Computation

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,

Automata: a short introduction

CSCI 2670 Introduction to Theory of Computing

Computational Models Lecture 5

Finite Automata and Regular languages

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

(Refer Slide Time: 0:21)

Decision, Computation and Language

TDDD65 Introduction to the Theory of Computation

Computational Models - Lecture 4 1

Deterministic Finite Automata (DFAs)

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F)

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

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata

CSE 105 Theory of Computation Professor Jeanne Ferrante

Deterministic Finite Automaton (DFA)

Name: Student ID: Instructions:

Final exam study sheet for CS3719 Turing machines and decidability.

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

Nondeterministic finite automata

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Büchi Automata and their closure properties. - Ajith S and Ankit Kumar

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

CS 154 Introduction to Automata and Complexity Theory

Examples of Regular Expressions. Finite Automata vs. Regular Expressions. Example of Using flex. Application

Deterministic Finite Automata (DFAs)

Course 4 Finite Automata/Finite State Machines

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

Introduction to the Theory of Computing

Deterministic Finite Automata (DFAs)

CMSC 330: Organization of Programming Languages

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs

Lecture 1: Finite State Automaton

The Pumping Lemma and Closure Properties

How do regular expressions work? CMSC 330: Organization of Programming Languages

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

Introduction to Theoretical Computer Science. Motivation. Automata = abstract computing devices

Theory of Computation Lecture 1. Dr. Nahla Belal

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Transcription:

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Critical CS Questions What is a computer? And What is a Computation? real computers too complex for any theory need manageable mathematical abstraction idealized models: accurate in some ways, but not in all details

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 2 Finite Automata formal definition of finite automata deterministic vs. non-deterministic finite automata regular languages operations on regular languages regular expressions pumping lemma

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 3 Example: A One-Way Automatic Door front pad rear pad door open when person approaches hold open until person clears don t open when someone standing behind door

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 4 The Automatic Door as DFA REAR BOTH NEITHER closed FRONT open FRONT REAR BOTH States: OPEN CLOSED NEITHER Sensor: FRONT: someone on front pad REAR: someone on rear pad BOTH: someone(s) on both pads NEITHER no one on either pad.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 5 The Automatic Door as DFA DFA is Deterministic Finite Automata REAR BOTH NEITHER closed FRONT open FRONT REAR BOTH NEITHER neither front rear both closed closed open closed closed open closed open open open

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 6 DFA: Informal Definition 0 1 1 0 q 1 q q 2 3 0,1 The machine M 1 : states: q 1,q 2, and q 3. start state: q 1 (arrow from outside ). accept state: q 2 (double circle). state transitions: arrows.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 7 DFA: Informal Definition (cont.) 0 1 1 0 q 1 q q 2 3 0,1 On an input string DFA begins in start state q 1 after reading each symbol, DFA makes state transition with matching label. After reading last symbol, DFA produces output: accept if DFA is an accepting state. reject otherwise.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 8 Informal Definition - Example 0 1 1 0 q 1 q q 2 3 0,1 What happens on input strings 1101 0010 01100

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 9 Informal Definition 0 1 1 0 q 1 q q 2 3 This DFA accepts all input strings that end with a 1 all input strings that contain at least one 1, and end with an even number of 0 s no other strings 0,1

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 10 Languages and Alphabets An alphabet Σ is a finite set of letters. Σ = {a,b,c,...,z} the English alphabet. Σ = {α,β,γ,...,ζ} the Greek alphabet. Σ = {0, 1} the binary alphabet. Σ = {0, 1,..., 9} the digital alphabet. The collection of all strings over Σ is denoted by Σ. For the binary alphabet, ε, 1, 0, 000000000, 1111111000 are all members of Σ.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 11 Languages and Examples A language over Σ is a subset L Σ. For example Modern English. Ancient Greek. All prime numbers, written using digits. A = {w w has at most seventeen 0 s}. B = {0 n 1 n n 0}. C = {w w has an equal number of 0 s and 1 s}.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 12 Languages and DFA Definition: L(M), the language of a DFA M, is the set of strings L that M accepts, L(M) = L. Note that M may accept many strings, but M accepts only one language. What language does M accept if it accepts no strings? A language is called regular if some deterministic finite automaton accepts it.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 13 Formal Definitions A deterministic finite automaton (DFA) is a 5-tuple (Q, Σ,δ,q 0,F), where Q is a finite set called the states, Σ is a finite set called the alphabet, δ : Q Σ Q is the transition function, q 0 Q is the start state, and F Q is the set of accept states.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 14 Back to M 1 0 1 1 0 q 1 q q 2 3 0,1 M 1 = (Q, Σ,δ,q 1,F) where Q = {q 1,q 2,q 3 }, Σ = {0, 1}, 0 1 the transition function δ is q 1 q 1 q 2 q 2 q 3 q 2 q 1 is the start state, and F= {q 2 }. q 3 q 2 q 2

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 15 Another Example a s b a q 1 r 1 b b a a b b q 2 r 2 a

And Yet Another Example Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 16

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 17 A Formal Model of Computation Let M = (Q, Σ,δ,q 0,F) be a DFA, and let w = w 1 w 2 w n be a string over Σ. We say that M accepts w if there is a sequence of states r 0,...,r n (r i Q) such that r 0 = q 0 δ(r i,w i+1 ) = r i+1, 0 i < n r n F

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 18 The Regular Operations Let A and B be languages. The union operation: A B = {x x A or x B} The concatenation operation: A B = {xy x A and y B} The star operation: A = {x 1 x 2...x k k 0 and each x i A}

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 19 The Regular Operations Examples Let A= {good, bad} and B = {boy, girl}. Union Concatenation A B = {good, bad, boy, girl} A B = {goodboy, goodgirl, badboy, badgirl} Star A = {ε, good, bad, goodgood, goodbad, badbad, badgood,...}

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 20 Claim: Closure Under Union If A 1 and A 2 are regular languages, so is A 1 A 2. Approach to Proof: some M 1 accepts A 1 some M 2 accepts A 2 construct M that accepts A 1 A 2. Attempted Proof Idea: first simulate M 1, and if M 1 doesn t accept, then simulate M 2. What s wrong with this? Fix: Simulate both machines simultaneously.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 21 Closure Under Union: Correct Proof Suppose M 1 = (Q 1, Σ,δ 1,q 1,F 1 ) accepts L 1, and M 2 = (Q 2, Σ,δ 2,q 2,F 2 ) accepts L 2. Define M as follows (M will accept L 1 L 2 ): Q = Q 1 Q 2. Σ is the same. For each (r 1,r 2 ) Q and a Σ, δ((r 1,r 2 ),a) = (δ 1 (r 1,a),δ 2 (r 2,a)) q 0 = (q 1,q 2 ) F = {(r 1,r 2 ) r 1 F 1 or r 2 F 2 }. (hey, why not choose F = F 1 F 2?)

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 22 What About Concatenation? Thm: If L 1, L 2 are regular languages, so is L 1 L 2. Example: L 1 = {good, bad} and L 2 = {boy, girl}. L 1 L 2 = {goodboy, goodgirl, badboy, badgirl} This is much harder to prove. Idea: Simulate M 1 for a while, then switch to M 2. Problem: But when do you switch? This leads us into non-determinism.