Presentation is loading. Please wait.

Presentation is loading. Please wait.

Regular expressions Regular languages Sipser 1.3 (pages 63-76)

Similar presentations


Presentation on theme: "Regular expressions Regular languages Sipser 1.3 (pages 63-76)"— Presentation transcript:

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

2 Last time…

3 CS 311 Mount Holyoke College 3 Regular expressions 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

4 CS 311 Mount Holyoke College 4 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

5 Today…

6 CS 311 Mount Holyoke College 6 Going forward Theorem 1.54: A language is regular if and only if some regular expression describes it. ( ⇒ ) 3-state DFA 5-state GNFA 4-state GNFA 3-state GNFA 2-state GNFA regular expression

7 CS 311 Mount Holyoke College 7 Generalized NFA Transition to every other state, but no transitions in Transitions in from every other state, but no transitions out Exactly one arrow to and from every state (including itself) other than start and accept

8 CS 311 Mount Holyoke College 8 Proof DFA to GNFA… Step 1: Add a unique start state with an εjump to the original one Step 2: Add a unique accept state with εjumps from the previous accept states Step 3: Convert multiple labels to ∪ Step 4: Add Ø jumps for any transition that’s missing

9 CS 311 Mount Holyoke College 9 Induction step: rip a state

10 CS 311 Mount Holyoke College 10 A simple example


Download ppt "Regular expressions Regular languages Sipser 1.3 (pages 63-76)"

Similar presentations


Ads by Google