Upload
chirag-arora
View
8
Download
3
Embed Size (px)
DESCRIPTION
Theoty of computation
Citation preview
Theory ofComputation
Deterministic Finite Automata
Barath RaghavanCS 361 Fall 2009Williams College
Tuesday, September 15, 2009
MISC
Anonymous feedbackHomework 1
LaTeX
Tuesday, September 15, 2009
Claim:In any set of n hats, all are the same color.
“Proof” by induction:Base case: If n = 1, all hats are the same color.Inductive case: Assume that the claim holds for all
n ≤ k. Examine any set of n = k+1 hats. Remove one hat from the set; the remaining set has k hats and thus is of a single color. Replace the hat and remove a different hat from the set; the resulting set has k hats and thus is of a single color. The two sets overlap, thus they must be of the same color.
Therefore, all k+1 hats are the same color. ☐
Tuesday, September 15, 2009
Claim:In any set of n hats, all are the same color.
“Proof” by induction:Base case: If n = 1, all hats are the same color.Inductive case: Assume that the claim holds for all
n ≤ k. Examine any set of n = k+1 hats. Remove one hat from the set; the remaining set has k hats and thus is of a single color. Replace the hat and remove a different hat from the set; the resulting set has k hats and thus is of a single color. The two sets overlap, thus they must be of the same color.
Therefore, all k+1 hats are the same color. ☐
Tuesday, September 15, 2009
Deterministic
FiniteAutomata
Tuesday, September 15, 2009
Tuesday, September 15, 2009
“An organism or an automaton receives stimuli via its sensory receptor organs, and performs actions via its effector organs. To say that certain actions are a response to certain stimuli means, in the simplest case, that the actions are performed when and only when those stimuli occur... So we ask what kind of events are capable of being represented in the state of an automaton.”
-- Kleene, “Representation of events in nerve nets and finite automata” (1956)
Tuesday, September 15, 2009
Tuesday, September 15, 2009
1 2 3
1 2 32, 3 3
1, 21
Elevator Automaton
Tuesday, September 15, 2009
StatesAlphabetTransitionStart stateFinal states
Tuesday, September 15, 2009
Q set of states
Tuesday, September 15, 2009
Q set of states
Σ the alphabet
Tuesday, September 15, 2009
Q set of states
Σ the alphabet
δ : Q× Σ→ Q transitionfunction
Tuesday, September 15, 2009
Q set of states
Σ the alphabet
δ : Q× Σ→ Q transitionfunction
q0 ∈ Q start state
Tuesday, September 15, 2009
Q set of states
Σ the alphabet
δ : Q× Σ→ Q transitionfunction
q0 ∈ Q start state
F ⊆ Q set of final states
Tuesday, September 15, 2009
1 2 3
1 2 32, 3 3
1, 21
Tuesday, September 15, 2009
1 2 3
1 2 32, 3 3
1, 21
Q = { 1�, 2�, 3�}
Tuesday, September 15, 2009
1 2 3
1 2 32, 3 3
1, 21
Q = { 1�, 2�, 3�}Σ = {1, 2, 3}
Tuesday, September 15, 2009
1 2 3
1 2 32, 3 3
1, 21
Q = { 1�, 2�, 3�}Σ = {1, 2, 3}
q0 = 1� F = { 3�}Tuesday, September 15, 2009
1 2 3
1 2 32, 3 3
1, 21
Inputs
States
δ 1 2 31� 1� 2� 2�2� 1� 2� 3�3� 2� 2� 3�
Tuesday, September 15, 2009
What languages do these automata recognize?
Tuesday, September 15, 2009
A B0, 1
0, 1
Tuesday, September 15, 2009
L = {ε}
A B0, 1
0, 1
Tuesday, September 15, 2009
A B C D
0 0 0 0, 1
1 1 1
Tuesday, September 15, 2009
A B C D
0 0 0 0, 1
1 1 1
L = {w | w contains at least 3 1s}
Tuesday, September 15, 2009
?Tuesday, September 15, 2009
A B C D
0 1 0, 1
1
0
1 0
L = {w | w doesn’t contain 110}d)
L = {w | w contains at most two 1s}a)
L = {w | |w| < 3}b)
L = {w | |w| < 3 or contains at least two 1s}c)
Tuesday, September 15, 2009
A B C D
0 1 0, 1
1
0
1 0
L = {w | w doesn’t contain 110}
Tuesday, September 15, 2009
A B C D
0 1 0, 1
1
0
1 0
L = {w | w doesn’t contain 110}d)
L = {w | w contains at most two 1s}a)
L = {w | |w| < 3}b)
L = {w | |w| < 3 or contains at least two 1s}c)
Tuesday, September 15, 2009
A B C D
0 1 0, 1
1
0
1 0
L = {w | w doesn’t contain 110}d)
L = {w | w contains at most two 1s}a)
L = {w | |w| < 3}b)
L = {w | |w| < 3 or contains at least two 1s}c)
Tuesday, September 15, 2009
A B C D
0 1 0, 1
1
0
1 0
L = {w | w doesn’t contain 110}d)
L = {w | w contains at most two 1s}a)
L = {w | |w| < 3}b)
L = {w | |w| < 3 or contains at least two 1s}c)
Tuesday, September 15, 2009
A B C D
0 1 0, 1
1
0
1 0
L = {w | w doesn’t contain 110}d)
L = {w | w contains at most two 1s}a)
L = {w | |w| < 3}b)
L = {w | |w| < 3 or contains at least two 1s}c)
Tuesday, September 15, 2009
What automata recognize these
languages?
Tuesday, September 15, 2009
L = {w | |w| is odd and begins with 0 oris even and begins with 1}
Tuesday, September 15, 2009
L = {w | |w| is odd and begins with 0 oris even and begins with 1}
A B
C
0
1
0, 1
0, 1
Tuesday, September 15, 2009
L = {w | w = ε or every odd position of w is a 1}
Tuesday, September 15, 2009
L = {w | w = ε or every odd position of w is a 1}
A B
C
1
0, 10
0, 1
Tuesday, September 15, 2009
?Tuesday, September 15, 2009
L = {w | w is not the string 11 or 111}
Tuesday, September 15, 2009
L = {w | w is not the string 11 or 111}
A B C D
E
1 1 1
0 00
0, 1
0, 1
Tuesday, September 15, 2009
Definition
1. A language L is regular if some DFA recognizes it.
2. The language L(A) recognized by a DFA A is regular.
Tuesday, September 15, 2009
L1 = {w | |w| is odd and begins with 0 oris even and begins with 1}
L2 = {w | w = ε or every odd position of w is a 1}
Can we build an automaton that accepts:
L3 = L1 ∪ L2
Tuesday, September 15, 2009
L1 = {w | |w| is odd and begins with 0 oris even and begins with 1}
L2 = {w | w = ε or every odd position of w is a 1}
L3 = L1 ∪ L2
A1 B1
C1
0
1
0, 1
0, 1
A2 B2
C2
1
0, 10
0, 1
Tuesday, September 15, 2009
How can we combine two DFAs?
Tuesday, September 15, 2009
Q = {(r1, r2) | r1 ∈ Q1 and r2 ∈ Q2}
Tuesday, September 15, 2009
Q = {(r1, r2) | r1 ∈ Q1 and r2 ∈ Q2}
Σ = Σ1 ∪Σ2
Tuesday, September 15, 2009
Q = {(r1, r2) | r1 ∈ Q1 and r2 ∈ Q2}
Σ = Σ1 ∪Σ2
δ((r1, r2), a) = (δ1(r1, a), δ2(r2, a))
Tuesday, September 15, 2009
Q = {(r1, r2) | r1 ∈ Q1 and r2 ∈ Q2}
Σ = Σ1 ∪Σ2
δ((r1, r2), a) = (δ1(r1, a), δ2(r2, a))
q0 = (q1, q2)
Tuesday, September 15, 2009
Q = {(r1, r2) | r1 ∈ Q1 and r2 ∈ Q2}
Σ = Σ1 ∪Σ2
δ((r1, r2), a) = (δ1(r1, a), δ2(r2, a))
q0 = (q1, q2)
F = {(r1, r2) | r1 ∈ F1 or r2 ∈ F2}
Tuesday, September 15, 2009
A1 B1
C1
0
1
0, 1
0, 1
A2 B2
C2
1
0, 10
0, 1
Tuesday, September 15, 2009
A1A2
B1A2 B1C2
C1B2 C1C2
0
1
10
0, 10, 1
0, 1
Tuesday, September 15, 2009
Regular languages are
closed under union.
if L1 and L2 are regular languagesthen L1 ∪ L2 is a regular language
Tuesday, September 15, 2009
Reading: Sipser 1.1
Tuesday, September 15, 2009
?Tuesday, September 15, 2009
L = {w | w �= ε}
WHATAUTOMATONRECOGNIZES
?
Tuesday, September 15, 2009