Closure under regular operations I Recall we define three - - PowerPoint PPT Presentation

closure under regular operations i
SMART_READER_LITE
LIVE PREVIEW

Closure under regular operations I Recall we define three - - PowerPoint PPT Presentation

Closure under regular operations I Recall we define three operations: , , We will see that by using NFA, the proof is easier September 17, 2020 1 / 13 Union I Given two regular languages A 1 , A 2 under the same Is A 1 A 2


slide-1
SLIDE 1

Closure under regular operations I

Recall we define three operations: ∪, ◦, ∗ We will see that by using NFA, the proof is easier

September 17, 2020 1 / 13

slide-2
SLIDE 2

Union I

Given two regular languages A1, A2 under the same Σ Is A1 ∪ A2 regular? To prove that a language is regular, by definition, it should be accepted by one DFA (or an NFA) We will construct an NFA for A1 ∪ A2 Assume A1 and A2 are recognized by two NFAs N1 and N2, respectively N1 N2

q1 q2

September 17, 2020 2 / 13

slide-3
SLIDE 3

Union II

q0 q1 q2 ǫ ǫ

Formal definition

September 17, 2020 3 / 13

slide-4
SLIDE 4

Union III

Two NFAs: N1 = (Q1, Σ, δ1, q1, F1) N2 = (Q2, Σ, δ2, q2, F2) Note for NFA, ǫ / ∈ Σ

September 17, 2020 4 / 13

slide-5
SLIDE 5

Union IV

New NFA Q = Q1 ∪ Q2 ∪ {q0} q = q0 F = F1 ∪ F2 δ(q, a) =          δ1(q, a) q ∈ Q1 δ2(q, a) q ∈ Q2 {q1, q2} q = q0 and a = ǫ ∅ q = q0 and a = ǫ

September 17, 2020 5 / 13

slide-6
SLIDE 6

Union V

The last case of δ is easily neglected

September 17, 2020 6 / 13

slide-7
SLIDE 7

Closed Under Concatenation I

Given two NFAs N1 N2 Idea: from any accept state of N1, add an ǫ link to q2 (start state of N2) The new machine:

September 17, 2020 7 / 13

slide-8
SLIDE 8

Closed Under Concatenation II

ǫ ǫ

Formal definition. Given two automata (Q1, Σ, δ1, q1, F1) (Q2, Σ, δ2, q2, F2)

September 17, 2020 8 / 13

slide-9
SLIDE 9

Closed Under Concatenation III

New machine Q = Q1 ∪ Q2 q0 = q1 F = F2 δ function: δ(q, a) =          δ1(q, a) q ∈ Q1\F1 δ2(q, a) q ∈ Q2 δ1(q, ǫ) ∪ {q2} q ∈ F1, a = ǫ δ1(q, a) q ∈ F1, a = ǫ

September 17, 2020 9 / 13

slide-10
SLIDE 10

Closed under star I

Given the following machine Recall the star operation is defined as follows A∗ = {x1 · · · xk | k ≥ 0, xi ∈ A} How about the following diagram

September 17, 2020 10 / 13

slide-11
SLIDE 11

Closed under star II

ǫ ǫ

The problem is that ǫ may not be accepted How about making the start state an accepting one

ǫ ǫ

September 17, 2020 11 / 13

slide-12
SLIDE 12

Closed under star III

This may make the machine to accept strings not in A A correct setting

ǫ ǫ ǫ

Formal definition Given the machine (Q1, Σ, δ1, q1, F1)

September 17, 2020 12 / 13

slide-13
SLIDE 13

Closed under star IV

New machine: Q = Q1 ∪ {q0} q0 : new start state F = F1 ∪ {q0} δ(q, a) =                δ1(q, a) q ∈ Q1\F1 δ1(q, a) ∪ {q1} q ∈ F1, a = ǫ δ1(q, a) q ∈ F1, a = ǫ {q1} q = q0, a = ǫ ∅ q = q0, a = ǫ

September 17, 2020 13 / 13