1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.

Slides:



Advertisements
Similar presentations
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
Advertisements

FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
1 Introduction to Computability Theory Discussion1: Conversion of A DFA to a Regular Expression Prof. Amos Israeli.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture4: Regular Expressions Prof. Amos Israeli.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture7: PushDown Automata (Part 1) Prof. Amos Israeli.
Introduction to Computability Theory
1 Introduction to Computability Theory Discussion1: Non-Deterministic Finite Automatons Prof. Amos Israeli.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY (For next time: Read Chapter 1.3 of the book)
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
1 Introduction to Computability Theory Lecture2: Non Deterministic Finite Automata (cont.) Prof. Amos Israeli.
Lecture 3: Closure Properties & Regular Expressions Jim Hook Tim Sheard Portland State University.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Regular.
1 Introduction to Computability Theory Lecture4: Non Regular Languages Prof. Amos Israeli.
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)
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.
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
Lecture 5UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 5.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
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.
Regular Expressions. Notation to specify a language –Declarative –Sort of like a programming language. Fundamental in some languages like perl and applications.
Nondeterministic Finite Automata CS 130: Theory of Computation HMU textbook, Chapter 2 (Sec 2.3 & 2.5)
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
Theory of Languages and Automata
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
Prof. Busch - LSU1 NFAs accept the Regular Languages.
Lecture 5 Sept 06, 2012 Regular expressions – examples Converting DFA to regular expression. (same works for NFA to r.e. conversion.) Converting R.E. to.
Lesson No.6 Naveen Z Quazilbash. Overview Attendance and lesson plan sharing Assignments Quiz (10 mins.). Some basic ideas about this course Regular Expressions.
CHAPTER 1 Regular Languages
January 9, 2015CS21 Lecture 31 CS21 Decidability and Tractability Lecture 3 January 9, 2015.
CSCI 2670 Introduction to Theory of Computing September 13.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 1 Regular Languages Some slides are in courtesy.
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
Regular Expressions Section 1.3 (also 1.1, 1.2) CSC 4170 Theory of Computation.
 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.
1 Introduction to the Theory of Computation Regular Expressions.
CSCI 2670 Introduction to Theory of Computing September 11, 2007.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
Theory of Computation Automata Theory Dr. Ayman Srour.
Non Deterministic Automata
Regular Expressions.
REGULAR LANGUAGES AND REGULAR GRAMMARS
Non-Deterministic Finite Automata
CS 154, Lecture 3: DFANFA, Regular Expressions.
COSC 3340: Introduction to Theory of Computation
Non-Deterministic Finite Automata
Non Deterministic Automata
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
CS21 Decidability and Tractability
Chapter 1 Regular Language - 02
CS21 Decidability and Tractability
Chapter 1 Regular Language
NFAs accept the Regular Languages
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
COSC 3340: Introduction to Theory of Computation
COSC 3340: Introduction to Theory of Computation
Presentation transcript:

1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli

Regular languages are defined and described by use of finite automata. In this lecture, we introduce Regular Expressions as an equivalent way, yet more elegant, to describe regular languages. Introduction 2

If one wants to describe a regular language, La, she can use the a DFA, D or an NFA N, such that that. This is not always very convenient. Consider for example the regular expression describing the language of binary strings containing a single 1. Motivation 3

Basic Regular Expressions A Regular Expression (RE in short) is a string of symbols that describes a regular Language. Let be an alphabet. For each, the symbol is an RE representing the set. The symbol is an RE representing the set. (The set containing the empty string). The symbol is an RE representing the empty set. 4

Inductive Construction Let and be two regular expressions representing languages and, resp. The string is a regular expression representing the set. 5

Some Useful Notation Let be a regular expression: The string represents, and it also holds that. The string represents. The Language represented by R is denoted by. 6

Precedence Rules The star (*) operation has the highest precedence. The concatenation ( ) operation is second on the preference order. The union ( ) operation is the least preferred. Parentheses can be omitted using these rules. 7

Examples –. 8

Examples - all words starting and ending with the same letter. - all strings of forms 1,1,…,1 and 0,1,1,…1. - A set concatenated with the empty set yields the empty set.. 9

Regular expressions and finite automata are equivalent in their descriptive power. This fact is expressed in the following Theorem: Theorem A set is regular if and only if it can be described by a regular expression. The proof is by two Lemmata (Lemmas): Equivalence With Finite Automata 10,

If a language L can be described by regular expression then L is regular. Lemma -> 11,,

The proof is by induction on the length of the regular expression: Induction Base: We show that each basic regular construct describes a regular language. Induction Step: Assume that all RE up to a certain length describe regular sets and show that application of any inductive rule preserves this property. Proof Idea 12,,

Induction Basis 1.For any, the expression describes the set, recognized by: 2.The expression is recognized by: 3.The expression is recognized by: 13

Now, we assume that and represent two regular sets and claim that, and represent the corresponding regular sets. The proof for this claim is straight forward using the constructions given in the proof for the closure of the three regular operations. The Induction Step 14

Show that the following regular expressions represent regular languages: To be demonstrated on the Blackboard. Examples 15

If a language L is regular then L can be described by regular expression. Lemma <- 16

The proof follows the following stages: 1.Define Generalized Nondeterministic Finite Automaton (GNFA in short). 2.Show how to convert any DFA to an equivalent GNFA. 3.Show an algorithm to convert any GNFA to a GNFA with 2 states. 4.Convert a 2-state GNFA to an equivalent RE. Proof Stages 17,

1.A GNFA is a finite automaton in which each transition is labeled with a regular expression over the alphabet. 2.A single initial state with all possible outgoing transitions and no incoming trans. 3.A single final state without outgoing trans. 4.A single transition between every two states, including self loops. Properties of a Generalized NFA 18,

To be presented on the blackboard. Example of a Generalized NFA 19

A computation of a GNFA is similar to a computation of an NFA. except: In each step, a GNFA consumes a block of symbols that matches the RE on the transition used by the NFA. A Computation of a GNFA 20

To be presented on the blackboard Example of a GNFA Computation 21

Conversion is done by a very simple process: 1.Add a new start state with an - transition from the start state to all other states. 2.Add a new accepting state with - transition from every state to the accepting state. 3.Replace any transition with multiple labels by a single transition labeled with the union of all labels. Converting a DFA to a GNFA 22

4.Add any missing transition, including self transitions; label the added transition by. Converting a DFA to a GNFA (Cont) 23

The final element needed for the proof is a procedure in which for any GFN G, any state of G, not including and, can be ripped off G, while preserving. This is demonstrated in the next slide by considering a general state, denoted by, and an arbitrary pair of states, and, as demonstrated in the next slide: Removing a state from a GNFA 24

Removing a state from a GNFA 25 Before RippingAfter Ripping Note: This should be done for every pair of outgoing and incoming outgoing.

A (half?) Formal Proof The first step is to formally define a GNFA. Each transition should be labeled with an RE. Define the transition function as follows: where denotes all regular expressions over. 26

A Generalized Finite Automaton is a 5-tupple where: 1. is a finite set called the states. 2. is a finite set called the alphabet. 3. * is the transition function. 4. is the start state, and 5. is the accept state. GNFA – A Formal Definition 27

A GNFA accepts a string if and there exists a sequence of states, satisfying: For each,,, where, or in other words, is the expression on the arrow from to. GNFA – Defining a Computation 28

Procedure CONVERT takes as input a GNFA G with k states. If then these 2 states must be and and the algorithm returns. If the algorithm converts G to an equivalent G’ with states by use of the ripping procedure described before. Procedure CONVERT 29