360 likes | 372 Views
This text describes regular expressions, regular languages, and their relationship. It covers the definition of regular expressions, examples, equivalent expressions, languages generated by regular expressions, and standard representations.
E N D
Regular Expressions Costas Busch - LSU
Regular Expressions Regular expressions describe regular languages Example: describes the language Costas Busch - LSU
Given regular expressions and Are regular expressions Recursive Definition Primitive regular expressions: Costas Busch - LSU
Not a regular expression: Examples A regular expression: Costas Busch - LSU
Languages of Regular Expressions : language of regular expression Example Costas Busch - LSU
Definition For primitive regular expressions: Costas Busch - LSU
Definition (continued) For regular expressions and Costas Busch - LSU
Example Regular expression: Costas Busch - LSU
Example Regular expression Costas Busch - LSU
Example Regular expression Costas Busch - LSU
= { all strings containing substring 00 } Example Regular expression Costas Busch - LSU
= { all strings without substring 00 } Example Regular expression Costas Busch - LSU
Equivalent Regular Expressions Definition: Regular expressions and are equivalent if Costas Busch - LSU
and are equivalent regular expressions Example = { all strings without substring 00 } Costas Busch - LSU
Regular ExpressionsandRegular Languages Costas Busch - LSU
Theorem Languages Generated by Regular Expressions Regular Languages Costas Busch - LSU
Proof: Languages Generated by Regular Expressions Regular Languages Languages Generated by Regular Expressions Regular Languages Costas Busch - LSU
For any regular expression the language is regular Proof by induction on the size of Proof - Part 1 Languages Generated by Regular Expressions Regular Languages Costas Busch - LSU
regular languages Induction Basis Primitive Regular Expressions: Corresponding NFAs Costas Busch - LSU
Inductive Hypothesis Suppose that for regular expressions and , and are regular languages Costas Busch - LSU
Inductive Step We will prove: Are regular Languages Costas Busch - LSU
By definition of regular expressions: Costas Busch - LSU
We also know: Regular languages are closed under: Union Concatenation Star By inductive hypothesis we know: and are regular languages Costas Busch - LSU
Therefore: Are regular languages is trivially a regular language (by induction hypothesis) End of Proof-Part 1 Costas Busch - LSU
Using the regular closure of operations, we can construct recursively the NFA that accepts Example: Costas Busch - LSU
Proof - Part 2 Languages Generated by Regular Expressions Regular Languages For any regular language there is a regular expression with We will convert an NFA that accepts to a regular expression Costas Busch - LSU
Since is regular, there is a NFA that accepts it Take it with a single accept state Costas Busch - LSU
From construct the equivalent Generalized Transition Graph in which transition labels are regular expressions Example: Corresponding Generalized transition graph Costas Busch - LSU
Another Example: Transition labels are regular expressions Costas Busch - LSU
Reducing the states: Transition labels are regular expressions Costas Busch - LSU
Resulting Regular Expression: Costas Busch - LSU
In General Removing a state: 2-neighbors Costas Busch - LSU
This can be generalized to arbitrary number of neighbors to q 3-neighbors Costas Busch - LSU
By repeating the process until two states are left, the resulting graph is Initial graph Resulting graph The resulting regular expression: End of Proof-Part 2 Costas Busch - LSU
Standard Representations of Regular Languages Regular Languages DFAs Regular Expressions NFAs Costas Busch - LSU
When we say: We are given a Regular Language We mean: Language is in a standard representation (DFA, NFA, or Regular Expression) Costas Busch - LSU