SLIDE 1
Closed under complementation Proposition: Let be some finite - - PDF document
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 2
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
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
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
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
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
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