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'. 

day one of theory of computation

 1. The Three Pillars of ToC 

2. Basic Definitions (The Vocabulary) 
To begin, you must master these fundamental building blocks: 
  • Symbol: The smallest unit of data (e.g., 0, 1, a, b).
  • Alphabet (
    Σcap sigma
    ):
    A finite, non-empty set of symbols (e.g., binary
    Σ={0,1}cap sigma equals the set 0 comma 1 end-set
    ).
  • String: A finite sequence of symbols from an alphabet (e.g., 0101).
  • Language: A set of strings (e.g., the set of all binary strings that end in 1). 
3. Introduction to Finite Automata (FA) 
The first model usually introduced is the Finite State Machine, which has no external memory. 
  • Deterministic Finite Automata (DFA): For every state and input symbol, there is exactly one transition to a next state.
  • Non-Deterministic Finite Automata (NFA): Can have multiple possible next states for the same input, providing a more flexible but equivalent model for regular languages. 

📗 PHASE 2: Web Security Core (Month 3–4)

  📗 PHASE 2: Web Security Core (Month 3–4) 🔥 OWASP Top 10 (Very Important) 4 1️⃣ SQL Injection Vulnerable code: SELECT * FROM users WHERE ...