TOC Notes
All Topics (9)
- 1. Why Study Theory of Computation?
- 2. What is Computation?
- 3. Subject of TOC
- 4. Terms Used in Theory of Computation (TOC)
- 5. Kleene Star, Kleene Plus, and Language
- 6. What is Automata.
- 7. Types of Automata
- 8. Finite Automata (FA)
- 9. Representation of Finite Automata
6. What is Automata.
Automata is an automatic machine which is programmed by a developer to perform a desired computational task. It uses only given input and produces output without knowing the internal process.
or
An automata is a system (abstract machine) which transforms information/data by performing some internal function with different states at different instants of time and produces output without human participation.
Characteristics of Automata
1) Input :-
Set of input symbols from given alphabet (Domain)
Σ = {Iβ, Iβ, Iβ … In}
2) Output :-
Set of output symbols (Range)
O = {Oβ, Oβ, Oβ … On}
3) State :-
At any instant of time, automata can be in only one state
Q = {q0, q1, q2 … qn}
4) State Relation (Transition Function) :-
Relation between states with respect to input symbol
δ(q, input) → next state
5) Output Relation :-
Output is associated with state or input
Types of Output Machines
i) Moore Machine :-
The automata in which output is associated only with state.
ii) Mealy Machine :-
The automata in which output is associated with both state and input.
7. Types of Automata

8. Finite Automata (FA)
Basic Idea
A Finite Automaton is a machine that:
- Takes input (like 0 and 1)
- Processes it step by step
- Gives output:
β Accept (Yes)
β Reject (No)
Real-Life Example
Think of a password system:
- Correct password → Accepted
- Wrong password → Rejected
This behaves like a finite automaton
Definition 1:
A machine that has a finite number of states is called a finite automaton.
Definition 2:
A finite automaton is a computational model consisting of a finite set of states that processes input and changes states accordingly.
Formal Definition
A Finite Automaton is defined as:
M = (Q, Σ, δ, qβ, F)
Components Explained
1) Q (Set of States)
- All possible positions of the machine
- Example:
Q = {q0, q1}
At any time, the machine is in only one state
2) Σ (Sigma – Input Alphabet)
- Set of input symbols
- Example:
Σ = {0, 1}
3) δ (Delta – Transition Function)
- Tells how the machine moves from one state to another
Written as:
δ(q, input) → next state
Example:
δ(q0,1) = q1
4) qβ (Initial State)
- Starting state of the machine
- Example:
qβ = q0
5) F (Final States)
- Set of accepting states
- Example:
F = {q1}
If the machine ends in this state → Accepted
Important Concept
Finite Automata are used to recognize a language
That means:
- If a string follows the rules → Accept
- Otherwise → Reject
Example
Problem:
Language L = Strings with odd number of 1’s
Alphabet:
Σ = {0, 1}
Step-by-Step Construction
States
- q0 → even number of 1’s
- q1 → odd number of 1’s
Initial State
q0 (because initially count = 0 → even)
Final State
q1 (because we want odd number of 1’s)
Transition Table
| Current State | Input | Next State |
|---|---|---|
| q0 | 0 | q0 |
| q0 | 1 | q1 |
| q1 | 0 | q1 |
| q1 | 1 | q0 |
How It Works (Step-by-Step)
Example 1: "111"
Start at q0
→ input 1 → q1
→ input 1 → q0
→ input 1 → q1
Final state = q1
β Accepted
Example 2: "11"
Start at q0
→ 1 → q1
→ 1 → q0
Final state = q0
β Rejected
Example 3: "0111"
Start at q0
→ 0 → q0
→ 1 → q1
→ 1 → q0
→ 1 → q1
Final state = q1
β Accepted
9. Representation of Finite Automata
As we know, we construct finite automata to recognize a language. So we can represent finite automata by using:
- Transition Graph / Transition State Diagram
- Transition Matrix / Transition Table
1) Transition Graph / Transition State Diagram
It is a finite directed labeled graph in which each vertex or node represents a state, and the directed edges indicate the transition state.
- Edges are labeled with input symbols.
- It shows how the automata moves from one state to another.
Notations Used in Transition Graph
1. Circle (β―)
A circle represents states.
Example: q0, q1, q2β
2. Initial/Start State ( →β―)
A state represented by a circle with an empty arrow pointing to it is called the initial/start state.
Example:
Here, q0 is the start state.
3. Final/Accepting State
A state represented by a double circle is called the final/accepting state.
Example: ((q1β))
Here, q1 is the accepting state.
4. Transition
A directed edge with an input symbol “a” indicates the transition of state qi to qj upon receiving input “a”.
Example: qi ----a---> qj
Meaning:
- Current state = qiβ
- Input symbol = a
- Next state = qjβ
Example 1: Set of All Strings Containing an Odd Number of 1s
In this DFA, the state changes only when a ‘1’ is encountered. An even number of 1s keeps the machine in the initial state, while an odd number moves it to the final state.
States
Initial State (q0β)
Represents an even number of 1s encountered so far.
Final State (q1β)
Represents an odd number of 1s encountered so far.
Transitions
1. Transition on Input 0
Zeros do not change the count of 1s.
q0 --0→q0
2. Transition on Input 1
First ‘1’ (odd) moves to the final state.
q0 --1→q1
Second ‘1’ (even) moves back to the initial state.
q1--1→q0
Transition Diagram
1
+-----------+
| v
->(q0) -----> ((q1))
^ | | ^
| |0 |0 |
| +----------+ |
+-------1--------+
Transition Table
| Present State | Input 0 | Input 1 |
|---|---|---|
| q0β | q0β | q1β |
| q1β | q1β | q0β |
Working of DFA
Input String: 1011
Step 1:
Start from q0β
Step 2:
Read 1
q0→q1
Step 3:
Read 0
q1→q1
Step 4:
Read 1
q1→q0
Step 5:
Read 1
q0→q1
Final state is q1β, which is an accepting state.
Hence, the string is accepted.
