1 / 8

Regular expressions

Regular expressions. Sipser 1.3 (pages 63-76). Looks familiar…. Your turn now!. Formally. Definition 1.52: Say that R is a regular expression if R is a for some a in the alphabet Σ ε Ø ( R 1 ∪ R 2 ), where R 1 and R 2 are regular exressions

stevie
Download Presentation

Regular expressions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Regular expressions Sipser 1.3 (pages 63-76)

  2. Looks familiar…

  3. Your turn now!

  4. Formally • Definition 1.52: Say that R is a regular expression if R is • a for some a in the alphabet Σ • ε • Ø • (R1∪R2), where R1 and R2 are regular exressions • (R1°R2), where R1 and R2 are regular expressions • (R1*), where R1is a regular expression

  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. Identities • Let R be a regular expression • R°Ø = • R°ε = • R∪Ø = • R∪ε =

  7. Regular expressions and NFAs • Theorem 1.54: A language is regular if and only if some regular expression describes it. • Proof (⇐) • If a ∈ Σ, then a is regular. • ε is regular. • Ø is regular. • If R1 and R2 are regular, then (R1∪R2) is regular. • If R1 and R2 are regular, then (R1°R2) is regular. • If R1 is a regular, then (R1*) is regular

  8. Proof in action • Build an NFA to that recognizes the regular expression a(a∪b)*a

More Related