
- Automata Theory - Applications
- Automata Terminology
- Basics of String in Automata
- Set Theory for Automata
- Finite Sets and Infinite Sets
- Algebraic Operations on Sets
- Relations Sets in Automata Theory
- Graph and Tree in Automata Theory
- Transition Table in Automata
- What is Queue Automata?
- Compound Finite Automata
- Complementation Process in DFA
- Closure Properties in Automata
- Concatenation Process in DFA
- Language and Grammars
- Language and Grammar
- Grammars in Theory of Computation
- Language Generated by a Grammar
- Chomsky Classification of Grammars
- Context-Sensitive Languages
- Finite Automata
- What is Finite Automata?
- Finite Automata Types
- Applications of Finite Automata
- Limitations of Finite Automata
- Two-way Deterministic Finite Automata
- Deterministic Finite Automaton (DFA)
- Non-deterministic Finite Automaton (NFA)
- NDFA to DFA Conversion
- Equivalence of NFA and DFA
- Dead State in Finite Automata
- Minimization of DFA
- Automata Moore Machine
- Automata Mealy Machine
- Moore vs Mealy Machines
- Moore to Mealy Machine
- Mealy to Moore Machine
- Myhill–Nerode Theorem
- Mealy Machine for 1’s Complement
- Finite Automata Exercises
- Complement of DFA
- Regular Expressions
- Regular Expression in Automata
- Regular Expression Identities
- Applications of Regular Expression
- Regular Expressions vs Regular Grammar
- Kleene Closure in Automata
- Arden’s Theorem in Automata
- Convert Regular Expression to Finite Automata
- Conversion of Regular Expression to DFA
- Equivalence of Two Finite Automata
- Equivalence of Two Regular Expressions
- Convert Regular Expression to Regular Grammar
- Convert Regular Grammar to Finite Automata
- Pumping Lemma in Theory of Computation
- Pumping Lemma for Regular Grammar
- Pumping Lemma for Regular Expression
- Pumping Lemma for Regular Languages
- Applications of Pumping Lemma
- Closure Properties of Regular Set
- Closure Properties of Regular Language
- Decision Problems for Regular Languages
- Decision Problems for Automata and Grammars
- Conversion of Epsilon-NFA to DFA
- Regular Sets in Theory of Computation
- Context-Free Grammars
- Context-Free Grammars (CFG)
- Derivation Tree
- Parse Tree
- Ambiguity in Context-Free Grammar
- CFG vs Regular Grammar
- Applications of Context-Free Grammar
- Left Recursion and Left Factoring
- Closure Properties of Context Free Languages
- Simplifying Context Free Grammars
- Removal of Useless Symbols in CFG
- Removal Unit Production in CFG
- Removal of Null Productions in CFG
- Linear Grammar
- Chomsky Normal Form (CNF)
- Greibach Normal Form (GNF)
- Pumping Lemma for Context-Free Grammars
- Decision Problems of CFG
- Pushdown Automata
- Pushdown Automata (PDA)
- Pushdown Automata Acceptance
- Deterministic Pushdown Automata
- Non-deterministic Pushdown Automata
- Construction of PDA from CFG
- CFG Equivalent to PDA Conversion
- Pushdown Automata Graphical Notation
- Pushdown Automata and Parsing
- Two-stack Pushdown Automata
- Turing Machines
- Basics of Turing Machine (TM)
- Representation of Turing Machine
- Examples of Turing Machine
- Turing Machine Accepted Languages
- Variations of Turing Machine
- Multi-tape Turing Machine
- Multi-head Turing Machine
- Multitrack Turing Machine
- Non-Deterministic Turing Machine
- Semi-Infinite Tape Turing Machine
- K-dimensional Turing Machine
- Enumerator Turing Machine
- Universal Turing Machine
- Restricted Turing Machine
- Convert Regular Expression to Turing Machine
- Two-stack PDA and Turing Machine
- Turing Machine as Integer Function
- Post–Turing Machine
- Turing Machine for Addition
- Turing Machine for Copying Data
- Turing Machine as Comparator
- Turing Machine for Multiplication
- Turing Machine for Subtraction
- Modifications to Standard Turing Machine
- Linear-Bounded Automata (LBA)
- Church's Thesis for Turing Machine
- Recursively Enumerable Language
- Computability & Undecidability
- Turing Language Decidability
- Undecidable Languages
- Turing Machine and Grammar
- Kuroda Normal Form
- Converting Grammar to Kuroda Normal Form
- Decidability
- Undecidability
- Reducibility
- Halting Problem
- Turing Machine Halting Problem
- Rice's Theorem in Theory of Computation
- Post’s Correspondence Problem (PCP)
- Types of Functions
- Recursive Functions
- Injective Functions
- Surjective Function
- Bijective Function
- Partial Recursive Function
- Total Recursive Function
- Primitive Recursive Function
- μ Recursive Function
- Ackermann’s Function
- Russell’s Paradox
- Gödel Numbering
- Recursive Enumerations
- Kleene's Theorem
- Kleene's Recursion Theorem
- Advanced Concepts
- Matrix Grammars
- Probabilistic Finite Automata
- Cellular Automata
- Reduction of CFG
- Reduction Theorem
- Regular expression to ∈-NFA
- Quotient Operation
- Parikh’s Theorem
- Ladner’s Theorem
Complementation Process in DFA
In this chapter, we will first provide a brief introduction on deterministic finite automata (DFA) before moving on to explain the complementation in DFA with steps and examples.
Complementation plays a great role in compiler design and other applications. We will highlight some important points on complemented DFAs.
Deterministic Finite Automata
Before understanding the complementation of DFA, we must recap the concept of DFA a little. In the following table we will see the components of DFA in automata.
Components | Description |
---|---|
States | A DFA is a set of states that represent the various configurations an automaton can be in at any given time. |
Alphabet | The input symbols that a DFA can process, such as in a binary DFA, are represented by the alphabet {0, 1}. |
Transition Function | The function outlines the DFA's transition from one state to another upon reading an input symbol, specifying one next state for each state and input symbol. |
Initial State | This is the state in which the DFA begins processing input. |
Final State | Accepting states refer to the states where the DFA will be if it has successfully recognized a string in its language. |
The finite automata, more precisely a DFA recognizes or accepts a string, starting from the initial state and processing the string symbol by symbol, then it ends up in one of its final states after consuming all input. And the set of all strings that is accepted by a DFA is called the language of the DFA. It is important to understand the language in DFA on which the complementation is works on. Let us understand the complementation here.
Complement Language
The complement of a language L, denoted as Lc. It is the set of all strings over the same alphabet that are not in L. (If Σ* represents all possible strings over the alphabet Σ, then Lc = Σ* − L).
Let us understand through an example. If L is the language of all binary strings ending in '0' over the alphabet {0, 1}, then Lc is the language of all binary strings ending with '1', along with an empty string.
Now let us see the steps involved to complement a DFA that will accept the complemented language.
Complementation Steps for DFA
Suppose we have a DFA,
$$\mathrm{M \:=\: (Q,\: \Sigma,\: \delta,\: q0,\: F)}$$
Its complement DFA,
$$\mathrm{M' \:=\: (Q,\: \Sigma,\: \delta,\: q0,\: F')}$$
Here F' = Q - F. So, it is clear that, the complement DFA has the same states, alphabet, transition function, and initial state as the original DFA, but the set of final states is replaced with its complement within the set of all states.
The steps are simple −
- The first step is to identify all states in the original DFA that are not final states.
- Swap the final and non-final states of the original DFA, so that all non-final states of the original DFA are included in the new DFA.
- The transition function remains unchanged in the original DFA, preserving the automaton's structure but altering which states are accepted.
Examples of Complementation in DFA
Let us see some examples. Consider the first DFA, D1 −

The complemented DFA, D1c is as follows.

See another example, where L1: that is the set of all strings over {0, 1} starting with '0'., for example {0, 00, 01, 000, 001, 010, 011,…} the DFA is like below −

Now the complemented machine, L2: that is the set of all strings over {0, 1} not starting with '0'. L2 = { ε, 1, 10, 11, 101, 100, 110, ...}, the DFA is looking like:

Important Facts on DFA
Make a note of the following important facts on DFA −
- Enables the implementation of the "not" operator in regular expressions, for complex pattern matching by allowing the exclusion of certain patterns.
- It proves regular languages are closed under complementation, also helps to prove other closure properties like intersection and set difference.
Conclusion
In finite automata, closure properties are important factors. We know that the regular expressions are closed under complementation. Here we discussed the complementation concepts for DFA with steps and two different examples in action.