1 Regular Expressions
2 Regular expressions describe regular languages Example: describes the language
3 Recursive Definition Are regular expressions Primitive regular expressions: Given regular expressions and
4 Examples A regular expression: Not a regular expression:
5 Languages of Regular Expressions : language of regular expression Example
6 Definition For primitive regular expressions:
7 Definition (continued) For regular expressions and
8 Example Regular expression:
9 Example Regular expression
10 Example Regular expression
11 Example Regular expression = { all strings with at least two consecutive 0 }
12 Example Regular expression = { all strings without two consecutive 0 }
13 Equivalent Regular Expressions Definition: Regular expressions and are equivalent if
14 Example = { all strings without two consecutive 0 } and are equivalent regular expr.
15 Regular Expressions and Regular Languages
16 Theorem Languages Generated by Regular Expressions Regular Languages
17 Languages Generated by Regular Expressions Regular Languages Generated by Regular Expressions Regular Languages We will show:
18 Proof - Part 1 For any regular expression the language is regular Languages Generated by Regular Expressions Regular Languages Proof by induction on the size of
19 Induction Basis Primitive Regular Expressions: NFAs regular languages
20 Inductive Hypothesis Assume for regular expressions and that and are regular languages
21 Inductive Step We will prove: Are regular Languages
22 By definition of regular expressions:
23 By inductive hypothesis we know: and are regular languages Regular languages are closed under: Union Concatenation Star We also know:
24 Therefore: Are regular languages
25 And trivially: is a regular language
26 Proof - Part 2 Languages Generated by Regular Expressions Regular Languages For any regular language there is a regular expression with Proof by construction of regular expression
27 Since is regular take the NFA that accepts it Single final state
28 From construct the equivalent Generalized Transition Graph in which transition labels are regular expressions Example:
29 Another Example:
30 Reducing the states:
31 Resulting Regular Expression:
32 In General Removing states:
33 The final transition graph: The resulting regular expression:
34 Standard Representations of Regular Languages Regular Languages FAs NFAs Regular Expressions
35 When we say: We are given a Regular Language We mean:Language is in a standard representation
36 Elementary Questions about Regular Languages
37 Membership Question Question:Given regular language and string how can we check if ? Answer:Take the DFA that accepts and check if is accepted
38 DFA
39 Given regular language how can we check if is empty: ? Take the DFA that accepts Check if there is any path from the initial state to a final state Question: Answer:
40 DFA
41 Given regular language how can we check if is finite? Take the DFA that accepts Check if there is a walk with cycle from the initial state to a final state Question: Answer:
42 DFA is infinite DFA is finite
43 Given regular languages and how can we check if ? Question: Find if Answer:
44 and
45 or