Additional Material Section 2.1

Additional Material Section 2.1
2IT16 Finite Automata and Processes
Technische Universiteit Eindhoven
February 8, 2011
Exercise 2.1.15 (formulation)
Design an automaton with no more than five states that accepts
the language {ababn | n ≥ 0} ∪ {aban | n ≥ 0}.
2 IT16 (2011) Chapter 2
2 / 17
Exercise 2.1.15 (solution)
a
a
a
b
a
b
L = { abab n | n ≥ 0 } ∪ { aba n | n ≥ 0 }
2 IT16 (2011) Chapter 2
3 / 17
Exercise 2.1.19 (formulation)
Show that the language
L = {an | n is a multiple of 3, but not a multiple of 5 }
is regular.
2 IT16 (2011) Chapter 2
4 / 17
Exercise 2.1.19 (solution)
a
s0
a
s1
a
s2
L(M3 ) = { a n | n multiple of 3 }
2 IT16 (2011) Chapter 2
5 / 17
Exercise 2.1.19 (solution)
a
t0
a
t1
a
t2
a
t3
a
t4
L(M5 ) = { a n | n no multiple of 5 }
2 IT16 (2011) Chapter 2
6 / 17
Exercise 2.1.19 (solution)
t0
t1
t2
t3
t4
s0
u 00
u 01
u 02
u 03
u 04
s1
u 10
u 11
u 12
u 13
u 14
s2
u 20
u 21
u 22
u 23
u 24
2 IT16 (2011) Chapter 2
7 / 17
Exercise 2.1.19 (solution)
t0
t1
t2
t3
t4
s0
u 00
u 01
u 02
u 03
u 04
s1
u 10
u 11
u 12
u 13
u 14
s2
u 20
u 21
u 22
u 23
u 24
2 IT16 (2011) Chapter 2
8 / 17
Exercise 2.1.19 (solution)
u 00
u 01
u 02
u 03
u 04
u 10
u 11
u 12
u 13
u 14
u 20
u 21
u 22
u 23
u 24
2 IT16 (2011) Chapter 2
9 / 17
Intersection of regular languages
two automata M1 = (S1 , A, →1 , ↑1 , ↓1 ), M2 = (S2 , A, →2 , ↑2 , ↓2 )
definition: product automaton M = (S, A, →, ↑, ↓)
S = S1 × S2 = { (s1 , s2 ) | s1 ∈ S1 , s2 ∈ S2 }
a
a
a
(s1 , s2 ) −→ (t1 , t2 ) ⇐⇒ s1 −→1 t1 ∧ s2 −→2 t2
↑ = (↑1 , ↑2 ), ↓ = ↓1 × ↓2
theorem: if L1 and L2 regular, then L1 ∩ L2 regular
2 IT16 (2011) Chapter 2
10 / 17
Exercise 2.1.10 (formulation)
For each of the statements below, decide whether it is true or
false. If it is true, prove it. If not, give a counterexample.
All parts refer to languages over the alphabet {a, b}.
1
If L1 ⊆ L2 and L1 is not regular, then L2 is not regular.
2
If L1 is regular, L2 is not regular, and L1 ∩ L2 is regular, then
L1 ∪ L2 is not regular.
2 IT16 (2011) Chapter 2
11 / 17
Exercise 2.1.10 (solution)
1
L = { a n b n | n ≥ 0 } is non-regular
L ⊆ {a, b}∗
but {a, b}∗ is regular
2
suppose L1 ∪ L2 is regular
then (L1 ∪ L2 ) ∩ (L1 ∩ L2 ) is regular
also (L1 ∪ L2 ) ∩ Lc1 is regular
¡
¢ ¡
¢
hence L2 = (L1 ∪ L2 ) ∩ (L1 ∩ L2 ) ∪ (L1 ∪ L2 ) ∩ Lc1 is regular
2 IT16 (2011) Chapter 2
12 / 17
Exercise 2.1.21 (formulation)
Suppose the language L is regular and a ∈ A.
Show that L ∪ {a} is regular.
2 IT16 (2011) Chapter 2
13 / 17
Exercise 2.1.21 (solution)
s
a
b
a
a
t
M′
b
c
c
M = (S, A, →, ↑, ↓)
= (S ∪ {s, t}, A, →′ , ↑, ↓ ∪ {s})
b
→′ = { (u, b, v ) | u, v ∈ S, b ∈ A : u −→ v ∧ v 6= ↑ } ∪
b
{ (u, b, t) | u, v ∈ S, b ∈ A : u −→ ↑ } ∪
{(↑, a, s)}
2 IT16 (2011) Chapter 2
14 / 17
Exercise 2.1.20 (formulation)
Suppose the language L is regular.
Show that L − {ε} is regular.
2 IT16 (2011) Chapter 2
15 / 17
Exercise 2.1.20 (solution)
b
s
a
t
r
a
M = (S, A, →, ↑, ↓)
M′ = (S ∪ {r }, A, → ∪ {(r , a, t)}, r , ↓)
2 IT16 (2011) Chapter 2
16 / 17
Exercise 2.1.20 (solution)
given M = (S, A, →, ↑, ↓)
add fresh state r ∈
/S
let r be the new initial state
a
a
if ↑ −→ s in M, add r −→ s
a
a
M′ = (S ∪ {r }, A, → ∪ { r −→ s | ↑ −→ s }, r , ↓)
2 IT16 (2011) Chapter 2
17 / 17