Instructor: Aaron Roth

Slides:



Advertisements
Similar presentations
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Advertisements

1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
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.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture4: Regular Expressions 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
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.
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.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
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
CMPS 3223 Theory of Computation
Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers.
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.
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.
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
MA/CSSE 474 Theory of Computation Decision Problems, Continued DFSMs.
Costas Busch - LSU1 Deterministic Finite Automata And Regular Languages.
Fall 2004COMP 3351 Finite Automata. Fall 2004COMP 3352 Finite Automaton Input String Output String Finite Automaton.
CIS 262 Automata, Computability, and Complexity Fall Instructor: Aaron Roth
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.
Languages.
Lecture2 Regular Language
Non Deterministic Automata
Push-down Automata.
Deterministic Finite Automata
Two issues in lexical analysis
Jaya Krishna, M.Tech, Assistant Professor
Chapter 2 FINITE AUTOMATA.
Deterministic Finite Automata
Hierarchy of languages
THEORY OF COMPUTATION Lecture One: Automata Theory Automata Theory.
Deterministic Finite Automata And Regular Languages Prof. Busch - LSU.
Non-Deterministic Finite Automata
COSC 3340: Introduction to Theory of Computation
Decidable Languages Costas Busch - LSU.
Finite Automata.
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
CSC312 Automata Theory Transition Graphs Lecture # 9
Instructor: Aaron Roth
Instructor: Aaron Roth
AUTOMATA THEORY.
Instructor: Aaron Roth
Instructor: Aaron Roth
CSE 105 theory of computation
Instructor: Aaron Roth
Instructor: Aaron Roth
CSCE 355 Foundations of Computation
Presentation transcript:

Instructor: Aaron Roth aaroth@cis.upenn.edu CIS 262 Automata, Computability, and Complexity Spring 2019 http://www.seas.upenn.edu/~cse262/ Instructor: Aaron Roth aaroth@cis.upenn.edu Lecture: January 23, 2019

Course Logistics Homework 1: Posted on Piazza/Class website Due next Wednesday Before Class 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 Alphabet S : Finite set of symbols/characters used for encoding A string w over an alphabet S is a finite sequence of symbols in S A language L over an alphabet S is a subset of S* Inputs are encoded as strings and (decision) problems correspond to languages

Example Language S = All English text characters String w then corresponds to a text document L1 = { 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,s) = the number of times the symbol s occurs in w L2 = { w | count(w,a) = count(w,e) }

Encoding Graph Problems 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 In this graph over 4 people, does person 2 have max number of connections? S = { 0, 1, # } 1 2 4 3 1 0 0 # 1 0 # 1 # 1 0 # 1 # 1 1 # 1 # 1 0 0 # 1 0 # 1 1 # 1 1 # 1 0 0 # Number of People 4 Person identifier 2 Edge between 1 and 2 Edge between 1 and 3

Graph Problems as Languages 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 0 # 1 1 # 1 # 1 0 # 1 # 1 1 # 1 # 1 0 0 # 1 0 # 1 1 # 1 1 # 1 0 0 # 1 0 0 # 1 0 # 1 # 1 0 # 1 # 1 1 # 1 # 1 0 0 # 1 0 # 1 1 # 1 1 # 1 0 0 #

Machines for Languages 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 Machine M has some fixed (finite) number of states q0 a One of these states is the initial state b q1 q2 Behavior specified by transitions: for each state, based on symbol being processed, what should the next state be q4 q3 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 Construct machine M for L = { w | w contains an even number of a’s }, where S = { a, b } Start with the initial state b b a q0 q1 Figure out transitions out of q0 on a and b a Key question: can we reuse an existing state or need a new state? Figure out transitions out of q1 on a and b

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

Designing Finite Automaton: Example 2 Construct machine M for L = { w | w ends with a }, where S = { a, b } b a a q0 q1 b After reading a string w, the machine is in state q1 if w ends with a, and in state q0 otherwise In particular, after reading the empty string e, M is in state q0, and thus rejects e

Designing Finite Automaton: Example 3 Construct machine M for L = { w | w contains the substring “ACC” }, where S = { A, C, G, T } C, G,T A A,C, G,T A C C q0 q1 q2 q3 G,T A G,T Precisely describe the set of strings w such that the machine is in state q2 after reading w { w | w does not contain the substring “ACC” and ends with “AC” }

Designing Finite Automaton: Example 4 Construct machine M for L = { w | count(w,a) = count(w,b) }, where S = { a, b } a a a a q0 q1 q2 q3 q4 String aa leads to q2 and aaa leads to q3. String aabb should be accepted but aaabb should be rejected. So states q2 and q3 have to be distinct (otherwise M cannot possibly make the correct decision if what follows is string “bb”). By similar logic, all the states q1, q2, q3, q4, … 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 Construct machine M for L = { w | decimal number corresponding to w is divisible by 3 }, where S = { 0,1,2,…,9 } 0,3,6,9 0,3,6,9 1,4,7 q0 q1 2,5,8 1,4,7 2,5,8 2,5,8 1,4,7 q2 0,3,6,9

Formal Definition A deterministic finite automaton (DFA) M consists of a finite set Q of states a finite alphabet S an initial state q0 that belongs to Q a subset F of Q, called accepting/final states a transition function d : Q x S  Q (if M reads symbol s in state q, the resulting state is d(q, s) )

Example Automaton Q = { q0, q1 } S = { a, b } Initial state = q0 F = { q0 } Transition function: d(q0,a) = q1, d(q0,b) = q0, d(q1,a) = q0, d(q1,b) = q1 b b a q0 q1 a

Language of a DFA Let M = (Q, S, q0, F, d) be a DFA. L(M) = The set of strings w over S 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 Let M = (Q, S, q0, F, d) be a DFA. d is one-step transition function: Maps a state and a single symbol to a state d(q, s): if machine starting in state q reads the single symbol s, where will it be d* : multi-step transition function (reflexive-transitive closure of d) Maps a state and a string w to a state d*(q,w): if the machine starting in state q processes the entire string w, where will it be ?

Definition: Extended Transition Function How to define d* in terms of d ? Inductive definition based on definition of strings A string w is either the empty string e or is of the form x s, where x is a string (of length one shorter than w) and s is a symbol d*(q, e) = q d*(q, x s) = d ( d* (q, x), s) 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, d*(q, u.v) = d*(d*(q, u), v) q x s

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