CS21 Decidability and Tractability

Size: px
Start display at page:

Download "CS21 Decidability and Tractability"

Transcription

1 CS21 Decidability and Tractability Lecture 2 January 5, 2018 January 5, 2018 CS21 Lecture 2 1

2 Outline Finite Automata Nondeterministic Finite Automata Closure under regular operations NFA, FA equivalence January 5, 2018 CS21 Lecture 2 2

3 Finite Automata simple model of computation reads input from left to right, one symbol at a time maintains state: information about what seen so far ( memory ) finite automaton has finite # of states: cannot remember more things for longer inputs 2 ways to describe: by diagram, or formally January 5, 2018 CS21 Lecture 2 3

4 FA diagrams (single) start state 1 0,1 alphabet Σ = {0,1} states 0 (several) accept states 0,1 transition for each symbol read input one symbol at a time; follow arrows; accept if end in accept state January 5, 2018 CS21 Lecture 2 4

5 Example FA Σ = {A,B,C} {Q,N,D} C B B B A C C A B C A rej A,B,C Try: A AC CBCC AA BBBBBBB CCBC A A,C A,B,C A B B B C C 35 cents January 5, 2018 CS21 Lecture 2 5

6 FA formal definition A finite automaton is a 5-tuple (Q, Σ, δ, q 0, F) Q is a finite set called the states Σ is a finite set called the alphabet δ:q x Σ Q is a function called the transition function q 0 is an element of Q called the start state F is a subset of Q called the accept states January 5, 2018 CS21 Lecture 2 6

7 FA formal definition even odd 1 Specification of this FA in formal terms: Q = {even, odd} Σ = {0,1} q 0 = even F = {even} function δ: δ(even, 0) = even δ(even, 1) = odd δ(odd, 0) = odd δ(odd, 1) = even January 5, 2018 CS21 Lecture 2 7

8 Formal description of FA operation finite automaton accepts a string M = (Q, Σ, δ, q 0, F) w = w 1 w 2 w 3 w n Î Σ* if $ sequence r 0,r 1,r 2,,r n of states for which r 0 = q 0 δ(r i, w i+1 ) = r i+1 for i = 0,1,2,, n-1 r n Î F January 5, 2018 CS21 Lecture 2 8

9 What now? We have a model of computation (Maybe this is it. Maybe everything we can do with real computers we can do with FA ) try to characterize the languages FAs can recognize investigate closure under certain operations show that some languages not of this type January 5, 2018 CS21 Lecture 2 9

10 Characterizing FA languages We will show that the set of languages recognized by FA is closed under: union C = (A È B) concatenation C = (A B) star C = A* Meaning: if A and B are languages recognized by a FA, then C is a language recognized by a FA January 5, 2018 CS21 Lecture 2 10

11 Characterizing FA languages union C = (A È B) (A È B) = {x : x Î A or x Î B or both} concatenation C = (A B) (A B) = {xy : x Î A and y Î B} star C = A* (note: ε always in A*) A* = {x 1 x 2 x 3 x k : k 0 and each x i Î A} January 5, 2018 CS21 Lecture 2 11

12 Concatenation attempt (A B) = {xy : x Î A and y Î B} A B What label do we put on the new transitions? January 5, 2018 CS21 Lecture 2 12

13 Concatenation attempt ε 1 1 A B = 1 1 Need it to happen for free : label with ε (?) allows construct with multiple transitions with the same label (!?) January 5, 2018 CS21 Lecture 2 13

14 Nondeterministic FA We will make life easier by describing an additional feature (nondeterminism) that helps us to program FAs We will prove that FAs with this new feature can be simulated by ordinary FA same spirit as programming constructs like procedures The concept of nondeterminism has a significant role in TCS and this course. January 5, 2018 CS21 Lecture 2 14

15 (single) start state NFA diagrams states transitions: (several) accept states may have several with a given label (or none) may be labeled with ε At each step, several choices for next state January 5, 2018 CS21 Lecture 2 15

16 NFA operation Example of NFA operation: alphabet Σ = {0,1} 1 0,ε 1 0,1 0,1 input: not accepted January 5, 2018 CS21 Lecture 2 16

17 NFA operation Example of NFA operation: alphabet Σ = {0,1} 1 0,ε 1 0,1 0,1 input: accepted January 5, 2018 CS21 Lecture 2 17

18 NFA operation One way to think of NFA operation: string x = x 1 x 2 x 3 x n accepted if and only if there exists a way of inserting ε s into x x 1 εεx 2 x 3 εx n so that there exists a path of transitions from the start state to an accept state January 5, 2018 CS21 Lecture 2 18

19 NFA formal definition transitions powerset of Q : labeled with the set of all (Q, Σ, δ, q 0 alphabet, F) subsets of Q Q is a finite set called the symbols statesor ε A nondeterministic FA is a 5-tuple Σ is a finite set called the alphabet δ:q x (Σ È {ε}) Ã(Q) is a function called the transition function q 0 is an element of Q called the start state F is a subset of Q called the accept states January 5, 2018 CS21 Lecture 2 19

20 NFA formal definition s 1 0,ε 1 1 s 2 s 3 s 4 Specification of this NFA in formal terms: Q = {s 1, s 2, s 3, s 4 } Σ = {0,1} q 0 = s 1 F = {s 4 } 0,1 0,1 δ(s 1, 0) = {s 1 } δ(s 1, 1) = {s 1, s 2 } δ(s 1, ε) = { } δ(s 2, 0) = {s 3 } δ(s 2, 1) = { } δ(s 3, 0) = { } δ(s 3, 1) = {s 4 } δ(s 3, ε) = { } δ(s 4, 0) = {s 4 } δ(s 4, 1) = {s 4 } δ(s 2, ε) = {s 3 } δ(s 4, ε) = { } January 5, 2018 CS21 Lecture 2 20

21 Formal description of NFA operation NFA M = (Q, Σ, δ, q 0, F) accepts a string w = w 1 w 2 w 3 w n Î Σ* if w can be written (by inserting ε s) as: y = y 1 y 2 y 3 y m Î (Σ È {ε})* and $ sequence r 0,r 1,,r m of states for which r 0 = q 0 r i+1 Î δ(r i, y i+1 ) for i = 0,1,2,, m-1 r m Î F January 5, 2018 CS21 Lecture 2 21

22 Closures Recall: want to show the set of languages recognized by NFA is closed under: union C = (A È B) concatenation C = (A B) star C = A* January 5, 2018 CS21 Lecture 2 22

23 Closure under union C = (A È B) = {x : x Î A or x Î B} ε A A ε B C B January 5, 2018 CS21 Lecture 2 23

24 Closure under concatenation C = (A B) = {xy : x Î A and y Î B} A B ε ε C A B January 5, 2018 CS21 Lecture 2 24

25 Closure under star C = A* = {x 1 x 2 x 3 x k : k 0 and each x i Î A} C A ε ε ε A January 5, 2018 CS21 Lecture 2 25

26 NFA, FA equivalence Theorem: a language L is recognized by a FA if and only if L is recognized by a NFA. Must prove two directions: (Þ) L is recognized by a FA implies L is recognized by a NFA. (Ü) L is recognized by a NFA implies L is recognized by a FA. (usually one is easy, the other more difficult) January 5, 2018 CS21 Lecture 2 26

27 NFA, FA equivalence (Þ) L is recognized by a FA implies L is recognized by a NFA Proof: a finite automaton is a nondeterministic finite automaton that happens to have no ε-transitions, and for which each state has exactly one outgoing transition for each symbol. January 5, 2018 CS21 Lecture 2 27

28 NFA, FA equivalence (Ü) L is recognized by a NFA implies L is recognized by a FA. Proof: we will build a FA that simulates the NFA (and thus recognizes the same language). alphabet will be the same what are the states of the FA? January 5, 2018 CS21 Lecture 2 28

29 NFA, FA equivalence 1 0,ε 1 0,1 0,1 given NFA M = (Q, Σ, δ, q 0, F) construct FA M = (Q, Σ, δ, q 0, F ) same alphabet: Σ = Σ states are subsets of M s states: Q = Ã(Q) if we are in state RÎQ and we read symbol aîσ, what is the new state? January 5, 2018 CS21 Lecture 2 29

30 NFA, FA equivalence 1 0,ε 1 0,1 0,1 given NFA M = (Q, Σ, δ, q 0, F) construct FA M = (Q, Σ, δ, q 0, F ) Helpful def n: E(S) = {q Î Q : q reachable from S by traveling along 0 or more ε-transitions} new transition fn: δ (R, a) = È rîr E(δ(r, a)) = all nodes reachable from R by following an a-transition, and then 0 or more ε-transitions January 5, 2018 CS21 Lecture 2 30

31 NFA, FA equivalence 1 0,ε 1 0,1 0,1 given NFA M = (Q, Σ, δ, q 0, F) construct FA M = (Q, Σ, δ, q 0, F ) new start state: q 0 = E({q 0 }) new accept states: F = {R Î Q : R contains an accept state of M) January 5, 2018 CS21 Lecture 2 31

32 NFA, FA equivalence We have proved (Ü) by construction. Formally we should also prove that the construction works, by induction on the number of steps of the computation. at each step, the state of the FA M is exactly the set of reachable states of the NFA M January 5, 2018 CS21 Lecture 2 32

33 So far Theorem: the set of languages recognized by NFA is closed under union, concatenation, and star. Theorem: a language L is recognized by a FA if and only if L is recognized by a NFA. Theorem: the set of languages recognized by FA is closed under union, concatenation, and star. January 5, 2018 CS21 Lecture 2 33

34 Next Describe the set of languages that can be built up from: unions concatenations star operations Called patterns or regular expressions Theorem: a language L is recognized by a FA if and only if L is described by a regular expression. January 5, 2018 CS21 Lecture 2 34

35 Regular expressions R is a regular expression if R is a, for some a Î Σ ε, the empty string Ø, the empty set (R 1 È R 2 ), where R 1 and R 2 are reg. exprs. (R 1 R 2 ), where R 1 and R 2 are reg. exprs. (R 1 *), where R 1 is a regular expression A reg. expression R describes the language L(R). January 5, 2018 CS21 Lecture 2 35

36 Regular expressions example: R = (0 È 1) if Σ = {0,1} then use Σ as shorthand for R example: R = 0 Σ* shorthand: omit R = 0Σ* precedence: *, then, then È, unless override by parentheses in example R = 0(Σ*), not R = (0Σ)* January 5, 2018 CS21 Lecture 2 36

37 Some examples {w : w has at least one 1} = Σ*1Σ* {w : w starts and ends with same symbol} = 0Σ*0 È 1Σ*1 È 0 È 1 {w : w 5} = (ε È Σ)(ε È Σ)(ε È Σ)(ε È Σ)(ε È Σ) {w : every 3 rd position of w is 1} = (1ΣΣ)*(ε È 1 È 1Σ) alphabet Σ = {0,1} January 5, 2018 CS21 Lecture 2 37

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 3 January 9, 2017 January 9, 2017 CS21 Lecture 3 1 Outline NFA, FA equivalence Regular Expressions FA and Regular Expressions January 9, 2017 CS21 Lecture 3 2

More information

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

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism, CS 54, Lecture 2: Finite Automata, Closure Properties Nondeterminism, Why so Many Models? Streaming Algorithms 0 42 Deterministic Finite Automata Anatomy of Deterministic Finite Automata transition: for

More information

CS 154. Finite Automata, Nondeterminism, Regular Expressions

CS 154. Finite Automata, Nondeterminism, Regular Expressions CS 54 Finite Automata, Nondeterminism, Regular Expressions Read string left to right The DFA accepts a string if the process ends in a double circle A DFA is a 5-tuple M = (Q, Σ, δ, q, F) Q is the set

More information

Theory of Computation (I) Yijia Chen Fudan University

Theory of Computation (I) Yijia Chen Fudan University Theory of Computation (I) Yijia Chen Fudan University Instructor Yijia Chen Homepage: http://basics.sjtu.edu.cn/~chen Email: yijiachen@fudan.edu.cn Textbook Introduction to the Theory of Computation Michael

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Not A DFA Does not have exactly one transition from every state on every symbol: Two transitions from q 0 on a No transition from q 1 (on either a or b) Though not a DFA,

More information

COM364 Automata Theory Lecture Note 2 - Nondeterminism

COM364 Automata Theory Lecture Note 2 - Nondeterminism COM364 Automata Theory Lecture Note 2 - Nondeterminism Kurtuluş Küllü March 2018 The FA we saw until now were deterministic FA (DFA) in the sense that for each state and input symbol there was exactly

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 5-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY NON-DETERMINISM and REGULAR OPERATIONS THURSDAY JAN 6 UNION THEOREM The union of two regular languages is also a regular language Regular Languages Are

More information

CS 455/555: Finite automata

CS 455/555: Finite automata CS 455/555: Finite automata Stefan D. Bruda Winter 2019 AUTOMATA (FINITE OR NOT) Generally any automaton Has a finite-state control Scans the input one symbol at a time Takes an action based on the currently

More information

Chapter Five: Nondeterministic Finite Automata

Chapter Five: Nondeterministic Finite Automata Chapter Five: Nondeterministic Finite Automata From DFA to NFA A DFA has exactly one transition from every state on every symbol in the alphabet. By relaxing this requirement we get a related but more

More information

CS 154, Lecture 3: DFA NFA, Regular Expressions

CS 154, Lecture 3: DFA NFA, Regular Expressions CS 154, Lecture 3: DFA NFA, Regular Expressions Homework 1 is coming out Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and

More information

September 7, Formal Definition of a Nondeterministic Finite Automaton

September 7, Formal Definition of a Nondeterministic Finite Automaton Formal Definition of a Nondeterministic Finite Automaton September 7, 2014 A comment first The formal definition of an NFA is similar to that of a DFA. Both have states, an alphabet, transition function,

More information

Lecture 3: Nondeterministic Finite Automata

Lecture 3: Nondeterministic Finite Automata Lecture 3: Nondeterministic Finite Automata September 5, 206 CS 00 Theory of Computation As a recap of last lecture, recall that a deterministic finite automaton (DFA) consists of (Q, Σ, δ, q 0, F ) where

More information

Theory of Computation (II) Yijia Chen Fudan University

Theory of Computation (II) Yijia Chen Fudan University Theory of Computation (II) Yijia Chen Fudan University Review A language L is a subset of strings over an alphabet Σ. Our goal is to identify those languages that can be recognized by one of the simplest

More information

Inf2A: Converting from NFAs to DFAs and Closure Properties

Inf2A: Converting from NFAs to DFAs and Closure Properties 1/43 Inf2A: Converting from NFAs to DFAs and Stuart Anderson School of Informatics University of Edinburgh October 13, 2009 Starter Questions 2/43 1 Can you devise a way of testing for any FSM M whether

More information

Finite Automata and Regular languages

Finite Automata and Regular languages Finite Automata and Regular languages Huan Long Shanghai Jiao Tong University Acknowledgements Part of the slides comes from a similar course in Fudan University given by Prof. Yijia Chen. http://basics.sjtu.edu.cn/

More information

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

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata. CMSC 330: Organization of Programming Languages Last Lecture Languages Sets of strings Operations on languages Finite Automata Regular expressions Constants Operators Precedence CMSC 330 2 Clarifications

More information

Nondeterministic finite automata

Nondeterministic finite automata Lecture 3 Nondeterministic finite automata This lecture is focused on the nondeterministic finite automata (NFA) model and its relationship to the DFA model. Nondeterminism is an important concept in the

More information

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

CS:4330 Theory of Computation Spring Regular Languages. Finite Automata and Regular Expressions. Haniel Barbosa CS:4330 Theory of Computation Spring 2018 Regular Languages Finite Automata and Regular Expressions Haniel Barbosa Readings for this lecture Chapter 1 of [Sipser 1996], 3rd edition. Sections 1.1 and 1.3.

More information

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

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r Syllabus R9 Regulation UNIT-II NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: In the automata theory, a nondeterministic finite automaton (NFA) or nondeterministic finite state machine is a finite

More information

Lecture 4 Nondeterministic Finite Accepters

Lecture 4 Nondeterministic Finite Accepters Lecture 4 Nondeterministic Finite Accepters COT 4420 Theory of Computation Section 2.2, 2.3 Nondeterminism A nondeterministic finite automaton can go to several states at once. Transitions from one state

More information

Computational Models Lecture 2 1

Computational Models Lecture 2 1 Computational Models Lecture 2 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. March 16/18, 2015 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Fooling Sets and. Lecture 5

Fooling Sets and. Lecture 5 Fooling Sets and Introduction to Nondeterministic Finite Automata Lecture 5 Proving that a language is not regular Given a language, we saw how to prove it is regular (union, intersection, concatenation,

More information

Outline. CS21 Decidability and Tractability. Regular expressions and FA. Regular expressions and FA. Regular expressions and FA

Outline. CS21 Decidability and Tractability. Regular expressions and FA. Regular expressions and FA. Regular expressions and FA Outline CS21 Decidability and Tractability Lecture 4 January 14, 2019 FA and Regular Exressions Non-regular languages: Puming Lemma Pushdown Automata Context-Free Grammars and Languages January 14, 2019

More information

Intro to Theory of Computation

Intro to Theory of Computation Intro to Theory of Computation 1/19/2016 LECTURE 3 Last time: DFAs and NFAs Operations on languages Today: Nondeterminism Equivalence of NFAs and DFAs Closure properties of regular languages Sofya Raskhodnikova

More information

CSC236 Week 11. Larry Zhang

CSC236 Week 11. Larry Zhang CSC236 Week 11 Larry Zhang 1 Announcements Next week s lecture: Final exam review This week s tutorial: Exercises with DFAs PS9 will be out later this week s. 2 Recap Last week we learned about Deterministic

More information

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,

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, Recall A deterministic finite automaton is a five-tuple where S is a finite set of states, M = (S, Σ, T, s 0, F ) Σ is an alphabet the input alphabet, T : S Σ S is the transition function, s 0 S is the

More information

Computational Models Lecture 2 1

Computational Models Lecture 2 1 Computational Models Lecture 2 1 Handout Mode Iftach Haitner. Tel Aviv University. October 30, 2017 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

Closure under the Regular Operations

Closure under the Regular Operations September 7, 2013 Application of NFA Now we use the NFA to show that collection of regular languages is closed under regular operations union, concatenation, and star Earlier we have shown this closure

More information

Theory of Languages and Automata

Theory of Languages and Automata Theory of Languages and Automata Chapter 1- Regular Languages & Finite State Automaton Sharif University of Technology Finite State Automaton We begin with the simplest model of Computation, called finite

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be

More information

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

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS Automata Theory Lecture on Discussion Course of CS2 This Lecture is about Mathematical Models of Computation. Why Should I Care? - Ways of thinking. - Theory can drive practice. - Don t be an Instrumentalist.

More information

Non-Deterministic Finite Automata

Non-Deterministic Finite Automata Slides modified Yishay Mansour on modification by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 8 Non-Deterministic Finite Automata 0,1 0,1 0 0,ε q q 1 q 2 3 1 q 4 an NFA

More information

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA)

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA) Deterministic Finite Automata Non deterministic finite automata Automata we ve been dealing with have been deterministic For every state and every alphabet symbol there is exactly one move that the machine

More information

Chap. 1.2 NonDeterministic Finite Automata (NFA)

Chap. 1.2 NonDeterministic Finite Automata (NFA) Chap. 1.2 NonDeterministic Finite Automata (NFA) DFAs: exactly 1 new state for any state & next char NFA: machine may not work same each time More than 1 transition rule for same state & input Any one

More information

Automata: a short introduction

Automata: a short introduction ILIAS, University of Luxembourg Discrete Mathematics II May 2012 What is a computer? Real computers are complicated; We abstract up to an essential model of computation; We begin with the simplest possible

More information

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

September 11, Second Part of Regular Expressions Equivalence with Finite Aut Second Part of Regular Expressions Equivalence with Finite Automata September 11, 2013 Lemma 1.60 If a language is regular then it is specified by a regular expression Proof idea: For a given regular language

More information

Outline. CS21 Decidability and Tractability. Machine view of FA. Machine view of FA. Machine view of FA. Machine view of FA.

Outline. CS21 Decidability and Tractability. Machine view of FA. Machine view of FA. Machine view of FA. Machine view of FA. Outline CS21 Decidability and Tractability Lecture 5 January 16, 219 and Languages equivalence of NPDAs and CFGs non context-free languages January 16, 219 CS21 Lecture 5 1 January 16, 219 CS21 Lecture

More information

Automata and Languages

Automata and Languages Automata and Languages Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan Nondeterministic Finite Automata with empty moves (-NFA) Definition A nondeterministic finite automaton

More information

Computational Theory

Computational Theory Computational Theory Finite Automata and Regular Languages Curtis Larsen Dixie State University Computing and Design Fall 2018 Adapted from notes by Russ Ross Adapted from notes by Harry Lewis Curtis Larsen

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Mahesh Viswanathan Introducing Nondeterminism Consider the machine shown in Figure. Like a DFA it has finitely many states and transitions labeled by symbols from an input

More information

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

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont ) CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont ) Sungjin Im University of California, Merced 2-3-214 Example II A ɛ B ɛ D F C E Example II A ɛ B ɛ D F C E NFA accepting

More information

Algorithms for NLP

Algorithms for NLP Regular Expressions Chris Dyer Algorithms for NLP 11-711 Adapted from materials from Alon Lavie Goals of Today s Lecture Understand the properties of NFAs with epsilon transitions Understand concepts and

More information

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

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 CMPSCI 250: Introduction to Computation Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 λ-nfa s to NFA s to DFA s Reviewing the Three Models and Kleene s Theorem The Subset

More information

Theory of computation: initial remarks (Chapter 11)

Theory of computation: initial remarks (Chapter 11) Theory of computation: initial remarks (Chapter 11) For many purposes, computation is elegantly modeled with simple mathematical objects: Turing machines, finite automata, pushdown automata, and such.

More information

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

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata CISC 4090: Theory of Computation Chapter Regular Languages Xiaolan Zhang, adapted from slides by Prof. Werschulz Section.: Finite Automata Fordham University Department of Computer and Information Sciences

More information

Introduction to Languages and Computation

Introduction to Languages and Computation Introduction to Languages and Computation George Voutsadakis 1 1 Mathematics and Computer Science Lake Superior State University LSSU Math 400 George Voutsadakis (LSSU) Languages and Computation July 2014

More information

Non-deterministic Finite Automata (NFAs)

Non-deterministic Finite Automata (NFAs) Algorithms & Models of Computation CS/ECE 374, Fall 27 Non-deterministic Finite Automata (NFAs) Part I NFA Introduction Lecture 4 Thursday, September 7, 27 Sariel Har-Peled (UIUC) CS374 Fall 27 / 39 Sariel

More information

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

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata : Organization of Programming Languages Theory of Regular Expressions Finite Automata Previous Course Review {s s defined} means the set of string s such that s is chosen or defined as given s A means

More information

UNIT-III REGULAR LANGUAGES

UNIT-III REGULAR LANGUAGES Syllabus R9 Regulation REGULAR EXPRESSIONS UNIT-III REGULAR LANGUAGES Regular expressions are useful for representing certain sets of strings in an algebraic fashion. In arithmetic we can use the operations

More information

Lecture 17: Language Recognition

Lecture 17: Language Recognition Lecture 17: Language Recognition Finite State Automata Deterministic and Non-Deterministic Finite Automata Regular Expressions Push-Down Automata Turing Machines Modeling Computation When attempting to

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Review of CFG, CFL, ambiguity What is the language generated by the CFG below: G 1 = ({S,T 1,T 2 }, {0,1,2}, { S

More information

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA)

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA) Languages Non deterministic finite automata with ε transitions Recall What is a language? What is a class of languages? Finite Automata Consists of A set of states (Q) A start state (q o ) A set of accepting

More information

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

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Outline Nondeterminism Regular expressions Elementary reductions http://www.cs.caltech.edu/~cs20/a October 8, 2002 1 Determistic Finite Automata A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Q is a finite

More information

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 8 January 24, 2018 Outline Turing Machines and variants multitape TMs nondeterministic TMs Church-Turing Thesis So far several models of computation finite automata

More information

Theory of Computation

Theory of Computation Theory of Computation COMP363/COMP6363 Prerequisites: COMP4 and COMP 6 (Foundations of Computing) Textbook: Introduction to Automata Theory, Languages and Computation John E. Hopcroft, Rajeev Motwani,

More information

Equivalence of DFAs and NFAs

Equivalence of DFAs and NFAs CS 172: Computability and Complexity Equivalence of DFAs and NFAs It s a tie! DFA NFA Sanjit A. Seshia EECS, UC Berkeley Acknowledgments: L.von Ahn, L. Blum, M. Blum What we ll do today Prove that DFAs

More information

TDDD65 Introduction to the Theory of Computation

TDDD65 Introduction to the Theory of Computation TDDD65 Introduction to the Theory of Computation Lecture 2 Gustav Nordh, IDA gustav.nordh@liu.se 2012-08-31 Outline - Lecture 2 Closure properties of regular languages Regular expressions Equivalence of

More information

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

How do regular expressions work? CMSC 330: Organization of Programming Languages How do regular expressions work? CMSC 330: Organization of Programming Languages Regular Expressions and Finite Automata What we ve learned What regular expressions are What they can express, and cannot

More information

CS243, Logic and Computation Nondeterministic finite automata

CS243, Logic and Computation Nondeterministic finite automata CS243, Prof. Alvarez NONDETERMINISTIC FINITE AUTOMATA (NFA) Prof. Sergio A. Alvarez http://www.cs.bc.edu/ alvarez/ Maloney Hall, room 569 alvarez@cs.bc.edu Computer Science Department voice: (67) 552-4333

More information

Nondeterminism and Epsilon Transitions

Nondeterminism and Epsilon Transitions Nondeterminism and Epsilon Transitions Mridul Aanjaneya Stanford University June 28, 22 Mridul Aanjaneya Automata Theory / 3 Challenge Problem Question Prove that any square with side length a power of

More information

Computer Sciences Department

Computer Sciences Department 1 Reference Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER 3 objectives Finite automaton Infinite automaton Formal definition State diagram Regular and Non-regular

More information

Nondeterministic Finite Automata. Nondeterminism Subset Construction

Nondeterministic Finite Automata. Nondeterminism Subset Construction Nondeterministic Finite Automata Nondeterminism Subset Construction 1 Nondeterminism A nondeterministic finite automaton has the ability to be in several states at once. Transitions from a state on an

More information

CPS 220 Theory of Computation REGULAR LANGUAGES

CPS 220 Theory of Computation REGULAR LANGUAGES CPS 22 Theory of Computation REGULAR LANGUAGES Introduction Model (def) a miniature representation of a thing; sometimes a facsimile Iraq village mockup for the Marines Scientific modelling - the process

More information

INF Introduction and Regular Languages. Daniel Lupp. 18th January University of Oslo. Department of Informatics. Universitetet i Oslo

INF Introduction and Regular Languages. Daniel Lupp. 18th January University of Oslo. Department of Informatics. Universitetet i Oslo INF28 1. Introduction and Regular Languages Daniel Lupp Universitetet i Oslo 18th January 218 Department of Informatics University of Oslo INF28 Lecture :: 18th January 1 / 33 Details on the Course consists

More information

Lecture 1: Finite State Automaton

Lecture 1: Finite State Automaton Lecture 1: Finite State Automaton Instructor: Ketan Mulmuley Scriber: Yuan Li January 6, 2015 1 Deterministic Finite Automaton Informally, a deterministic finite automaton (DFA) has finite number of s-

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 6 CHAPTER 2 FINITE AUTOMATA 2. Nondeterministic Finite Automata NFA 3. Finite Automata and Regular Expressions 4. Languages

More information

Uses of finite automata

Uses of finite automata Chapter 2 :Finite Automata 2.1 Finite Automata Automata are computational devices to solve language recognition problems. Language recognition problem is to determine whether a word belongs to a language.

More information

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

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) Definition 1 (Alphabet) A alphabet is a finite set of objects called symbols. Definition 2 (String)

More information

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

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova. Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures Tuesday 10:45 pm - 12:15 pm Instructions Tuesday 12:30

More information

Theory of computation: initial remarks (Chapter 11)

Theory of computation: initial remarks (Chapter 11) Theory of computation: initial remarks (Chapter 11) For many purposes, computation is elegantly modeled with simple mathematical objects: Turing machines, finite automata, pushdown automata, and such.

More information

CSE 105 Theory of Computation Professor Jeanne Ferrante

CSE 105 Theory of Computation  Professor Jeanne Ferrante CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Today s agenda NFA Review and Design NFA s Equivalence to DFA s Another Closure Property proof for Regular Languages

More information

CISC 4090 Theory of Computation

CISC 4090 Theory of Computation 9/2/28 Stereotypical computer CISC 49 Theory of Computation Finite state machines & Regular languages Professor Daniel Leeds dleeds@fordham.edu JMH 332 Central processing unit (CPU) performs all the instructions

More information

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

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever.  ETH Zürich (D-ITET) September, Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu ETH Zürich (D-ITET) September, 24 2015 Last week was all about Deterministic Finite Automaton We saw three main

More information

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

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties Recall a closure property is a statement

More information

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

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova. Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures and Instructions 23.10. 3.11. 17.11. 24.11. 1.12. 11.12.

More information

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata Sungjin Im University of California, Merced 1-27-215 Nondeterminism Michael Rabin and Dana Scott (1959) Michael Rabin Dana

More information

Finite Automata and Languages

Finite Automata and Languages CS62, IIT BOMBAY Finite Automata and Languages Ashutosh Trivedi Department of Computer Science and Engineering, IIT Bombay CS62: New Trends in IT: Modeling and Verification of Cyber-Physical Systems (2

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Non-determinism, Regular Expressions CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Theory of Regular Expressions DFAs and NFAs Reminders Project 1 due Sep. 24 Homework 1 posted Exam 1 on Sep. 25 Exam topics list posted Practice homework

More information

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

Finite Automata. BİL405 - Automata Theory and Formal Languages 1 Finite Automata BİL405 - Automata Theory and Formal Languages 1 Deterministic Finite Automata (DFA) A Deterministic Finite Automata (DFA) is a quintuple A = (Q,,, q 0, F) 1. Q is a finite set of states

More information

Decision, Computation and Language

Decision, Computation and Language Decision, Computation and Language Non-Deterministic Finite Automata (NFA) Dr. Muhammad S Khan (mskhan@liv.ac.uk) Ashton Building, Room G22 http://www.csc.liv.ac.uk/~khan/comp218 Finite State Automata

More information

Formal Definition of Computation. August 28, 2013

Formal Definition of Computation. August 28, 2013 August 28, 2013 Computation model The model of computation considered so far is the work performed by a finite automaton Finite automata were described informally, using state diagrams, and formally, as

More information

CS 154 Introduction to Automata and Complexity Theory

CS 154 Introduction to Automata and Complexity Theory CS 154 Introduction to Automata and Complexity Theory cs154.stanford.edu 1 INSTRUCTORS & TAs Ryan Williams Cody Murray Lera Nikolaenko Sunny Rajan 2 Textbook 3 Homework / Problem Sets Homework will be

More information

Finite Automata. Dr. Neil T. Dantam. Fall CSCI-561, Colorado School of Mines. Dantam (Mines CSCI-561) Finite Automata Fall / 35

Finite Automata. Dr. Neil T. Dantam. Fall CSCI-561, Colorado School of Mines. Dantam (Mines CSCI-561) Finite Automata Fall / 35 Finite Automata Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Finite Automata Fall 2017 1 / 35 Outline Dantam (Mines CSCI-561) Finite Automata Fall 2017 2 / 35

More information

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 BIJU PATNAIK UNIVERSITY OF TECHNOLOGY, ODISHA Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2 Prepared by, Dr. Subhendu Kumar Rath, BPUT, Odisha. UNIT 2 Structure NON-DETERMINISTIC FINITE AUTOMATA

More information

Computational Models - Lecture 1 1

Computational Models - Lecture 1 1 Computational Models - Lecture 1 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. February 29/ March 02, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames

More information

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

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs CSE : Foundations of Computing Lecture : Finite State Machine Minimization & NFAs State Minimization Many different FSMs (DFAs) for the same problem Take a given FSM and try to reduce its state set by

More information

Finite Automata (contd)

Finite Automata (contd) Finite Automata (contd) CS 2800: Discrete Structures, Fall 2014 Sid Chaudhuri Recap: Deterministic Finite Automaton A DFA is a 5-tuple M = (Q, Σ, δ, q 0, F) Q is a fnite set of states Σ is a fnite input

More information

Foundations of

Foundations of 91.304 Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (Section 1.3: Regular Expressions) David Martin dm@cs.uml.edu d with some modifications by Prof. Karen Daniels, Spring 2012

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata COMP2600 Formal Methods for Software Engineering Katya Lebedeva Australian National University Semester 2, 206 Slides by Katya Lebedeva. COMP 2600 Nondeterministic Finite

More information

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

acs-04: Regular Languages Regular Languages Andreas Karwath & Malte Helmert Informatik Theorie II (A) WS2009/10 Regular Languages Andreas Karwath & Malte Helmert 1 Overview Deterministic finite automata Regular languages Nondeterministic finite automata Closure operations Regular expressions Nonregular languages

More information

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

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is Abstraction of Problems Data: abstracted as a word in a given alphabet. Σ: alphabet, a finite, non-empty set of symbols. Σ : all the words of finite length built up using Σ: Conditions: abstracted as a

More information

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

Proofs, Strings, and Finite Automata. CS154 Chris Pollett Feb 5, 2007. Proofs, Strings, and Finite Automata CS154 Chris Pollett Feb 5, 2007. Outline Proofs and Proof Strategies Strings Finding proofs Example: For every graph G, the sum of the degrees of all the nodes in G

More information

CS 208: Automata Theory and Logic

CS 208: Automata Theory and Logic CS 28: Automata Theory and Logic b a a start A x(la(x) y(x < y) L b (y)) B b Department of Computer Science and Engineering, Indian Institute of Technology Bombay of 32 Nondeterminism Alternation 2 of

More information

3515ICT: Theory of Computation. Regular languages

3515ICT: Theory of Computation. Regular languages 3515ICT: Theory of Computation Regular languages Notation and concepts concerning alphabets, strings and languages, and identification of languages with problems (H, 1.5). Regular expressions (H, 3.1,

More information

Further discussion of Turing machines

Further discussion of Turing machines Further discussion of Turing machines In this lecture we will discuss various aspects of decidable and Turing-recognizable languages that were not mentioned in previous lectures. In particular, we will

More information

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

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2 5-25 Great Theoretical Ideas in Computer Science Lecture 4: Deterministic Finite Automaton (DFA), Part 2 January 26th, 27 Formal definition: DFA A deterministic finite automaton (DFA) M =(Q,,,q,F) M is

More information

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

Examples of Regular Expressions. Finite Automata vs. Regular Expressions. Example of Using flex. Application Examples of Regular Expressions 1. 0 10, L(0 10 ) = {w w contains exactly a single 1} 2. Σ 1Σ, L(Σ 1Σ ) = {w w contains at least one 1} 3. Σ 001Σ, L(Σ 001Σ ) = {w w contains the string 001 as a substring}

More information

Closure under the Regular Operations

Closure under the Regular Operations Closure under the Regular Operations Application of NFA Now we use the NFA to show that collection of regular languages is closed under regular operations union, concatenation, and star Earlier we have

More information

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

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen Pushdown automata Twan van Laarhoven Institute for Computing and Information Sciences Intelligent Systems Version: fall 2014 T. van Laarhoven Version: fall 2014 Formal Languages, Grammars and Automata

More information