Week 14 - Wednesday.  What did we talk about last time?  Regular expressions  Introduction to finite state automata.

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

Why empty strings? A bit like zero –you may think you can do without –but it makes definitions & calculations easier Definitions: –An alphabeth is a finite.
Pushdown Automata Chapter 12. Recognizing Context-Free Languages Two notions of recognition: (1) Say yes or no, just like with FSMs (2) Say yes or no,
Pushdown Automata Chapter 12. Recognizing Context-Free Languages We need a device similar to an FSM except that it needs more power. The insight: Precisely.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Week 13 - Wednesday.  What did we talk about last time?  Exam 3  Before review:  Graphing functions  Rules for manipulating asymptotic bounds  Computing.
Discrete Mathematics Lecture 5 Alexander Bukharovich New York University.
Finite Automata Section 1.1 CSC 4170 Theory of Computation.
CS21 Decidability and Tractability
Introduction to Computability Theory
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 Lecture3: 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.
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
Discrete Mathematics Lecture 7 Alexander Bukharovich New York University.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
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 Regular.
1 Finite Automata. 2 Finite Automaton Input “Accept” or “Reject” String Finite Automaton Output.
Validating Streaming XML Documents Luc Segoufin & Victor Vianu Presented by Harel Paz.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.2: Pushdown Automata) Prof. Karen Daniels, Fall 2009 with acknowledgement.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG)
Copyright © Cengage Learning. All rights reserved.
Regular Expressions and Automata Chapter 2. Regular Expressions Standard notation for characterizing text sequences Used in all kinds of text processing.
Great Theoretical Ideas in Computer Science.
Week 14 - Friday.  What did we talk about last time?  Exam 3 post mortem  Finite state automata  Equivalence with regular expressions.
Finite-State Machines with No Output Longin Jan Latecki Temple University Based on Slides by Elsa L Gunter, NJIT, and by Costas Busch Costas Busch.
Finite-State Machines with No Output
Week 15 - Friday.  What did we talk about last time?  Review second third of the course.
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
Automating Construction of Lexers. Example in javacc TOKEN: { ( | | "_")* > | ( )* > | } SKIP: { " " | "\n" | "\t" } --> get automatically generated code.
Lecture 05: Theory of Automata:08 Kleene’s Theorem and NFA.
CHAPTER 1 Regular Languages
Copyright © Cengage Learning. All rights reserved.
Week 6 - Friday.  What did we talk about last time?  Solving recurrence relations.
NFA defined. NFA A Non-deterministic Finite-state Automata (NFA) is a language recognizing system similar to a DFA. It supports a level of non-determinism.
CSCI 2670 Introduction to Theory of Computing September 13.
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.
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.2: Pushdown Automata) Prof. Karen Daniels, Fall 2010 with acknowledgement.
September1999 CMSC 203 / 0201 Fall 2002 Week #15 – 2/4/6 December 2002 Prof. Marie desJardins.
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 10 Automata, Grammars and Languages.
Chapter 8 Properties of Context-free Languages These class notes are based on material from our textbook, An Introduction to Formal Languages and Automata,
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AA.
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.
1 Language Recognition (11.4) Longin Jan Latecki Temple University Based on slides by Costas Busch from the courseCostas Busch
BİL711 Natural Language Processing1 Regular Expressions & FSAs Any regular expression can be realized as a finite state automaton (FSA) There are two kinds.
Conceptual Foundations © 2008 Pearson Education Australia Lecture slides for this course are based on teaching materials provided/referred by: (1) Statistics.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
Lecture 03: Theory of Automata:2014 Asif Nawaz Theory of Automata.
 2005 SDU Lecture11 Decidability.  2005 SDU 2 Topics Discuss the power of algorithms to solve problems. Demonstrate that some problems can be solved.
Week 14 - Friday.  What did we talk about last time?  Simplifying FSAs  Quotient automata.
Week 14 - Wednesday.  What did we talk about last time?  Exam 3 post mortem  Finite state automata  Equivalence with regular expressions.
Week 13 - Friday.  What did we talk about last time?  Regular expressions.
Copyright © Cengage Learning. All rights reserved.
Language Recognition (12.4)
CSE322 Finite Automata Lecture #2.
Regular Expression We shall build expressions from the symbols using simple operations include concatenation, union and kleen closure. Several intuitive.
Principles of Computing – UFCFA3-30-1
COSC 3340: Introduction to Theory of Computation
CSE322 CONSTRUCTION OF FINITE AUTOMATA EQUIVALENT TO REGULAR EXPRESSION Lecture #9.
CS21 Decidability and Tractability
Language Recognition (12.4)
CSC 4170 Theory of Computation Finite Automata Section 1.1.
Presentation transcript:

Week 14 - Wednesday

 What did we talk about last time?  Regular expressions  Introduction to finite state automata

 Each of the following equations is made of matches and written using Roman numerals  Unfortunately, each equation is wrong  Move a single match stick in each equation to correct the error  VI = IV – III(12 matches)  XIV – V = XX(14 matches)  X = VIII – II (12 matches)  VII = I(7 matches but bizarre)

 Consider this FSA again:  Which state will be reached on the following inputs: i. 01 ii iii iv s0s0 s0s0 s1s1 s1s1 s2s2 s2s

 Let A be a FSA with a set of states S, set of input symbols I, and next-state function N: S x I  S  Let I * be the set of all strings over I  The eventual-state function N * : S x I *  S is the following  N * (s,w) = the state that A goes to if the symbols of w are input to A in sequence, starting with A in state s  All of this is just a notational convenience so that we have a way of talking about the state that a string will transition an FSA to  We say that w is accepted by A iff N * (s 0, w) is an accepting state of A  The language of A, L(A) = { w  I * | w is accepted by A }

 Design a finite-state automaton that accepts the set of all strings of 0's and 1's such that the number of 1's in the string is divisible by 3  Make a regular expression for this language  Design a finite-state automaton that accepts the set of all strings of 0's and 1's that contain exactly one 1  Make a regular expression for this language

 Kleene's Theorem shows that Finite-State Automata are equivalent to regular expressions  That is, for every finite-state automaton there is some equivalent regular expression, and vice versa  We won't prove it, but it should be intuitively clear because there are algorithms for building FSA's from regular expressions and vice versa

 Languages that can be expressed as an FSA or a regular expression are called regular  Some languages are not regular  For example, the language consisting of strings a k b k, meaning all strings that have a positive number of a's followed by the same number of b's, is not regular  Prove it (by contradiction)  Hint: We use the pigeonhole principle to show that more than one sequence of a p and a q must end up the in the same state

Student Lecture

 List strings accepted by the FSA A  List strings accepted by the FSA B s0s0 s0s0 s1s1 s1s1 s2s2 s2s s3s3 s3s A s1s1 s1s s0s0 s0s0 B

 Two states of a finite-state automaton are *- equivalent if any string accepted by the automaton when it starts from one state is accepted when starting from the other  Given an automaton A with eventual-state function N *, we can formally say:  States s and t in A are*-equivalent iff N * (s,w) and N * (t,w) are both accepting states or both not  It turns out that *-equivalence defines an equivalence relation

 *-equivalence is hard to demonstrate directly  Instead, we'll focus on equivalence after k or fewer inputs  Given an automaton A with eventual-state function N *, we can formally say:  States s and t in A are k-equivalent iff N * (s,w) and N * (t,w) are both accepting states or both not, for all strings w of length k or less

 For k ≥ 0, k-equivalence is an equivalence relation  For k ≥ 0, the k-equivalence classes partition the set of all states of the automaton into a union of mutually disjoint subsets  For k ≥ 1, if two states are k-equivalent, they are also (k-1)-equivalent  For k ≥ 1, each k-equivalence class is a subset of a (k-1)-equivalence class  Any two states that are k-equivalent for all integers k ≥ 0 are *-equivalent

 Let A be an FSA with next-state function N  Given any states s and t in A: 1. s is 0-equivalent to t iff either s and t are both accepting states or they are both nonaccepting states 2. For every integer k ≥ 1, s is k-equivalent to t iff s and t are (k-1)-equivalent and for any input symbol m, N(s,m) and N(t,m) are also (k-1)-equivalent  These theorems essentially allow us to create a recursive definition for testing k-equivalence

 Find the 0-equivalence classes, the 1- equivalence classes, and the 2-equivalence classes for the following FSA: s1s1 s1s1 s2s2 s2s2 s3s3 s3s s4s4 s4s4 0 0 s0s0 s0s

 Keep finding k-equivalence classes for larger and larger values of k  If you ever find that the set of k-equivalence classes is equal to the set of (k+1)-equivalence classes, that is the set of *-equivalence classes  This is known as a fixed point in mathematics

 We can build a new FSA from the *-equivalence classes  Recall that [s] means the equivalence class of s  This FSA is called the quotient automaton A', and is defined from an FSA A with states S, input symbols I, and next-state function N as follows: 1. The set of states S' of A' is the set of *-equivalent classes of states of A 2. The set of input symbols I' of A' equals I 3. The initial state of A' is [s 0 ] where s o is the initial state of A 4. The accepting states of A' are the states of the form [s] where s is an accepting state of A 5. The next-state function N': S' x I  S' is: For all states [s] in S' and input symbols m, N'([s], m) = [N(s,m)]

 Let A be an FSA with states S, input symbols I, and next-state function N  To build A': 1. Find the set of 0-equivalence classes of S 2. For each integer k ≥ 1, find the k-equivalence classes of S until the k-equivalence classes are the same as the (k-1)-equivalence classes 3. Build a quotient automaton whose states are the equivalence classes given above with transition function N'([s],m) = [N(s,m)] for any input symbol m

 Find the quotient automaton for the following FSA s1s1 s1s1 s2s2 s2s2 s3s3 s3s s4s4 s4s4 0 0 s0s0 s0s

 Two automata A 1 and A 2 are equivalent iff L(A 1 ) = L(A 2 )  Proving the languages accepted by two automata can be difficult  However, the quotient automata for both A 1 and A 2 will be the same (except for labeling) if A 1 is equivalent to A 2

 Prove that the following two automata are equivalent by finding their quotient automata s0s0 s0s0 s2s2 s2s2 s1s1 s1s s3s3 s3s s0's0' s0's0' s1's1' s1's1' s2's2' s2's2' 0, s3's3' s3's3'

 Context free languages

 Keep reading Chapter 12  Finish Assignment 10  Due Friday before midnight