CSE322 Regular Expressions and their Identities

Slides:



Advertisements
Similar presentations
Finite-state Recognizers
Advertisements

Lecture # 10 Theory Of Automata By Dr. MM Alam 1.
Theory Of Automata By Dr. MM Alam
Regular Grammars Formal definition of a regular expression.
Representing Relations Using Matrices
Strings and Languages Operations
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
Validating Streaming XML Documents Luc Segoufin & Victor Vianu Presented by Harel Paz.
Lecture 7 Sept 22, 2011 Goals: closure properties regular expressions.
CS5371 Theory of Computation Lecture 6: Automata Theory IV (Regular Expression = NFA = DFA)
79 Regular Expression Regular expressions over an alphabet  are defined recursively as follows. (1) Ø, which denotes the empty set, is a regular expression.
1 Lecture 19 Closure Properties for LFSA using NFA’s –union second proof –concatenation –Kleene closure.
Boolean Algebra cont’ The digital abstraction מבנה המחשב + מבוא למחשבים ספרתיים תרגול 2#
Matrix Algebra THE INVERSE OF A MATRIX © 2012 Pearson Education, Inc.
Syntactic Pattern Recognition Statistical PR:Find a feature vector x Train a system using a set of labeled patterns Classify unknown patterns Ignores relational.
1 Regular Expressions/Languages Regular languages –Inductive definitions –Regular expressions syntax semantics Not covered in lecture.
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.
Lecture 1 String and Language. String string is a finite sequence of symbols. For example, string ( s, t, r, i, n, g) CS4384 ( C, S, 4, 3, 8) (1,
Chapter 2 Languages.
Induction and recursion
Theory Of Automata By Dr. MM Alam
Section 5.3. Section Summary Recursively Defined Functions Recursively Defined Sets and Structures Structural Induction.
Formal Methods in SE Theory of Automata Qasiar Javaid Assistant Professor Lecture # 06.
Theory of Computation, Feodor F. Dragan, Kent State University 1 Regular expressions: definition An algebraic equivalent to finite automata. We can build.
Recap Lecture-2 Kleene Star Closure, Plus operation, recursive definition of languages, INTEGER, EVEN, factorial, PALINDROME, {anbn}, languages of strings.
Automata, Computability, & Complexity by Elaine Rich ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slides provided by author Slides edited for.
Module 2 How to design Computer Language Huma Ayub Software Construction Lecture 8.
L ECTURE 3 Chapter 4 Regular Expressions. I MPORTANT T ERMS Regular Expressions Regular Languages Finite Representations.
1 Module 14 Regular languages –Inductive definitions –Regular expressions syntax semantics.
MA/CSSE 474 Theory of Computation Regular Expressions Intro.
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
Overview of Previous Lesson(s) Over View  Symbol tables are data structures that are used by compilers to hold information about source-program constructs.
UNIT - 2.  A binary operation on a set combines two elements of the set to produce another element of the set. a*b  G,  a, b  G e.g. +, -, ,  are.
CSC312 Automata Theory Lecture # 3 Languages-II. Formal Language A formal language is a set of words—that is, strings of symbols drawn from a common alphabet.
Regular Expressions Chapter 6. Regular Languages Regular Language Regular Expression Finite State Machine L Accepts.
CS 203: Introduction to Formal Languages and Automata
Recursive Definations Regular Expressions Ch # 4 by Cohen
Chapter 3 Regular Expressions, Nondeterminism, and Kleene’s Theorem Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction.
Grammars A grammar is a 4-tuple G = (V, T, P, S) where 1)V is a set of nonterminal symbols (also called variables or syntactic categories) 2)T is a finite.
November 2003Computational Morphology III1 CSA405: Advanced Topics in NLP Xerox Notation.
Lecture # 4.
1 Section 11.1 Regular Languages Problem: Suppose the input strings to a program must be strings over the alphabet {a, b} that contain exactly one substring.
1 Chapter Regular Languages. 2 Section 11.1 Regular Languages Problem: Suppose the input strings to a program must be strings over the alphabet.
Mathematics. Session Set, Relation & Function Session - 2.
 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.
2 2.2 © 2016 Pearson Education, Ltd. Matrix Algebra THE INVERSE OF A MATRIX.
Lecture 03: Theory of Automata:2014 Asif Nawaz Theory of Automata.
Recap Lecture 3 RE, Recursive definition of RE, defining languages by RE, { x}*, { x}+, {a+b}*, Language of strings having exactly one aa, Language of.
Formal Methods in software development
Formal Language & Automata Theory
Lecture 9 Theory of AUTOMATA
REGULAR LANGUAGES AND REGULAR GRAMMARS
Regular Expression We shall build expressions from the symbols using simple operations include concatenation, union and kleen closure. Several intuitive.
Recap lecture 29 Example of prefixes of a language, Theorem: pref(Q in R) is regular, proof, example, Decidablity, deciding whether two languages are equivalent.
Kleene’s Theorem Muhammad Arif 12/6/2018.
Finite Automata and Formal Languages
Formal Methods in software development
Recap lecture 10 Definition of GTG, examples of GTG accepting the languages of strings:containing aa or bb, beginning with and ending in same letters,
Recap Lecture-2 Kleene Star Closure, Plus operation, recursive definition of languages, INTEGER, EVEN, factorial, PALINDROME, {anbn}, languages of strings.
Recap lecture 11 Proof of Kleene’s theorem part II (method with different steps), particular examples of TGs to determine corresponding REs.
Recap lecture 23 Mealy machines in terms of sequential circuit.
CSC312 Automata Theory Kleene’s Theorem Lecture # 12
Recap Lecture-2 Kleene Star Closure, Plus operation, recursive definition of languages, INTEGER, EVEN, factorial, PALINDROME, {anbn}, languages of strings.
Recap Lecture 3 RE, Recursive definition of RE, defining languages by RE, { x}*, { x}+, {a+b}*, Language of strings having exactly one aa, Language of.
Matrix Algebra THE INVERSE OF A MATRIX © 2012 Pearson Education, Inc.
Presentation transcript:

CSE322 Regular Expressions and their Identities Lecture #6

Regular Expressions We give a formal recursive definition of regular expressions over ∑ as follows: 1. Any terminal symbol (i.e. an element of ∑), Λ and ∅ are regular expressions. When we view a in ∑ as a regular expression, we denote it by a. 2. The union of two regular expressions R1and R2 , written as R 1 + R2, is also a regular expression. 3. The concatenation of two regular expressions R1and R2, written as R1 R2, is also a regular expression. 4. The iteration (or closure) of a regular expression R written as R*, is also a regular expression. 5.If R is a regular expression, then (R) is also a regular expression. 6. The regular expressions over∑ are precisely those obtained recursively by the application of the rules 1-5 once or several times

Any set represented by a regular expression is called a regular set. Definitions Any set represented by a regular expression is called a regular set. If for example, a, b ε ∑. Then (i) a denotes the set {a}, (ii) a + b denotes {a, b}, (iii) ab denotes {ab}, (iv) a* denotes the set {A. a, aa. aaa, ... } and (v) (a + b)* denotes {a, b}*. The set represented by R is denoted by L(R), Definitions

Questions Describe the following sets by regular expressions: {101} {abba} {01,10} {Λ ,ab} {abb. a, b, bba} {Λ , 0, 00, 000.... } {1, 11, 111 ... }

Solution (a) Now. {1}. {O} are represented by 1 and O. respectively. 101 is obtained by concatenating 1,0 and 1 So. {10 I} is represented by 101. (b) abba represents {abba}. (c) As {01, 10} is the union of {01} and {10}, we have {01, 10} represented by 01 + 10 (d) The set {Λ , ab} is represented by Λ + ab (e) The set {abb, a, b, bba} is represented by abb + a + b + bba. f) As {Λ , 0, 00, 000, ... } is simply {O}*. it is represented by 0* (g) Any element in {1, 11, 111, ... } can be obtained by concatenating 1 and any element of {1}*. Hence 1(1)* represents {1, 11, 111, ... }

Problem

Solution

Solution (a) Now. {1}. {O} are represented by 1 and O. respectively. 101 is obtained by concatenating 1,0 and 1 So. {10 I} is represented by 101. (b) abba represents {abba}. (c) As {01, 10} is the union of {01} and {10}, we have {01, 10} represented by 01 + 10 (d) The set {Λ , ab} is represented by Λ + ab (e) The set {abb, a, b, bba} is represented by abb + a + b + bba. f) As {Λ , 0, 00, 000, ... } is simply {O}*. it is represented by 0* (g) Any element in {1, 11, 111, ... } can be obtained by concatenating 1 and any element of {1}*. Hence 1(1)* represents {1, 11, 111, ... }

IDENTITIES FOR REGULAR EXPRESSIONS

THEORM Theorem : (Arden' s theorem) Let P and Q be two regular expressions over ∑. If P does not contain Λ, then the following equation in R, namely R = Q + RP has a unique solution (i.e. one and only one solution) given by R = QP*.

THEORM Proof Q + (QP*)P = Q(Λ+ P*P) = QP* by I9

PROBLEM

SOLUTION

PROBLEM & SOLUTION

TRANSITION SYSTEM CONTAINING Λ -MOVES Suppose we want to replace a Λ -move from vertex V1 to vertex V2' Then we proceed as follows: Step 1- Find all the edges starting from V2. Step 2- Duplicate all these edges starting from V1' without changing the edge labels. Step 3- If V1 is an initial state, make V2 also as initial state. Step 4- If V2 is a final state. make V1 also as the final state.

EXAMPLE

EXAMPLE