Theory of Computation: Dr. Nagashree N Associate Professor and HOD, Dept of Data Science SVIT, Bangalore
Theory of Computation: Dr. Nagashree N Associate Professor and HOD, Dept of Data Science SVIT, Bangalore
Dr. Nagashree N
Associate professor and HOD, Dept of Data Science
SVIT, Bangalore
Applications of TOC
Tic-Tac-Toe Game
Introduction to Finite
Automata
Finite automata are mathematical models of computation that can be used to
recognize patterns in data. They are essential tools in computer science,
especially in areas like compiler design and formal verification.
preencoded.png
preencoded.png
MODEL A TRAFFIC LIGHT and A TOLL BOOTH
preencoded.png
Structural Representation
States Transitions
A finite automaton has a finite The transitions between states
number of states, representing are determined by the input
different stages of processing. symbols.
preencoded.png
States and Transitions
Start State
The automaton starts in a defined initial state.
Input Symbol
The automaton reads an input symbol from the input stream.
Transition
Based on the current state and the input symbol, the automaton transitions to
a new state.
Accept State
If the automaton reaches an accept state after processing the input, the input
is accepted.
preencoded.png
Formal Definition and Properties
Definition A finite automaton is a mathematical
model of computation.
preencoded.png
Practical Applications of Finite Automata
For a given state and input symbol, there Transitions are clearly defined and DFAs are widely used in lexical analysis,
is only one possible transition to another unambiguous, allowing for predictable regular expression matching, and other
state. behavior. areas of computer science.
preencoded.png
Nondeterministic Finite
Automata (NFA)
1 Nondeterminism 2 Epsilon Transitions
From a given state, multiple NFAs can transition to other
transitions can occur based states without consuming any
on the same input symbol. input symbols.
Iva was given a *map*, but it wasn't just an ordinary map. It was a map that told her
which direction to take depending on the symbols she encountered on the road.
Every time she saw a signpost, it had a symbol on it — either an "A" or a "B." Based
on this symbol, she had to choose the next path.
The rules were strict: if she took the wrong path, she wouldn't get to her destination,
and she’d have to start again. However, there was a special property of the paths in
the *Kingdom of Determination: **at any given moment, for each sign she saw, there
was **only one correct path* forward. No matter how many signposts she passed, as
long as she followed the rules on the map, she would eventually reach her
destination.
One day, Iva set out to visit the *Castle of Success*, which was far
away in the kingdom. Her map had clear instructions:
At each step of the journey, Iva made her decisions based on the
current symbol and the rules on her map. If she followed the rules
exactly, she'd reach the castle. But if she made even one mistake,
she'd be sent back to the start.
Iva’s journey is like a *Deterministic Finite Automaton (DFA)*. In
a DFA:
In the end, Iva successfully reached the Castle of Success, knowing that
she could always trust the rules and transitions on her map to guide her,
as long as she followed them without deviation.
This story shows how *Deterministic Finite Automata* help
us solve problems by following *deterministic rules* — where
each input leads us through a set of states until we either
reach the desired state or realize that the input cannot be
accepted.
• Now lets start solving problems……………………………..
• Design a DFA to accept strings of a’s and b’s ending with string “ab”.
• Design a DFA to accept strings of a’s and b’s having substring “aa”
• Design a DFA to accept strings of a’s and b’s starting with string “ab”
• Design DFA to accept the language of all strings starting with a and
ending with b.
• Design a DFA to accept strings of a’s and b’s with at most 2
consecutive b’s.
https://easyexamnotes.com/dfa-solved-examples/
Design a DFA to accept strings of a’s and b’s except those containing substring aab
DFA to accept strings of a’s and b’s such that each
block of 5 consecutive symbols have atleast 2 a’s
The Quest for Golden Key