Computability Regular expressions. Languages defined by regular expresses = Regular languages (languages recognized by FSM). Applications. Pumping lemma.

Slides:



Advertisements
Similar presentations
CMPS 3223 Theory of Computation
Advertisements

FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
CSCI 2670 Introduction to Theory of Computing September 13, 2005.
CSCI 2670 Introduction to Theory of Computing September 15, 2004.
CS21 Decidability and Tractability
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture4: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Nonregular languages Sipser 1.4 (pages 77-82). CS 311 Mount Holyoke College 2 Nonregular languages? We now know: –Regular languages may be specified either.
Introduction to Computability Theory
Nonregular languages Sipser 1.4 (pages 77-82). CS 311 Fall Nonregular languages? We now know: –Regular languages may be specified either by regular.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY (For next time: Read Chapter 1.3 of the book)
1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Lecture 3: Closure Properties & Regular Expressions Jim Hook Tim Sheard Portland State University.
CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
Courtesy Costas Busch - RPI1 Non-regular languages.
Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
FSA Lecture 1 Finite State Machines. Creating a Automaton  Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such.
1 Regular Languages Finite Automata eg. Supermarket automatic door: exit or entrance.
Prof. Busch - LSU1 Non-regular languages (Pumping Lemma)
1 Non-regular languages. 2 Regular languages Non-regular languages.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
Fall 2004COMP 3351 Regular Expressions. Fall 2004COMP 3352 Regular Expressions Regular expressions describe regular languages Example: describes the language.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
Solution Exercise 1.43 a A r r s q q > b b e b s’ q r q’ b r’ a A’
Computability Construct TMs. Decidability. Preview: next class: diagonalization and Halting theorem.
Computability Review homework. Regular Operations. Nondeterministic machines. NFSM = FSM Homework: By hand, build FSM version of specific NFSM. Try to.
Regular Expressions and Languages A regular expression is a notation to represent languages, i.e. a set of strings, where the set is either finite or contains.
Kleene’s Theorem Group No. 3 Presented To Mam Amina Presented By Roll No Roll No Roll No Roll No Group No. 3 Presented To Mam.
CHAPTER 1 Regular Languages
CS355 - Theory of Computation Regular Expressions.
Regular Expressions Chapter 6. Regular Languages Regular Language Regular Expression Finite State Machine L Accepts.
CSCI 2670 Introduction to Theory of Computing September 13.
CS 203: Introduction to Formal Languages and Automata
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
Computability Review homework. Video. Variations. Definitions. Enumerators. Hilbert's Problem. Algorithms. Summary Homework: Give formal definition of.
Nonregular Languages How do you prove a language to be regular? How do you prove a language to be nonregular? A Pumping Lemma.
Equivalence with FA * Any Regex can be converted to FA and vice versa, because: * Regex and FA are equivalent in their descriptive power ** Regular language.
 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
Lecture 09: Theory of Automata:2014 Asif NawazUIIT, PMAS-Arid Agriclture University Rawalpindi. Kleene’s Theorem and NFA.
Theory of Languages and Automata By: Mojtaba Khezrian.
MA/CSSE 474 Theory of Computation How many regular/non-regular languages are there? Closure properties of Regular Languages (if there is time) Pumping.
Computability Joke. Context-free grammars Parsing. Chomsky
Kleene’s Theorem and NFA
CSE 105 theory of computation
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
PROPERTIES OF REGULAR LANGUAGES
CSE 105 theory of computation
Infiniteness Test The Pumping Lemma Nonregular Languages
CS 154, Lecture 3: DFANFA, Regular Expressions.
Elementary Questions about Regular Languages
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
CSCI 2670 Introduction to Theory of Computing
CS21 Decidability and Tractability
Chapter 1 Regular Language - 02
CS21 Decidability and Tractability
Chapter 1 Regular Language
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

Computability Regular expressions. Languages defined by regular expresses = Regular languages (languages recognized by FSM). Applications. Pumping lemma. Homework: Postings? Watch videos.

Regular expressions, cont. Want to prove relationship. Two directions. –Regular expressions are defined by an inductive process so need to show that steps of induction can lead to definitions by FSM (or NDFSM) –Take ANY FSM and show a way to define its regular expression. Will use [yet another type of] machine. Use induction.

Regular expression definition. For given alphabet: the empty string is a regular expression the empty set is a regular expression any single letter is a regular expression For any regular expressions R and S, then –R union S is a regular expession –R concatenate S is a regular expression –R star is a regular expression

Building the FSMs for any regular expression There is a FSM for any the empty string, any single letter, the empty set. [Though the Sipser text did not mention this, I believe it is necessary to do an induction on the length of the expression…] If there is a regular expression R that is defined by R1 union R2, then we can define a FSM for R using the FSMs for R1 and R2. Similarly, for concatenation and for star.

Opposite direction Given a FSM, produce the regular expression that describes the same language. Use (yet another) new machine: generalized nondeterministic finite state machine: –arrows from state to state will be regular expressions –start state has no incoming arrows; outgoing to every state –single accepting state with no outgoing arrows; incoming from every state –start state different from accepting state –there are arrows between all the other states, but note: there are some arrows labeled with the empty set –GNFSM accepts a string by going from state to state using transition labels as regular expressions and ending in the single accepting state.

Process of proof Convert any FSM to a GNFSM –add a new start state and arrow labeled with the empty string from it to the original start state –add a new real accepting state, and add labels with the empty string going to it from all old accepting states –if there are more than one arrow from any state S to any state T, replace by one new arrow with the union of the labels –add arrows labeled with empty set between any pair of states without arrows –CLAIM: this GNFSM accepts the same languages as the FSM. Convert any GNFSM to a GNFSM with exactly 2 states, the arrow from start to accepting is the regular expression

Break for joke(s) Theorem: All horses have an infinite number of legs. Lemma: All horses are of the same color. Homework: make a posting of explanation of problem with the lemma.

Induction proof Take any GNFSM. It must have at least two states. –If it has just 2 states, then we are done. –if it has >2 states, show we can reduce it by one state.

Inductive step Select a state, call it Q, different from starting and accepting state. We will remove Q from the machine and/but modify all other arcs to include what Q did. For any two states Si and Sj in the remaining states, –let R 1 by the label from Si to Q –R 2 by the label from Q to itself, –R 3 be the label from Q to Sj and –R 4 be the (original) label from Si to Sj. Then the new label from Si to Sj is R 1 R 2 *R 3 ⊔ R 4 Claim this new GNFSM accepts the same strings as the former one and has 1 fewer states.

Pumping lemma The term pumping is for pumping out new strings. If A is a regular language, there is a number p such that if a string s in A of length at least p, then we can divide s into 3 parts: s = xyz, so that –xy i z is in A, for i>=0. That is, repeat the y substring –|y| (length of y) >0 –|xy| < p Note: this means that if there are strings of arbitrarity large size (length), then we can take one and pump out others….

Proof of pumping lemma There are [only] a finite number of states. Let p be the number of states of the FSM for A. Assume there is a string of length at least p. This string must have visited at least one state more than one time. –pigeonhole principle –call one such state Q Let x be the string up to Q, y be the string that comes back to Q, z be the rest of the string. xyz satisfies the conditions.

Examples of non-regular languages B = {0 i 1 i | i>=0}. B is strings with the a set number of 0s followed by the same number of 1s –Apply pumping lemma. Take a string and what could it look like? C = {w | w has equal number of 0s and 1s} –Apply pumping lemma to strings of form 0 i 1 i to get strings with different number of 0s and 1s

Reflection FSM only have finite number of states. The next type of machine (push down automata) also has only a finite number of states BUT will have a way of saving information. Turing machines have a finite number of states BUT allow for writing (and reading) on the tape.

Applications Virtual dog: pet3.html pet3.html –states corresponded to images –nearly or not quite FSM since I did keep a variable weight

Lexical scanning First step in compiling or interpreting is to go from string of characters to string of lexical units. –units delimited by spaces AND by definitions sum = old + total*12.50 ; Want to reduce this string of 26 characters to 8 typed lexical units: –name(sum), operator(=), name(old), operator(+), name(total), operator(*), number(12.50), statement-ender(;) Construct a FSM-like machine that has accepting states for each of name, operator, number, statement-ender, and scans strings of alphanumeric characters plus operators.

Homework Continue to look out for computability OR complexity in the news –What is status of the P and NP proof? Watch videos Determine problem in my proof of the 'all horses are of the same color' lemma. Finish lexical scanning exercise

Next class push down automata and context-free languages