Open In App

Design a DFA that Every 00 is Immediately Followed by 1

Last Updated : 12 Jul, 2025
Comments
Improve
Suggest changes
5 Likes
Like
Report

DFA Machines are designed to accept the specific kind of input whose output is generated by the transition of input alphabet from each state. We want to design a Deterministic Finite Automaton (DFA) that ensures every time the string contains "00," it is immediately followed by "1". This means:

  • The DFA must allow valid sequences where:
    • "00" is always followed by "1".
    • Any sequence of 0s and 1s is fine, as long as it follows this rule.
  • The DFA must reject invalid sequences where:
    • "00" is followed by another 0 or the string ends after "00".

Approach

  • In this situation, strings all strings are acceptable except more than 3 zeros. In this kind of string, no three continuous zeros are acceptable.
  • Create initial state and start with minimum length of possible string do transition of its input 0 and 1 to possible states.
  • according to transition, notice the final state and mark it.

Designing DFA Step-by-step

Step-1: Make a initial state,say "A", minimum possible strings are 1 and 0 and also any number of 1 are acceptable.To do this put self-loop of 1 on state "A" and make transition of input alphabet 0 to state "B".

dfa_step1
DFA Step 1

Step-2: After a single zero, if again '0' comes, it will go to the next state otherwise, in the case of '1', it will return to the initial state. Transect input 0 from state "B" to state "C".

dfa step 2
DFA Step 2

Step-3: As every 00 is immediately followed by 1 so now after state "C" do transition of input '1' from state "C" to state "D" and '0' to 'Dead State'.

dfa Step 3
DFA Step 3

Step-4: We are left with transition of input alphabet 1 and 0 of state "D" and also from the dead state.

dfa Step 4
DFA Step 4

Transition Table of above DFA

State "A" is both final as well as the initial state, state "C" is final state, state "D" is Dead State. Initial state is depicted by ---> and final state ids depicted by *.

StateInput (0)Input (1)
--->A (Initial State)BA
BCA
CDead StateD
D * (Final State)BA

Dead State

Dead State

Dead State

Q': set of finite sets = {A, B, C, D, Dead} set of input alphabets = {0, 1}

Conclusion

The DFA designed for this problem ensures that every occurrence of "00" in the input is immediately followed by "1". It does this by carefully transitioning through states to track the sequence and also reject the invalid patterns. Only the patterns that are valid will reach to the final state.


Explore