Saturday, January 24, 2026

day two of theory of computation

 1. The Formal Definition (The 5-Tuple) 

A DFA is mathematically defined as a 5-tuple
M=(Q,Σ,δ,q0,F)cap M equals open paren cap Q comma cap sigma comma delta comma q sub 0 comma cap F close paren
: 
  • Qcap Q
    :
    A finite set of states (e.g.,
    {q0,q1,q2}the set q sub 0 comma q sub 1 comma q sub 2 end-set
    ).
  • Σcap sigma
    :
    A finite set of symbols called the alphabet (e.g.,
    {0,1}the set 0 comma 1 end-set
    ).
  • δdelta
    :
    The transition function, defined as
    δQ×ΣQdelta colon cap Q cross cap sigma right arrow cap Q
    . This ensures that for every state and input, there is exactly one destination state.
  • q0q sub 0
    :
    The start state (
    q0Qq sub 0 is an element of cap Q
    ).
  • Fcap F
    :
    The set of accept states or final states (
    FQcap F is a subset of or equal to cap Q
    ).
     
2. Key Rules of DFA Design 
  • Determinism: Every state must have exactly one outgoing arrow for every symbol in the alphabet.
  • No Epsilon (
    ϵepsilon
    ) Moves:
    A DFA cannot change states without consuming an input symbol.
  • Completeness: If a state should not lead to an acceptance path, it must transition to a "Dead State" (trap state) where it stays for all subsequent inputs. 
3. Practical Design Examples 
Common Day Two exercises include building machines for specific languages: 
  • Strings ending with '01': Requires at least 3 states to track the last two seen characters.
  • Even number of 'a's: Uses two states to flip-flop between "Even" (Accepting) and "Odd" (Non-Accepting) counts.
  • Strings starting with 'ab': Uses a "Dead State" for any string that begins with 'b' or 'aa'. 

No comments:

Post a Comment

Day three of theory of computation

 1. Non-deterministic Finite Automata (NFA)   Unlike a DFA, an NFA allows a machine to explore multiple paths simultaneously.   Definition: ...