# Automata and Languages

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Automata and Languages Computational Models: An idealized mathematical model of a computer. A computational model may be accurate in some ways but not in others. We shall be defining increasingly powerful models of computation. We begin with the simplest model of computation called the finite state machine or finite automaton. Finite Automata: The finite State automaton (FSA): has a central processing unit of fixed, finite capacity. has no or an extremely limited amount of memory receives its input as a string, it delivered to it on an input tape. delivers no output, except an indication of whether or not the input is acceptable. Various electromechanical devices are built on the FSA models. In addition, FSA are applicable to the design of several types of algorithms and programs. Case of automatic door controller: Automatic doors swing open when sensing that a person is approaching. An automatic door has a pad in front to detect the presence of a person about to walk through the doorway. Another pad is located to the rear of the doorway so that the controller can hold the door open long enough for the person to pass all the way through. The controller is in either of two states: OPEN or CLOSED representing the corresponding condition of the door.

2 Input signal States Neither Front Rear Both Closed Closed Open Closed Closed Open Closed Open Open Open The central concepts of Automata Theory: -Alphabets: An alphabet is a finite, nonempty set of symbols. Conventionally, we use the symbol Σ for an alphabet. Common alphabets include: 1. Σ = {0,1}, the binary alphabet 2. Σ = {a, b,,z}, the set of all lower case letters 3. The set of ASCII characters or the set of printable ASCII characters. -Strings: A string (or sometimes word) is a finite sequence of symbols chosen from some alphabet. For example is a string from the binary alphabet Σ = {0,1}. The string 111 is another string from this alphabet. The Empty String: The empty string is the string with zero occurrences of symbols. This string denoted ε, is a string that may be chosen from any alphabet whatsoever. Length of a String: If is often useful to classify strings by their length. The length is the number of positions for symbols in the string. For instance, has length 5. The standard notation for the length of a string w is w. For example, 011 = 3 and ε = 0.

3 Powers of an alphabet: If Σ is an alphabet, we can express the set of all strings of a certain length from that alphabet by using exponential notation. We define Σ k to be the set of strings of length k, each of whose symbols is in Σ. Σ 0 = {ε} regardless of the alphabet. That is ε is the only string whose length is 0. if Σ = {0,1}, then Σ 1 = {0,1}, Σ 2 = {00,01,10,11}. What is Σ 3? Confusion between Σ and Σ 1? The former is an alphabet; its members are symbols, The latter is a set of strings, each of which is of length 1. The set of all strings over an alphabet Σ is conventionally denoted Σ *. For instance {0,1} * = {ε, 0, 1, 00, 01, 10, 11, 000,..}. Σ * = Σ 0 Σ 1 Σ 2 Sometimes we wish to exclude the empty string from the set of strings, we then use the set of nonempty strings from alphabet Σ denoted Σ +. Σ + = Σ 1 Σ 2 Σ 3 Σ * = ε Σ + Concatenation of Strings: Let x and y be strings. The xy denotes the concatenation of x and y, that is the string formed by making a copy of x and following it by a copy of y. More precisely, if x is a string composed of i symbols x= a 1 a 2 a 3.a i and y is a string composed of j symbols y = b 1 b 2 b 3 b j, the xy is the string of length i+j: xy= a 1 a 2 a 3.a i b 1 b 2 b 3 b j ε is the identity for the concatenation. Languages: A set of strings chosen from Σ * where Σ is a particular alphabet is called a language. If Σ is an alphabet and L Σ *, the L is a language over Σ.

4 Example of languages: 1. The language of all strings consisting of n 0 s followed by n 1 s, for some n The set of binary numbers whose value is a prime: 3. Σ * is a language for any alphabet Σ 4., the empty language, is a language over any alphabet 5. {ε}, the language consisting of only the empty string. Notice that {ε}, the former has no strings and the latter has one string. Problems: In automata theory, a problem is the question of deciding whether a given string is a member of some particular language. More precisely, if Σ is an alphabet and L is a language over Σ, then the problem is: Given a string w in Σ *, decide whether or not w is in L. Let the following picture depicts a finite automaton called M1: q1 q2 0,1 q3 1,01,11, ,00110? The figure above is called the state diagram of M1: It has three states, labeled q1, q2, and q3. The start state q1 is indicated by the arrow pointing at it from nowhere. The accept state q2 is represented with a double circle The arrows going from one state to another are called transitions. When this automaton receives an input string such as 1101, it processes that string and produces an output. The output is either accept or reject.

5 What language is accepted by the automaton? 1,01,11, ,00110? Formal definition of a finite automaton: A finite automaton is a 5-tuple (Q,,δ, q0, F), where: 1. Q is a finite set called the states 2. is a finite set called the alphabet 3. δ : Q x Q is the transition function 4. q0 Q is the start state, and 5. F Q is the set of accept or final states We can describe M1 formally by writing M1= (Q,, δ, q1, F), where 1. Q ={q1, q2, q3} 2. ={0,1} 3. δ is described as: 0 1 q1 q1 q2 q2 q3 q2 q3 q2 q2 4. q1 is the start state, and 5. F= {q2} δ(q1,0)= q1 δ(q2, 0)= q3 δ(q3, 0)= q2 δ(q1, 1) = q2 δ(q2, 1) = q2 δ(q3, 1) = q2 M= {{q1, q2, q3}, {0, 1},δ q1, {q2}} Notations for DFA s There are two preferred notations for describing automata: 1. A transition diagram, which is a graph.

6 2. A transition table, which is a tabular listing of the δ function. Transition Diagrams: A transition diagram for a DFA M= (Q,,δ, q0, F) is a graph defined as follows: 1. For each state in Q there is a node. 2. For each state q in Q and each input symbol a in, Let δ(q,a) =p then the transition diagram has an arc from node q to node p, labeled a. If there are several input symbols that cause transitions from q to p, then the transition diagram can have one arc, labeled by the list of these symbols. 3. There is an arrow into the start q0, labeled Start. This arrow does not originate at any node 4. Nodes corresponding to accepting states (those in F) are marked by a double circle. 5. States not in F have a single circle. Transition Tables: 1. A transition table is a conventional, tabular representation of a function like δ that takes two arguments and returns a value. 2. The rows of the table correspond to the states and the columns correspond to the inputs. 3. The entry for the row corresponding to state q and the column corresponding to input a is the state δ(q,a). Extending the transition function to Strings:

7 The DFA defines a language which is the set of all strings that result in a sequence of state transitions from the start state to an accepting state. Extended Transition function: If δ be the transition function, then the extended transition function is a function that takes a state q and a string w and returns the state p- The state that the automaton reaches when starting in state q and processing the sequence of input w. We define δˆ by induction on the length of the input string, as follows: BASIS: δˆ (q, ε) = q. That is, if we are in state q and read no inputs, then we are still in state q. Suppose that δˆ (q, x)= p Induction: Suppose w is a string of the form xa; that is a is the last symbol of w and x is the string consisting of all but the last symbol. Then δˆ (q,w) = δ(δˆ (q,x),a), to compute δˆ (q,w), we first compute δˆ (q,x), suppose that the automaton gets to state p, that isδˆ (q,x)=p. Then δˆ (q,w) is what we get by making a transition from state p on input a, the last symbol of w. Thus δˆ (q,w)= δ(p,a) Language of a DFA If A is the set of all strings that machine M accepts, we say that A is the language of machine M and write L(M) = A that M recognizes A or that M accepts A. L(M)= { w Σ* δˆ (q0, w) F} Non acceptance means that the DFA stops in a non final state so that: L (M ) = { w Σ* δˆ (q0, w) F} A machine may accept several strings, but it always recognizes only one language.

8 If a machine accepts no strings, it still recognizes only one language, namely the empty language φ. The language A defined by the Machine M1 is: A = {w w contains at least one 1 and an even number of 0 s follow the last 1} Regular Languages: Definition: A language L is called regular if and only if there exists some deterministic finite automaton M such that L = L(M). To show that a language is regular, it is necessary and sufficient to build a dfa that accepts it. Closure under the regular operations: Theorem: The class of regular languages is closed under the union operation Theorem: The class of regular languages is closed under the concatenation operation Theorem: The class of regular languages is closed under the star operation. Example: Show that the language L = {abw: w {a, b}* } is regular. The only issue here is that the first two symbols of the string. After they have been processed no further decision are needed. Non deterministic and Deterministic computation:

9 So far, we have seen automata in which every step of a computation follows in a unique way from the preceding step. When the machine is in a given state and reads the next symbol, we know the next state it ll be in, it is determined. In a nondeterministic machine several choices exist for the next state at any point. A nondeterministic finite automaton has the power to be in several states at once. Nondeterminism is a generalization of determinism, so every deterministic finite automaton is automatically a nondeterministic finite automaton. Notation: A deterministic finite state automaton is called DFA and a nondeterministic finite state automaton is called NFA. Like the DFA, and NFA has a finite set of states, a finite set of input symbols, one start state and a set of accepting states. The difference between the DFA and the NFA is in the type of transition. For the NFA, the transition function δ takes a state and an input symbol as arguments and returns 0, 1 or more states, rather than returning exactly one state, as the DFA must. 0, q0 q1 q2 An NFA accepting all strings that end in 01

10 Let s assume that we want to test whether this automaton accepts q0 q0 q0 q0 q0 q0 (stuck) q1 q1 q1 (stuck) q2 q2 (successful computation) (stuck) Draw the computation trees for Computation in an NFA: Suppose we are running an NFA on an input string and come to a state with multiple ways to proceed. For example, say that we are in state q1 in NFA N1, and the next input symbol is 1. After reading that symbol, the machine splits into multiple copies of itself and follows all the possibilities in parallel. Each copy of the machine takes one of the possible ways to proceed and continues as before. If there are subsequent choices, the machine splits again. If the next input symbol doesn t appear on any of the arrows exiting the state occupied by a copy of the machine, that copy along with the branch of computation associated with it, die. Finally, if any one of these copies of the machine is in an accept state at the end of the input, the NFA accepts the input string. Nondeterminism can be viewed as a kind of parallel computation wherein multiple independent processes a or threads can be running concurrently. If at least one of these processes accepts, then the entire computation accepts.

11 Representation of the above automaton: N= ({q0, q1, q2}, {0,1}, δ, q0, {q2}) 0 1 q0 {q0,q1} {q0} q1 {q2} *q2 The extended Transition Function: We need to extend the transition function δ to the function δ that takes a state q and a string of input symbols w and returns the set of states that the NFA is in when it starts at in state q and processes the string w. The language of an NFA: An NFA accepts a string w if it is possible to make any sequence of choices of next state, while reading the characters of w and go from the start state to any accepting state. The fact that other choices using the input symbols of w lead to a non accepting state does not prevent w from being accepted by the NFA as a whole. Formally, if N= (Q, Σ, δ, q0, F) L(N)= { w δ (q0, w) F } Finite Automaton with Epsilon-Transition: Another extension of the DFA is to allow transition on ε, the empty string. In effect, this is equivalent to making a transition spontaneously. This new capability does not expand the class of languages that can be accepted by a finite state automaton.

12 Use of ε-transitions: We use transition diagrams with ε allowed as a label. However an ε- transition contributes nothing to the string along the path. 0,1 0,ε 1 q1 q2 q3 1 q4 0,1 Example: ε-nfa that accepts decimal numbers consisting of: 1. An optional + or - sign 2. a string of digits 3. a decimal point 4. another string of digits. Either this string or the string (2) can be empty, but at least one of the strings must be non-empty. Formal definition of a nondeterministic finite automaton: The formal definition of a NFA differs from that of a DFA in one essential way: the type of transition function. In a DFA the transition function takes a state and an input symbol and produces the next state. In an NFA the transition function takes a state and an input symbol or the empty string and produces a set of possible states. Definition: We define the power set P(Q) of set Q to be the collection of all subsets of Q. Definition: For any alphabet we write ε = ε

13 Definition: A nondeterministic finite automaton is a 5-tuple (Q,, δ, q0, F) where, 1. Q is a finite set of states 2. is a finite alphabet 3. δ: Q x ε P(Q) is the transition function 4. q0 Q is the start state and 5. F Q is the set of accept states Differences between a DFA and a NFA: Every state of a DFA has exactly one exiting transition arrow for each symbol of the alphabet. An NFA violates this rule. in a DFA, labels on the transition arrows are symbols from the alphabet. An NFA may have arrows labeled with members of the alphabet or ε Zero, one or many arrows may exit from each state with the label ε Equivalence of NFAs and DFAs: Deterministic and nondeterministic finite automata recognize the same class of languages. We say that two machines are equivalent if they recognize the same language. Theorem:

14 Every nondeterministic finite automaton has an equivalent deterministic finite automaton. If k is the number of states of the NFA, it has 2 k subsets of states. Each subset corresponds to one of the possibilities that the DFA must remember, so the DFA simulating the NFA will have 2 k states. Proof: Let N =(Q,, δ, q0, F) be the NFA recognizing some language A. We construct a DFA M=(Q,, δ, q0, F ) recognizing A. Case 1: N has no ε arrows. 1. Q = P(Q). Every state of M is a set of states of N. (Recall that P(Q) is the set of subsets of Q). 2. For R Q and a let δ (R, a)= {q Q q δ(r, a) for some r R} if R is a state of M, it is also a set of states of N. When M reads a symbol a in a state R, it shows where a takes each state in R. Because each state may go to a set of states, we take the union of all these sets. Another way to write this expression is: δ ( R, a) = Uδ ( r, a) r R 3. q 0 = {q 0 } M starts in the state corresponding to the collection containing just the start state of N. 4. F = {R Q R contains an accept state of N}. The machine M accepts if one of the possible states that N could be in at this point is an accept state. Case 2: Now we consider the ε arrows: For any state R in M, Let E(R) be the collection of states that can be reached from R by going only along ε arrows, including the members of R themselves. Formally, for R Q let

15 E(R)= {q q can be reached from R by traveling along 0 or more ε arrows}. Thus we modify the transition function of M by placing additional states that can be reached by going along ε arrows. Replacing δ (r, a) by E(δ (r, a)) achieves this effect. δ (R, a)= {q Q q E(δ (r, a)) for some r R} The start state is modified by adding all possible states that can be reached from the start state of N along the ε arrow So q 0 =E({q 0 }) Example: Let us illustrate the procedure we gave for converting an NFA into a DFA by using the machine N4 depicted below: a b 2 1 a a, b ε 3 N4=({1,2,3},{a, b},δ, 1, {1}) To construct a DFA that is equivalent to N4, we first determine D s states, D s states are P(Q) or power set of Q. N4 has three states, so we construct D with 2 3 = 8 states, one of each subset of N4 s states. D s={,{1},{2},{3},{1,3},{1,2},{2,3},{1,2,3}} Next, we determine the start and accept states of D. The start state of N4 is E({1}), the set of states of that are reachable from 1 by traveling along ε arrows, plus 1 itself, so E({1})={1,3}.

16 The new accept states are those containing N4 s accept states; thus {{1},{1,2},{1,3},{1,2,3}}. Finally, we determine D s transition function. Each of D s states goes to one place on input a and one place on input b. In D, - state{2} goes to {2,3} on input a, and to {3} on input b - state{1} goes to on a, because no arrows exit it. It goes to {2} on b. - state{3} goes to {1,3} on a, because in N4, state{3} goes to 1 on a and 1 in turn goes to 3 with an ε arrow. - state {3} on b goes to - state{1,2} on a goes to {2,3} because 1 points at no states with a arrows and 2 points at states {2, 3} - state{1,2} on b goes to {2,3} - state{1,3} on a goes to {1,3} - state{1,3} on b goes to {2} - state{1,2,3} on a goes to {1,2,3} - state{1,2,3} on b goes to {2,3} We may simplify this machine by removing unreachable states such as {1} and {1, 2} (c, d) (a,b)

17 REGULAR EXPRESSIONS: In arithmetic, we can use the operation + and x to build up expressions such as (5+3) x 4. Another example of regular expression is (0 1)*. The value of this expression is the language consisting of all possible strings of 0 s and 1 s. If is an alphabet, the regular expression describes the language consisting of all strings of length 1 over this alphabet and * describes the language consisting of all strings over that alphabet. Similarly *1 is the language that contains all strings ending in a 1. Formal Definition of a Regular Expression: We say that R is a regular expression if R is: 1. a for some a in the alphabet 2. ε (R1 R2), where R1 and R2 are regular expressions 5. (R1 R2), where R1 and R2 are regular expressions or 6. (R1*), where R1 is a regular expression. In items 1 and 2, the regular expressions a and ε represent the languages {a}, and {ε}, respectively. In item 3, the regular expression represents the empty language. In items 4, 5, and 6, the expressions represent the languages obtained by taking the union or concatenation of the languages R1 and R2 or the star of the language R1, respectively. Regular expressions are useful tools in the design of compilers for programming languages.

18 Equivalence with finite automata: Regular expressions and finite automata are equivalent in their descriptive power. That is any regular expression can be converted into a finite automaton that recognizes the language and vice versa. Theorem: A language is regular if and only if some regular expression describes it. Lemma: If a language is described by a regular expression, then it is regular. Proof: (page 67) We consider the six cases in the formal definition of regular expressions. We convert the regular expression (ab a)* to an NFA Lemma: If a language is regular, then it is described by a regular expression Algorithm for converting a DFA into an equivalent regular expression: 1. Add two states to the DFA: a start state called s and an accept state called a. This defines a new automaton called G 2. CONVERT(G): CONVERT(G): 1. Let k be the number of states of G 2. If k=2, then G must consist of a start state, an accept state and a single arrow connecting them and labeled with a regular expression R. return R.

19 3. If k >2, we select any state q rip Q different from s and a and let G = (Q,, δ,s, a), where: Q = Q-{q rip } and for any q i Q -{a} and any q j Q -{s} let: δ (q i, q j ) = (R1)(R2)*(R3) R4 for R1= δ(q i, q rip ), R2= δ( q rip, q rip ), R3= δ( q rip, q j ) and R4= δ(q i, q j ) 4. Compute CONVERT(G ) and return this value Non Regular Languages: Pigeonhole Principle: The pigeonhole Principle states that if n pigeons fly into m pigeonholes and n > m then at least one hole must contain two or more pigeons.

20 Pigeonhole Principle: A function from a finite set to a smaller set cannot be one-to-one. There must be at least two elements in the domain that have the same image. Nonregular languages: Because a finite state automaton can assume only a finite number of states and because there are infinitely many input sequences, by the pigeonhole principle, there must be at least one state to which the automaton returns over and over again. This is an essential feature of the automaton. Showing that a language is not regular Example: L= {s * s= 1 n 0 n n 0} If we attempt to find a DFA that recognizes B, we discover that the machine needs to remember how many 0 s have been seen so far as it reads the input. So the machine has to keep track of unlimited number of possibilities, this cannot be done with a finite number of states. In this case, we say that the language B is nonregular. We use the pigeonhole principle to show that B is not regular Proof by contradiction: The Pumping Lemma for regular languages:

21 If A is a regular language, then there is a number p(the pumping length) where, if s is any string in A of length of at least p, then s may be divided into three pieces: 1. for each i 0 xy i z A 2. y > 0 3. xy p Notation: s represents the length of string s. y i means that i copies of y are concatenated together and y 0 equals ε. Proof: Suppose that there is a DFN A that accepts L. [A contradiction will be derived]. Since A has only a finite number of states, these states can be denoted s 1,s 2,.,s n, where n is a positive integer. Consider all inputs strings that consist entirely of 1 s: 1,11,111,1 4, etc.. Now there are infinitely many such strings and only finitely many states. Thus, by the pigeonhole principle, there must be a state s m and two input strings a p and a q with p q such that when either a p or a q are input to A, A goes to state s m. (the pigeons are the strings of a s, the pigeonholes are the states and the correspondences associate each string with the state to which A goes when the string is input). Suppose that A accepts L. Hence A accepts the string 1 p 0 p. This means that after p a s have been input, at which point A is in state s m, inputting p additional b s sends A into an accept state, s q. This also implies that a q b p also sends A to the accept state s q, and so a q b p is accepted by A. Now, we have supposed that L is the language accepted by A. Thus, since s is accepted by A, s L. But by definition of L, L consists of only strings with equal numbers of a s and b s. So, since p q, s L. Hence s L and s L; which is a contradiction. It follows that the supposition is false, and so there is no finite-state automaton that accepts L. Therefore L is not a regular language.

### Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Formal Languages and Automata Theory - Regular Expressions and Finite Automata - Samarjit Chakraborty Computer Engineering and Networks Laboratory Swiss Federal Institute of Technology (ETH) Zürich March

### 6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010. Class 4 Nancy Lynch

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010 Class 4 Nancy Lynch Today Two more models of computation: Nondeterministic Finite Automata (NFAs)

### Regular Languages and Finite State Machines

Regular Languages and Finite State Machines Plan for the Day: Mathematical preliminaries - some review One application formal definition of finite automata Examples 1 Sets A set is an unordered collection

### Regular Expressions and Automata using Haskell

Regular Expressions and Automata using Haskell Simon Thompson Computing Laboratory University of Kent at Canterbury January 2000 Contents 1 Introduction 2 2 Regular Expressions 2 3 Matching regular expressions

### Reading 13 : Finite State Automata and Regular Expressions

CS/Math 24: Introduction to Discrete Mathematics Fall 25 Reading 3 : Finite State Automata and Regular Expressions Instructors: Beck Hasti, Gautam Prakriya In this reading we study a mathematical model

### Finite Automata. Reading: Chapter 2

Finite Automata Reading: Chapter 2 1 Finite Automaton (FA) Informally, a state diagram that comprehensively captures all possible states and transitions that a machine can take while responding to a stream

### Motivation. Automata = abstract computing devices. Turing studied Turing Machines (= computers) before there were any real computers

Motivation Automata = abstract computing devices Turing studied Turing Machines (= computers) before there were any real computers We will also look at simpler devices than Turing machines (Finite State

### Finite Automata. Reading: Chapter 2

Finite Automata Reading: Chapter 2 1 Finite Automata Informally, a state machine that comprehensively captures all possible states and transitions that a machine can take while responding to a stream (or

### Theory of Computation

Theory of Computation For Computer Science & Information Technology By www.thegateacademy.com Syllabus Syllabus for Theory of Computation Regular Expressions and Finite Automata, Context-Free Grammar s

### Automata and Computability. Solutions to Exercises

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

### CSC4510 AUTOMATA 2.1 Finite Automata: Examples and D efinitions Definitions

CSC45 AUTOMATA 2. Finite Automata: Examples and Definitions Finite Automata: Examples and Definitions A finite automaton is a simple type of computer. Itsoutputislimitedto yes to or no. It has very primitive

### The Halting Problem is Undecidable

185 Corollary G = { M, w w L(M) } is not Turing-recognizable. Proof. = ERR, where ERR is the easy to decide language: ERR = { x { 0, 1 }* x does not have a prefix that is a valid code for a Turing machine

### C H A P T E R Regular Expressions regular expression

7 CHAPTER Regular Expressions Most programmers and other power-users of computer systems have used tools that match text patterns. You may have used a Web search engine with a pattern like travel cancun

### 6.080/6.089 GITCS Feb 12, 2008. Lecture 3

6.8/6.89 GITCS Feb 2, 28 Lecturer: Scott Aaronson Lecture 3 Scribe: Adam Rogal Administrivia. Scribe notes The purpose of scribe notes is to transcribe our lectures. Although I have formal notes of my

### Finite Automata and Formal Languages

Finite Automata and Formal Languages TMV026/DIT321 LP4 2011 Lecture 14 May 19th 2011 Overview of today s lecture: Turing Machines Push-down Automata Overview of the Course Undecidable and Intractable Problems

### Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi

Automata Theory Automata theory is the study of abstract computing devices. A. M. Turing studied an abstract machine that had all the capabilities of today s computers. Turing s goal was to describe the

### CSE 135: Introduction to Theory of Computation Decidability and Recognizability

CSE 135: Introduction to Theory of Computation Decidability and Recognizability Sungjin Im University of California, Merced 04-28, 30-2014 High-Level Descriptions of Computation Instead of giving a Turing

### Deterministic Finite Automata

1 Deterministic Finite Automata Definition: A deterministic finite automaton (DFA) consists of 1. a finite set of states (often denoted Q) 2. a finite set Σ of symbols (alphabet) 3. a transition function

### Regular Languages and Finite Automata

Regular Languages and Finite Automata 1 Introduction Hing Leung Department of Computer Science New Mexico State University Sep 16, 2010 In 1943, McCulloch and Pitts [4] published a pioneering work on a

### Automata and Formal Languages

Automata and Formal Languages Winter 2009-2010 Yacov Hel-Or 1 What this course is all about This course is about mathematical models of computation We ll study different machine models (finite automata,

### Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras

Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture No. # 31 Recursive Sets, Recursively Innumerable Sets, Encoding

### Automata on Infinite Words and Trees

Automata on Infinite Words and Trees Course notes for the course Automata on Infinite Words and Trees given by Dr. Meghyn Bienvenu at Universität Bremen in the 2009-2010 winter semester Last modified:

### CS 3719 (Theory of Computation and Algorithms) Lecture 4

CS 3719 (Theory of Computation and Algorithms) Lecture 4 Antonina Kolokolova January 18, 2012 1 Undecidable languages 1.1 Church-Turing thesis Let s recap how it all started. In 1990, Hilbert stated a

### Computing Functions with Turing Machines

CS 30 - Lecture 20 Combining Turing Machines and Turing s Thesis Fall 2008 Review Languages and Grammars Alphabets, strings, languages Regular Languages Deterministic Finite and Nondeterministic Automata

### Finite Automata and Regular Languages

CHAPTER 3 Finite Automata and Regular Languages 3. Introduction 3.. States and Automata A finite-state machine or finite automaton (the noun comes from the Greek; the singular is automaton, the Greek-derived

### (IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

3130CIT: Theory of Computation Turing machines and undecidability (IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems. An undecidable problem

### Scanner. tokens scanner parser IR. source code. errors

Scanner source code tokens scanner parser IR errors maps characters into tokens the basic unit of syntax x = x + y; becomes = + ; character string value for a token is a lexeme

### 3515ICT Theory of Computation Turing Machines

Griffith University 3515ICT Theory of Computation Turing Machines (Based loosely on slides by Harald Søndergaard of The University of Melbourne) 9-0 Overview Turing machines: a general model of computation

### Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

Mathematics for Computer Science/Software Engineering Notes for the course MSM1F3 Dr. R. A. Wilson October 1996 Chapter 1 Logic Lecture no. 1. We introduce the concept of a proposition, which is a statement

### CHAPTER 3 Numbers and Numeral Systems

CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,

### Computational Models Lecture 8, Spring 2009

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown Univ. p. 1 Computational Models Lecture 8, Spring 2009 Encoding of TMs Universal Turing Machines The Halting/Acceptance

### 1 Definition of a Turing machine

Introduction to Algorithms Notes on Turing Machines CS 4820, Spring 2012 April 2-16, 2012 1 Definition of a Turing machine Turing machines are an abstract model of computation. They provide a precise,

### Compiler Construction

Compiler Construction Regular expressions Scanning Görel Hedin Reviderad 2013 01 23.a 2013 Compiler Construction 2013 F02-1 Compiler overview source code lexical analysis tokens intermediate code generation

### Lecture I FINITE AUTOMATA

1. Regular Sets and DFA Lecture I Page 1 Lecture I FINITE AUTOMATA Lecture 1: Honors Theory, Spring 02, Yap We introduce finite automata (deterministic and nondeterministic) and regular languages. Some

### GROUPS SUBGROUPS. Definition 1: An operation on a set G is a function : G G G.

Definition 1: GROUPS An operation on a set G is a function : G G G. Definition 2: A group is a set G which is equipped with an operation and a special element e G, called the identity, such that (i) the

### Pushdown automata. Informatics 2A: Lecture 9. Alex Simpson. 3 October, 2014. School of Informatics University of Edinburgh als@inf.ed.ac.

Pushdown automata Informatics 2A: Lecture 9 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 3 October, 2014 1 / 17 Recap of lecture 8 Context-free languages are defined by context-free

### Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2 Proofs Intuitively, the concept of proof should already be familiar We all like to assert things, and few of us

### 8 Divisibility and prime numbers

8 Divisibility and prime numbers 8.1 Divisibility In this short section we extend the concept of a multiple from the natural numbers to the integers. We also summarize several other terms that express

CS5236 Advanced Automata Theory Frank Stephan Semester I, Academic Year 2012-2013 Advanced Automata Theory is a lecture which will first review the basics of formal languages and automata theory and then

### Full and Complete Binary Trees

Full and Complete Binary Trees Binary Tree Theorems 1 Here are two important types of binary trees. Note that the definitions, while similar, are logically independent. Definition: a binary tree T is full

### ECS 120 Lesson 17 Church s Thesis, The Universal Turing Machine

ECS 120 Lesson 17 Church s Thesis, The Universal Turing Machine Oliver Kreylos Monday, May 7th, 2001 In the last lecture, we looked at the computation of Turing Machines, and also at some variants of Turing

### COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

### Pushdown Automata. place the input head on the leftmost input symbol. while symbol read = b and pile contains discs advance head remove disc from pile

Pushdown Automata In the last section we found that restricting the computational power of computing devices produced solvable decision problems for the class of sets accepted by finite automata. But along

### T-79.186 Reactive Systems: Introduction and Finite State Automata

T-79.186 Reactive Systems: Introduction and Finite State Automata Timo Latvala 14.1.2004 Reactive Systems: Introduction and Finite State Automata 1-1 Reactive Systems Reactive systems are a class of software

### Introduction to Automata Theory. Reading: Chapter 1

Introduction to Automata Theory Reading: Chapter 1 1 What is Automata Theory? Study of abstract computing devices, or machines Automaton = an abstract computing device Note: A device need not even be a

### Handout #1: Mathematical Reasoning

Math 101 Rumbos Spring 2010 1 Handout #1: Mathematical Reasoning 1 Propositional Logic A proposition is a mathematical statement that it is either true or false; that is, a statement whose certainty or

### Properties of Stabilizing Computations

Theory and Applications of Mathematics & Computer Science 5 (1) (2015) 71 93 Properties of Stabilizing Computations Mark Burgin a a University of California, Los Angeles 405 Hilgard Ave. Los Angeles, CA

### CMPSCI 250: Introduction to Computation. Lecture #19: Regular Expressions and Their Languages David Mix Barrington 11 April 2013

CMPSCI 250: Introduction to Computation Lecture #19: Regular Expressions and Their Languages David Mix Barrington 11 April 2013 Regular Expressions and Their Languages Alphabets, Strings and Languages

### CS 103X: Discrete Structures Homework Assignment 3 Solutions

CS 103X: Discrete Structures Homework Assignment 3 s Exercise 1 (20 points). On well-ordering and induction: (a) Prove the induction principle from the well-ordering principle. (b) Prove the well-ordering

### 6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 2008

MIT OpenCourseWare http://ocw.mit.edu 6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

### Deterministic Push-Down Store Automata

Deterministic Push-Down tore Automata 1 Context-Free Languages A B C D... A w 0 w 1 D...E The languagea n b n : a b ab 2 Finite-tate Automata 3 Pushdown Automata Pushdown automata (pda s) is an fsa with

### MODULAR ARITHMETIC. a smallest member. It is equivalent to the Principle of Mathematical Induction.

MODULAR ARITHMETIC 1 Working With Integers The usual arithmetic operations of addition, subtraction and multiplication can be performed on integers, and the result is always another integer Division, on

### 1 Introduction to Counting

1 Introduction to Counting 1.1 Introduction In this chapter you will learn the fundamentals of enumerative combinatorics, the branch of mathematics concerned with counting. While enumeration problems can

### 7 Relations and Functions

7 Relations and Functions In this section, we introduce the concept of relations and functions. Relations A relation R from a set A to a set B is a set of ordered pairs (a, b), where a is a member of A,

### Informatique Fondamentale IMA S8

Informatique Fondamentale IMA S8 Cours 1 - Intro + schedule + finite state machines Laure Gonnord http://laure.gonnord.org/pro/teaching/ Laure.Gonnord@polytech-lille.fr Université Lille 1 - Polytech Lille

### Honors Class (Foundations of) Informatics. Tom Verhoeff. Department of Mathematics & Computer Science Software Engineering & Technology

Honors Class (Foundations of) Informatics Tom Verhoeff Department of Mathematics & Computer Science Software Engineering & Technology www.win.tue.nl/~wstomv/edu/hci c 2011, T. Verhoeff @ TUE.NL 1/20 Information

### 3 Some Integer Functions

3 Some Integer Functions A Pair of Fundamental Integer Functions The integer function that is the heart of this section is the modulo function. However, before getting to it, let us look at some very simple

### Regular Expressions. Languages. Recall. A language is a set of strings made up of symbols from a given alphabet. Computer Science Theory 2

Regular Expressions Languages Recall. A language is a set of strings made up of symbols from a given alphabet. Computer Science Theory 2 1 String Recognition Machine Given a string and a definition of

### CS154. Turing Machines. Turing Machine. Turing Machines versus DFAs FINITE STATE CONTROL AI N P U T INFINITE TAPE. read write move.

CS54 Turing Machines Turing Machine q 0 AI N P U T IN TAPE read write move read write move Language = {0} q This Turing machine recognizes the language {0} Turing Machines versus DFAs TM can both write

### Turing Machines: An Introduction

CIT 596 Theory of Computation 1 We have seen several abstract models of computing devices: Deterministic Finite Automata, Nondeterministic Finite Automata, Nondeterministic Finite Automata with ɛ-transitions,

### Applications of Methods of Proof

CHAPTER 4 Applications of Methods of Proof 1. Set Operations 1.1. Set Operations. The set-theoretic operations, intersection, union, and complementation, defined in Chapter 1.1 Introduction to Sets are

### 26 Integers: Multiplication, Division, and Order

26 Integers: Multiplication, Division, and Order Integer multiplication and division are extensions of whole number multiplication and division. In multiplying and dividing integers, the one new issue

### ω-automata Automata that accept (or reject) words of infinite length. Languages of infinite words appear:

ω-automata ω-automata Automata that accept (or reject) words of infinite length. Languages of infinite words appear: in verification, as encodings of non-terminating executions of a program. in arithmetic,

### Computability Theory

CSC 438F/2404F Notes (S. Cook and T. Pitassi) Fall, 2014 Computability Theory This section is partly inspired by the material in A Course in Mathematical Logic by Bell and Machover, Chap 6, sections 1-10.

### 1. LINEAR EQUATIONS. A linear equation in n unknowns x 1, x 2,, x n is an equation of the form

1. LINEAR EQUATIONS A linear equation in n unknowns x 1, x 2,, x n is an equation of the form a 1 x 1 + a 2 x 2 + + a n x n = b, where a 1, a 2,..., a n, b are given real numbers. For example, with x and

### THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER

THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER JASPER DEANTONIO Abstract. This paper is a study of the Turing Degrees, which are levels of incomputability naturally arising from sets of natural numbers.

### NUMBER SYSTEMS. William Stallings

NUMBER SYSTEMS William Stallings The Decimal System... The Binary System...3 Converting between Binary and Decimal...3 Integers...4 Fractions...5 Hexadecimal Notation...6 This document available at WilliamStallings.com/StudentSupport.html

### Fundamentele Informatica II

Fundamentele Informatica II Answer to selected exercises 1 John C Martin: Introduction to Languages and the Theory of Computation M.M. Bonsangue (and J. Kleijn) Fall 2011 Let L be a language. It is clear

### Automata and Rational Numbers

Automata and Rational Numbers Jeffrey Shallit School of Computer Science University of Waterloo Waterloo, Ontario N2L 3G1 Canada shallit@cs.uwaterloo.ca http://www.cs.uwaterloo.ca/~shallit 1/40 Representations

### a 11 x 1 + a 12 x 2 + + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + + a 2n x n = b 2.

Chapter 1 LINEAR EQUATIONS 1.1 Introduction to linear equations A linear equation in n unknowns x 1, x,, x n is an equation of the form a 1 x 1 + a x + + a n x n = b, where a 1, a,..., a n, b are given

### Genetic programming with regular expressions

Genetic programming with regular expressions Børge Svingen Chief Technology Officer, Open AdExchange bsvingen@openadex.com 2009-03-23 Pattern discovery Pattern discovery: Recognizing patterns that characterize

### 2. Methods of Proof Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try.

2. METHODS OF PROOF 69 2. Methods of Proof 2.1. Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try. Trivial Proof: If we know q is true then

### Continued Fractions and the Euclidean Algorithm

Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

### Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

Chapter 3 Cartesian Products and Relations The material in this chapter is the first real encounter with abstraction. Relations are very general thing they are a special type of subset. After introducing

### Mathematics Review for MS Finance Students

Mathematics Review for MS Finance Students Anthony M. Marino Department of Finance and Business Economics Marshall School of Business Lecture 1: Introductory Material Sets The Real Number System Functions,

### . 0 1 10 2 100 11 1000 3 20 1 2 3 4 5 6 7 8 9

Introduction The purpose of this note is to find and study a method for determining and counting all the positive integer divisors of a positive integer Let N be a given positive integer We say d is a

### Lecture 2: Universality

CS 710: Complexity Theory 1/21/2010 Lecture 2: Universality Instructor: Dieter van Melkebeek Scribe: Tyson Williams In this lecture, we introduce the notion of a universal machine, develop efficient universal

### Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

### Cartesian Products and Relations

Cartesian Products and Relations Definition (Cartesian product) If A and B are sets, the Cartesian product of A and B is the set A B = {(a, b) :(a A) and (b B)}. The following points are worth special

### 1. Prove that the empty set is a subset of every set.

1. Prove that the empty set is a subset of every set. Basic Topology Written by Men-Gen Tsai email: b89902089@ntu.edu.tw Proof: For any element x of the empty set, x is also an element of every set since

### Lies My Calculator and Computer Told Me

Lies My Calculator and Computer Told Me 2 LIES MY CALCULATOR AND COMPUTER TOLD ME Lies My Calculator and Computer Told Me See Section.4 for a discussion of graphing calculators and computers with graphing

### Testing LTL Formula Translation into Büchi Automata

Testing LTL Formula Translation into Büchi Automata Heikki Tauriainen and Keijo Heljanko Helsinki University of Technology, Laboratory for Theoretical Computer Science, P. O. Box 5400, FIN-02015 HUT, Finland

### Formal Deænition of Finite Automaton. 1. Finite set of states, typically Q. 2. Alphabet of input symbols, typically æ.

Formal Denition of Finite Automaton 1. Finite set of states, typically Q. 2. Alphabet of input symbols, typically. 3. One state is the startèinitial state, typically q 0. 4. Zero or more nalèaccepting

### Inf1A: Deterministic Finite State Machines

Lecture 2 InfA: Deterministic Finite State Machines 2. Introduction In this lecture we will focus a little more on deterministic Finite State Machines. Also, we will be mostly concerned with Finite State

### 4.1. Definitions. A set may be viewed as any well defined collection of objects, called elements or members of the set.

Section 4. Set Theory 4.1. Definitions A set may be viewed as any well defined collection of objects, called elements or members of the set. Sets are usually denoted with upper case letters, A, B, X, Y,

### INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING DUNDIGAL 500 043, HYDERABAD COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Name : FORMAL LANGUAGES AND AUTOMATA THEORY Code : A40509 Class : II B. Tech II

### An Exponential Gap between LasVegas and Deterministic Sweeping Finite Automata

An Exponential Gap between LasVegas and Deterministic Sweeping Finite Automata Christos Kapoutsis, Richard Královič, and Tobias Mömke Department of Computer Science, ETH Zürich Abstract. A two-way finite

### PART I. THE REAL NUMBERS

PART I. THE REAL NUMBERS This material assumes that you are already familiar with the real number system and the representation of the real numbers as points on the real line. I.1. THE NATURAL NUMBERS

### Mathematical Induction

Mathematical Induction (Handout March 8, 01) The Principle of Mathematical Induction provides a means to prove infinitely many statements all at once The principle is logical rather than strictly mathematical,

### 6.3 Conditional Probability and Independence

222 CHAPTER 6. PROBABILITY 6.3 Conditional Probability and Independence Conditional Probability Two cubical dice each have a triangle painted on one side, a circle painted on two sides and a square painted

### Lecture 2: Regular Languages [Fa 14]

Caveat lector: This is the first edition of this lecture note. Please send bug reports and suggestions to jeffe@illinois.edu. But the Lord came down to see the city and the tower the people were building.

### I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

I GROUPS: BASIC DEFINITIONS AND EXAMPLES Definition 1: An operation on a set G is a function : G G G Definition 2: A group is a set G which is equipped with an operation and a special element e G, called

### Notes on Complexity Theory Last updated: August, 2011. Lecture 1

Notes on Complexity Theory Last updated: August, 2011 Jonathan Katz Lecture 1 1 Turing Machines I assume that most students have encountered Turing machines before. (Students who have not may want to look

### Quotient Rings and Field Extensions

Chapter 5 Quotient Rings and Field Extensions In this chapter we describe a method for producing field extension of a given field. If F is a field, then a field extension is a field K that contains F.

### Figure 2.1(a) Bistable element circuit.

3.1 Bistable Element Let us look at the inverter. If you provide the inverter input with a 1, the inverter will output a 0. If you do not provide the inverter with an input (that is neither a 0 nor a 1),

### Graph Theory Problems and Solutions

raph Theory Problems and Solutions Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles November, 005 Problems. Prove that the sum of the degrees of the vertices of any finite graph is

### Introduction to Finite Automata

Introduction to Finite Automata Our First Machine Model Captain Pedro Ortiz Department of Computer Science United States Naval Academy SI-340 Theory of Computing Fall 2012 Captain Pedro Ortiz (US Naval