Deterministic Finite Automata (DFAs)

Size: px
Start display at page:

Download "Deterministic Finite Automata (DFAs)"

Transcription

1 Algorithms & Models of Computation CS/ECE 374, Fall 27 Deterministic Finite Automata (DFAs) Lecture 3 Tuesday, September 5, 27 Part I DFA Introduction Sariel Har-Peled (UIUC) CS374 Fall 27 / 36 Sariel Har-Peled (UIUC) CS374 2 Fall 27 2 / 36 DFAs also called Finite State Machines (FSMs) The simplest model for computers? State machines that are common in practice. Vending machines Elevators Digital watches Simple network protocols Programs with fixed memory A simple program Program to check if a given input string w has odd length int n = While input is not finished read next character c n n + endwhile If (n is odd) output YES Else output NO bit x = While input is not finished read next character c x flip(x) endwhile If (x = ) output YES Else output NO Sariel Har-Peled (UIUC) CS374 3 Fall 27 3 / 36 Sariel Har-Peled (UIUC) CS374 4 Fall 27 4 / 36

2 alphabet, is a finite set called the input alphabet, function, nal states. Another view : Q! Q is the transition function, Graphical Representation/State Machine s 2 Q is the start state, A Q is the set of accepting/final states. 3 2,,s,A), string w = w w 2 w k, where for each i, w i 2, and Definition states 5. For a DFA M =(Q,,,s,A), string w = w w 2 w k, where for each i, w i 2, and states a seuence of states r,r,...r k such that (a) r = p, (b) for p, each 2 Q, i, wesayp w! M if there is a seuence of states r,r,...r k such that (a) r = p, (b) for each i, (r i,w i+ )=r i+, and (c) r k =. p, and string w 2,thereisauniue state such that pproblem w! M. 4. Prove that for any state p, and string w 2,thereisauniue state such that p w! M. Notation. Directed graph with nodes representing states and edge/arcs M (p, w) = where p w! M representing transitions labeled by symbols in Σ Machine has input written on a read-only tape Q,,,s,A). Definition 6. Consider a DFA M =(Q,,,s,A). For each state (vertex) and symbol a Σ there is exactly one Start in specified start state (s, w) 2 A. M accepts string w 2 i outgoing edge labeled by a M (s, w) 2 A. Start at left, scan symbol, change state and move right ized by a DFA M is L(M) ={w 2 Initial/start state has a pointer (or labeled as s, or start ) Circled states are accepting M accepts w}. The language accepted/recognized by a DFA M is L(M) ={w 2 M accepts w}. d/recognized by M i L = L(M). A set L Some states with double circles labeled as accepting/final states Machine accepts input string if it is in an accepting state is said to accepted/recognized by M i L = L(M). after scanning the last symbol. Sariel Har-Peled (UIUC) CS374 5 Fall 27 5 / 36 Sariel Har-Peled (UIUC) CS374 6 Fall 27 6 / 36 Problem 5. Graphical Representation 3. Which of the following is true? B! M B A! M D D! M C A! M2 B Graphical Representation 3 2 Where does lead?? Figure : DFA M for problem 5 Which strings end up in accepting state? 2. What is the following?, M 2 (A, ) = (B,) = (C, ) = Definition Can you prove it? 3. What is L(M)? Every string w has a uniue walk that it follows from a given if we change the initial state to B? 4. What is the language recognized if we change the initial state to B? state by reading one letter of w from left to right. 2 Figure : DFA M for problem 5 A DFA M accepts a string w iff the uniue walk starting at the start state and spelling out w ends in an accepting state. Definition The language accepted (or recognized) by a DFA M is denote by L(M) and defined as: L(M) = {w M accepts w}. if we change the set of final states to be {B} (with initial state 5. A)? What is the language recognized if we change the set of final states to be {B} (with initial state A)?, Sariel Har-Peled (UIUC) CS374 7 Fall 27 7 / 36 Sariel Har-Peled (UIUC) CS374 8 Fall 27 8 / 36

3 is a finite set called the input alphabet, Warning : Q! Q is the transition function, s 2 Q is the start state, Formal Tuple Notation M accepts language L does not mean simply that A that Q is the M accepts set of accepting/final states. Definition each string in L. A deterministic finite automata (DFA) M = (Q, Σ, δ, s, A) is a Definition 5. For a DFA M =(Q,,,s,A), string w = w It means that M accepts each string in L and no others. Euivalently five tuple where w 2 w k, where for each i, w i 2, and states p, 2 Q, wesayp w! M if there is a seuence of states r,r,...r k such that (a) r = p, (b) for each i, M accepts each string in L and does not accept/rejects (r i,w i+ )=rstrings i+, and in(c) r k =. Q is a finite set whose elements are called states, Σ \ L. Σ is a finite set called the input alphabet, Problem 4. Prove that for any state p, and string w 2,thereisauniue state such that p w! M. δ : Q Σ Q is the transition function, M recognizes L is a better term but accepts is widely Notation. accepted M (p, w) = where p w! M s Q is the start state, (and recognized) (joke attributed to Lenny Pitt) Definition 6. Consider a DFA M =(Q,,,s,A). A Q is the set of accepting/final states. M accepts string w 2 i M (s, w) 2 A. Common alternate notation: for start state, F for final states. The language accepted/recognized by a DFA M is L(M) ={w 2 M accepts w}. A set L is said to accepted/recognized by M i L = L(M). Sariel Har-Peled (UIUC) CS374 9 Fall 27 9 / 36 Sariel Har-Peled (UIUC) CS374 Fall 27 / 36 DFA Notation M = Problem 5.. Which of the following is true? B! M B A! M D set of all states transition func set ofd all accept! M Cstates ( {}}{{}}{{}}{ ) Q, }{{} Σ, δ, }{{} s, A A! M2 B alphabet start state 2. What is the following? (A, ) = (B,) = (C, ) = Example 3. What is L(M)? δ s = 4. What is the language recognized if we change the initial state to B? A = { } 3 2 Q = {,,, 3 } Figure : DFA M for problem 5 Σ = {, }, 5. What is the language recognized if we change the set of final states to be {B} (with initial state A)? Sariel Har-Peled (UIUC) CS374 Fall 27 / 36 Sariel Har-Peled (UIUC) CS374 2 Fall 27 2 / 36

4 alphabet, is a finite set called the input alphabet, function, Extending the transition function to strings : Q! Q is the transition function, s 2 Q is the start state, Formal definition of language accepted by M nal states. Given DFA M = (Q, Σ, δ, s, A), δ(, a) is the Astate Q is that themset goes of accepting/final states. Definition to from on reading letter a The language L(M) accepted by a DFA M = (Q, Σ, δ, s, A) is,s,a), string w = w w 2 w k, where for each i, w i 2, and Definition states 5. For a DFA M =(Q,,,s,A), string w = w w 2 w k, where for each i, w i 2, and states a seuenceuseful of states to have r,r,...r notation k suchtothat specify (a) r the = p, uniue (b) for p, state each 2 Q, that i, wesayp M will w! reach M if there is a seuence of states r,r,...r k such that {w Σ (a) r δ = p, (b) for each i, (s, w) A}. from on reading string w (r i,w i+ )=r i+, and (c) r k =. p, and string w 2 Transition,thereisauniue function δ state : Q Σ such that pproblem Q defined! M. 4. Prove that for any state p, and string w 2 inductively as,thereisauniue state such that p w! M. follows: δ (, w) = if w = ɛ Notation. M (p, w) = where p w! M Q,,,s,A). δ (, w) = δ Definition 6. Consider a DFA M =(Q,,,s,A). (δ(, a), x) if w = ax. (s, w) 2 A. M accepts string w 2 i M (s, w) 2 A. ized by a DFA M is L(M) ={w 2 M accepts w}. d/recognized by M i L = L(M). The language accepted/recognized by a DFA M is L(M) ={w 2 M accepts w}. A set L is said to accepted/recognized by M i L = L(M). Sariel Har-Peled (UIUC) CS374 3 Fall 27 3 / 36 Sariel Har-Peled (UIUC) CS374 4 Fall 27 4 / 36 Problem 5. Example 3. Which of the following is true? B! M B A! M D D! M C A! M2 B Example continued 3 What is: δ (, ɛ) δ (, ) δ (, ) if we change the initial state to B? δ ( 4, ) 2 Figure : DFA M for problem 5 2. What is the following?, M 2 (A, ) = (B,) = (C, ) = 3. What is L(M)? 4. What is the language recognized if we change the initial state to B? 2 What is L(M) if start state is changed to? Figure : DFA M for problem 5 What is L(M) if final/accept states are set to { 2, 3 } instead of { }?, if we change the set of final states to be {B} (with initial state 5. A)? What is the language recognized if we change the set of final states to be {B} (with initial state A)? Sariel Har-Peled (UIUC) CS374 5 Fall 27 5 / 36 Sariel Har-Peled (UIUC) CS374 6 Fall 27 6 / 36

5 Advantages of formal specification Necessary for proofs Necessary to specify abstractly for class of languages Exercise: Prove by induction that for any two strings u, v, any state, δ (, uv) = δ (δ (, u), v). Part II Constructing DFAs Sariel Har-Peled (UIUC) CS374 7 Fall 27 7 / 36 Sariel Har-Peled (UIUC) CS374 8 Fall 27 8 / 36 DFAs: State = Memory How do we design a DFA M for a given language L? That is L(M) = L. DFA is a like a program that has fixed amount of memory independent of input size. The memory of a DFA is encoded in its states The state/memory must capture enough information from the input seen so far that it is sufficient for the suffix that is yet to be seen (note that DFA cannot go back) DFA Construction: Example Assume Σ = {, } L =, L = Σ, L = {ɛ}, L = {}. L = {w {, } w is divisible by 5} L = {w {, } w ends with } L = {w {, } w contains as substring} L = {w {, } w contains or as substring} L = {w w has a k positions from the end} Sariel Har-Peled (UIUC) CS374 9 Fall 27 9 / 36 Sariel Har-Peled (UIUC) CS374 2 Fall 27 2 / 36

6 DFA Construction: Example L = {Binary numbers congruent to mod 5} Example: = 7 = 2 mod 5, = = mod 5 Key observation: w mod 5 = a implies w mod 5 = 2a mod 5 and w mod 5 = (2a + ) mod 5 Part III Product Construction and Closure Properties Sariel Har-Peled (UIUC) CS374 2 Fall 27 2 / 36 Sariel Har-Peled (UIUC) CS Fall / 36 Part IV Complement Question: If M is a DFA, is there a DFA M such that L(M ) = Σ \ L(M)? That is, are languages recognized by DFAs closed under complement? 3 2, Complement Sariel Har-Peled (UIUC) CS Fall / 36 Sariel Har-Peled (UIUC) CS Fall / 36

7 Complement Complement Example... Theorem Languages accepted by DFAs are closed under complement. Just flip the state of the states! 3 2, 3 2, Proof. Let M = (Q, Σ, δ, s, A) such that L = L(M). Let M = (Q, Σ, δ, s, Q \ A). Claim: L(M ) = L. Why? δ M = δ M. Thus, for every string w, δ M (s, w) = δ M (s, w). δ M (s, w) A δ M (s, w) Q \ A. δ M (s, w) A δ M (s, w) Q \ A. Sariel Har-Peled (UIUC) CS Fall / 36 Sariel Har-Peled (UIUC) CS Fall / 36 Union and Intersection Part V Product Construction Question: Are languages accepted by DFAs closed under union? That is, given DFAs M and M 2 is there a DFA that accepts L(M ) L(M 2 )? How about intersection L(M ) L(M 2 )? Idea from programming: on input string w Simulate M on w Simulate M 2 on w If both accept than w L(M ) L(M 2 ). If at least one accepts then w L(M ) L(M 2 ). Catch: We want a single DFA M that can only read w once. Solution: Simulate M and M 2 in parallel by keeping track of states of both machines Sariel Har-Peled (UIUC) CS Fall / 36 Sariel Har-Peled (UIUC) CS Fall / 36

8 Example Example M accepts # = odd M accepts # = odd M 2 accepts # = odd M 2 accepts # = odd Cross-product machine Sariel Har-Peled (UIUC) CS Fall / 36 Sariel Har-Peled (UIUC) CS374 3 Fall 27 3 / 36 Example II Accept all binary strings of length divisible by 3 and 5 Product construction for intersection M = (Q, Σ, δ, s, A ) and M 2 = (Q, Σ, δ 2, s 2, A 2 ) 2 3 4,, 2, 3, 4,,, 2, 3, 4, Create M = (Q, Σ, δ, s, A) where Q = Q Q 2 = {(, 2 ) Q, 2 Q 2 } s = (s, s 2 ) δ : Q Σ Q where δ((, 2 ), a) = (δ (, a), δ 2 ( 2, a)) 2, 2, 2 2, 2 3, 2 4, 2 Assume all edges are labeled by,. A = A A 2 = {(, 2 ) A, 2 A 2 } Theorem L(M) = L(M ) L(M 2 ). Sariel Har-Peled (UIUC) CS374 3 Fall 27 3 / 36 Sariel Har-Peled (UIUC) CS Fall / 36

9 Correctness of construction Lemma For each string w, δ (s, w) = (δ (s, w), δ 2 (s 2, w)). Exercise: Assuming lemma prove the theorem in previous slide. Proof of lemma by induction on w Product construction for union M = (Q, Σ, δ, s, A ) and M 2 = (Q, Σ, δ 2, s 2, A 2 ) Create M = (Q, Σ, δ, s, A) where Q = Q Q 2 = {(, 2 ) Q, 2 Q 2 } s = (s, s 2 ) δ : Q Σ Q where δ((, 2 ), a) = (δ (, a), δ 2 ( 2, a)) A = {(, 2 ) A or 2 A 2 } Theorem L(M) = L(M ) L(M 2 ). Sariel Har-Peled (UIUC) CS Fall / 36 Sariel Har-Peled (UIUC) CS Fall / 36 Set Difference Things to know: 2-way DFA Theorem M, M 2 DFAs. There is a DFA M such that L(M) = L(M ) \ L(M 2 ). Exercise: Prove the above using two methods. Using a direct product construction Using closure under complement and intersection and union Sariel Har-Peled (UIUC) CS Fall / 36 Question: Why are DFAs reuired to only move right? Can we allow DFA to scan back and forth? Caveat: Tape is read-only so only memory is in machine s state. Can define a formal notion of a 2-way DFA Can show that any language recognized by a 2-way DFA can be recognized by a regular (-way) DFA Proof is tricky simulation via NFAs Sariel Har-Peled (UIUC) CS Fall / 36

Deterministic Finite Automata (DFAs)

Deterministic Finite Automata (DFAs) Algorithms & Models of Computation CS/ECE 374, Fall 27 Deterministic Finite Automata (DFAs) Lecture 3 Tuesday, September 5, 27 Sariel Har-Peled (UIUC) CS374 Fall 27 / 36 Part I DFA Introduction Sariel

More information

Deterministic Finite Automata (DFAs)

Deterministic Finite Automata (DFAs) Algorithms & Models of Computation CS/ECE 374, Spring 29 Deterministic Finite Automata (DFAs) Lecture 3 Tuesday, January 22, 29 L A TEXed: December 27, 28 8:25 Chan, Har-Peled, Hassanieh (UIUC) CS374 Spring

More information

Deterministic Finite Automata (DFAs)

Deterministic Finite Automata (DFAs) CS/ECE 374: Algorithms & Models of Computation, Fall 28 Deterministic Finite Automata (DFAs) Lecture 3 September 4, 28 Chandra Chekuri (UIUC) CS/ECE 374 Fall 28 / 33 Part I DFA Introduction Chandra Chekuri

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

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

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

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata.

Let us first give some intuitive idea about a state of a system and state transitions before describing finite automata. Finite Automata Automata (singular: automation) are a particularly simple, but useful, model of computation. They were initially proposed as a simple model for the behavior of neurons. The concept of a

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

CHAPTER 1 Regular Languages. Contents

CHAPTER 1 Regular Languages. Contents Finite Automata (FA or DFA) CHAPTER Regular Languages Contents definitions, examples, designing, regular operations Non-deterministic Finite Automata (NFA) definitions, euivalence of NFAs and DFAs, closure

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

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

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

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM) Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM) 1 Deterministic Turing Machine (DTM).. B B 0 1 1 0 0 B B.. Finite Control Two-way, infinite tape, broken into

More information

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

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT. Recap DFA,NFA, DTM Slides by Prof. Debasis Mitra, FIT. 1 Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { {, } } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite

More information

Sri vidya college of engineering and technology

Sri vidya college of engineering and technology Unit I FINITE AUTOMATA 1. Define hypothesis. The formal proof can be using deductive proof and inductive proof. The deductive proof consists of sequence of statements given with logical reasoning in order

More information

Finite Automata. Mahesh Viswanathan

Finite Automata. Mahesh Viswanathan Finite Automata Mahesh Viswanathan In this lecture, we will consider different models of finite state machines and study their relative power. These notes assume that the reader is familiar with DFAs,

More information

CSE 311 Lecture 23: Finite State Machines. Emina Torlak and Kevin Zatloukal

CSE 311 Lecture 23: Finite State Machines. Emina Torlak and Kevin Zatloukal CSE 3 Lecture 3: Finite State Machines Emina Torlak and Kevin Zatloukal Topics Finite state machines (FSMs) Definition and examples. Finite state machines with output Definition and examples. Finite state

More information

Chapter 5. Finite Automata

Chapter 5. Finite Automata Chapter 5 Finite Automata 5.1 Finite State Automata Capable of recognizing numerous symbol patterns, the class of regular languages Suitable for pattern-recognition type applications, such as the lexical

More information

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

CS 154. Finite Automata vs Regular Expressions, Non-Regular Languages CS 154 Finite Automata vs Regular Expressions, Non-Regular Languages Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and guessing

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

Finite Automata. Finite Automata

Finite Automata. Finite Automata Finite Automata Finite Automata Formal Specification of Languages Generators Grammars Context-free Regular Regular Expressions Recognizers Parsers, Push-down Automata Context Free Grammar Finite State

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

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

Introduction to Turing Machines. Reading: Chapters 8 & 9

Introduction to Turing Machines. Reading: Chapters 8 & 9 Introduction to Turing Machines Reading: Chapters 8 & 9 1 Turing Machines (TM) Generalize the class of CFLs: Recursively Enumerable Languages Recursive Languages Context-Free Languages Regular Languages

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

FINITE STATE AUTOMATA

FINITE STATE AUTOMATA FINITE STATE AUTOMATA States An FSA has a finite set of states A system has a limited number of configurations Examples {On, Off}, {1,2,3,4,,k} {TV channels} States can be graphically represented as follows:

More information

Griffith University 3130CIT Theory of Computation (Based on slides by Harald Søndergaard of The University of Melbourne) Turing Machines 9-0

Griffith University 3130CIT Theory of Computation (Based on slides by Harald Søndergaard of The University of Melbourne) Turing Machines 9-0 Griffith University 3130CIT Theory of Computation (Based on slides by Harald Søndergaard of The University of Melbourne) Turing Machines 9-0 Turing Machines Now for a machine model of much greater power.

More information

1 More finite deterministic automata

1 More finite deterministic automata CS 125 Section #6 Finite automata October 18, 2016 1 More finite deterministic automata Exercise. Consider the following game with two players: Repeatedly flip a coin. On heads, player 1 gets a point.

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION 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

More information

Computational Models #1

Computational Models #1 Computational Models #1 Handout Mode Nachum Dershowitz & Yishay Mansour March 13-15, 2017 Nachum Dershowitz & Yishay Mansour Computational Models #1 March 13-15, 2017 1 / 41 Lecture Outline I Motivation

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

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

Context Free Languages and Grammars

Context Free Languages and Grammars Algorithms & Models of Computation CS/ECE 374, Fall 2017 Context Free Languages and Grammars Lecture 7 Tuesday, September 19, 2017 Sariel Har-Peled (UIUC) CS374 1 Fall 2017 1 / 36 What stack got to do

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

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

Automata and Computability. Solutions to Exercises

Automata and Computability. Solutions to Exercises Automata and Computability Solutions to Exercises Fall 28 Alexis Maciel Department of Computer Science Clarkson University Copyright c 28 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

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

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

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

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 5 CHAPTER 2 FINITE AUTOMATA 1. Deterministic Finite Automata DFA 2. Nondeterministic Finite Automata NDFA 3. Finite Automata

More information

Theory of Computation

Theory of Computation Thomas Zeugmann Hokkaido University Laboratory for Algorithmics http://www-alg.ist.hokudai.ac.jp/ thomas/toc/ Lecture 3: Finite State Automata Motivation In the previous lecture we learned how to formalize

More information

(Refer Slide Time: 0:21)

(Refer Slide Time: 0:21) Theory of Computation Prof. Somenath Biswas Department of Computer Science and Engineering Indian Institute of Technology Kanpur Lecture 7 A generalisation of pumping lemma, Non-deterministic finite automata

More information

Deterministic Finite Automaton (DFA)

Deterministic Finite Automaton (DFA) 1 Lecture Overview Deterministic Finite Automata (DFA) o accepting a string o defining a language Nondeterministic Finite Automata (NFA) o converting to DFA (subset construction) o constructed from a regular

More information

Finite-State Machines (Automata) lecture 12

Finite-State Machines (Automata) lecture 12 Finite-State Machines (Automata) lecture 12 cl a simple form of computation used widely one way to find patterns 1 A current D B A B C D B C D A C next 2 Application Fields Industry real-time control,

More information

Automata and Computability. Solutions to Exercises

Automata and Computability. Solutions to Exercises Automata and Computability Solutions to Exercises Spring 27 Alexis Maciel Department of Computer Science Clarkson University Copyright c 27 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

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

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS 1. [6 POINTS] For language L 1 = {0 n 1 m n, m 1, m n}, which string is in L 1? ANSWER: 0001111 is in L 1 (with n =

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

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

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

Course 4 Finite Automata/Finite State Machines

Course 4 Finite Automata/Finite State Machines Course 4 Finite Automata/Finite State Machines The structure and the content of the lecture is based on (1) http://www.eecs.wsu.edu/~ananth/cpts317/lectures/index.htm, (2) W. Schreiner Computability and

More information

CS 322 D: Formal languages and automata theory

CS 322 D: Formal languages and automata theory CS 322 D: Formal languages and automata theory Tutorial NFA DFA Regular Expression T. Najla Arfawi 2 nd Term - 26 Finite Automata Finite Automata. Q - States 2. S - Alphabets 3. d - Transitions 4. q -

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

Theory of Computation Lecture 1. Dr. Nahla Belal

Theory of Computation Lecture 1. Dr. Nahla Belal Theory of Computation Lecture 1 Dr. Nahla Belal Book The primary textbook is: Introduction to the Theory of Computation by Michael Sipser. Grading 10%: Weekly Homework. 30%: Two quizzes and one exam. 20%:

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

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

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

Büchi Automata and their closure properties. - Ajith S and Ankit Kumar Büchi Automata and their closure properties - Ajith S and Ankit Kumar Motivation Conventional programs accept input, compute, output result, then terminate Reactive program : not expected to terminate

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION FORMAL LANGUAGES, AUTOMATA AND COMPUTATION DECIDABILITY ( LECTURE 15) SLIDES FOR 15-453 SPRING 2011 1 / 34 TURING MACHINES-SYNOPSIS The most general model of computation Computations of a TM are described

More information

Languages, regular languages, finite automata

Languages, regular languages, finite automata Notes on Computer Theory Last updated: January, 2018 Languages, regular languages, finite automata Content largely taken from Richards [1] and Sipser [2] 1 Languages An alphabet is a finite set of characters,

More information

Finite Automata. Seungjin Choi

Finite Automata. Seungjin Choi Finite Automata Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr 1 / 28 Outline

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

Computational Models: Class 1

Computational Models: Class 1 Computational Models: Class 1 Benny Chor School of Computer Science Tel Aviv University October 19, 2015 Based on slides by Maurice Herlihy, Brown University, and modifications by Iftach Haitner and Yishay

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

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

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

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

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

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

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

NFA and regex. the Boolean algebra of languages. regular expressions. Informatics 1 School of Informatics, University of Edinburgh

NFA and regex. the Boolean algebra of languages. regular expressions. Informatics 1 School of Informatics, University of Edinburgh NFA and regex cl the Boolean algebra of languages regular expressions Informatics The intersection of two regular languages is regular L = even numbers L = odd numbers L = mod L = mod Informatics The intersection

More information

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I Internal Examination 2017-18 B.Tech III Year VI Semester Sub: Theory of Computation (6CS3A) Time: 1 Hour 30 min. Max Marks: 40 Note: Attempt all three

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. Wen-Guey Tzeng Computer Science Department National Chiao Tung University

Finite Automata. Wen-Guey Tzeng Computer Science Department National Chiao Tung University Finite Automata Wen-Guey Tzeng Computer Science Department National Chiao Tung University Syllabus Deterministic finite acceptor Nondeterministic finite acceptor Equivalence of DFA and NFA Reduction of

More information

Critical CS Questions

Critical CS Questions 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

More information

CS4026 Formal Models of Computation

CS4026 Formal Models of Computation CS4026 Formal Models of Computation Turing Machines Turing Machines Abstract but accurate model of computers Proposed by Alan Turing in 1936 There weren t computers back then! Turing s motivation: find

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

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

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

Lecture 3: Finite Automata

Lecture 3: Finite Automata Administrivia Lecture 3: Finite Automata Everyone should now be registered electronically using the link on our webpage. If you haven t, do so today! I d like to have teams formed by next Monday at the

More information

CS 581: Introduction to the Theory of Computation! Lecture 1!

CS 581: Introduction to the Theory of Computation! Lecture 1! CS 581: Introduction to the Theory of Computation! Lecture 1! James Hook! Portland State University! hook@cs.pdx.edu! http://www.cs.pdx.edu/~hook/cs581f10/! Welcome!! Contact Information! Jim Hook! Office:

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

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

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

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

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

CS 154 Formal Languages and Computability Assignment #2 Solutions

CS 154 Formal Languages and Computability Assignment #2 Solutions CS 154 Formal Languages and Computability Assignment #2 Solutions Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak www.cs.sjsu.edu/~mak Assignment #2: Question 1

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Lecture 5 Reductions Undecidable problems from language theory Linear bounded automata given by Jiri Srba Lecture 5 Computability and Complexity 1/14 Reduction Informal Definition

More information

CMP 309: Automata Theory, Computability and Formal Languages. Adapted from the work of Andrej Bogdanov

CMP 309: Automata Theory, Computability and Formal Languages. Adapted from the work of Andrej Bogdanov CMP 309: Automata Theory, Computability and Formal Languages Adapted from the work of Andrej Bogdanov Course outline Introduction to Automata Theory Finite Automata Deterministic Finite state automata

More information

Finite-state machines (FSMs)

Finite-state machines (FSMs) Finite-state machines (FSMs) Dr. C. Constantinides Department of Computer Science and Software Engineering Concordia University Montreal, Canada January 10, 2017 1/19 Finite-state machines (FSMs) and state

More information

CSC173 Workshop: 13 Sept. Notes

CSC173 Workshop: 13 Sept. Notes CSC173 Workshop: 13 Sept. Notes Frank Ferraro Department of Computer Science University of Rochester September 14, 2010 1 Regular Languages and Equivalent Forms A language can be thought of a set L of

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

CpSc 421 Homework 1 Solutions

CpSc 421 Homework 1 Solutions CpSc 421 Homework 1 Solutions 1. (15 points) Let Σ = {a, b, c}. Figure 7 depicts two finite state machines that read Let L a and L b denote the languages recognized by DFA (a) and DFA (b) respectively.

More information

Computation Theory Finite Automata

Computation Theory Finite Automata Computation Theory Dept. of Computing ITT Dublin October 14, 2010 Computation Theory I 1 We would like a model that captures the general nature of computation Consider two simple problems: 2 Design a program

More information

Finite Automata. Warren McCulloch ( ) and Walter Pitts ( )

Finite Automata. Warren McCulloch ( ) and Walter Pitts ( ) 2 C H A P T E R Finite Automata Warren McCulloch (898 968) and Walter Pitts (923 969) Warren S. McCulloch was an American psychiatrist and neurophysiologist who co-founded Cybernetics. His greatest contributions

More information

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine) CS537 Theory of Computation Lecture : Computability Theory I (Turing Machine) Objectives Introduce the Turing Machine (TM) Proposed by Alan Turing in 936 finite-state control + infinitely long tape A stronger

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

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

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

CS 121, Section 2. Week of September 16, 2013 CS 121, Section 2 Week of September 16, 2013 1 Concept Review 1.1 Overview In the past weeks, we have examined the finite automaton, a simple computational model with limited memory. We proved that DFAs,

More information