Download presentation
Presentation is loading. Please wait.
Published byΗμέρα Δημητρίου Modified over 6 years ago
1
Lecture 10 Closure Properties of Regular Languages
CSCE 355 Foundations of Computation Lecture 10 Closure Properties of Regular Languages Topics: Extended RegExpr Thompson Construction June 13, 2015
2
Last Time: Readings 2.3 New: Mutual Induction Proof revisited
Languages denoted by regular expressions Examples Ruby Regular Expressions TEST 2 – Monday New: Readings section 3.1,3.2(skip DFA RE), 3.3
3
Homework English descriptions Regular expressions
3.1.1b – The set of strings of 0’s and 1’s such that the tenth symbol from the right is a 1. 3.1.1c - The set of strings of 0’s and 1’s with at most one pair of consecutive 1’s. 3.1.2 b The set of strings of 0’s and 1’s such that the number of zeroes is divisible by 5. Regular expressions English descriptions 3.14b (0*1*)*000(0+1)* 3.14c (0+10)*1* Regular expressions εNFA (construction) 3.2.4b (0+1)01 3.2.4c 00(0+1)* 3.14b, 3.14c convert to εNFA Text matching re for matching phone numbers (international etc)
4
Regular expressions for Addresses
Why? So we can automatically read messages and extract addresses and insert into DB Joe Shmo 532 Spring Lake Road Columbia, SC 29209 Let’s start with Street Names Spring Lake Road Road | Rd. | Rd | avenue | Street | …
5
McNaughton-Yamada Construction Examples
6
McNaughton-Yamada Construction Examples
Extended regular expressions
7
Lex and Flex Regular definitions Pattern match “.” Last pattern
Examples digit = [0-9] alpha= [a-zA-Z_] id = {alpha} ({alpha} | {letter} | ‘_’)* %% id {install_InSymbolTable(yytext); return(ID);} while { return (KEYWHILE);}
8
Compilation
9
DFA RegExpr NFA DFA Regular Languages
10
Not every language can be recognized by a DFA!
11
Algebraic Laws for Arithmetic Expressions
Properties Equivalence of two expressions
12
Algebraic Laws for Regular Expressions
What does it mean re1=re2 ?
13
Languages are Sets So Properties are Inherited
Commutativity Law for alternation AUB = BUA so r l s = s l r Associativity Law for alternation (r + s) + t = r + (s + t) Associativity Law for concatenation (rs) t = r (st)
14
Commutivity
15
Identity/Annihilator
16
Distributive Laws In algebra
Theorem 3.11 If L, M, and N are any languages, then L(M U N) = LM U LN Proof: w is in L(M U N) if and only if w is in LM U LN w is in L(M U N) w is in LM U LN
17
Factoring and Simplifying
0 + 01* = 0(ϵ + 1*) = 01*
18
Checking for Equality of Two Regular Expressions
s = r ? (r+s)* = r* s*
19
Idempotent Law x + x ? xx ?
20
Laws involving Closures
Ф* = ϵ ϵ* = ϵ L+ = L L* L* = L+ + ϵ L?
21
Is L intersection R regular?
22
Is the Complement of a Regular Lang. regular?
23
Not all Languages are regular
L = {0n1n | n >= 1}
24
Every finite language is Regular
25
Discovering Laws for Regular Expressions
(L +M)* = (L*M*)* Concretize expressions (only work for pure regular expressions, not intersections.)
26
Theorem 3.14 Theorem 3.14 The following test identifies true laws for regular expressions: Test for a Regular-Expression Algebraic Law to Test if regular expressions E = F is true (L(E) = L(F)) Convert E and F to concrete regular expressions C and D by replacing Variables by a concrete symbol Test whether L(C) = L(D) if so the E = F is true!
28
Pumping Lemma
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.