Closed under complementation Proposition: Let be some finite - - PDF document

closed under complementation
SMART_READER_LITE
LIVE PREVIEW

Closed under complementation Proposition: Let be some finite - - PDF document

15-251 Great Ideas in Theoretical Computer Science Lecture 4: Deterministic Finite Automaton (DFA), Part 2 January 25th, 2018 Closure properties of regular languages Closed under complementation Proposition: Let be some finite


slide-1
SLIDE 1

January 25th, 2018

15-251 Great Ideas in Theoretical Computer Science

Lecture 4: Deterministic Finite Automaton (DFA), Part 2 Closure properties of regular languages

Closed under complementation

Proposition: Let be some finite alphabet. Σ If is regular, then so is . L ⊆ Σ∗ L = Σ∗\L Proof:

slide-2
SLIDE 2

Closed under union

Theorem: Let be some finite alphabet. Σ If and are regular, then so is . L1 ⊆ Σ∗ L2 ⊆ Σ∗ L1 ∪ L2 Proof: The mindset Step 1: Imagining ourselves as a DFA

slide-3
SLIDE 3

Closed under union

Example L1 = L2 =

strings with even number of 1’s strings with length divisible by 3.

0, 1 0, 1 0, 1 p0 p1 p2 M2 qeven qodd

1 1 M1

Closed under union

0, 1 0, 1 0, 1 p0 p1 p2 qeven qodd

1 1

Input: 101001 M1 M2

Closed under union

0, 1 0, 1 0, 1 p0 p1 p2 qeven qodd

1 1

Input: 101001 M1 M2 Accept

slide-4
SLIDE 4

Closed under union

0, 1 0, 1 0, 1 p0 p1 p2 qeven qodd

1 1 M1 M2

Main idea: Construct a DFA that keeps track of both at once.

Closed under union

Main idea: Construct a DFA that keeps track of both at once. p0 p2 qeven qodd qeven qeven p1

qodd qodd

p0 p2 p1 Step 2: Formally defining the DFA

slide-5
SLIDE 5

Closed under union

Proof: Let be a DFA deciding L1 and be a DFA deciding . M = (Q, Σ, δ, q0, F) M 0 = (Q0, Σ, δ0, q0

0, F 0)

L2 We construct a DFA M 00 = (Q00, Σ, δ00, q00

0, F 00)

that decides , as follows: L1 ∪ L2

More closure properties

Closed under star: Closed under concatenation: Closed under union:

super awesome vs regular

What is the relationship between super awesome and regular ?

slide-6
SLIDE 6

super awesome vs regular

Theorem: Can define regular languages recursively as follows:

Closed under concatenation

Theorem: Let be some finite alphabet. Σ If and are regular, then so is . L1 ⊆ Σ∗ L2 ⊆ Σ∗ L1L2 The mindset Imagine yourself as a DFA. Rules: 1) Can only scan the input once, from left to right. 2) Can only remember “constant” amount of information.

should not change based on input length

slide-7
SLIDE 7

Step 1: Imagining ourselves as a DFA Given , we need to decide if w ∈ Σ∗ w = uv for u ∈ L1, v ∈ L2. Problem: Don’t know where ends, begins.

u

v When do you stop simulating and start simulating ?

M1

M2 M1

1 1 1 1 1 q0

q1

q2 q3 q4 1 1 1

M2

q0

2

q0

1

q0

w1 w2 w3 w4 w5 w6 w7 w8 w9

1 1 1

w10

1

q0 q1

q1 q0 q0

2

q0

2

q0

2

q0

1

q0

2

q0

2

q0

1

Suppose God tells you ends at . u w3 M1

1 1 1 1 1 q0

q1

q2 q3 q4 1 1 1

M2

q0

2

q0

1

q0

q3 thread:

slide-8
SLIDE 8

M1

1 1 1 1 1 q0

q1

q2 q3 q4 1 1 1

w1 w2 w3 w4 w5 w6 w7 w8 w9

1 1 1 M2

q0

2

q0

1

q0

w10 w11

1 1

q0 q1

q1 q0 q2 q0

2

q1

q0

2

q0

1

q1

q0

2

q0

1

q0

1

q1

q0

2

q0

2

q0

2

q2 q0

q0 q0 q0

2

thread1 q0 thread2

q0

thread3

q0

thread4

automatic teleportation

q3

q4 q0

2

q3 q0

1

q0 q3 q0

1

q0

1

q0

1

w1 w2 w3 w4 w5 w6 w7 w8 w9

1 1 1

w10 w11

1 1

q0 q1

q1 q3 q2

q4

q1 q3 q1 q1

q3

q2 q0 q0

2

q0

2

q0

2

q0

1

q0

2

q0

2

q0

1

q0

q0 q0

1

q0 q0

1

q0 q0

2

q0 q0

1

q0

2

q0

1

q0

q0

2

q0

1

q0 thread1 thread2 thread3 thread4

M1

1 1 1 1 1 q0

q1

q2 q3 q4 1 1 1

M2

q0

2

q0

1

q0

automatic teleportation

w1 w2 w3 w4 w5 w6 w7 w8 w9

1 1 1

w10 w11

1 1

q0 q1

q1 q3 q2

q4

q1 q3 q1 q1

q3

q2 q0 q0

2

q0

2

q0

2

q0

1

q0

2

q0

2

q0

1

q0

q0 q0

1

q0 q0

1

q0 q0

2

q0 q0

1

q0

2

q0

1

q0

q0

2

q0

1

q0 ⊆ ⊆ ⊆ ⊆ ⊆ ⊆ ⊆ ⊆ ⊆ ⊆ ⊆ Q0 Q0 Q0

Q0

Q0

Q0

Q0 Q0

Q0

Q0 Q0

slide-9
SLIDE 9

Step 2: Formally defining the DFA M1 = (Q, Σ, δ, q0, F) M2 = (Q0, Σ, δ0, q0

0, F 0)

=

Q00 δ00 : q00

0 =

F 00 =