120 likes | 304 Views
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
E N D
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.
Regular expression e = λ e = e = a, for some a Σ Proof Sketch of Claim 1 – Base Case NFA 𝜆 a
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 𝜆 𝜆
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
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
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
Construction Continued • Two states remaining • Start state q’0, and • Accepting state qf • Regular expression: • r00* r0f (rff + rf0r00*r0f)*