1 / 9

Regular Expressions and Regular Languages

Regular Expressions and Regular Languages. Languages of REXs = Regular Languages. Language of REX is regular. Claim 1: For each REX e, there exists an NFA M such that L(e) = L(M) where M has only a single accepting state The start state is not an accepting state

fionan
Download Presentation

Regular Expressions and Regular Languages

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 and Regular Languages

  2. Languages of REXs = Regular Languages

  3. Language of REX is regular • Claim 1: For each REX e, there exists an NFA M such that L(e) = L(M) where • M has only a single accepting state • The start state is not an accepting state • Proof by (strong) induction on the length of the regular expression.

  4. Regular expression e = λ e =  e = a, for some a  Σ Proof Sketch of Claim 1 – Base Case NFA 𝜆 a

  5. Regular expression e = (e1 + e2), e = (e1 . e2) e = (e1*) Proof Sketch Claim 1 – Inductive Step NFA L(M1) = L(e1) L(M2) = L(e2) M1 M2 M1 M2 𝜆 𝜆 M1 𝜆 𝜆

  6. REX exists for all Regular Languages • Showed that for all language Lif L = L(e) for some REX e then L = L(M) for some NFA M • Hence, language of an REX is regular • Remains to show there exists an REX for all regular languages

  7. Sketch of Proof by construction • Convert FA M=(Q,,,q0,F) to generalized transition graph GTG M’=(Q’,,’,q’0,qf)such that • M’ has a single accepting state qf • Accepting state  start state (q’0  qf) • State transition labels are REXs • For all qi, qj  Q’ there is a transition from qi to qj labelled rij

  8. Construction continued • State Reduction – repeatedly remove states until only start and accepting state left. When removing state qk • For all qi and qj that are remaining states • Change label from qi to qj to • rij + rik rkk* rkj

  9. Construction Continued • Two states remaining • Start state q’0, and • Accepting state qf • Regular expression: • r00* r0f (rff + rf0r00*r0f)*

More Related