Presentation is loading. Please wait.

Presentation is loading. Please wait.

Regular expressions Sipser 1.3 (pages 63-76). CS 311 Fall 2008 2 Looks familiar…

Similar presentations


Presentation on theme: "Regular expressions Sipser 1.3 (pages 63-76). CS 311 Fall 2008 2 Looks familiar…"— Presentation transcript:

1 Regular expressions Sipser 1.3 (pages 63-76)

2 CS 311 Fall 2008 2 Looks familiar…

3 CS 311 Fall 2008 3 Your turn now!

4 CS 311 Fall 2008 4 Formally Definition 1.52: Say that R is a regular expression if R is 1. a for some a in the alphabet Σ 2.ε 3.Ø 4.( R 1 ∪ R 2 ), where R 1 and R 2 are regular exressions 5.( R 1 ° R 2 ), where R 1 and R 2 are regular expressions 6.( R 1 *), where R 1 is a regular expression

5 CS 311 Fall 2008 5 Examples 0*10* ={w | } ={w | w is a string of odd length} (0 ∪ ε)(1 ∪ ε) = (01)* ∅ = (+ ∪ - ∪ ε)(DD* ∪ DD*.D* ∪ D*.DD*) = where D = {0,1,2,3,4,5,6,7,8,9}

6 CS 311 Fall 2008 6 Identities Let R be a regular expression –R ° Ø = –R ° ε = –R ∪ Ø = –R ∪ ε =

7 CS 311 Fall 2008 7 Regular expressions and NFAs Theorem 1.54: A language is regular if and only if some regular expression describes it. Proof ( ⇐ ) 1.If a ∈ Σ, then a is regular. 2.ε is regular. 3. Ø is regular. 4.If R 1 and R 2 are regular, then ( R 1 ∪ R 2 ) is regular. 5.If R 1 and R 2 are regular, then ( R 1 ° R 2 ) is regular. 6.If R 1 is a regular, then ( R 1 *) is regular

8 CS 311 Fall 2008 8 Proof in action Build an NFA to that recognizes the regular expression a(a ∪ b)*a


Download ppt "Regular expressions Sipser 1.3 (pages 63-76). CS 311 Fall 2008 2 Looks familiar…"

Similar presentations


Ads by Google