Last time: introduced our first computational model the DFA.

Similar documents
FSA. CmSc 365 Theory of Computation. Finite State Automata and Regular Expressions (Chapter 2, Section 2.3) ALPHABET operations: U, concatenation, *

CSE303 - Introduction to the Theory of Computing Sample Solutions for Exercises on Finite Automata

DFA (Deterministic Finite Automata) q a

Notes on Finite Automata Department of Computer Science Professor Goldberg Textbooks: Introduction to the Theory of Computation by Michael Sipser

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Non-deterministic Finite Automata

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Theory of Computation Regular Languages

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Finite-State Automata: Recap

Non-deterministic Finite Automata

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

Let's start with an example:

NFAs continued, Closure Properties of Regular Languages

Formal Languages and Automata

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1 Nondeterministic Finite Automata

Fundamentals of Computer Science

Lecture 08: Feb. 08, 2019

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

More on automata. Michael George. March 24 April 7, 2014

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

1 Introduction to Modulo 7 Arithmetic

Designing finite automata II

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

1 Finite Automata and Regular Expressions

Non-Deterministic Finite Automata

Deterministic Finite Automata

Finite Automata. d: Q S Q. Finite automaton is M=(Q, S, d, q 0, F) Ex: an FA that accepts all odd-length strings of zeros: q 0 q 1. q i. q k.

Lecture 09: Myhill-Nerode Theorem

COMP108 Algorithmic Foundations

Nondeterminism and Nodeterministic Automata

NFAs continued, Closure Properties of Regular Languages

a b c cat CAT A B C Aa Bb Cc cat cat Lesson 1 (Part 1) Verbal lesson: Capital Letters Make The Same Sound Lesson 1 (Part 1) continued...

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

CHAPTER 1 Regular Languages. Contents

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

Convert the NFA into DFA

Minimal DFA. minimal DFA for L starting from any other

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Winter 2016 COMP-250: Introduction to Computer Science. Lecture 23, April 5, 2016

More Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations

CISC 4090 Theory of Computation

Section 3: Antiderivatives of Formulas

INTEGRALS. Chapter 7. d dx. 7.1 Overview Let d dx F (x) = f (x). Then, we write f ( x)

Finite Automata-cont d

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

Homework 3 Solutions

1 From NFA to regular expression

In-depth introduction to main models, concepts of theory of computation:

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Lecture 11 Waves in Periodic Potentials Today: Questions you should be able to address after today s lecture:

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

Ch 1.2: Solutions of Some Differential Equations

Formal Language and Automata Theory (CS21004)

Worked out examples Finite Automata

Lecture 6 Regular Grammars

CS 361 Meeting 12 10/3/18

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs.

Formal languages, automata, and theory of computation

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

CSC Design and Analysis of Algorithms. Example: Change-Making Problem

CS S-12 Turing Machine Modifications 1. When we added a stack to NFA to get a PDA, we increased computational power

CS 573 Automata Theory and Formal Languages

Math 61 : Discrete Structures Final Exam Instructor: Ciprian Manolescu. You have 180 minutes.

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

Chapter 10. The singular integral Introducing S(n) and J(n)

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

Integration Continued. Integration by Parts Solving Definite Integrals: Area Under a Curve Improper Integrals

Walk Like a Mathematician Learning Task:

Garnir Polynomial and their Properties

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Chapter 2 Finite Automata

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Java II Finite Automata I

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016

# 1 ' 10 ' 100. Decimal point = 4 hundred. = 6 tens (or sixty) = 5 ones (or five) = 2 tenths. = 7 hundredths.

Lexical Analysis Finite Automate

Graphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari

CMSC 330: Organization of Programming Languages

Introduction to ω-autamata

CS September 2018

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Enforcement of Opacity Security Properties Using Insertion Functions

Present state Next state Q + M N

Coalgebra, Lecture 15: Equations for Deterministic Automata

b. How many ternary words of length 23 with eight 0 s, nine 1 s and six 2 s?

E 1 (n) = E 0 (n-1) E 0 (n) = E 0 (n-1)+e 0 (n-2) T(n -1)=2E 0 (n-2) + E 0 (n-3)

The Course covers: Lexical Analysis Syntax Analysis Semantic Analysis Runtime environments Code Generation Code Optimization. CS 540 Spring 2013 GMU 2

The Matrix Exponential

Transcription:

Lctur 7 Homwork #7: 2.2.1, 2.2.2, 2.2.3 (hnd in c nd d), Misc: Givn: M, NFA Prov: (q,xy) * (p,y) iff (q,x) * (p,) (follow proof don in clss tody) Lst tim: introducd our first computtionl modl th DFA. Tody w'll xpnd on th DFA modl. This xpnsion will not incrs th powr of th modl, ut will incrs th xprssivnss of th modl. Wht r w dding? Nondtrminism - i.., whn in givn stt, might l to slct from svrl trnsitions for givn input symol. For xmpl. ()* ()* Not: if thr is no trnsition spcifid for prticulr symol out of stt, th impliction is tht th trnsition would to "dd stt". Also Not: ccptnc is dfind s follows - string w Σ* is ccptd y NFA iff thr is som wy to gt to finl stt from th strt stt. Why introduc nondtrminism?

1) quivlnt to DFA 2) ut provids dditionl rprsnttionl flxiility And w'll llow vn mor flxiility in NFAs: 1) -trnsitions 2) trnsitions on strings rthr thn on symols An xmpl. Exrcis. Giv n NFA to rcogniz rls (rcll xrcis for DFAs). Df. A nondtrministic finit utomton (NFA or NDFA) is quintupl M = (K, Σ, Δ, s, F), whr K is finit st of stts Σ is n lpht s K is th strt stt F K is th st of finl stts Δ is th trnsition rltion, finit sust of K x Σ* x K (q,u,p) Δ iff u Σ* nd q u p W'll lrgly l to us th sm nottion nd dfinitions s for, ut w nd to mk fw modifictions: is "yilds in on stp"

(q,w) (q 1,w 1 ) iff w = uw 1 nd (q,u,q 1 ) Δ. * is th rflxiv, trnsitiv closur of w Σ* is ccptd iff (s,w) * (q,) nd q F. Not: tht th stt t ny point is dtrmind y wht's n rd - you cn't look hd. And thr is only limitd mmory of wht's n rd (just lik DFA). Lmm. Lt M = (K, Σ, Δ, s, F) NFA; q, r K x, y Σ* Thn (q, xy) * (r,) if, for som p K (q,x) * (p,) nd (p,y) * (r,). W will prov this y induction on th lngth of * in (q,x) * (p,), i.., on th numr of stps in th computtion. Bsis. Lt (q,x) * (p,) in 0 stps. Thn q = p, nd x =. So (q, xy) = (p, y) = (p,y) * (r,) Induction Stp. Assum (q,x) * (p,) nd (p,y) * (r,) (q, xy) * (r,), whn (q,x) * (p,) in < n stps. Now considr (q,x) * (p,) nd (p,y) * (r,), whr (q,x) * (p,) in n stps. Thn (q,x) = (q,ux 1 ) (q 1,x 1 ) * (p,), whr x = ux 1 (q,u,q 1 ) Δ (q 1, x 1 ) * (p,) in (n-1) stps

But thn (q 1,x 1 y) * (r,), y th induction hypothsis. So (q,xy) = (q,ux 1 y) (q 1,x 1 y) * (r,). Not tht th following is strongr vrsion tht holds for DFAs: Givn (p,y) * (r,) (q,xy) * (r,) iff (q,x) * (p,). Now, lt's show tht NFAs = DFAs. W'll sy tht two finit utomt M1 nd M2 r quivlnt iff L(M1) = L(M2). Thm. For ch NFA, thr is n quivlnt DFA. Proof will procd y construction. Tht is, w will show how to turn n NFA into DFA. To do this, w nd to: (1) limint trnsitions on. (2) limint trnsitions on strings of lngth > 1. (3) dd trnsitions to hv ctions for ll symols in givn stt. (4) limint multipl trnsitions from 1 stt. (2) is sy - just "strtch" th NFA y dding stts. Exmpl., q0 q1 q4 q2 q3

coms, p q0 q1 q4 q2 q3 (of cours, w'd nd to prov tht th "strtchd" NFA is quiv to th originl, ut it's firly ovious) Bsiclly, if (q,u,q 1 ) Δ, nd u > 1, thn w cn writ u = u1u2...un. To "strtch" th NFA, w dd trnsitions to Δ: (q,u1,p1), (p1,u2,p2),..., (pn-1,un,q 1 ). Lt's cll th initil NFA M = (K, Σ, Δ, s, F), nd th strtchd NFA M 1 = (K 1, Σ, Δ 1, s 1, F 1 ). Now, for th rmindr of th proof: W will viw th NFA s follows: t ny point in tim, it cn in mny stts t onc. Exmpl cont'd. On input, it cn in ny of {q0, q1, q2, q4} W cn viw this s singl stt in DFA. Th id is tht w'r uilding "multi-stts". Now, wht r susqunt stts? Anything tht cn rchd from on of ths on givn input symol. So, if th nxt symol wr "": {q0, q1, p, q3} Bsiclly, th DFA is simulting ll movs of th NFA simultnously.

Now, for w formliz this, lt's look t trnsitions on - ths nd to considrd spcilly. Dfin th stts tht r rchl from stt q on no input: E(q) = {p K 1 : (q,) * (p,)} or E(q) = {p K 1 : (q,w) * (p,w)} In our Exmpl. E(q0) = {q0, q1} E(q1) = {q1} E(q2) = {q2} E(q3) = {q3, q4} E(q4) = {q4} E(p) = {p} Bfor giving th forml construction, lt s tk ths ids nd complt th construction of DFA from th NFA ov: S" = {q0, q1} δ"(s", ) = E(q0) E(p) = {q0, q1, p} = t1 δ"(s", ) = E(q0) E(q2) = {q0, q1, q2} = t2 δ"(t1, ) = E(q0) E(p) = {q0, q1, p} = t1 δ"(t1, ) = E(q0) E(q2) E(q4)= {q0, q1, q2, q4} = t3 (FINAL STATE) δ"(t2, ) = E(q0) E(p) E(q3) = {q0, q1, p, q3, q4} = t4 (FINAL) δ"(t2, ) = E(q0) E(q2) = {q0, q1, q2} = t2 δ"(t3, ) = E(q0) E(p) E(q3) = {q0, q1, p, q3, q4} = t4 δ"(t3, ) = E(q0) E(q2) = {q0, q1, q2} = t2 δ"(t4, ) = E(q0) E(p) E(q3) = {q0, q1, p, q3, q4} = t4 δ"(t4, ) = E(q0) E(q2) E(q4) = {q0, q1, q2, q4} = t3

t1 t3 t2 t4