Notes on Finite Automata

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

Chapter 5. Finite Automata

Deterministic Finite Automaton (DFA)

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

Deterministic Finite Automata (DFAs)

Sri vidya college of engineering and technology

Deterministic Finite Automata (DFAs)

ECS 120 Lesson 15 Turing Machines, Pt. 1

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

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

Finite Automata. Finite Automata

Johns Hopkins Math Tournament Proof Round: Automata

Deterministic Finite Automata (DFAs)

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Theory of Computation. Copyright By NODIA & COMPANY

Nondeterministic finite automata

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

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

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

Theory of Computation Lecture 1. Dr. Nahla Belal

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

CSE 105 Theory of Computation

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

Part I: Definitions and Properties

Name: Student ID: Instructions:

Finite Automata. Mahesh Viswanathan

Computer Sciences Department

Turing Machines Part III

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

1. Induction on Strings

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

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

Theory of Computation

Computational Models #1

Introduction to Turing Machines. Reading: Chapters 8 & 9

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

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

Finite-State Machines (Automata) lecture 12

Finite State Machines 2

Models of Computation. by Costas Busch, LSU

UNIT-III REGULAR LANGUAGES

Theory of computation: initial remarks (Chapter 11)

Kleene Algebras and Algebraic Path Problems

Turing machines COMS Ashley Montanaro 21 March Department of Computer Science, University of Bristol Bristol, UK

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

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin

Nondeterministic Finite Automata

Uses of finite automata

Chapter Two: Finite Automata

Turing s thesis: (1930) Any computation carried out by mechanical means can be performed by a Turing Machine

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Deterministic finite Automata

Nondeterminism and Epsilon Transitions

Theory Bridge Exam Example Questions

Theory of Computation

About the relationship between formal logic and complexity classes

Deterministic Finite Automata (DFAs)

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

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

Finite State Automata Design

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

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

Automata, Logic and Games: Theory and Application

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

Section 14.1 Computability then else

Languages, regular languages, finite automata

Advanced topic: Space complexity

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

Automata Theory for Presburger Arithmetic Logic

Introduction to Automata

CPSC 421: Tutorial #1

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

CSE 105 THEORY OF COMPUTATION

Constructions on Finite Automata

Opleiding Informatica

The Turing Machine. CSE 211 (Theory of Computation) The Turing Machine continued. Turing Machines

1 More finite deterministic automata

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

Lecture notes on Turing machines

(a) Definition of TMs. First Problem of URMs

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

UNIT-VIII COMPUTABILITY THEORY

UNIT-I. Strings, Alphabets, Language and Operations

Computability and Complexity

Notes on State Minimization

Announcements. Problem Set 6 due next Monday, February 25, at 12:50PM. Midterm graded, will be returned at end of lecture.

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.

Closure under the Regular Operations

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 8 Nancy Lynch

On Rice s theorem. Hans Hüttel. October 2001

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Lecture 23 : Nondeterministic Finite Automata DRAFT Connection between Regular Expressions and Finite Automata


Computational Models - Lecture 1 1

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Finite Automata and Languages

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Final Exam Comments. UVa - cs302: Theory of Computation Spring < Total

Chapter 2: Finite Automata

Theory of computation: initial remarks (Chapter 11)

Introduction to Theoretical Computer Science. Motivation. Automata = abstract computing devices

Transcription:

Notes on Finite Automata Turing machines are widely considered to be the abstract proptotype of digital computers; workers in the field, however, have felt more and more that the notion of a Turing machine is too general to serve as an accurate model of actual computers. It is well known that even for simple calculations it is impossible to give an a priori upper bound on the amount of tape a Turing machine will need for any given computation. It is precisely this feature that renders Turing s concept unrealistic. In the last few years the idea of a finite automaton has appeared in the literature. These are machines having only a finite number of internal states that can be used for memory and computation. The restriction of finiteness appears to give a better approximation to the idea of a physical machine. Of course, such machines cannot do as much as Turing machines, but the advantage of being able to compute an arbitrary general recursive function is questionable, since very few of these functions come up in practical applications. From the Introduction to Finite Automata and their Decision Problems, Rabin & Scott, IBM Journal, April 959, pp4-25.s 0. The intuitive model and basic definitions Again, we quote from Rabin and Scott: An automaton will be considered as a black box of which questions can be asked and from which a yes or no answer is obtained. The number of questions that can be asked will be infinite, adn for simplicity aquestionisinterpretedasanyarbitraryfinitesequenceofsymbols from a finite alphabet given in advance....... we shall... think of the question as given on one-dimensional tapes. The machine will be endowed with a reading head which can read one square of the tape (i.e. one symbol) at a time, and then it can advance the tape one unit and read, say, the next square to the right.

Informatics We assume the machine stops when it runs out of tape. So much for the external character of an automaton. The internal workings of an automaton will not be analyzed too deeply. We are not concerned with how the machine is built but with what it can do. The definition of the internal structure must be general enough to cover all conceivable machines, but it need not involve itself with problems of circuitry. The simple method of obtaining generality without unnecessary detail is to use the concept of internal states. No matter how many wiresor tubes or relays the machine contains, its operation is determined by stable states of the machine at discrete time intervals. An actual existing machine may have billions of such internal states, but the number is not important from the theoretical standpoint only the fact that it is finite.... if we make a table of all the transitions from a state and a symbol to a new state, then the whole action of the machine is essentially described. Finally, to get an answer from the machine,... we need only distinguish.. those states in which the yes light is on... The whole machine is described when a class of designated states corresponding to the yes answers is given. ibid., ChapterI.p5. Here is Rabin and Scott s formal definition of an automaton. Definition. A(finite)automatonoverthealphabet isasystem A = hq,,q 0, A, Ni, where Q is a finite non-empty set (the internal states of A), the alphabet isaset whose elements we call symbols, thenext-state function N is a function defined on the Cartesian product Q ofallpairsofstatesandsymbolstogivevaluesinq (defining transitions or moves of A), the initial state q 0 2 Q is an element of Q (of A), and A Q is a subset of Q (the final, oraccepting states of A). This definition has stood the test of time. For small automata, it is often helpful to draw a transition graph rather than listing the various elements of the formal definition. Each state is represented by a node in this graph, and there is an arrow a transition labelled a from state s to state t i t = M(s, a). We use circles to represent the nodes (states). We use The symbol A is a capital A in the Fraktur or Gothic typeface. Typesetting in Fraktur fractured, or broken type, known in German as Gebrochene Schrift was common in Germanspeaking countries until the mid 20th century. Individual Fraktur letters are often used in mathematics: 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 Michael Fourman 204,205 2

Informatics an arrow, which looks just like an unlabelled transition coming from nowhere, to indicate the starting state, s 0, and a double ring around each accepting state t 2 F. To recap, states are nodes and transitions are labelled arrows in a directed graph. The start state is indicated by an arrow, coming from nowhere. An accepting state is indicated by a double border. Each transition is labelled with a symbol from the alphabet. Examples 2. We start with two complementary examples. 2.: Here is an automaton (we call it even) thatacceptsbinarynumbers(strings of zeros and ones) divisible by 2. 0 0 even Start 0 This machine is simple. Its alphabet is {0, }. The transitions labelled 0 end in state 0, and the transitions labelled end in state. So this machine starts in state 0, then moves from state-to-state, as required to ensure that its state always corresponds to the last symbol read. 2.2: We can change the accepting state to create a machine (odd) thataccepts exactly the odd binary numbers. 0 0 odd Start 0 These examples are complementary in the sense that they give complementary answers: one answers, Yes, when the other answers, No, and vice versa. We can create a similar complement for any machine, simply by replacing F S by its complement, F = S \ F,inthedefinition. Taking stock, we have seen that a finite automaton can recognise the di erence between odd and even binary numbers this is not surprising: we can even say it would be odd if it could not! c Michael Fourman 204,205 3

Informatics Examples 3. Moving from two to three gives three more interesting examples. 0 0 0 mod 3 0 2 0 mod 3 0 0 0 2 0 0 0 2 mod 3 0 2 0 These three machines share the same set of states, and the same transition function. These keep track of the value mod 3, of the binary number they have seen. If we write b for some sequence of binary digits, and JbK for the number it represents, then Jb 0K =2 JbK and Jb K =2 JbK + For example, if b =then,jbk =7,andwehave, J0K =4 and JK =5 Now 7 mod 3= sothetwoequations,4mod 3=2,and5mod 3=0,correspond to the two transitions from state, to state 2 and state 0 respectively. These values correspond to the middle row of the full transition function igiven by the following table: JbK mod 3 Jb 0K mod 3 Jb K mod 3 0 0 2 0 2 2 where each entry in the JbK mod 3columncorrespondstoadi erentcurrentstate, and the two following columns give the next state determined by the input of a 0 or, respectively. By a tape we shall understand any finite sequence of symbols from. A machine processes an input tape by starting its start state, s 0,thenfollowingaseriesof transitions, from state-to-state, whose labels correspond to the sequence of symbols c Michael Fourman 204,205 4

Informatics on the tape. 2 The sequence of states visited by this process is called the trace of the computation. For example, for both machines in Example 2 above, the trace for an input x is just 0x. The set of all tapes is denoted by,thesetoffinitesequencesofsymbols, which includes the empty tape with no symbols, denoted by. For each input tape x =(x,...,x n ), where n is the length of x, thetraceisafinitesequenceof states, that is, an element of S. Definition 4. For a machine M with alphabet, and a tape x =(x 0,...,x n ) 2 the trace T(M,x) 2 S is the sequence (s 0,...,s n )ofstateswheres 0 is the starting state of M and the remaining steps are defined by induction: s i+ = M(s i,x i ) We also extend the function M, definedons, to a function M defined on S. To process we do nothing. M(s, ) = s M(s, x )=M(M(s, x), ) To process x first process x then step to the state determined by. So, if the machine A =(S, M, s 0,F)processesatapex starting from s 0,itwill terminate in the state t = M(s 0,x), and give the answer yes just in case t 2 F. This is a natural definition. Every symbol can be viewed as a tape of length. The definition of the automaton determines the values of M(s, ), and this definition extends the function so that M(s, xy) =M(M(s, x),y). To process xy first process x and then process y. In presenting examples, we may present M as a partial function: for some state-symbol pairs we show no next state. We can view this, for the time being, as short-hand for a machine with a distinguished sink state, or black hole from which there is no escape. We don t show the black hole state, and for any state-symbol pair that is not shown the convention is that the next state is the black hole (which is not an accepting state). once a trace falls into a black hole, it cannot escape. 2 Once a symbol has been read, the tape moves on. In this model of computation there is no going back to look at the same symbol twice. c Michael Fourman 204,205 5

Informatics Theorem 5. No finite automaton can recognise the language 0 n n n 2 N, that consists of strings that consist of some number of zeros follwed by the same number of ones. Proof. Let M be a DFA with k(> 0) states. Let n =2 k. Thenanytraceofthe states (x,...,x n )visitedforaninputofn zeros in succession, must visit some state more than once, say s = x p = x q,wherep<q. Now consider the traces for the following two input sequences: let a i be the trace of states visited for the sequence of q zeros followed by q ones; let b j be the trace of states visited for the sequence of p zeros followed by q ones. By construction a q = b p = s. Beyondthis state, both inputs continue with q ones, so, by induction on i, a q+i = b p+i for all i apple q. In particular, the two traces end in the same state, but one input has equal numbers of ones and zeros, while the other does not. c Michael Fourman 204,205 6