Theory of Computing Lecture 23 MAS 714 Hartmut Klauck.

Slides:



Advertisements
Similar presentations
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Advertisements

Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
CSE 311 Foundations of Computing I
4b Lexical analysis Finite Automata
Lecture 16 Deterministic Turing Machine (DTM) Finite Control tape head.
Lecture 24 MAS 714 Hartmut Klauck
Lecture 6 Nondeterministic Finite Automata (NFA)
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
CS21 Decidability and Tractability
Introduction to Computability Theory
NFAs Sipser 1.2 (pages 47–54). CS 311 Fall Recall… Last time we showed that the class of regular languages is closed under: –Complement –Union.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
CS5371 Theory of Computation
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata (cont.) Prof. Amos Israeli.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
Theory of Computing Lecture 20 MAS 714 Hartmut Klauck.
Theory of Computing Lecture 22 MAS 714 Hartmut Klauck.
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
CSE 311: Foundations of Computing Fall 2014 Lecture 23: State Minimization, NFAs.
Theory of Computing Lecture 19 MAS 714 Hartmut Klauck.
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 language,
Theory of Computing Lecture 15 MAS 714 Hartmut Klauck.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
1 Unit 1: Automata Theory and Formal Languages Readings 1, 2.2, 2.3.
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
Athasit Surarerks THEORY OF COMPUTATION 07 NON-DETERMINISTIC FINITE AUTOMATA 1.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
Theory of Computing Lecture 21 MAS 714 Hartmut Klauck.
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
CS 203: Introduction to Formal Languages and Automata
Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
The decidability of Presburger Arithmetic By Guillermo Guillen 04/13/05 Dr. Smith COT 6421 FIU Spring 2005.
Finite Automata Great Theoretical Ideas In Computer Science Victor Adamchik Danny Sleator CS Spring 2010 Lecture 20Mar 30, 2010Carnegie Mellon.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
 2004 SDU Lecture4 Regular Expressions.  2004 SDU 2 Regular expressions A third way to view regular languages. Say that R is a regular expression if.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
Lexical analysis Finite Automata
PROPERTIES OF REGULAR LANGUAGES
CSE 105 theory of computation
CSE 105 theory of computation
CSE 105 theory of computation
Hierarchy of languages
Alternating tree Automata and Parity games
COSC 3340: Introduction to Theory of Computation
4. Properties of Regular Languages
Decidable Languages Costas Busch - LSU.
Finite Automata.
4b Lexical analysis Finite Automata
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Chapter 1 Regular Language - 02
4b Lexical analysis Finite Automata
Instructor: Aaron Roth
CSE 105 theory of computation
Chapter 1 Regular Language
Instructor: Aaron Roth
CSE 105 theory of computation
Presentation transcript:

Theory of Computing Lecture 23 MAS 714 Hartmut Klauck

The game Two players, Alice and Bob Alice receives an input x 2 § * Bob receives y 2 § * Alice sends a message to Bob, who decides whether x ± y 2 L – ± : concatenation, we will also just write xy Cost of the game: number of messages used

DFA and the game Theorem [DFA vs. game]: – If L is regular, then the optimal number of messages in the game is equal to the smallest number of states in a DFA. – If L is not regular, then the smallest number of messages is infinite

Application How to show that we need many messages? Consider the infinite matrix M, rows labeled with x 2 § * and columns labeled with y 2 § * and M[x,y]=1 iff xy 2 L Call this matrix the communication matrix of L Lemma: The minimum number of messages in the game is equal to the number of distinct rows in the matrix

Proof Two rows labeled x, x’ are distinct if there is a column y where M[x,y]=1 and M[x’,y]=0 – or vice versa If Alice sends the same message on x and x’ Bob cannot distinguish x and x’, so there is an error on xy or on x’y On the other hand it is enough for Alice to send the same message for rows that are not distinct

Examples Parity: M has two distinct rows – one for x with odd number of 1’s and for even {0 n 1 n }: – Consider the rows labeled 0 k for all k=1,…, 1 – The rows are all different Conclusion: {0 n 1 n : n natural} is not a regular language Note: We can consider subsets of the rows and columns of M and show that this submatrix has infinitely many distinct rows. Then M also has infinitely many distinct rows

Example L={xx: x 2 {0,1}* } is not regular Proof: we need to show the number of distinct rows is infinite Consider the rows and columns labeled by 0 n 1 for all natural n Take two rows labeled by x=0 p 1 and x’=0 r 1 Clearly there is a 1 in M[x,y] for y=0 p 1 but there is no 1 in M[x’,1] Again M contains an infinite identity matrix

Proof [DFA to game] Assume L is regular. There is a DFA M for L. Alice simulates M on x, and sends the state of M reached after reading x to Bob, who continues the simulation Bob accepts iff M accepts xy Clearly this is a correct protocol, and the number of messages is the size of the set of states

Proof [game to DFA] Now assume that there is a protocol with m messages We can assume that Alice uses one message for each distinct row of the matrix, otherwise the protocol is not optimal – i.e., for two rows that are not distinct she uses the same message We construct a DFA with m states corresponding to the m messages q 0 [the starting state] is the message that Alice sends on the empty string We use m-1 other states, corresponding to messages Set of accepting states: messages/states, such that Bob accepts on the message when y is empty string Remains to define the transition function

Proof Assume that on some input x Alice sends message q, and on input xa she sends message q’ Then we include the transition q,a  q’ Clearly this defines transitions, but are they consistent? I.e., If Alice sends q on x and q’ on xa, and Alice also sends q on x’, then she should send q’ on x’a But x and x’ have the same row, hence xa and x’a also have the same row [if not, there is some y such that xay 2 L and x’ay not in L, hence rows of x and x’ not the same] Hence the transition function is well-defined. We get a DFA with m states for L

Note The minimum number of messages in our communication game is usually called the Myhill-Nerode index

2-way DFA Theorem: 2-way DFA can recognize only regular languages Note: – Sometimes it is easier to show that L is regular by using a 2-way DFA – Sometimes 2-way DFA need fewer states – Proof: We show that the Myhill-Nerode index is finite.

Examples L={w: third last symbol of w is 1} 2-way DFA: move to the right end of the input, move 3 steps left, accept if there is a 1 L rev for a regular language L is the set of w, such that w read in reverse is in L – Move to the right end and then simulate the DFA for L while reading the input backwards

Proof (theorem) Proof: We show that the Myhill-Nerode index is finite. Language L is decided by a 2-way DFA M, where M has n states Consider words w=xy Suppose the tape-head of M comes back from y into x while M is in state q, and the same happens later in state q’ – q  q’ otherwise there is an infinite loop Hence the states on which M crosses from y to x are distinct, and there are at most n such crossings Simulation in the communication game:

Proof We describe the communication protocol Let S=[q 1,...,q m ] be a sequence of any m · n distinct states of M Alice simulates M on x, assuming that when M first leaves x it later returns to x in state q 1 – Etc: If M leaves x for the k-th time it returns to x in state q k Alice’s message: for every possible S Alice sends the m states in which M leaves x (for even m), and additionally if she would accept, for odd m Bob finds the sequence S that is consistent with M’s behavior on y and Alice’s message (S is the correct sequence occurring on M and xy) Bob accepts if M accepts It is easy to see that this protocol is correct, and uses no more than O(n 2n ) messages, which is finite

2-way NFA Definition: a two-way NFA is a nondeterministic Turing machine that cannot write and cannot leave the tape area that contains the input. Theorem: Two-way NFA can decide only regular languages Proof: Same as for two-way DFA, Alice and Bob check consistency with respect to the nondeterministic A – Is there a computation that leads to the communicated sequence of states and accepts?

Open Problem Is there a language, for which 2-way NFA need much fewer states than 2-way DFA?

Size of Automata? We know L is regular, if there is a DFA with a finite number of states for L Minimum number of states is the Myhill-Nerode Index Questions: 1. How can we find a minimal DFA for L? 2. Is the minimal DFA unique (up to renaming states)? 3.Are NFA sometimes smaller than minimal DFA? 4.Are two-way DFA sometimes smaller than DFA?

Question 4 Consider the language L={xi : x 2 {0,1} n and i 2 {0,1} log n and x n-i =1} – n is fix, this is a finite language, hence regular It is easy to see that there are at least 2 n rows in the communication matrix – Consider only columns for the different i=n-1,…,0 – Rows labeled x contains the string x at entries i=n-1…0 Hence any DFA for L has at least 2 n states Can give a 2-way DFA with O(n 2 ) states: – go to the right end of the input, read i into the state, move i steps left, accept if there is a 1

Question 3 Consider L={xy: x,y 2 {0,1} n, x  y} – This is a FINITE language, n is fixed Exercise: there is an NFA with O(n 2 ) states for L DFA-size: the matrix has more than 2 n distinct rows – DFA size is exponential Hence NFA can be exponentially smaller than DFA for some languages Example where they are not: complement of L

2) Uniqueness Uniqueness of the minimal DFA (up to vertex names) follows from the Myhill-Nerode characterization The optimal DFA has exactly one state for each set of equal rows of the communication matrix Edges/the transition function are also determined uniquely, i.e., if x is in set q and xa is in set q’ then there must be an edge labeled a from q to q’