+ All Categories
Home > Documents > CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208:...

CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208:...

Date post: 21-Mar-2020
Category:
Upload: others
View: 5 times
Download: 0 times
Share this document with a friend
46
Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi A start B b x(La (x) →∃y.(x < y) L b (y)) a b a Department of Computer Science and Engineering, Indian Institute of Technology Bombay. Ashutosh Trivedi Regular Languages Closure Properties
Transcript
Page 1: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 1 of 13

CS 208: Automata Theory and LogicClosure Properties for Regular Languages

Ashutosh Trivedi

Astart B

b

∀x(La(x) → ∃y.(x < y) ∧ Lb(y))

a

b

a

Department of Computer Science and Engineering,Indian Institute of Technology Bombay.

Ashutosh Trivedi Regular Languages Closure Properties

Page 2: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 2 of 13

Regular Languages: Properties

Definition (Regular Languages)A language is called regular if it is accepted by a finite state automaton.

Let A and B be languages (remember they are sets). We define thefollowing operations on them:

1. Union: A ∪ B = {w : w ∈ A or w ∈ B}2. Intersection: A ∩ B = {w : w ∈ A and w ∈ B}3. Complementation: A = {w : w 6∈ A}4. Concatenation: AB = {wv : w ∈ A and v ∈ B}5. Closure (Kleene Closure, or Star):

A∗ = {w1w2 . . .wk : k ≥ 0 and wi ∈ A}. In other words:

A∗ = ∪i≥0Ai

where A0 = ∅, A1 = A, A2 = AA, and so on.Define the notion of a set being closed under an operation (say, N and ×).

TheoremThe class of regular languages is closed under union, intersection,complementation, concatenation, and Kleene closure.

Ashutosh Trivedi Regular Languages Closure Properties

Page 3: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 2 of 13

Regular Languages: Properties

Definition (Regular Languages)A language is called regular if it is accepted by a finite state automaton.

Let A and B be languages (remember they are sets). We define thefollowing operations on them:

1. Union: A ∪ B = {w : w ∈ A or w ∈ B}2. Intersection: A ∩ B = {w : w ∈ A and w ∈ B}

3. Complementation: A = {w : w 6∈ A}4. Concatenation: AB = {wv : w ∈ A and v ∈ B}5. Closure (Kleene Closure, or Star):

A∗ = {w1w2 . . .wk : k ≥ 0 and wi ∈ A}. In other words:

A∗ = ∪i≥0Ai

where A0 = ∅, A1 = A, A2 = AA, and so on.Define the notion of a set being closed under an operation (say, N and ×).

TheoremThe class of regular languages is closed under union, intersection,complementation, concatenation, and Kleene closure.

Ashutosh Trivedi Regular Languages Closure Properties

Page 4: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 2 of 13

Regular Languages: Properties

Definition (Regular Languages)A language is called regular if it is accepted by a finite state automaton.

Let A and B be languages (remember they are sets). We define thefollowing operations on them:

1. Union: A ∪ B = {w : w ∈ A or w ∈ B}2. Intersection: A ∩ B = {w : w ∈ A and w ∈ B}3. Complementation: A = {w : w 6∈ A}

4. Concatenation: AB = {wv : w ∈ A and v ∈ B}5. Closure (Kleene Closure, or Star):

A∗ = {w1w2 . . .wk : k ≥ 0 and wi ∈ A}. In other words:

A∗ = ∪i≥0Ai

where A0 = ∅, A1 = A, A2 = AA, and so on.Define the notion of a set being closed under an operation (say, N and ×).

TheoremThe class of regular languages is closed under union, intersection,complementation, concatenation, and Kleene closure.

Ashutosh Trivedi Regular Languages Closure Properties

Page 5: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 2 of 13

Regular Languages: Properties

Definition (Regular Languages)A language is called regular if it is accepted by a finite state automaton.

Let A and B be languages (remember they are sets). We define thefollowing operations on them:

1. Union: A ∪ B = {w : w ∈ A or w ∈ B}2. Intersection: A ∩ B = {w : w ∈ A and w ∈ B}3. Complementation: A = {w : w 6∈ A}4. Concatenation: AB = {wv : w ∈ A and v ∈ B}

5. Closure (Kleene Closure, or Star):A∗ = {w1w2 . . .wk : k ≥ 0 and wi ∈ A}. In other words:

A∗ = ∪i≥0Ai

where A0 = ∅, A1 = A, A2 = AA, and so on.Define the notion of a set being closed under an operation (say, N and ×).

TheoremThe class of regular languages is closed under union, intersection,complementation, concatenation, and Kleene closure.

Ashutosh Trivedi Regular Languages Closure Properties

Page 6: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 2 of 13

Regular Languages: Properties

Definition (Regular Languages)A language is called regular if it is accepted by a finite state automaton.

Let A and B be languages (remember they are sets). We define thefollowing operations on them:

1. Union: A ∪ B = {w : w ∈ A or w ∈ B}2. Intersection: A ∩ B = {w : w ∈ A and w ∈ B}3. Complementation: A = {w : w 6∈ A}4. Concatenation: AB = {wv : w ∈ A and v ∈ B}5. Closure (Kleene Closure, or Star):

A∗ = {w1w2 . . .wk : k ≥ 0 and wi ∈ A}. In other words:

A∗ = ∪i≥0Ai

where A0 = ∅, A1 = A, A2 = AA, and so on.

Define the notion of a set being closed under an operation (say, N and ×).

TheoremThe class of regular languages is closed under union, intersection,complementation, concatenation, and Kleene closure.

Ashutosh Trivedi Regular Languages Closure Properties

Page 7: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 2 of 13

Regular Languages: Properties

Definition (Regular Languages)A language is called regular if it is accepted by a finite state automaton.

Let A and B be languages (remember they are sets). We define thefollowing operations on them:

1. Union: A ∪ B = {w : w ∈ A or w ∈ B}2. Intersection: A ∩ B = {w : w ∈ A and w ∈ B}3. Complementation: A = {w : w 6∈ A}4. Concatenation: AB = {wv : w ∈ A and v ∈ B}5. Closure (Kleene Closure, or Star):

A∗ = {w1w2 . . .wk : k ≥ 0 and wi ∈ A}. In other words:

A∗ = ∪i≥0Ai

where A0 = ∅, A1 = A, A2 = AA, and so on.Define the notion of a set being closed under an operation (say, N and ×).

TheoremThe class of regular languages is closed under union, intersection,complementation, concatenation, and Kleene closure.

Ashutosh Trivedi Regular Languages Closure Properties

Page 8: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 2 of 13

Regular Languages: Properties

Definition (Regular Languages)A language is called regular if it is accepted by a finite state automaton.

Let A and B be languages (remember they are sets). We define thefollowing operations on them:

1. Union: A ∪ B = {w : w ∈ A or w ∈ B}2. Intersection: A ∩ B = {w : w ∈ A and w ∈ B}3. Complementation: A = {w : w 6∈ A}4. Concatenation: AB = {wv : w ∈ A and v ∈ B}5. Closure (Kleene Closure, or Star):

A∗ = {w1w2 . . .wk : k ≥ 0 and wi ∈ A}. In other words:

A∗ = ∪i≥0Ai

where A0 = ∅, A1 = A, A2 = AA, and so on.Define the notion of a set being closed under an operation (say, N and ×).

TheoremThe class of regular languages is closed under union, intersection,complementation, concatenation, and Kleene closure.

Ashutosh Trivedi Regular Languages Closure Properties

Page 9: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 3 of 13

Closure under Union

LemmaThe class of regular languages is closed under union.

Proof.– Prove that for regular languages L1 and L2 that L1 ∪ L2 is regular.– Let M1 = (S1,Σ, δ1, s1,F1) and M2 = (S2,Σ, δ2, s2,F2) be DFA for L1

and L2.– DFA Construction: (the Product Construction)

We claim the DFA M = (S1 × S2,Σ, δ, (s1, s2),F) where– δ((s1, s2), a) = (δ1(s1, a), δ2(s2, a)) for all s1 ∈ S1, s2 ∈ S2, and a ∈ Σ,– F = (F1 × S2) ∪ (S1 × F2).

accepts L1 ∪ L2 i.e. L(M) = L(M1) ∪ L(M2).– Proof of correctness: For every string w, we have

1. δ((s1, s2),w) = (δ1(s1,w), δ2(s2,w))2. δ((s1, s2),w) ∈ F iff δ1(s1,w) ∈ F or δ2(s2,w) ∈ F.

– L1 ∪ L2 is regular since there is a DFA accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 10: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 3 of 13

Closure under Union

LemmaThe class of regular languages is closed under union.

Proof.– Prove that for regular languages L1 and L2 that L1 ∪ L2 is regular.

– Let M1 = (S1,Σ, δ1, s1,F1) and M2 = (S2,Σ, δ2, s2,F2) be DFA for L1and L2.

– DFA Construction: (the Product Construction)We claim the DFA M = (S1 × S2,Σ, δ, (s1, s2),F) where

– δ((s1, s2), a) = (δ1(s1, a), δ2(s2, a)) for all s1 ∈ S1, s2 ∈ S2, and a ∈ Σ,– F = (F1 × S2) ∪ (S1 × F2).

accepts L1 ∪ L2 i.e. L(M) = L(M1) ∪ L(M2).– Proof of correctness: For every string w, we have

1. δ((s1, s2),w) = (δ1(s1,w), δ2(s2,w))2. δ((s1, s2),w) ∈ F iff δ1(s1,w) ∈ F or δ2(s2,w) ∈ F.

– L1 ∪ L2 is regular since there is a DFA accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 11: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 3 of 13

Closure under Union

LemmaThe class of regular languages is closed under union.

Proof.– Prove that for regular languages L1 and L2 that L1 ∪ L2 is regular.– Let M1 = (S1,Σ, δ1, s1,F1) and M2 = (S2,Σ, δ2, s2,F2) be DFA for L1

and L2.

– DFA Construction: (the Product Construction)We claim the DFA M = (S1 × S2,Σ, δ, (s1, s2),F) where

– δ((s1, s2), a) = (δ1(s1, a), δ2(s2, a)) for all s1 ∈ S1, s2 ∈ S2, and a ∈ Σ,– F = (F1 × S2) ∪ (S1 × F2).

accepts L1 ∪ L2 i.e. L(M) = L(M1) ∪ L(M2).– Proof of correctness: For every string w, we have

1. δ((s1, s2),w) = (δ1(s1,w), δ2(s2,w))2. δ((s1, s2),w) ∈ F iff δ1(s1,w) ∈ F or δ2(s2,w) ∈ F.

– L1 ∪ L2 is regular since there is a DFA accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 12: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 3 of 13

Closure under Union

LemmaThe class of regular languages is closed under union.

Proof.– Prove that for regular languages L1 and L2 that L1 ∪ L2 is regular.– Let M1 = (S1,Σ, δ1, s1,F1) and M2 = (S2,Σ, δ2, s2,F2) be DFA for L1

and L2.– DFA Construction: (the Product Construction)

We claim the DFA M = (S1 × S2,Σ, δ, (s1, s2),F) where– δ((s1, s2), a) = (δ1(s1, a), δ2(s2, a)) for all s1 ∈ S1, s2 ∈ S2, and a ∈ Σ,– F = (F1 × S2) ∪ (S1 × F2).

accepts L1 ∪ L2 i.e. L(M) = L(M1) ∪ L(M2).

– Proof of correctness: For every string w, we have1. δ((s1, s2),w) = (δ1(s1,w), δ2(s2,w))2. δ((s1, s2),w) ∈ F iff δ1(s1,w) ∈ F or δ2(s2,w) ∈ F.

– L1 ∪ L2 is regular since there is a DFA accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 13: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 3 of 13

Closure under Union

LemmaThe class of regular languages is closed under union.

Proof.– Prove that for regular languages L1 and L2 that L1 ∪ L2 is regular.– Let M1 = (S1,Σ, δ1, s1,F1) and M2 = (S2,Σ, δ2, s2,F2) be DFA for L1

and L2.– DFA Construction: (the Product Construction)

We claim the DFA M = (S1 × S2,Σ, δ, (s1, s2),F) where– δ((s1, s2), a) = (δ1(s1, a), δ2(s2, a)) for all s1 ∈ S1, s2 ∈ S2, and a ∈ Σ,– F = (F1 × S2) ∪ (S1 × F2).

accepts L1 ∪ L2 i.e. L(M) = L(M1) ∪ L(M2).– Proof of correctness:

For every string w, we have1. δ((s1, s2),w) = (δ1(s1,w), δ2(s2,w))2. δ((s1, s2),w) ∈ F iff δ1(s1,w) ∈ F or δ2(s2,w) ∈ F.

– L1 ∪ L2 is regular since there is a DFA accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 14: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 3 of 13

Closure under Union

LemmaThe class of regular languages is closed under union.

Proof.– Prove that for regular languages L1 and L2 that L1 ∪ L2 is regular.– Let M1 = (S1,Σ, δ1, s1,F1) and M2 = (S2,Σ, δ2, s2,F2) be DFA for L1

and L2.– DFA Construction: (the Product Construction)

We claim the DFA M = (S1 × S2,Σ, δ, (s1, s2),F) where– δ((s1, s2), a) = (δ1(s1, a), δ2(s2, a)) for all s1 ∈ S1, s2 ∈ S2, and a ∈ Σ,– F = (F1 × S2) ∪ (S1 × F2).

accepts L1 ∪ L2 i.e. L(M) = L(M1) ∪ L(M2).– Proof of correctness: For every string w, we have

1. δ((s1, s2),w) = (δ1(s1,w), δ2(s2,w))2. δ((s1, s2),w) ∈ F iff δ1(s1,w) ∈ F or δ2(s2,w) ∈ F.

– L1 ∪ L2 is regular since there is a DFA accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 15: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 3 of 13

Closure under Union

LemmaThe class of regular languages is closed under union.

Proof.– Prove that for regular languages L1 and L2 that L1 ∪ L2 is regular.– Let M1 = (S1,Σ, δ1, s1,F1) and M2 = (S2,Σ, δ2, s2,F2) be DFA for L1

and L2.– DFA Construction: (the Product Construction)

We claim the DFA M = (S1 × S2,Σ, δ, (s1, s2),F) where– δ((s1, s2), a) = (δ1(s1, a), δ2(s2, a)) for all s1 ∈ S1, s2 ∈ S2, and a ∈ Σ,– F = (F1 × S2) ∪ (S1 × F2).

accepts L1 ∪ L2 i.e. L(M) = L(M1) ∪ L(M2).– Proof of correctness: For every string w, we have

1. δ((s1, s2),w) = (δ1(s1,w), δ2(s2,w))2. δ((s1, s2),w) ∈ F iff δ1(s1,w) ∈ F or δ2(s2,w) ∈ F.

– L1 ∪ L2 is regular since there is a DFA accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 16: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 4 of 13

Closure under Union via RegEx

LemmaThe class of regular languages is closed under union.

Proof.– Prove for arbitrary regular languages L1 and L2 that L1 ∪ L2 is a

regular languages.– Let E1 and E2 be REGEX accepting L1 and L2.

– REGEX Construction:We claim the REGEX

E = E1 + E2

accepts L1 ∪ L2, i.e. L(E1 + E2) = L(E1) ∪ L(E2).– Proof of correctness: trivial by definition of regular expressions.– L1 ∪ L2 is regular since there is a REGEX E1 + E2 accepting this

language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 17: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 4 of 13

Closure under Union via RegEx

LemmaThe class of regular languages is closed under union.

Proof.– Prove for arbitrary regular languages L1 and L2 that L1 ∪ L2 is a

regular languages.– Let E1 and E2 be REGEX accepting L1 and L2.– REGEX Construction:

We claim the REGEXE = E1 + E2

accepts L1 ∪ L2, i.e. L(E1 + E2) = L(E1) ∪ L(E2).

– Proof of correctness: trivial by definition of regular expressions.– L1 ∪ L2 is regular since there is a REGEX E1 + E2 accepting this

language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 18: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 4 of 13

Closure under Union via RegEx

LemmaThe class of regular languages is closed under union.

Proof.– Prove for arbitrary regular languages L1 and L2 that L1 ∪ L2 is a

regular languages.– Let E1 and E2 be REGEX accepting L1 and L2.– REGEX Construction:

We claim the REGEXE = E1 + E2

accepts L1 ∪ L2, i.e. L(E1 + E2) = L(E1) ∪ L(E2).– Proof of correctness: trivial by definition of regular expressions.

– L1 ∪ L2 is regular since there is a REGEX E1 + E2 accepting thislanguage.

Ashutosh Trivedi Regular Languages Closure Properties

Page 19: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 4 of 13

Closure under Union via RegEx

LemmaThe class of regular languages is closed under union.

Proof.– Prove for arbitrary regular languages L1 and L2 that L1 ∪ L2 is a

regular languages.– Let E1 and E2 be REGEX accepting L1 and L2.– REGEX Construction:

We claim the REGEXE = E1 + E2

accepts L1 ∪ L2, i.e. L(E1 + E2) = L(E1) ∪ L(E2).– Proof of correctness: trivial by definition of regular expressions.– L1 ∪ L2 is regular since there is a REGEX E1 + E2 accepting this

language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 20: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 5 of 13

Closure under Complementation

LemmaThe class of regular languages is closed under complementation.

Proof.– Prove for arbitrary regular language L that L is a regular languages.– Let M = (S,Σ, δ, s0,F) be a DFA accepting L.

– DFA Construction:We claim the DFA

M′ = (S,Σ, δ, s0,F′) where F′ = Q \ F

accepts L, i.e. L(M′) = {w : w 6∈ L(M)}.– Proof of correctness: For every string w, we have

1. δ(s0,w) 6∈ F iff δ(s0,w) ∈ F′.

– L is regular since there is a DFA accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 21: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 5 of 13

Closure under Complementation

LemmaThe class of regular languages is closed under complementation.

Proof.– Prove for arbitrary regular language L that L is a regular languages.– Let M = (S,Σ, δ, s0,F) be a DFA accepting L.– DFA Construction:

We claim the DFA

M′ = (S,Σ, δ, s0,F′) where F′ = Q \ F

accepts L, i.e. L(M′) = {w : w 6∈ L(M)}.

– Proof of correctness: For every string w, we have1. δ(s0,w) 6∈ F iff δ(s0,w) ∈ F′.

– L is regular since there is a DFA accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 22: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 5 of 13

Closure under Complementation

LemmaThe class of regular languages is closed under complementation.

Proof.– Prove for arbitrary regular language L that L is a regular languages.– Let M = (S,Σ, δ, s0,F) be a DFA accepting L.– DFA Construction:

We claim the DFA

M′ = (S,Σ, δ, s0,F′) where F′ = Q \ F

accepts L, i.e. L(M′) = {w : w 6∈ L(M)}.– Proof of correctness: For every string w, we have

1. δ(s0,w) 6∈ F iff δ(s0,w) ∈ F′.

– L is regular since there is a DFA accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 23: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 5 of 13

Closure under Complementation

LemmaThe class of regular languages is closed under complementation.

Proof.– Prove for arbitrary regular language L that L is a regular languages.– Let M = (S,Σ, δ, s0,F) be a DFA accepting L.– DFA Construction:

We claim the DFA

M′ = (S,Σ, δ, s0,F′) where F′ = Q \ F

accepts L, i.e. L(M′) = {w : w 6∈ L(M)}.– Proof of correctness: For every string w, we have

1. δ(s0,w) 6∈ F iff δ(s0,w) ∈ F′.

– L is regular since there is a DFA accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 24: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 6 of 13

Closure under Intersection

LemmaThe class of regular languages is closed under intersection.

Proof.– DFA based via product construction,– Using De Morgan’s laws.

Ashutosh Trivedi Regular Languages Closure Properties

Page 25: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 6 of 13

Closure under Intersection

LemmaThe class of regular languages is closed under intersection.

Proof.– DFA based via product construction,

– Using De Morgan’s laws.

Ashutosh Trivedi Regular Languages Closure Properties

Page 26: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 6 of 13

Closure under Intersection

LemmaThe class of regular languages is closed under intersection.

Proof.– DFA based via product construction,– Using De Morgan’s laws.

Ashutosh Trivedi Regular Languages Closure Properties

Page 27: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 7 of 13

Closure under Concatenation

LemmaThe class of regular languages is closed under concatenation.

Proof.– Prove for arbitrary regular languages L1 and L2 that L1.L2 is a regular

languages.– Let E1 and E2 be REGEX accepting L1 and L2.– REGEX Construction:

We claim the REGEXE = E1.E2

accepts L1.L2, i.e. L(E1.E2) = L(E1).L(E2).– Proof of correctness: trivial by definition of regular expressions.– L1.L2 is regular since there is a REGEX E1.E2 accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 28: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 7 of 13

Closure under Concatenation

LemmaThe class of regular languages is closed under concatenation.

Proof.– Prove for arbitrary regular languages L1 and L2 that L1.L2 is a regular

languages.– Let E1 and E2 be REGEX accepting L1 and L2.

– REGEX Construction:We claim the REGEX

E = E1.E2

accepts L1.L2, i.e. L(E1.E2) = L(E1).L(E2).– Proof of correctness: trivial by definition of regular expressions.– L1.L2 is regular since there is a REGEX E1.E2 accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 29: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 7 of 13

Closure under Concatenation

LemmaThe class of regular languages is closed under concatenation.

Proof.– Prove for arbitrary regular languages L1 and L2 that L1.L2 is a regular

languages.– Let E1 and E2 be REGEX accepting L1 and L2.– REGEX Construction:

We claim the REGEXE = E1.E2

accepts L1.L2, i.e. L(E1.E2) = L(E1).L(E2).

– Proof of correctness: trivial by definition of regular expressions.– L1.L2 is regular since there is a REGEX E1.E2 accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 30: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 7 of 13

Closure under Concatenation

LemmaThe class of regular languages is closed under concatenation.

Proof.– Prove for arbitrary regular languages L1 and L2 that L1.L2 is a regular

languages.– Let E1 and E2 be REGEX accepting L1 and L2.– REGEX Construction:

We claim the REGEXE = E1.E2

accepts L1.L2, i.e. L(E1.E2) = L(E1).L(E2).– Proof of correctness: trivial by definition of regular expressions.

– L1.L2 is regular since there is a REGEX E1.E2 accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 31: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 7 of 13

Closure under Concatenation

LemmaThe class of regular languages is closed under concatenation.

Proof.– Prove for arbitrary regular languages L1 and L2 that L1.L2 is a regular

languages.– Let E1 and E2 be REGEX accepting L1 and L2.– REGEX Construction:

We claim the REGEXE = E1.E2

accepts L1.L2, i.e. L(E1.E2) = L(E1).L(E2).– Proof of correctness: trivial by definition of regular expressions.– L1.L2 is regular since there is a REGEX E1.E2 accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 32: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 8 of 13

Closure under Kleene Star Operation

LemmaThe class of regular languages is closed under Kleene star operation.

Proof.– Prove for arbitrary regular language L that L∗ is a regular languages.– Let E be REGEX accepting L.

– REGEX Construction:We claim the REGEX

E′ = E∗

accepts L, i.e. L(E∗) = (L(E))∗.– Proof of correctness: trivial by definition of regular expressions.– L∗ is regular since there is a REGEX E∗ accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 33: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 8 of 13

Closure under Kleene Star Operation

LemmaThe class of regular languages is closed under Kleene star operation.

Proof.– Prove for arbitrary regular language L that L∗ is a regular languages.– Let E be REGEX accepting L.– REGEX Construction:

We claim the REGEXE′ = E∗

accepts L, i.e. L(E∗) = (L(E))∗.

– Proof of correctness: trivial by definition of regular expressions.– L∗ is regular since there is a REGEX E∗ accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 34: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 8 of 13

Closure under Kleene Star Operation

LemmaThe class of regular languages is closed under Kleene star operation.

Proof.– Prove for arbitrary regular language L that L∗ is a regular languages.– Let E be REGEX accepting L.– REGEX Construction:

We claim the REGEXE′ = E∗

accepts L, i.e. L(E∗) = (L(E))∗.– Proof of correctness: trivial by definition of regular expressions.

– L∗ is regular since there is a REGEX E∗ accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 35: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 8 of 13

Closure under Kleene Star Operation

LemmaThe class of regular languages is closed under Kleene star operation.

Proof.– Prove for arbitrary regular language L that L∗ is a regular languages.– Let E be REGEX accepting L.– REGEX Construction:

We claim the REGEXE′ = E∗

accepts L, i.e. L(E∗) = (L(E))∗.– Proof of correctness: trivial by definition of regular expressions.– L∗ is regular since there is a REGEX E∗ accepting this language.

Ashutosh Trivedi Regular Languages Closure Properties

Page 36: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 9 of 13

Closure under Homomorphism– A homomorphism is just substitution of strings for letters.– Formally a homomorphism is a function h : Σ→ Γ∗.

– Homomorphism can be extended from letters to strings h : Σ∗ → Γ∗

in a straightforward manner:

h(w) =

{ε if w = ε

h(w).h(a) if w = xa

– We can apply homomorphism to languages as well, for ahomomorphism h and a language L ⊆ Σ∗ we define h(L) ⊆ Γ∗ as

h(L) = {h(w) ∈ Γ∗ : w ∈ L ⊆ Σ∗}.

– We define inverse-homomorphism of a language L ∈ Γ∗ as

h−1(L) = {w ∈ Σ∗ : h(w) ∈ L ⊆ Γ∗}.

TheoremThe class of regular languages is closed under homomorphism, andinverse-homomorphism.

Ashutosh Trivedi Regular Languages Closure Properties

Page 37: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 9 of 13

Closure under Homomorphism– A homomorphism is just substitution of strings for letters.– Formally a homomorphism is a function h : Σ→ Γ∗.– Homomorphism can be extended from letters to strings h : Σ∗ → Γ∗

in a straightforward manner:

h(w) =

{ε if w = ε

h(w).h(a) if w = xa

– We can apply homomorphism to languages as well, for ahomomorphism h and a language L ⊆ Σ∗ we define h(L) ⊆ Γ∗ as

h(L) = {h(w) ∈ Γ∗ : w ∈ L ⊆ Σ∗}.

– We define inverse-homomorphism of a language L ∈ Γ∗ as

h−1(L) = {w ∈ Σ∗ : h(w) ∈ L ⊆ Γ∗}.

TheoremThe class of regular languages is closed under homomorphism, andinverse-homomorphism.

Ashutosh Trivedi Regular Languages Closure Properties

Page 38: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 9 of 13

Closure under Homomorphism– A homomorphism is just substitution of strings for letters.– Formally a homomorphism is a function h : Σ→ Γ∗.– Homomorphism can be extended from letters to strings h : Σ∗ → Γ∗

in a straightforward manner:

h(w) =

{ε if w = ε

h(w).h(a) if w = xa

– We can apply homomorphism to languages as well, for ahomomorphism h and a language L ⊆ Σ∗ we define h(L) ⊆ Γ∗ as

h(L) = {h(w) ∈ Γ∗ : w ∈ L ⊆ Σ∗}.

– We define inverse-homomorphism of a language L ∈ Γ∗ as

h−1(L) = {w ∈ Σ∗ : h(w) ∈ L ⊆ Γ∗}.

TheoremThe class of regular languages is closed under homomorphism, andinverse-homomorphism.

Ashutosh Trivedi Regular Languages Closure Properties

Page 39: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 9 of 13

Closure under Homomorphism– A homomorphism is just substitution of strings for letters.– Formally a homomorphism is a function h : Σ→ Γ∗.– Homomorphism can be extended from letters to strings h : Σ∗ → Γ∗

in a straightforward manner:

h(w) =

{ε if w = ε

h(w).h(a) if w = xa

– We can apply homomorphism to languages as well, for ahomomorphism h and a language L ⊆ Σ∗ we define h(L) ⊆ Γ∗ as

h(L) = {h(w) ∈ Γ∗ : w ∈ L ⊆ Σ∗}.

– We define inverse-homomorphism of a language L ∈ Γ∗ as

h−1(L) = {w ∈ Σ∗ : h(w) ∈ L ⊆ Γ∗}.

TheoremThe class of regular languages is closed under homomorphism, andinverse-homomorphism.

Ashutosh Trivedi Regular Languages Closure Properties

Page 40: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 9 of 13

Closure under Homomorphism– A homomorphism is just substitution of strings for letters.– Formally a homomorphism is a function h : Σ→ Γ∗.– Homomorphism can be extended from letters to strings h : Σ∗ → Γ∗

in a straightforward manner:

h(w) =

{ε if w = ε

h(w).h(a) if w = xa

– We can apply homomorphism to languages as well, for ahomomorphism h and a language L ⊆ Σ∗ we define h(L) ⊆ Γ∗ as

h(L) = {h(w) ∈ Γ∗ : w ∈ L ⊆ Σ∗}.

– We define inverse-homomorphism of a language L ∈ Γ∗ as

h−1(L) = {w ∈ Σ∗ : h(w) ∈ L ⊆ Γ∗}.

TheoremThe class of regular languages is closed under homomorphism, andinverse-homomorphism.

Ashutosh Trivedi Regular Languages Closure Properties

Page 41: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 10 of 13

Closure under Homomorphism

LemmaThe class of regular languages is closed under homomorphism.

Proof.– Prove for arbitrary regular language L and homomorphism h that

h(L) is a regular languages. Let E be REGEX accepting L.

– REGEX Construction: We claim the REGEX Eh defined inductively as

Eh = ε if E = ε

Eh = ∅ if E = ∅Eh = h(a) if E = a

Eh = Fh + Gh if E = F + GEh = Fh.Gh if E = F.GEh = (Fh)∗ if E = F∗

accepts h(L), i.e. L(Eh) = h(L(E)).

Ashutosh Trivedi Regular Languages Closure Properties

Page 42: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 10 of 13

Closure under Homomorphism

LemmaThe class of regular languages is closed under homomorphism.

Proof.– Prove for arbitrary regular language L and homomorphism h that

h(L) is a regular languages. Let E be REGEX accepting L.– REGEX Construction: We claim the REGEX Eh defined inductively as

Eh = ε if E = ε

Eh = ∅ if E = ∅Eh = h(a) if E = a

Eh = Fh + Gh if E = F + GEh = Fh.Gh if E = F.GEh = (Fh)∗ if E = F∗

accepts h(L), i.e. L(Eh) = h(L(E)).

Ashutosh Trivedi Regular Languages Closure Properties

Page 43: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 11 of 13

Closure under Homomorphism

– Proof of correctness: Prove that L(Eh) = h(L(E)).– if E = ε, then

LHS = L(Eh) = L(h(ε)) = L(ε) = {ε}RHS = h(L(E)) = h(L(ε)) = h({ε}) = {ε}.

– Similarly for E = ∅.

– if E = a, then

LHS = L(Eh) = L(h(a)) = {h(a)}RHS = h(L(E)) = h(L(a)) = h({a}) = {h(a)}.

– if E = F + G, then

L(h(E)) = L(h(F + G)) = L(h(F) + h(G)) = L(h(F)) ∪ L(h(G))

h(L(E)) = h(L(F + G)) = h(L(F)) ∪ h(L(G)).

From inductive hypothesis both of these expression are equal.– Other inductive cases are similar, and hence omitted.

Ashutosh Trivedi Regular Languages Closure Properties

Page 44: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 11 of 13

Closure under Homomorphism

– Proof of correctness: Prove that L(Eh) = h(L(E)).– if E = ε, then

LHS = L(Eh) = L(h(ε)) = L(ε) = {ε}RHS = h(L(E)) = h(L(ε)) = h({ε}) = {ε}.

– Similarly for E = ∅.– if E = a, then

LHS = L(Eh) = L(h(a)) = {h(a)}RHS = h(L(E)) = h(L(a)) = h({a}) = {h(a)}.

– if E = F + G, then

L(h(E)) = L(h(F + G)) = L(h(F) + h(G)) = L(h(F)) ∪ L(h(G))

h(L(E)) = h(L(F + G)) = h(L(F)) ∪ h(L(G)).

From inductive hypothesis both of these expression are equal.– Other inductive cases are similar, and hence omitted.

Ashutosh Trivedi Regular Languages Closure Properties

Page 45: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 12 of 13

Closure under Inverse-Homomorphism

LemmaThe class of regular languages is closed under homomorphism.

Proof.Let A = (S,Γ, δ, s0,F) be a DFA accepting L and h : Σ→ Γ∗ be an arbitraryhomomorphism. We show that the DFA h−1(A) = (S′,Σ, δ′, s′0,F

′) definedbelow accepts h−1(L).

– S′ = S, s′0 = s0, F′ = F

– δ′(s, a) = δ(s, h(a))

It is an easy induction over w that δ′(s,w) = δ(s, h(w)). Now, sinceaccepting states of A and h−1(A) are the same, h−1(A) accepts w iff Aaccepts h(w).

Ashutosh Trivedi Regular Languages Closure Properties

Page 46: CS 208: Automata Theory and Logicastr3586/courses/csci3434/...Ashutosh Trivedi – 1 of 13 CS 208: Automata Theory and Logic Closure Properties for Regular Languages Ashutosh Trivedi

Ashutosh Trivedi – 13 of 13

Practice Questions

1. Quotient Language. For a ∈ Σ and L ⊆ Σ∗ we define

L/a = {w : wa ∈ L}.a/L = {w : aw ∈ L}.L.a = {wa : w ∈ L}.a.L = {aw : w ∈ L}.

2. min(L) is the set of strings w such that w ∈ L and no proper prefix ofw is in L.

3. max(L) is the set of strings such that w ∈ L and no proper extensionwx ∈ L.

4. INIT(L) is the set of strings w such that for some x we have thatwx ∈ L.

5. HALF(L) is the set of strings w such that for some string x of same sizeas w we have that wx ∈ L.

Ashutosh Trivedi Regular Languages Closure Properties


Recommended