ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Theory of Automata
    COMP3148
    Progress0 / 25 topics
    Topics
    1. Finite State Models2. Language definitions preliminaries3. Regular expressions/Regular languages4. Finite automata (FAs)5. Transition graphs (TGs)6. NFAs7. Kleene's theorem8. Transducers (automata with output)9. Pumping lemma and non-regular language10. Grammars and PDA11. CFGs12. Derivations, derivation trees and ambiguity13. Simplifying CFLs14. Normal form grammars and parsing15. Decidability16. Context sensitive languages17. Grammars and linear bounded automata (LBA)18. Chomsky's hierarchy of grammars19. Turing Machines Theory20. Turing machines21. Post machine22. Variations on TM23. TM encoding24. Universal Turing Machine25. Defining Computers by TMs
    COMP3148›Finite automata (FAs)
    Theory of AutomataTopic 4 of 25

    Finite automata (FAs)

    10 minread
    1,783words
    Intermediatelevel

    Finite Automata (FAs)

    Finite Automata (FAs) are mathematical models used to recognize regular languages. They are abstract machines that consist of a finite set of states and transition rules, allowing them to process strings of symbols from a given alphabet. Finite automata are essential in the study of automata theory, as they provide the foundation for understanding computation in terms of state transitions.

    Key Concepts of Finite Automata

    A finite automaton can be seen as a directed graph where:

    • The nodes represent states.
    • The directed edges represent transitions between states based on input symbols.

    The automaton processes an input string and moves from one state to another based on the input symbols. If the machine ends in a final (accepting) state after reading the entire input, the string is accepted; otherwise, it is rejected.

    Components of Finite Automata

    A finite automaton is formally defined as a 5-tuple:

    M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F)M=(Q,Σ,δ,q0​,F)

    Where:

    1. Q: A finite set of states.
    2. Σ (Sigma): A finite set of input symbols, also called the alphabet.
    3. δ (delta): The transition function, which specifies the state transitions. It is defined as: δ:Q×Σ→Q\delta: Q \times \Sigma \rightarrow Qδ:Q×Σ→Q That is, for a given state and input symbol, it returns the next state.
    4. q₀: The initial state from which the machine starts processing the input string. q0∈Qq_0 \in Qq0​∈Q.
    5. F: The set of accepting (final) states, where F⊆QF \subseteq QF⊆Q. If the automaton ends in an accepting state after processing the input, the string is accepted.

    Types of Finite Automata

    There are two primary types of finite automata: Deterministic Finite Automata (DFA) and Nondeterministic Finite Automata (NFA).


    1. Deterministic Finite Automata (DFA)

    A Deterministic Finite Automaton (DFA) is a finite automaton where, for each state and input symbol, there is exactly one transition to a next state. There are no ambiguities in the state transitions.

    Formal Definition of a DFA

    A DFA is a 5-tuple:

    M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F)M=(Q,Σ,δ,q0​,F)

    Where:

    • QQQ is the set of states.
    • Σ\SigmaΣ is the alphabet (set of input symbols).
    • δ:Q×Σ→Q\delta: Q \times \Sigma \rightarrow Qδ:Q×Σ→Q is the transition function, which assigns exactly one state to each state-symbol pair.
    • q0q_0q0​ is the initial state.
    • FFF is the set of accepting (final) states.

    Example of DFA

    Consider a DFA that accepts binary strings ending with '01':

    • States: Q={q0,q1,q2}Q = \{q_0, q_1, q_2\}Q={q0​,q1​,q2​}

    • Alphabet: Σ={0,1}\Sigma = \{0, 1\}Σ={0,1}

    • Transition Function:

      • δ(q0,0)=q0\delta(q_0, 0) = q_0δ(q0​,0)=q0​ (stays in q0q_0q0​ when reading '0')
      • δ(q0,1)=q1\delta(q_0, 1) = q_1δ(q0​,1)=q1​
      • δ(q1,0)=q2\delta(q_1, 0) = q_2δ(q1​,0)=q2​
      • δ(q1,1)=q1\delta(q_1, 1) = q_1δ(q1​,1)=q1​ (stays in q1q_1q1​ when reading '1')
      • δ(q2,0)=q0\delta(q_2, 0) = q_0δ(q2​,0)=q0​ (goes to q0q_0q0​ on reading '0')
      • δ(q2,1)=q1\delta(q_2, 1) = q_1δ(q2​,1)=q1​
    • Initial State: q0q_0q0​

    • Accepting State: F={q2}F = \{q_2\}F={q2​}

    This DFA accepts strings like "01", "101", "1101", but rejects strings like "0", "111", and "100".

    Properties of DFAs:

    • Deterministic: There is exactly one transition for each state and input symbol.
    • Efficiency: DFAs are efficient because they process input in linear time, as there is only one state transition per input symbol.

    2. Nondeterministic Finite Automata (NFA)

    A Nondeterministic Finite Automaton (NFA) is a finite automaton where, for a given state and input symbol, there can be multiple possible next states, or even no next state at all. In other words, an NFA may have several transitions for a given input symbol.

    Formal Definition of an NFA

    An NFA is also defined as a 5-tuple:

    M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F)M=(Q,Σ,δ,q0​,F)

    Where:

    • QQQ is the set of states.
    • Σ\SigmaΣ is the alphabet.
    • δ:Q×Σ→2Q\delta: Q \times \Sigma \rightarrow 2^Qδ:Q×Σ→2Q is the transition function, which maps a state-symbol pair to a set of states (not a single state).
    • q0q_0q0​ is the initial state.
    • FFF is the set of accepting states.

    Example of NFA

    Consider an NFA that accepts strings containing "ab" (i.e., the substring "ab" appears anywhere in the string).

    • States: Q={q0,q1,q2}Q = \{q_0, q_1, q_2\}Q={q0​,q1​,q2​}

    • Alphabet: Σ={a,b}\Sigma = \{a, b\}Σ={a,b}

    • Transition Function:

      • δ(q0,a)={q0,q1}\delta(q_0, a) = \{q_0, q_1\}δ(q0​,a)={q0​,q1​} (either stays in q0q_0q0​ or transitions to q1q_1q1​ on reading 'a')
      • δ(q0,b)={q0}\delta(q_0, b) = \{q_0\}δ(q0​,b)={q0​}
      • δ(q1,a)={q1}\delta(q_1, a) = \{q_1\}δ(q1​,a)={q1​}
      • δ(q1,b)={q2}\delta(q_1, b) = \{q_2\}δ(q1​,b)={q2​} (transitions to q2q_2q2​ on reading 'b')
      • δ(q2,a)={q2}\delta(q_2, a) = \{q_2\}δ(q2​,a)={q2​}
      • δ(q2,b)={q2}\delta(q_2, b) = \{q_2\}δ(q2​,b)={q2​}
    • Initial State: q0q_0q0​

    • Accepting State: F={q2}F = \{q_2\}F={q2​}

    This NFA accepts strings like "ab", "aab", "abab", and "baab".

    Properties of NFAs:

    • Nondeterministic: There can be multiple possible next states for a given state and input symbol, or even no next state.
    • Parallel Exploration: Conceptually, an NFA can explore all possible state transitions simultaneously, accepting a string if there is at least one path that leads to an accepting state.

    3. Epsilon-Nondeterministic Finite Automaton (ε-NFA)

    An ε-NFA is a variant of an NFA where, in addition to regular transitions, the machine can also transition from one state to another without consuming any input symbols, using ε (epsilon) transitions.

    Formal Definition of ε-NFA

    An ε-NFA is defined as:

    M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F)M=(Q,Σ,δ,q0​,F)

    Where:

    • QQQ is the set of states.
    • Σ\SigmaΣ is the alphabet.
    • δ:Q×(Σ∪{ϵ})→2Q\delta: Q \times (\Sigma \cup \{\epsilon\}) \rightarrow 2^Qδ:Q×(Σ∪{ϵ})→2Q is the transition function, which allows transitions on both input symbols and epsilon (ε).
    • q0q_0q0​ is the initial state.
    • FFF is the set of accepting states.

    Acceptance by Finite Automata

    • DFA: A string is accepted if, after processing all the input symbols, the DFA ends in one of its accepting states.
    • NFA: A string is accepted if there exists at least one path through the NFA that ends in an accepting state after processing all input symbols.
    • ε-NFA: A string is accepted if there exists at least one path, considering both regular transitions and epsilon transitions, that ends in an accepting state.

    Equivalence of DFAs and NFAs

    • Recognizing the Same Class of Languages: Despite the differences in how transitions are handled, both DFAs and NFAs recognize the same class of languages: the regular languages.
    • Conversion: Any NFA can be converted into an equivalent DFA through a process called subset construction. While the DFA may have more states, both machines recognize the same language.

    Conclusion

    Finite Automata (FAs) are fundamental models for computation and form the basis of regular language theory. DFAs and NFAs are different types of finite automata, with DFAs having deterministic transitions and NFAs allowing for nondeterministic behavior. Despite their differences, both types of automata recognize regular languages, and any NFA can be converted into an equivalent DFA. Finite automata are widely used in practical applications such as lexical analysis, pattern matching, and text processing.

    Previous topic 3
    Regular expressions/Regular languages
    Next topic 5
    Transition graphs (TGs)

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time10 min
      Word count1,783
      Code examples0
      DifficultyIntermediate