






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The concepts of operations on languages, including union, concatenation, and kleene closure, using examples and formal definitions. It also covers regular expressions as a formula for representing complex languages using these operations.
Typology: Study notes
1 / 10
This page cannot be seen from the preview
Don't miss anything!







1 Operations on Languages
Operations on Languages
Union is a familiar operation on sets. We define and explain the other two operations below. Concatenation of Languages
Definition 1. Given languages L 1 and L 2 , we define their concatenation to be the language L 1 ◦ L 2 = {xy | x ∈ L 1 , y ∈ L 2 }
Example 2. • L 1 = {hello} and L 2 = {world} then L 1 ◦ L 2 = {helloworld}
Kleene Closure
Definition 3.
Ln^ =
{} if n = 0 Ln−^1 ◦ L otherwise
i≥ 0
Li
i.e., Li^ is L ◦ L ◦ · · · ◦ L (concatenation of i copies of L), for i > 0. L∗, the Kleene Closure of L: set of strings formed by taking any number of strings (possibly none) from L, possibly with repetitions and concatenating all of them.
0 ∗^ ∪ (0∗ 10 ∗ 10 ∗ 10 ∗)∗^ Strings where the number of 1s is divisible by 3 (0 ∪ 1)∗001(0 ∪ 1)∗^ Strings that have 001 as a sub- string
More Examples
(10)∗^ ∪ (01)∗^ ∪ 0(10)∗^ ∪ 1(01)∗^ Strings that consist of alter- nating 0s and 1s ( ∪ 1)(01)∗( ∪ 0) Strings that consist of alter- nating 0s and 1s (0 ∪ )(1 ∪ 10)∗^ Strings that do not have two consecutive 0s
Some Regular Expression Identities We say R 1 = R 2 if L(R 1 ) = L(R 2 ).
Useful Notation
Definition 4. Define R+^ = RR∗. Thus, R∗^ = R+^ ∪ . In addition, R+^ = R∗^ iff ∈ L(R).
Regular Expressions and Regular Languages Why do they have such similar names?
Theorem 5. L is a regular language if and only if there is a regular expression R such that L(R) = L
i.e., Regular expressions have the same “expressive power” as finite automata.
Proof. • Given regular expression R, will construct NFA N such that L(N ) = L(R)
Regular Expressions to Finite Automata
... to Non-determinstic Finite Automata
Lemma 6. For any regex R, there is an NFA NR s.t. L(NR) = L(R).
Proof Idea We will build the NFA NR for R, inductively, based on the number of operators in R, #(R).
Regular Expression to NFA
Base Cases If R is an elementary regular expression, NFA NR is constructed as follows.
q 0
q 0
R = a
q 0 a q 1
⇐ w ∈ L(N 1 ) ∪ L(N 2 ). Consider w ∈ L(N 1 ); case of w ∈ L(N 2 ) is similar. Then, q 1 −→w N 1 q for some q ∈ F 1. Thus, q 0
−→N q 1
w −→N q, and q ∈ F. This means that w ∈ L(N ).
Induction Step: Concatenation
Case R = R 1 ◦ R 2
q 1
q 11
q 12
q 2 q 21
Figure 3: NFA for L(N 1 ) ◦ L(N 2 )
Formal definition and proof of correctness left as exercise.
Induction Step: Kleene Closure First Attempt
Case R = R∗ 1
q 0
q 1
q 2
Figure 4: NFA accepts (L(N 1 ))+
Problem: May not accept ! One can show that L(N ) = (L(N 1 ))+.
Induction Step: Kleene Closure Second Attempt
Case R = R∗ 1
q 0
q 1
q 2
Figure 5: NFA accepts ⊇ (L(N 1 ))∗
Problem: May accept strings that are not in (L(N 1 ))∗!
Example demonstrating the problem
q 0 q 1
Figure 6: Example NFA N
q 0 q 1
Figure 7: Incorrect Kleene Closure of N
L(N ) = (0 ∪ 1)∗1(0 ∪ 1)∗. Thus, (L(N ))∗^ = ∪ (0 ∪ 1)∗1(0 ∪ 1)∗. The previous construction, gives an NFA that accepts 0 6 ∈ (L(N ))∗!
Induction Step: Kleene Closure Correct Construction
Case R = R∗ 1
Today