Chapter 2: Finite Automata

Size: px
Start display at page:

Download "Chapter 2: Finite Automata"

Transcription

1 Chapter 2: Finite Automata 2.1 States, State Diagrams, and Transitions Finite automaton is the simplest acceptor or recognizer for language specification. It is also the simplest model of a computer. A state is the condition with respect to structure, form, constitution, and phase. 1

2 2.2 Deterministic Finite Automata Definition A deterministic finite automaton (DFA) M is specified by a quintuple M = (Q, Σ, δ, s, F ) where Q is an alphabet of state symbols; Σ is an alphabet of input symbols; δ : Q Σ Q is a transition function; s in Q is the start state; and F Q is a set of final states. 2

3 DFAs are intended to read input words and accept or reject them, that is they are recognizers. To see how DFAs do this we treat them from a machine-oriented viewpoint. Input tape Read head Cells Finite control 3

4 Let M = (Q, Σ, δ, s, F ) be a DFA, then we view it as a machine (a primitive computer) which has an input tape (or file) of cells, a reading head, and a finite control: The finite control knows the transition function and the current state. The transition function and current state are analogous to a program and the current statement being executed (instruction counter). The input tape contains the input word, one symbol to each cell of the tape. 4

5 The DFA is initialized with an input word x as follows: 1. x is placed on the input tape one symbol to a cell. 2. The reading head is positioned over the leftmost cell. 3. The current state is set to s. 4. The DFA is started. 5

6 The DFA, once started, begins its computation on the input word. As with any computer it has a basic execute cycle: 1. The symbol under the reading head is read, that is, the current symbol. If there is no symbol under the reading head the DFA terminates. This occurs when the whole input word has been read. 2. The next state is computed from the current state and symbol using the transition function, that is δ(current state, current symbol)=next state. If the current state is undefined the DFA aborts. 3. The reading head moves one cell to the right. 4. The next state becomes the current state and the execute cycle has been completed. 6

7 Definition Let M = (Q, Σ, δ, s, F ) be a DFA. We say that a word in QΣ is a configuration of M. It represents the current state of M and the remaining unread input of M. A configuration of a DFA, M, contains all the information necessary to continue M s computation. In programming parlance it is equivalent to a dump of the current value of all variables of a program and the current position in the program. 7

8 Definition Let M = (Q, Σ, δ, s, F ) be a DFA. If px and qy are two configurations of M, then we write px qy, if x = ay for some a in Σ, and δ(p, a) = q. We say px yields qy. Observe that is a binary relation over QΣ For k 1, we write px k qy if k = 1 and px qy, or k > 1 and there exists a configuration rz such that px rz and rz k 1 qy. 8

9 We write px + qy, where + is the trsnsitive closure of, if px k qy, for some k 1. We write px qy, where is the reflexive trsnsitive closure of, if either px = qy or px + qy. We say that the sequence of configurations given by px qy is a configuration sequence. 9

10 We can formally define acceptance by a DFA and the language of a DFA as follows. Definition Let M = (Q, Σ, δ, s, F ) be a DFA. We say that a word x in Σ is accepted by M if sx f, for some f in F. We say that sx f is an accepting configuration sequence. A word that is not accepted is said to be rejected. The set of words accepted by M, called the language accepted, defined, or recognized by M is denoted by L(M) and is defined as L(M) = {x : x is in Σ and sx f, for some f in F }. 10

11 The notion of acceptance has caused DFA to stand for deterministic finite acceptor in some circles. We say that L Σ is a DFA language if there is a DFA, M, with L = L(M). The collection of all DFA languages is denoted by L DF A and is called the family of DFA languages. 11

12 DFA MEMBERSHIP INSTANCE: A DFA, M = (Q, Σ, δ, s, F ), and a word x in Σ. QUESTION: Is x in L(M)? Definition If the transition function of a DFA is total we say that the DFA is complete and otherwise we say it is incomplete. Every incomplete DFA can be transformed into a complete one while preserving its language. 12

13 Example Let L i = {a i b i }, i 1. Construct DFAs, M i, accepting L i, for each i 1. Let K = j=1 L j K = {a i b i, : i 1}. Claim: K is not a DFA language. There is a language that is not a DFA language. The family of all DFA language over Σ is enumerable. 13

14 Definition Let M 1 and M 2 be two DFAs. If L(M 1 ) = L(M 2 ) we say that M 1 and M 2 are equivalent. Theorem Let M = (Q, Σ, δ, s, F ) be an incomplete DFA, that is, there is a pair (q, a) in Q Σ such that δ(q, a) = undef. Then a DFA M can be constructed such that M is complete and L(M ) = L(M). Consider a computer implementation of DFAs. 14

15 2.3 Nondeterministic Finite Automata Definition A nondeterministic finite automaton (NFA) M is specified by a quintuple M = (Q, Σ, δ, s, F ) where Q is an alphabet of state symbols; Σ is an alphabet of input symbols; δ Q Σ Q is a transition relation; s in Q is the start state; and F Q is a set of final states. 15

16 For a triple (p, a, q) in δ, p corresponds to the current state, a to the current input symbol, and q to a next state. Clearly an NFA, (Q, Σ, δ, s, F ), is a DFA if for all p in Q and all a in Σ, there is at most one triple (p, a, q) in δ, for some q. When we are unconcerned about a finite automaton being deterministic or nondeterministic we refer to it simply as an FA. Remark: It is sometimes convenient to consider the transition relation δ as a function, which, in general, gives state sets, that is δ : Q Σ 2 Q is defined by For all p in Q and for all a in Σ: δ(p, a) = {q : (p, a, q) is in δ}. 16

17 Definition Let M = (Q, Σ, δ, s, F ) be an NFA. A configuration of M is a word in QΣ, as for DFAs. Given two configurations px and qy of M, we write px qy in M if x = ay for some a in Σ and (p, a, q) is in δ. Similarly, we write px k qy in M if either k = 1, when 1 is identical to or x = az, for some a in Σ and some z in Σ +, and there is an r such that px rz and rz k 1 qy. We write px + qy if px k qy for some k 1, and, finally, px qy if either px = qy or px + qy. 17

18 Definition Given M = (Q, Σ, δ, s, F ), an NFA, we say a word x in Σ is accepted if there is a configuration sequence sx q, for some q in F, and is rejected otherwise. The language of M, denoted by L(M) as before, is defined by L(M) = {x : x is in Σ and sx q, for some q in F }. A language L Σ is said to be an NFA language if there exists an NFA, M, with L = L(M) and we say two NFAs, M 1 and M 2, are equivalent if L(M 1 ) = L(M 2 ) and inequivalent otherwise. Finally, the family of NFA languages is denoted by L NF A. NFAs are simpler to define in many cases and, moreover, we can always construct a DFA from a given NFA which accepts exactly the same language. 18

19 Definition Let M = (Q, Σ, δ, s, F ) be an NFA. A super-configuration of M has the form Kx where K Q and x is in Σ. It means that K is the current set of states and x is the unread portion of the input word. The starting super-configuration for a word x in Σ is {s}x. We extend to super-configurations as follows. We say Kx Ny, for K, N Q and x, y in Σ, if x = ay, for some a in Σ, y in Σ, and N = {q : (p, a, q) is in δ, for some p in K}. We obtain + and as before and if Kx Ny we call it super-configuration sequence. Note that K K for all K Q and x, for all x in Σ. 19

20 Lemma Let M = (Q, Σ, δ, s, F ) be an NFA. Then for all words x in Σ and for all K Q Kx N and Kx P implies P = N. Hence, M is deterministic with respect to super-configuration sequences. The above lemma tells us that there is a unique super-configuration sequence, begining with K, for each input word that is read completely. 20

21 Lemma Let M = (Q, Σ, δ, s, F ) be an NFA. Then for all words x in Σ, and for all q in Q, qx p if and only if {q}x P, for some P with p in P. Definition Let M = (Q, Σ, δ, s, F ) be an NFA and x a word in Σ. We say x is accepted by M if {s}x P, for some P with P F, otherwise x is rejected. 21

22 Algorithm NFA to DFA - The Subset Construction. On entry: An NFA, M = (Q, Σ, δ, s, F ). On exit: A DFA, M = (Q, Σ, δ, s, F ) satisfying L(M) = L(M ). begin Let Q = 2 Q, s = {s}, and F = {K : K Q and K F }. We define δ : Q Σ Q by For all K Q and for all a in Σ, δ (K, a) = N if Ka N in M end of Algorithm. 22

23 Theorem Given an NFA, M = (Q, Σ, δ, s, F ), then the DFA, M = (Q, Σ, δ, s, F ), obtained by either subset construction satisfies L(M) = L(M ). Theorem L DF A = L NF A. Thus, NFAs have the some expressive power as DFAs. 23

24 2.4 Minimization and Simplification Definition Let M = (Q, Σ, δ, s, F ) be an NFA. A state q in Q is reachable or accessible if there exists a word x in Σ such that sx q. If no such word exists q is said to be unreachable or inaccessible. A state q in Q is useful if there exists a word x in Σ such that qx r, for some state r in F. Similarly q is useless if no such word exists. A symbol a in Σ is (symbol) reachable if there exists a reachable state q in Q for which δ(q, a). 24

25 Definition Let M = (Q, Σ, δ, s, F ) be a DFA. For two distinct states p and q in Q we say p and q are distinguishable if there exists an x in Σ such that px f, qx g and exactly one of f and g is in F. The word x distinguishes p from q. If no such word exists then p and q are indistingushable and we write p q, since ther are equivalent in their action as far as acceptance is concerned. Indeed, they can be merged without affecting the language accepted by M. This forms the basis of the minimization for which we need to refine the notion of indistingushable. Given an integer k 0, we say two distinct states p and q in Q are k-distindushable if there is a word x in Σ, x k, which distindushes p from q. If there is no such word, then we say that p and q are k-indistindushable and we write p k q. These notations are appropriate since both and k are equivalence relations over Q. 25

26 If we cannot distingush p and q with words of length at most k + 1, for some k 0, then we cannot distingush them with the words of at most k. In other words, p k+1 q implies p k q, for all k 0, that is k+1. k We say k+1 is a refinement of k. Similarly, we obtain k, for all k k There are at most two equivalence classes formed by 0, F and Q F. We can construct by refining 0 to give 1, 1 to give 2, and so on. To refine i to give i+1 we use the observation For two distinct states p and q with p i q, p i+1 q if and only if, for all a in Σ, δ(p, a) i δ(q, a) 26

27 Lemma Let M = (Q, Σ, δ, s, F ) be a DFA with #Q = m. Then two distinct states p and q are indistingushable if and only if they are (m 2)-indistingushable. Let M = (Q, Σ, δ, s, F ), be k and construct a DFA, M = (Q, Σ, δ, s, F ) from k as follows: Let Q = [p] p is in Q and [p] is the equivalence class of p in, s = [s], F = {[p] : p is in F }, and define δ by For all [p] in Q, for all a in Σ, δ ([p], a) = [δ(p, a)] 27

28 Theorem Let M = (Q, Σ, δ, s, F ) be a complete DFA having only reachable states and M = (Q, Σ, δ, s, F ) be the corresponding DFA constructed from for M. Then M is a minimal complete DFA equivalent to M. Corollary Let M = (Q, Σ, δ, s, F ) be a complete DFA and M and M be two minimal complete DFAs equivalent to M. Then M and M are equal apart from a renaming states, that is, there is an isomorphism between M and M. This corollary implies that the following question is decidable: DFA EQUIVALENCE INSTANCE: Two DFAs M 1 and M 2. QUESTION: Is L(M 1 ) = L(M 2 )? 28

29 2.5 DFAs and Tries Although the definition of DFA cannot be further restricted without restricting the languages accepted by them, there are two restrictions that are of interest. We say a DFA, M = (Q, Σ, δ, s, F ), has a loop if there is a state q in Q and a nonempty word x in Σ + such that qx q; q is said to be a looping state. M is said to be loop-free if it has no looping states, in other words, the state diagram has no cycles. 29

30 Furthermore, we say M is a tree if it is loop-free and for all states q in Q, q s, there is one and only one state p with δ(p, a) = q, for some a in Σ. Loop-free DFAs accept only finite languages, and this raises the question: Is every finite language accepted by some loop-free DFA? Even if a DFA has loops it may still accept a finite language; therefore, we have the decision problem DFA FINITENESS INSTANCE: A DFA, M = (Q, Σ, δ, s, F ). QUESTION: Is L(M) finite? 30

31 2.6 λ-fas and Lazy FAs λ-fas and λ-transitions In the FAs we have discussed so far we require that the reading head move at each step. We now relax the condition by allowing the reading head to remain at a cell during a transition. We call such a transition a λ-transition; the input symbol is ignored. 31

32 Definition M = (Q, Σ, δ, s, F ) is a λ-nfa, or λ-transition NFA, if δ Q (Σ {λ}) Q. We require, on a λ-transition, that the reading head doesn t move and the input symbol is ignored. Given a configuration px in QΣ we write px qy if x = Ay, for some A in Σ {λ}, and (p, A, q) is in δ; is extended to + and as before. Thus, at each configuration there is not only the choice of transition usual in NFAs, but also the additional possibility of taking λ-transitions. 32

33 There are two situation in which λ-transitions are useful: The Plus of an NFA The Union of Two NFAs Clearly, every NFA is a λ-nfa, but surprisingly the expressive power of λ-nfas is no more than that of NFAs. Theorem Let M = (Q, Σ, δ, s, F ) be a λ-nfa; then an equivalent NFA, M, can be constructed from M. 33

34 2.6.2 Lazy Finite Automata Definition A lazy finite automaton, M, is a quintuple (Q, Σ, δ, s, F ) where Q,, Σ, s, and F are as for FAs, but δ Q Σ Q, a finite transition relation. In other words, transitions are allowed with words rather than just symbols and the empty word. A single move is defined by px qy if x = wy, for some w in Σ, and (p, w, q) is in δ Theorem Let M be a lazy FA. Then there is a λ-nfa, M, with L(M ) = L(M). 34

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

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

Uses of finite automata

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

More information

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

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

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

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

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

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

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

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

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

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages

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

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

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

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

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

Turing machines Finite automaton no storage Pushdown automaton storage is a stack What if we give the automaton a more flexible storage?

Turing machines Finite automaton no storage Pushdown automaton storage is a stack What if we give the automaton a more flexible storage? Turing machines Finite automaton no storage Pushdown automaton storage is a stack What if we give the automaton a more flexible storage? What is the most powerful of automata? In this lecture we will introduce

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

More information

1 Showing Recognizability

1 Showing Recognizability CSCC63 Worksheet Recognizability and Decidability 1 1 Showing Recognizability 1.1 An Example - take 1 Let Σ be an alphabet. L = { M M is a T M and L(M) }, i.e., that M accepts some string from Σ. Prove

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

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

Constructions on Finite Automata

Constructions on Finite Automata Constructions on Finite Automata Informatics 2A: Lecture 4 Mary Cryan School of Informatics University of Edinburgh mcryan@inf.ed.ac.uk 24 September 2018 1 / 33 Determinization The subset construction

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

Formal Language and Automata Theory (CS21004)

Formal Language and Automata Theory (CS21004) Theory (CS21004) Announcements The slide is just a short summary Follow the discussion and the boardwork Solve problems (apart from those we dish out in class) Table of Contents 1 2 3 Languages that are

More information

Automata Theory (2A) Young Won Lim 5/31/18

Automata Theory (2A) Young Won Lim 5/31/18 Automata Theory (2A) Copyright (c) 2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

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

Computation Histories

Computation Histories 208 Computation Histories The computation history for a Turing machine on an input is simply the sequence of configurations that the machine goes through as it processes the input. An accepting computation

More information

Constructions on Finite Automata

Constructions on Finite Automata Constructions on Finite Automata Informatics 2A: Lecture 4 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 23rd September, 2014 1 / 29 1 Closure properties of regular languages

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

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

Introduction to Formal Languages, Automata and Computability p.1/42 Introduction to Formal Languages, Automata and Computability Pushdown Automata K. Krithivasan and R. Rama Introduction to Formal Languages, Automata and Computability p.1/42 Introduction We have considered

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

3515ICT: Theory of Computation. Regular languages

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

More information

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

Part I: Definitions and Properties

Part I: Definitions and Properties Turing Machines Part I: Definitions and Properties Finite State Automata Deterministic Automata (DFSA) M = {Q, Σ, δ, q 0, F} -- Σ = Symbols -- Q = States -- q 0 = Initial State -- F = Accepting States

More information

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES Contents i SYLLABUS UNIT - I CHAPTER - 1 : AUT UTOMA OMATA Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 2 : FINITE AUT UTOMA OMATA An Informal Picture of Finite Automata,

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

Theory of Computation (IV) Yijia Chen Fudan University

Theory of Computation (IV) Yijia Chen Fudan University Theory of Computation (IV) Yijia Chen Fudan University Review language regular context-free machine DFA/ NFA PDA syntax regular expression context-free grammar Pushdown automata Definition A pushdown automaton

More information

Further discussion of Turing machines

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

More information

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

Theory of Languages and Automata

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

More information

arxiv: v2 [cs.fl] 29 Nov 2013

arxiv: v2 [cs.fl] 29 Nov 2013 A Survey of Multi-Tape Automata Carlo A. Furia May 2012 arxiv:1205.0178v2 [cs.fl] 29 Nov 2013 Abstract This paper summarizes the fundamental expressiveness, closure, and decidability properties of various

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

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

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

Theory of Computation (IX) Yijia Chen Fudan University

Theory of Computation (IX) Yijia Chen Fudan University Theory of Computation (IX) Yijia Chen Fudan University Review The Definition of Algorithm Polynomials and their roots A polynomial is a sum of terms, where each term is a product of certain variables and

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

The Church-Turing Thesis

The Church-Turing Thesis The Church-Turing Thesis 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

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

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

Homework 8. a b b a b a b. two-way, read/write

Homework 8. a b b a b a b. two-way, read/write Homework 8 309 Homework 8 1. Describe a TM that accepts the set {a n n is a power of 2}. Your description should be at the level of the descriptions in Lecture 29 of the TM that accepts {ww w Σ } and the

More information

CPSC 421: Tutorial #1

CPSC 421: Tutorial #1 CPSC 421: Tutorial #1 October 14, 2016 Set Theory. 1. Let A be an arbitrary set, and let B = {x A : x / x}. That is, B contains all sets in A that do not contain themselves: For all y, ( ) y B if and only

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

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

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

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

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

Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata.

Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata. Pushdown Automata We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata. Next we consider a more powerful computation model, called a

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

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

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

CSCE 551: Chin-Tser Huang. University of South Carolina

CSCE 551: Chin-Tser Huang. University of South Carolina CSCE 551: Theory of Computation Chin-Tser Huang huangct@cse.sc.edu University of South Carolina Church-Turing Thesis The definition of the algorithm came in the 1936 papers of Alonzo Church h and Alan

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

DM17. Beregnelighed. Jacob Aae Mikkelsen

DM17. Beregnelighed. Jacob Aae Mikkelsen DM17 Beregnelighed Jacob Aae Mikkelsen January 12, 2007 CONTENTS Contents 1 Introduction 2 1.1 Operations with languages...................... 2 2 Finite Automata 3 2.1 Regular expressions/languages....................

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

Non-emptiness Testing for TMs

Non-emptiness Testing for TMs 180 5. Reducibility The proof of unsolvability of the halting problem is an example of a reduction: a way of converting problem A to problem B in such a way that a solution to problem B can be used to

More information

CSE 135: Introduction to Theory of Computation Optimal DFA

CSE 135: Introduction to Theory of Computation Optimal DFA CSE 35: Introduction to Theory of Computation Optimal DFA Sungjin Im University of California, Merced 2-9-25 Optimal Algorithms for Regular Languages Myhill-Nerode Theorem There is a unique optimal algorithm

More information

Lecture 17: Language Recognition

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

More information

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

The Turing machine model of computation

The Turing machine model of computation The Turing machine model of computation For most of the remainder of the course we will study the Turing machine model of computation, named after Alan Turing (1912 1954) who proposed the model in 1936.

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

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

Chapter 6: Turing Machines

Chapter 6: Turing Machines Chapter 6: Turing Machines 6.1 The Turing Machine Definition A deterministic Turing machine (DTM) M is specified by a sextuple (Q, Σ, Γ, δ, s, f), where Q is a finite set of states; Σ is an alphabet of

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Push-Down Automata CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard Janicki Computability

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

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

Variants of Turing Machine (intro)

Variants of Turing Machine (intro) CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples, Turing-recognizable and Turing-decidable languages Variants of Turing Machine Multi-tape Turing machines, non-deterministic

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

More on Finite Automata and Regular Languages. (NTU EE) Regular Languages Fall / 41

More on Finite Automata and Regular Languages. (NTU EE) Regular Languages Fall / 41 More on Finite Automata and Regular Languages (NTU EE) Regular Languages Fall 2016 1 / 41 Pumping Lemma is not a Sufficient Condition Example 1 We know L = {b m c m m > 0} is not regular. Let us consider

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

Most General computer?

Most General computer? Turing Machines Most General computer? DFAs are simple model of computation. Accept only the regular languages. Is there a kind of computer that can accept any language, or compute any function? Recall

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

CS21 Decidability and Tractability

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

More information

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

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

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

Blackhole Pushdown Automata

Blackhole Pushdown Automata Fundamenta Informaticae XXI (2001) 1001 1020 1001 IOS Press Blackhole Pushdown Automata Erzsébet Csuhaj-Varjú Computer and Automation Research Institute, Hungarian Academy of Sciences Kende u. 13 17, 1111

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

Computational Models - Lecture 5 1

Computational Models - Lecture 5 1 Computational Models - Lecture 5 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 10/22, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Pushdown Automata. Reading: Chapter 6

Pushdown Automata. Reading: Chapter 6 Pushdown Automata Reading: Chapter 6 1 Pushdown Automata (PDA) Informally: A PDA is an NFA-ε with a infinite stack. Transitions are modified to accommodate stack operations. Questions: What is a stack?

More information

Introduction: Computer Science is a cluster of related scientific and engineering disciplines concerned with the study and application of computations. These disciplines range from the pure and basic scientific

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

Computational Theory

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

More information

Decidability (intro.)

Decidability (intro.) CHAPTER 4 Decidability Contents Decidable Languages decidable problems concerning regular languages decidable problems concerning context-free languages The Halting Problem The diagonalization method The

More information

Student#: CISC-462 Exam, December XY, 2017 Page 1 of 12

Student#: CISC-462 Exam, December XY, 2017 Page 1 of 12 Student#: CISC-462 Exam, December XY, 2017 Page 1 of 12 Queen s University, Faculty of Arts and Science, School of Computing CISC-462 Final Exam, December XY, 2017 (Instructor: Kai Salomaa) INSTRUCTIONS

More information