CIS 262 Automata, Computability, and Complexity Fall 2016 Instructor: Aaron Roth

Slides:



Advertisements
Similar presentations
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
Advertisements

YES-NO machines Finite State Automata as language recognizers.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
Finite Automata Section 1.1 CSC 4170 Theory of Computation.
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
Intro to DFAs Readings: Sipser 1.1 (pages 31-44) With basic background from Sipser 0.
CS5371 Theory of Computation
Transparency No. 2-1 Formal Language and Automata Theory Chapter 2 Deterministic Finite Automata (DFA) (include Lecture 3 and 4)
Fall 2006Costas Busch - RPI1 Deterministic Finite Automata And Regular Languages.
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.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 Languages and Finite Automata or how to talk to machines...
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)
Finite Automata Chapter 5. Formal Language Definitions Why need formal definitions of language –Define a precise, unambiguous and uniform interpretation.
Topics Automata Theory Grammars and Languages Complexities
Finite Automata Costas Busch - RPI.
Finite State Machines Data Structures and Algorithms for Information Processing 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 language,
Finite-State Machines with No Output
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
Fall 2006Costas Busch - RPI1 Deterministic Finite Automaton (DFA) Input Tape “Accept” or “Reject” String Finite Automaton Output.
1 Course Overview PART I: overview material 1Introduction 2Language processors (tombstone diagrams, bootstrapping) 3Architecture of a compiler PART II:
Languages Given an alphabet , we can make a word or string by concatenating the letters of . Concatenation of “x” and “y” is “xy” Typical example: 
MA/CSSE 474 Theory of Computation Decision Problems DFSMs.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
Lecture 2 Overview Topics What I forgot from last lecture Proof techniques continued Alphabets, strings, languages Automata June 2, 2015 CSCE 355 Foundations.
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
Finite Automata Great Theoretical Ideas In Computer Science Victor Adamchik Danny Sleator CS Spring 2010 Lecture 20Mar 30, 2010Carnegie Mellon.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
Set, Alphabets, Strings, and Languages. The regular languages. Clouser properties of regular sets. Finite State Automata. Types of Finite State Automata.
MA/CSSE 474 Theory of Computation Decision Problems, Continued DFSMs.
Costas Busch - LSU1 Deterministic Finite Automata And Regular Languages.
Theory of Computation Automata Theory Dr. Ayman Srour.
Fall 2004COMP 3351 Finite Automata. Fall 2004COMP 3352 Finite Automaton Input String Output String Finite Automaton.
WELCOME TO A JOURNEY TO CS419 Dr. Hussien Sharaf Dr. Mohammad Nassef Department of Computer Science, Faculty of Computers and Information, Cairo University.
Lecture Three: Finite Automata Finite Automata, Lecture 3, slide 1 Amjad Ali.
Introduction to Automata Theory Theory of Computation Lecture 3 Tasneem Ghnaimat.
Languages.
Lecture2 Regular Language
CSE 105 theory of computation
Deterministic Finite Automata
Jaya Krishna, M.Tech, Assistant Professor
Chapter 2 FINITE AUTOMATA.
Deterministic Finite Automata
Hierarchy of languages
Undecidable Problems (unsolvable problems)
THEORY OF COMPUTATION Lecture One: Automata Theory Automata Theory.
Deterministic Finite Automata And Regular Languages Prof. Busch - LSU.
COSC 3340: Introduction to Theory of Computation
Intro to Data Structures
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
CSCI 2670 Introduction to Theory of Computing
Instructor: Aaron Roth
Instructor: Aaron Roth
CSE 105 theory of computation
Instructor: Aaron Roth
CSCE 355 Foundations of Computation
CSE 105 theory of computation
Presentation transcript:

CIS 262 Automata, Computability, and Complexity Fall Instructor: Aaron Roth Lecture: Sept 1, 2016

Course Logistics 2 Homework 1: Posted on Piazza/Class website Due next Thursday (11:59am) Construct DFAs using AutomataTutor. (Note – by demonstration, determining if two finite automata accept the same language must be solvable! Not so for general computer programs..)

Recap 3 Alphabet  : Finite set of symbols/characters used for encoding A string w over an alphabet  is a finite sequence of symbols in  A language L over an alphabet  is a subset of  * Inputs are encoded as strings and (decision) problems correspond to languages

Example Language 4  = All English text characters String w then corresponds to a text document L 1 = { w | each of the vowels a, e, i, o, u occurs at least once in w } = { w | count(w,a)>0 and count(w,e)>0 and count(w,i)>0 and count(w,o)>0 and count(w,u)>0 } notation: count(w,  ) = the number of times the symbol  occurs in w L 2 = { w | count(w,a) = count(w,e) }

Encoding Graph Problems 5 Problem: Given the graph of Facebook friends connections, find the person with the highest number of connections Decision version: Given a graph of connections among n people (numbered 1 through n) and person identifier m (between 1 and n), check if person m has the highest number of connections

Encoding Graph Problems 6 In this graph over 4 people, does person 2 have max number of connections?  = { 0, 1, # } # 1 0 # 1 # 1 0 # 1 # 1 1 # 1 # # 1 0 # 1 1 # 1 1 # # Number of People 4 Person identifier 2 Edge between 1 and 2 Edge between 1 and 3

Graph Problems as Languages 7  = { 0, 1, # } L = { w | w encodes a graph over n people such that person m has the highest number of connections } Example string in the language: Example string not in the language: We don’t need to worry about such low-level encoding of problems, but the high-level point is that it can be done! # 1 0 # 1 # 1 0 # 1 # 1 1 # 1 # # 1 0 # 1 1 # 1 1 # # # 1 1 # 1 # 1 0 # 1 # 1 1 # 1 # # 1 0 # 1 1 # 1 1 # #

Machines for Languages 8 Machine M for a language L: Given an input string w, machine M scans w from left to right, processing one symbol in each step After reading the entire string w, M should either accept or reject w, depending on whether or not w is in L

Finite-state Machines 9 Machine M has some fixed (finite) number of states q0q0 q1q1 q3q3 q4q4 q2q2 One of these states is the initial state Behavior specified by transitions: for each state, based on symbol being processed, what should the next state be a b Some states marked as accept/final states: after reading the entire input w, if M ends up in a final state, then accept w, else reject w

Designing Finite Automaton: Example 1 10 Construct machine M for L = { w | w contains an even number of a’s }, where  = { a, b } q0q0 q1q1 Start with the initial state Figure out transitions out of q 0 on a and b a b Key question: can we reuse an existing state or need a new state? Figure out transitions out of q 1 on a and b a b

Designing Finite Automaton: Example 1 11 Construct machine M for L = { w | w contains an even number of a’s }, where  = { a, b } q0q0 q1q1 a b a b Execution or “run” of the machine on input string w = abbab q0 q0 a q1 q1 b q1 q1 b q1 q1 a q0 q0 b q0 q0 Which states should be final/accepting ?

Designing Finite Automaton: Example 2 12 Construct machine M for L = { w | w ends with a }, where  = { a, b } q0q0 q1q1 a b b a After reading a string w, the machine is in state q 1 if w ends with a, and in state q 0 otherwise In particular, after reading the empty string , M is in state q 0, and thus rejects 

Designing Finite Automaton: Example 3 13 Construct machine M for L = { w | w contains the substring “ACC” }, where  = { A, C, G, T } q0q0 q1q1 A C, G,T G,T A q2q2 C q3q3 C A,C, G,T A G,T Precisely describe the set of strings w such that the machine is in state q 2 after reading w { w | w does not contain the substring “ACC” and ends with “AC” }

Designing Finite Automaton: Example 4 14 Construct machine M for L = { w | count(w,a) = count(w,b) }, where  = { a, b } q0q0 q1q1 a q2q2 a q3q3 a q4q4 a String aa leads to q 2 and aaa leads to q 3. String aabb should be accepted but aaabb should be rejected. So states q 2 and q 3 have to be distinct (otherwise M cannot possibly make the correct decision if what follows is string “bb”). By similar logic, all the states q 1, q 2, q 3, q 4, … have to be pairwise distinct. There does not exist a finite-state machine for L. Rigorous proof based on a general technique in a couple of lectures …

Designing Finite Automaton: Example 5 15 Construct machine M for L = { w | decimal number corresponding to w is divisible by 3 }, where  = { 0,1,2,…,9 } q0q0 q1q1 0,3,6,9 q2q2 2,5,8 1,4,7

Formal Definition 16 A deterministic finite automaton (DFA) M consists of  a finite set Q of states  a finite alphabet   an initial state q 0 that belongs to Q  a subset F of Q, called accepting/final states  a transition function  : Q x   Q (if M reads symbol  in state q, the resulting state is  (q,  ) )

Example Automaton 17 Q = { q 0, q 1 }  = { a, b } Initial state = q 0 F = { q 0 } Transition function:  (q 0,a) = q 1,  (q 0,b) = q 0,  (q 1,a) = q 0,  (q 1,b) = q 1 q0q0 q1q1 a b a b

Language of a DFA 18 Let M = (Q, , q 0, F,  ) be a DFA. L(M) = The set of strings w over  such that M accepts w Let us capture acceptance using a more mathematical notation that will be useful later in some proofs and constructions

Extended Transition Function 19 Let M = (Q, , q 0, F,  ) be a DFA.  is one-step transition function:  Maps a state and a single symbol to a state   (q,  ): if machine starting in state q reads the single symbol , where will it be  * : multi-step transition function (reflexive-transitive closure of  )  Maps a state and a string w to a state   *(q,w): if the machine starting in state q processes the entire string w, where will it be ?

Definition: Extended Transition Function 20 How to define  * in terms of  ? Inductive definition based on definition of strings A string w is either the empty string  or is of the form x , where x is a string (of length one shorter than w) and  is a symbol  *(q,  ) = q  *(q, x  ) =  (  * (q, x),  ) Basically, first clause says how strings of length 0 are processed and second clause says how strings of length n+1 are processed by relying on processing of strings of length n Exercise: Prove: for all q, for all strings u,v,  *(q, u.v) =  *(  *(q, u), v) q x 

Definition: Language of a DFA 21 Let M = (Q, , q 0, F,  ) be a DFA. Definition: M accepts w if  *(q 0, w) is in F L(M) = { w |  *(q 0, w) is in F } If F = Q, what is L(M) ? The set of all strings:  * If F is the empty set , what is L(M)? The empty set of strings:  If F = { q 0 }, what is L(M)? L(M) contains the empty string , but can’t say much more