Assignment 1
Assignment 1
States: p0,p1,p2
Alphabet: {0,1}
Transitions:
o p0:0p1,1p0
o p1:0p2,1p1
o p2:0p2,1p2
Start state: p0
Accept state: p2
Questions:
1. What is the start state?
The start state is the state in which the DFA begins processing any input.The start
state is p0.
2. What is the significance of state p2?
The significance of state p2 is that it is the accept state. In DFA terms, an accept
state is a state in which, if the DFA finishes processing the input string, the string is
considered accepted by the DFA.
3. What sequence of states does the machine enter on input “010”?
To determine the sequence of states the DFA enters on input “010,” we will follow
each transition step-by-step starting from the initial state, p0:
1. Start at p0:
• Input 0: Transition from p0 to p1 (based on transition rule: p0:0→p1).
2. State p1:
• Input 1: Transition from p1 to p1 (based on transition rule: p1:1→p1).
3. State p1:
• Input 0: Transition from p1 to p2 (based on transition rule: p1:0→p2).
The sequence of states the DFA enters on input “010” is therefore p0 → p1 → p1 →
p2.
4. Will the string “11” be accepted by this DFA?
To check if the string “11” is accepted, we trace the DFA’s transitions for each
symbol in “11” starting from the initial state p0:
1. Start at p0:
• Input 1: Transition from p0 to p0 (based on transition rule: p0:1→p0).
2. State p0:
• Input 1: Transition from p0 to p0 (based on transition rule: p0:1→p0).
After processing “11,” the DFA ends in state p0. Since p0 is not an accept state, the
string “11” is not accepted by this DFA.
5. Does this DFA accept the string “00”? Explain why.
To check if the string “00” is accepted, we again trace the DFA’s transitions for each
symbol in “00” starting from the initial state p0:
1. Start at p0:
• Input 0: Transition from p0 to p1 (based on transition rule: p0:0→p1).
2. State p1:
• Input 0: Transition from p1 to p2 (based on transition rule: p1:0→p2).
After processing “00,” the DFA ends in state p2, which is an accept state. Therefore,
the string “00” is accepted by this DFA.
2-Consider a DFA with the following structure:
States: s0,s1,s2,s3
Alphabet: {0,1}
Transitions:
o s0:0s1, 1s2
o s1:0s0,1s3
o s2:0s3,1s2
o s3:0s3,1s3
Start state: s0
Accept state: s3
Questions:
1. What is the initial state?
The initial state is where the DFA starts when it begins processing any input string
The initial state is s0.
2. What is the set of accepting states?
The accepting state is the state in which, if the DFA ends after processing the input,
the input is considered accepted. Accepting states is just {s3}.
3. Trace the sequence of states when the input is “0110”.
To determine the sequence of states for the input “0110,” we’ll follow the DFA’s
transitions starting from the initial state s0:
1. Start at s0:
• Input 0: Transition from s0 to s1 (based on transition rule: s0:0→s1).
2. State s1:
• Input 1: Transition from s1 to s3 (based on transition rule: s1:1→s3).
3. State s3:
• Input 1: Transition from s3 to s3 (based on transition rule: s3:1→s3).
4. State s3:
• Input 0: Transition from s3 to s3 (based on transition rule: s3:0→s3).
The sequence of states the DFA enters on input “0110” is s0 → s1 → s3 → s3 → s3.
4. Will the string “111” be accepted by the DFA?
To determine if the string “111” is accepted, we trace the DFA’s transitions for each
symbol in “111” starting from the initial state s0:
1. Start at s0:
• Input 1: Transition from s0 to s2 (based on transition rule: s0:1→s2).
2. State s2:
• Input 1: Transition from s2 to s2 (based on transition rule: s2:1→s2).
3. State s2:
• Input 1: Transition from s2 to s2 (based on transition rule: s2:1→s2).
After processing “111,” the DFA ends in state s2. Since s2 is not an accept state, the
string “111” is not accepted by this DFA.
5. Does the DFA accept all binary strings with exactly two 1s?
To answer this, let’s consider the conditions required for the DFA to accept a string
with exactly two 1s:
1. Starting at s0:
• If the DFA encounters 1 first, it transitions to s2.
• To reach the accept state s3, the DFA must pass through s1 with a
second 1 to reach s3.
2. The transitions indicate that after reaching s3 (upon processing the
second 1), any additional symbols (0s or 1s) will keep the DFA in s3, meaning it will
remain in the accept state.
Therefore, the DFA does accept strings with exactly two 1s as long as they
eventually lead to state s3 by the end of processing. However, it will also accept
any binary string that has two or more 1s, not just those with exactly two 1s.
In summary:
• The DFA accepts binary strings with at least two 1s but does not
restrict itself to only strings with exactly two 1s.
Analyze the following DFA:
States: q0,q1,q2
Alphabet: {a,b}
Transitions:
o From q0: a→q1,b→q0
Start state: q0
Accept state: q1
Questions:
1. What is the set of accepted states?
The set of accepted states refers to the states in which, if the DFA ends after
processing the input, the input is considered accepted. Here, the accept state is q1,
so the set of accepted states is {q1}.
2. Does the DFA accept the string “aab”?
To determine if the DFA accepts “aab,” we’ll follow the transitions starting from the
initial state q0:
1. Start at q0:
• Input a: Transition from q0 to q1 (based on transition rule: q0: a → q1).
2. State q1:
• Input a: Transition from q1 to q2 (based on transition rule: q1: a → q2).
3. State q2:
• Input b: Transition from q2 to q2 (based on transition rule: q2: b → q2).
After processing “aab,” the DFA ends in q2. Since q2 is not an accept state, the
string “aab” is not accepted by this DFA.
3. What sequence of states does the DFA go through on input “baba”?
To find the sequence of states for the input “baba,” let’s trace each transition
starting from q0:
1. Start at q0:
• Input b: Transition from q0 to q0 (based on transition rule: q0: b → q0).
2. State q0:
• Input a: Transition from q0 to q1 (based on transition rule: q0: a → q1).
3. State q1:
• Input b: Transition from q1 to q1 (based on transition rule: q1: b → q1).
4. State q1:
• Input a: Transition from q1 to q2 (based on transition rule: q1: a → q2).
The sequence of states the DFA goes through on input “baba” is q0 → q0 → q1 → q1
→ q2.
4. Does the DFA accept the empty string ε? Why or why not?
The empty string ε means no input symbols are provided to the DFA. In such cases,
the DFA remains in its start state, which is q0.
Since q0 is not an accept state, the empty string ε is not accepted by this DFA.
5. If the input string is “aaa”, which state does the machine end up in?
To find the state the DFA ends up in after processing “aaa,” let’s follow each
transition starting from q0:
1. Start at q0:
• Input a: Transition from q0 to q1 (based on transition rule: q0: a → q1).
2. State q1:
• Input a: Transition from q1 to q2 (based on transition rule: q1: a → q2).
3. State q2:
• Input a: Transition from q2 to q0 (based on transition rule: q2: a → q0).
After processing “aaa,” the DFA ends up in q0.