slides
slides
Peter Cappello
Department of Computer Science
University of California, Santa Barbara
Santa Barbara, CA 93106
[email protected]
1
Closure Properties
Definition: The language denoted by a regular expression is a regular
language.
2
Theorem: If L1 and L2 are regular languages, then L1 ∪ L2, L1L2, and
L∗1 are regular languages.
Proof (by regular expression):
1. Since L1 and L2 are regular languages, each is denoted by some
regular expression, say r1 and r2, respectively.
2. Given regular expressions r1 and r2, r1 + r2, r1r2, and r1∗ are
regular expressions, by the inductive rules for forming regular ex-
pressions.
3. The languages denoted by these regular expressions are L1 ∪ L2,
L1L2, and L∗1 , respectively.
4. Thus, these languages are regular.
3
Proof (by machine):
1. Since L1 and L2 are regular languages, there exist TGs that accept
them, say T G1 and T G2, respectively.
2. Assume, without loss of generality, that each has a single initial
state and a single final state.
3. Given these TGs, it is easy to construct TGs that accept L1 ∪ L2,
L1L2, and L∗1 . Produce on blackboard.
4. Thus, these languages are regular.
4
Example
Let Σ = {a, b}.
• Let L1 = a(a + b)∗a + b(a + b)∗b = { the set of all strings of length
≥ 2 that begin and end with the same letter. }
• Let L2 = (a + b)∗aba(a + b)∗ = { the set of all strings that contain
“aba” as a substring. }
Then:
• L1 ∪ L2 = (a(a + b)∗a + b(a + b)∗b) + ((a + b)∗aba(a + b)∗).
• L1L2 = (a(a + b)∗a + b(a + b)∗b)((a + b)∗aba(a + b)∗).
• L∗1 = (a(a + b)∗a + b(a + b)∗b)∗.
Produce machine compositions on the blackboard.
5
Complements and Intersections
Theorem: If L is a regular language, L is regular.
Proof:
Apply the construction on even − odd, the set of strings with an even
number of a’s and an odd number of b’s.
6
Theorem: If L1 and L2 are a regular languages, L1 ∩ L2 is regular.
Proof: By DeMorgan’s law, L1 ∩ L2 = L1 ∪ L2, a regular language.
7
Proof: (machine-based)
Replicate the FA construction for the union of 2 regular languages,
but final states are those where both component states are final in the
given machines.
Thus, a word is accepted by the constructed FA if and only if it is
accepted by both given finite automata.
Illustrate on the set of words that begin with a and end with b.