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

Size: px
Start display at page:

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

Transcription

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

2 Outline Dantam (Mines CSCI-561) Finite Automata Fall / 35

3 Languages Review Outline Dantam (Mines CSCI-561) Finite Automata Fall / 35

4 Languages Review Alphabets Symbol: An abstract, primitive, atomic thing Examples: a, x, 4, θ, ℵ,!, Set: An unordered collection, without repetition Alphabet: A non-empty, finite set of symbols Σ B = {0, 1} Σ E = {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z} Σ C = {,,, } Dantam (Mines CSCI-561) Finite Automata Fall / 35

5 Languages Review String Sequence: An ordered list of objects Example: (1, 2, 3, 5, 8,...) Abbreviated Notation: Empty (zero-length) sequence: ɛ String: A sequence over some alphabet Γ B = Γ E = hello Γ C = Dantam (Mines CSCI-561) Finite Automata Fall / 35

6 Languages Review Languages Language: A set of strings Examples: Alternations of 0 and 1: {ɛ, 01, 10, 0101, 1010, , ,...} 0s and 1s with no consecutive 1s: {ɛ, 0, 1, 00, 01, 10, 000, 001, 010, 100, 101, 0000, 0001, 0010, 0100, 0101,...} Dantam (Mines CSCI-561) Finite Automata Fall / 35

7 Traffic Light Example Outline Dantam (Mines CSCI-561) Finite Automata Fall / 35

8 Traffic Light Example Traffic Light Example State: NS = {red, yellow, green} EW = {red, yellow, green} timeout = {0, 1} Sensors: Q = {timeout, ns-car, ew-car} gr timeout grt ew-car yr timeout timeout rg timeout rgt ns-car ry Dantam (Mines CSCI-561) Finite Automata Fall / 35

9 Traffic Light Example Traffic Light w/ Pedestrian Example State: NS = {red, yellow, green}, EW = {red, yellow, green}, timeout = {0, 1}, pedestrian = {0, 1} Sensors: Q = {timeout, ns-car, ew-car, pedestrian} timeout ry ns-car ew-car gr timeout grt ew-car pedestrian yr timeout yrp rg timeout rgt timeout pedestrian ryp timeout rrp timeout rrpt ns-car More: Left-turn arrows Railroad crossings Synchronize with other lights Dantam (Mines CSCI-561) Finite Automata Fall / 35

10 Traffic Light Example Transition Table gr timeout grt ew-car yr timeout timeout rg timeout rgt ns-car state timeout ns-car ew-car gr grt grt yr yr rg rg rgt rgt ry ry gr ry / SWITCH CASE / e v e n t = n e x t e v e n t ( ) ; switch ( s t a t e ) { case GR: switch ( e v e n t ) { case TIMEOUT: s t a t e = GRT; break ; d e f a u l t : s t a t e = DEAD; } /... / } / LOOKUP TABLE / e v e n t = n e x t e v e n t ( ) ; s t a t e = t a b l e [ s t a t e ] [ e v e n t ] ; Dantam (Mines CSCI-561) Finite Automata Fall / 35

11 Deterministic Finite Automata Outline Dantam (Mines CSCI-561) Finite Automata Fall / 35

12 Deterministic Finite Automata Deterministic Finite Automata (DFA) A deterministic finite automaton is a 5-tuple: M = (Q, Σ, δ, q 0, F ), where Q is a finite set call the states Σ is a finite set call the alphabet δ : Q Σ Q is the transition function q0 Q is the start state F Q is the set of accept states Dantam (Mines CSCI-561) Finite Automata Fall / 35

13 Deterministic Finite Automata Conceptual DFA Operation tape M : Σ {accept, reject} σ = σ 0 } σ 1... {{ σ k 1 } history σ k σ k+1 }... {{ σ n } future Finite Control Q {accept, reject} accept Reach end of tape (string) with control in accept state q F reject Reach end of tape (string) with control not in accept state q F language The language of M is the set of strings accepted by M, L (M) = {x M(x) = accept} Dantam (Mines CSCI-561) Finite Automata Fall / 35

14 Deterministic Finite Automata Graphical DFA L (M) = {x {0, 1} x ends in 1} states Q Graph Nodes alphabet Σ Graph Edge Labels transition function δ Graph Edges start state q 0 Designed graph node accept states F Double-circled graph nodes start start q 0 q 1 0 state 0 1 F q 0 q 0 q 1 0 q 1 q 0 q 1 1 Dantam (Mines CSCI-561) Finite Automata Fall / 35

15 Deterministic Finite Automata Example: FA Design q even q odd L (M) = {w {0, 1} the number of 1s is odd} What state do we need to track? What are the state transitions? What are the start and accept states? q even 1 q odd 0 0 start 1 q even 1 q odd Dantam (Mines CSCI-561) Finite Automata Fall / 35

16 Deterministic Finite Automata Example: FA Design continued q even q odd 0 0 q even 1 1 q odd state 0 1 F q even q even q odd 0 q odd q odd q even start 1 q even 1 q odd Dantam (Mines CSCI-561) Finite Automata Fall / 35

17 Deterministic Finite Automata Symbolic DFA Semantics Transition Function δ : Q Σ Q Extended Transition Function ˆδ : Q Σ Q base ˆδ(q, ɛ) = q inductive For ω Σ and a Σ, ˆδ(q, ωa) = δ(ˆδ(q, ω), a) Accept ˆδ(q 0, ω) F M accepts ω Reject ˆδ(q 0, ω) F M rejects ω { } Language L (M) = ω Σ ˆδ(q 0, ω) F M recognizes L (M) Dantam (Mines CSCI-561) Finite Automata Fall / 35

18 Deterministic Finite Automata Example: DFA Simulation start q even 1 q odd state 0 1 F q even q even q odd 0 q odd q odd q even 1 Simulate the DFA on the following strings: ɛ Dantam (Mines CSCI-561) Finite Automata Fall / 35

19 Deterministic Finite Automata DFA Simulation Algorithm 1: DFA-Simulate(M) Input: M = (Q, Σ, δ, q 0, F ) ; // states,alphabet,transition,start,accept Output: y {accept, reject} 1 q q 0 ; /* Read next symbol on input tape */ 2 σ next() ; 3 while σ EOF do /* Follow state transition */ 4 q δ(q, σ) ; /* Read next symbol on input tape */ 5 σ next() ; 6 if q F then 7 y accept; 8 else 9 y reject; Dantam (Mines CSCI-561) Finite Automata Fall / 35

20 Deterministic Finite Automata Regular Languages The regular set is the set of languages that can be recognized by DFAs R = {L (M) M is a DFA} A language is a regular language if some DFA accepts it (L R) M, (L = L (M)) What languages are not regular? Dantam (Mines CSCI-561) Finite Automata Fall / 35

21 Nondeterministic Finite Automata Outline Dantam (Mines CSCI-561) Finite Automata Fall / 35

22 Nondeterministic Finite Automata Determinism vs. Nondeterminism tape σ 0 σ 1 σ 2 σ 3... Deterministic Transition to single state δ dfa (q i, σ) = q j δ(q 0, σ 0 ) δ(d 1, σ 1 ) δ(d 2, σ 2 ) δ(d 3, σ 3 ) q 0 d 1 d 2 d 3... Nondeterministic Transition to a multiple states δ nfa (q i, σ) = {q j, q k, q l,...} q 0 n 10. n 20.. n 11. Dantam (Mines CSCI-561) Finite Automata Fall / 35

23 Nondeterministic Finite Automata Example: NFA and Transition Table start a start q ɛ 0 q ɛ 1 q 2 0 s, followed by 1 s, followed by 2 s b q 0 q 1 q 2 a, b ɛ a state ɛ F q 0 {q 0 } {q 1 } 0 q 1 {q 1 } {q 2 } 0 q 2 {q 2 } 1 state a b ɛ F q 0 {q 1 } {q 2 } 1 q 1 {q 1, q 2 } {q 2 } 0 q 2 {q 0 } 0 Dantam (Mines CSCI-561) Finite Automata Fall / 35

24 Nondeterministic Finite Automata Nondeterministic Finite Automata (NFA) A nondeterministic finite automaton is a 5-tuple: N = (Q, Σ, δ, q 0, F ), where Q is a finite set call the states Σ is a finite set call the alphabet δ : Q Σ P (Q) is the transition function q0 Q is the start state F Q is the set of accept states Dantam (Mines CSCI-561) Finite Automata Fall / 35

25 Nondeterministic Finite Automata NFA vs. DFA Given: NFA N = (Q N, Σ, δ N, q 0,N, F N ) Find: DFA M = (Q M, Σ, δ M, q 0,N, F M ), such that L (M) = L (N) Solution: DFA states are sets of NFA states NFA DFA states Q N Q M = P (Q N ) alphabet Σ Σ transition δ N : Q N Σ P (Q N ) δ M (Q, σ) {q Q N σ-reachable from q i Q} start q 0,N Q N q 0,M = {q Q N ɛ-reachable from q 0,N } accept F N Q N F M = {q m Q M q m F N } Dantam (Mines CSCI-561) Finite Automata Fall / 35

26 Nondeterministic Finite Automata Practical usage of DFAs vs. NFAs Today s physical computers are deterministic Options: 1. Simulate NFA by tracking all possible current states 2. Convert NFA to DFA by constructing the subsets of NFA state set Which option is better? Dantam (Mines CSCI-561) Finite Automata Fall / 35

27 Nondeterministic Finite Automata NFA subset construction outines ɛ closure(q) States reachable from q on ɛ transitions move-ɛ closure(q, σ) States reachable from state q after reading symbol σ Construct the reachable subsets of NFA states Dantam (Mines CSCI-561) Finite Automata Fall / 35

28 Nondeterministic Finite Automata ɛ-closure examples start q 0 ɛ q 1 ɛ q 2 ɛ-closure(q 0 ) = {q 0, q 1, q 2 } ɛ-closure(q 1 ) = {q 1, q 2 } ɛ-closure(q 2 ) = {q 2 } a start q 0 b a ɛ q 1 a, b q 2 ɛ-closure(q 0 ) = {q 0, q 2 } ɛ-closure(q 1 ) = {q 1 } ɛ-closure(q 2 ) = {q 2 } States reachable from initial state on only ɛ transitions Dantam (Mines CSCI-561) Finite Automata Fall / 35

29 Nondeterministic Finite Automata ɛ closure Algorithm 2: ɛ-closure(nfa,s,c) Input: NFA, S, C ; // NFA, unvisited states, initial closure Output: C ; // final closure /* visit: P (Q) Q P (Q) 1 Function visit(c,q) is 2 if q c then // base case 3 return c; 4 else // Recursive case 5 return ɛ closure NFA, p, {q} c q p NFA ɛ }{{} ; add q to closure }{{} ɛ-neighbors of q 6 C fold-left(visit, C, S) ; */ Dantam (Mines CSCI-561) Finite Automata Fall / 35

30 Nondeterministic Finite Automata move-ɛ-closure examples start q 0 ɛ q 1 ɛ q 2 move-ɛ-closure(q 0, 0) = {q 0, q 1, q 2 } move-ɛ-closure(q 0, 1) = {q 1, q 2 } move-ɛ-closure(q 0, 2) = {q 2 } a start q 0 b a ɛ q 1 a, b q 2 move-ɛ-closure(q 0, a) = {q 0, q 2 } move-ɛ-closure(q 1, a) = {q 1, q 2 } move-ɛ-closure(q 2, a) = {q 0, q 2 } States reachable from initial state after reading one symbol Dantam (Mines CSCI-561) Finite Automata Fall / 35

31 Nondeterministic Finite Automata move-ɛ closure Algorithm 3: move-ɛ-closure(nfa,q,σ) Input: NFA, Q, σ ; // NFA, initial states, token Output: C ; // reachable states 1 Function visit(c,q) is 2 return ɛ closure NFA, σ reachable from q { }} { p q σ p NFA, c ; }{{} ɛ-reachable after move 3 C fold-left visit,, ɛ closure(nfa, Q, ) ; }{{} ɛ-reachable from Q Dantam (Mines CSCI-561) Finite Automata Fall / 35

32 Nondeterministic Finite Automata NFA Simulation Algorithm 4: NFA-Simulate(N) Input: N = (Q, Σ, δ, q 0, F ) ; // states,alphabet,transition,start,accept Output: y {accept, reject} 1 c ɛ-closure(q 0 ); /* Read next symbol on input tape */ 2 σ next() ; 3 while σ EOF do /* Follow state transition */ 4 c move-ɛ-closure(n, c, σ)) ; /* Read next symbol on input tape */ 5 σ next() ; 6 if c F then 7 y accept; 8 else 9 y reject; Dantam (Mines CSCI-561) Finite Automata Fall / 35

33 Nondeterministic Finite Automata NFA to DFA Subset Construction Algorithm 5: NFA-to-DFA Input: N = (Q, Σ, E, q 0, F ) ; // NFA states, alphabet, edges, start, accept Output: M = (Q, Σ, E, q 0, F ) ; // DFA states, alphabet, edges, start, accept 1 q 0 ɛ-closure(q 0) ; 2 Q {q 0 }, E ; /* Construct Subsets */ 3 i 0 ; 4 while i < Q do /* Finding outgoing edges of i th DFA state */ 5 forall σ Σ do /* Check for transition from Q i on symbol σ */ 6 u = move ɛ closure(n, Q i, σ) ; 7 if u then 8 Q Q u ; // Add new subset { } 9 E E Q i σ u ; // Add new edge/transition 10 i i + 1; /* Accept States */ 11 F = {q Q q F } Dantam (Mines CSCI-561) Finite Automata Fall / 35

34 Nondeterministic Finite Automata NFA to DFA Example NFA start q ɛ 0 q ɛ 1 q 2 DFA start 1 2 q 0, q1, q2 q 1, q2 q 2 Dantam (Mines CSCI-561) Finite Automata Fall / 35 2

35 Nondeterministic Finite Automata NFA to DFA Examples (cont.) a NFA start q 0 b a ɛ q 1 a, b q 2 DFA a start q 0, q 2 b a q 1 b q 2 a b a q 1, q 2 q 0, q 2, q 2 b a 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 / 43

Finite Automata. Dr. Neil T. Dantam. Fall CSCI-561, Colorado School of Mines. Dantam (Mines CSCI-561) Finite Automata Fall / 43 Finite Automata Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2018 Dantam (Mines CSCI-561) Finite Automata Fall 2018 1 / 43 Outline Languages Review Traffic Light Example Deterministic Finite

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

Pushdown Automata (Pre Lecture)

Pushdown Automata (Pre Lecture) Pushdown Automata (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Pushdown Automata (Pre Lecture) Fall 2017 1 / 41 Outline Pushdown Automata Pushdown

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

Extended transition function of a DFA

Extended transition function of a DFA Extended transition function of a DFA The next two pages describe the extended transition function of a DFA in a more detailed way than Handout 3.. p./43 Formal approach to accepted strings We define the

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

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

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

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

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

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

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

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

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

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

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

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

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

CSCE 551 Final Exam, April 28, 2016 Answer Key

CSCE 551 Final Exam, April 28, 2016 Answer Key CSCE 551 Final Exam, April 28, 2016 Answer Key 1. (15 points) Fix any alphabet Σ containing the symbol a. For any language L Σ, define the language a\l := {w Σ wa L}. Show that if L is regular, then a\l

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

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

Nondeterminism. September 7, Nondeterminism

Nondeterminism. September 7, Nondeterminism September 7, 204 Introduction is a useful concept that has a great impact on the theory of computation Introduction is a useful concept that has a great impact on the theory of computation So far in our

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

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

Regular Expressions (Pre Lecture)

Regular Expressions (Pre Lecture) Regular Expressions (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Regular Expressions (Pre Lecture) Fall 2017 1 / 39 Regular Expressions Outline

More information

CS21 Decidability and Tractability

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

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Lecture 6 Section 2.2 Robb T. Koether Hampden-Sydney College Mon, Sep 5, 2016 Robb T. Koether (Hampden-Sydney College) Nondeterministic Finite Automata Mon, Sep 5, 2016

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

Java II Finite Automata I

Java II Finite Automata I Java II Finite Automata I Bernd Kiefer Bernd.Kiefer@dfki.de Deutsches Forschungszentrum für künstliche Intelligenz November, 23 Processing Regular Expressions We already learned about Java s regular expression

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

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

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

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

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

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

Introduction to Formal Languages, Automata and Computability p.1/51

Introduction to Formal Languages, Automata and Computability p.1/51 Introduction to Formal Languages, Automata and Computability Finite State Automata K. Krithivasan and R. Rama Introduction to Formal Languages, Automata and Computability p.1/51 Introduction As another

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

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

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

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

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

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

Formal Models in NLP

Formal Models in NLP Formal Models in NLP Finite-State Automata Nina Seemann Universität Stuttgart Institut für Maschinelle Sprachverarbeitung Pfaffenwaldring 5b 70569 Stuttgart May 15, 2012 Nina Seemann (IMS) Formal Models

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

Context-Free Languages (Pre Lecture)

Context-Free Languages (Pre Lecture) Context-Free Languages (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Context-Free Languages (Pre Lecture) Fall 2017 1 / 34 Outline Pumping Lemma

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

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

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV27/DIT32 LP4 28 Lecture 5 Ana Bove March 26th 28 Recap: Inductive sets, (terminating) recursive functions, structural induction To define an inductive set

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

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

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

Takeaway Notes: Finite State Automata

Takeaway Notes: Finite State Automata Takeaway Notes: Finite State Automata Contents 1 Introduction 1 2 Basics and Ground Rules 2 2.1 Building Blocks.............................. 2 2.2 The Name of the Game.......................... 2 3 Deterministic

More information

CSE 311 Lecture 25: Relating NFAs, DFAs, and Regular Expressions. Emina Torlak and Kevin Zatloukal

CSE 311 Lecture 25: Relating NFAs, DFAs, and Regular Expressions. Emina Torlak and Kevin Zatloukal CSE 3 Lecture 25: Relating NFAs, DFAs, and Regular Expressions Emina Torlak and Kevin Zatloukal Topics From regular expressions to NFAs Theorem, algorithm, and examples. From NFAs to DFAs Theorem, algorithm,

More information

Chapter 6: NFA Applications

Chapter 6: NFA Applications Chapter 6: NFA Applications Implementing NFAs The problem with implementing NFAs is that, being nondeterministic, they define a more complex computational procedure for testing language membership. To

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

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

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

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

Finite Automata and Regular Languages

Finite Automata and Regular Languages Finite Automata and Regular Languages Topics to be covered in Chapters 1-4 include: deterministic vs. nondeterministic FA, regular expressions, one-way vs. two-way FA, minimization, pumping lemma for regular

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

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

Introduction to Finite-State Automata

Introduction to Finite-State Automata Introduction to Finite-State Automata John McDonough Language Technologies Institute, Machine Learning for Signal Processing Group, Carnegie Mellon University March 26, 2012 Introduction In this lecture,

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

Lecture 4: Nondeterministic Finite Automata

Lecture 4: Nondeterministic Finite Automata Lecture 4: Nondeterministic Finite Automata Dr Kieran T. Herley Department of Computer Science University College Cork 2017-2018 KH (26/09/17) Lecture 4: Nondeterministic Finite Automata 2017-2018 1 /

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

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

Finite Automata and Regular Languages (part III)

Finite Automata and Regular Languages (part III) Finite Automata and Regular Languages (part III) Prof. Dan A. Simovici UMB 1 / 1 Outline 2 / 1 Nondeterministic finite automata can be further generalized by allowing transitions between states without

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

2. Elements of the Theory of Computation, Lewis and Papadimitrou,

2. Elements of the Theory of Computation, Lewis and Papadimitrou, Introduction Finite Automata DFA, regular languages Nondeterminism, NFA, subset construction Regular Epressions Synta, Semantics Relationship to regular languages Properties of regular languages Pumping

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

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

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

Classes and conversions

Classes and conversions Classes and conversions Regular expressions Syntax: r = ε a r r r + r r Semantics: The language L r of a regular expression r is inductively defined as follows: L =, L ε = {ε}, L a = a L r r = L r L r

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

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

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

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

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

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

Lecture 3: Finite Automata. Finite Automata. Deterministic Finite Automata. Summary. Dr Kieran T. Herley

Lecture 3: Finite Automata. Finite Automata. Deterministic Finite Automata. Summary. Dr Kieran T. Herley Lecture 3: Finite Automata Dr Kieran T. Herley Department of Computer Science University College Cork Summary Deterministic finite automata (DFA). Definition and operation of same. DFAs as string classifiers

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

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

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

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

2017/08/29 Chapter 1.2 in Sipser Ø Announcement:

2017/08/29 Chapter 1.2 in Sipser Ø Announcement: Nondeterministic Human-aware Finite Robo.cs Automata 2017/08/29 Chapter 1.2 in Sipser Ø Announcement: q Piazza registration: http://piazza.com/asu/fall2017/cse355 q First poll will be posted on Piazza

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

CSE 211. Pushdown Automata. CSE 211 (Theory of Computation) Atif Hasan Rahman

CSE 211. Pushdown Automata. CSE 211 (Theory of Computation) Atif Hasan Rahman CSE 211 Pushdown Automata CSE 211 (Theory of Computation) Atif Hasan Rahman Lecturer Department of Computer Science and Engineering Bangladesh University of Engineering & Technology Adapted from slides

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

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

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

Computability Theory

Computability Theory CS:4330 Theory of Computation Spring 2018 Computability Theory Decidable Languages Haniel Barbosa Readings for this lecture Chapter 4 of [Sipser 1996], 3rd edition. Section 4.1. Decidable Languages We

More information

Finite Automata - Deterministic Finite Automata. Deterministic Finite Automaton (DFA) (or Finite State Machine)

Finite Automata - Deterministic Finite Automata. Deterministic Finite Automaton (DFA) (or Finite State Machine) Finite Automata - Deterministic Finite Automata Deterministic Finite Automaton (DFA) (or Finite State Machine) M = (K, Σ, δ, s, A), where K is a finite set of states Σ is an input alphabet s K is a distinguished

More information

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata

Automata and Formal Languages - CM0081 Non-Deterministic Finite Automata Automata and Formal Languages - CM81 Non-Deterministic Finite Automata Andrés Sicard-Ramírez Universidad EAFIT Semester 217-2 Non-Deterministic Finite Automata (NFA) Introduction q i a a q j a q k The

More information

Subset construction. We have defined for a DFA L(A) = {x Σ ˆδ(q 0, x) F } and for A NFA. For any NFA A we can build a DFA A D such that L(A) = L(A D )

Subset construction. We have defined for a DFA L(A) = {x Σ ˆδ(q 0, x) F } and for A NFA. For any NFA A we can build a DFA A D such that L(A) = L(A D ) Search algorithm Clever algorithm even for a single word Example: find abac in abaababac See Knuth-Morris-Pratt and String searching algorithm on wikipedia 2 Subset construction We have defined for a DFA

More information

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

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

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

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