Lecture 01 _ Finite Automat I
Lecture 01 _ Finite Automat I
Lecture 1
Finite Automat I
3/19/2023 2
Theory of Computation
3/19/2023 3
Theory of Computation
3/19/2023 5
A first look at an application
3/19/2023 6
A first look at an application
CLOSED OPEN
Neither
3/19/2023 7
A first look at an application
3/19/2023 8
Automata theory?
In theoretical computer science, automata theory is the study of abstract machines (or
more appropriately, abstract 'mathematical' machines or systems) and the computational
problems that can be solved using these machines. These abstract machines are called
automata. (singular : automaton)
Automata theory deals with the definitions and properties of mathematical models of
computation.
Examples of such models are:
Finite Automata (FA). These are used in text processing, compilers, and hardware
design.
Context-Free Grammars (CFG). These are used to define programming languages and
in Artificial Intelligence.
Turing Machines (TM). These form a simple abstract model of a “real” computer, such
as your PC at home.
3/19/2023 9
Finite Automata
Finite automata are used in text processing, compilers, and hardware design.
Finite automata are good models for computers with an extremely limited amount of
memory.
This automaton (abstract machine) consists of
States (represented in the figure by circles),
Transitions (represented by arrows).
Two Representations
Deterministic finite automata (DFA)
NonDeterministic finite automata (NFA)
Deterministic finite automata (DFA)
Computation follows in a unique way from the preceding step. we know what the next
state will be—it is determined.
Every state of a DFA always has exactly one exiting transition arrow for each symbol in
the alphabet.
3/19/2023 TCS3511 11
Deterministic finite automata (DFA)
1. The state diagram of a finite automaton M1
3/19/2023 TCS3511 12
Deterministic finite automata (DFA)
1. The state diagram of a finite automaton M1
NOTE: the state diagram of M2 and its formal description contain the same information. You can
always go from one to the other.
14
Deterministic finite automata (DFA)
15
Deterministic finite automata (DFA)
16
Deterministic finite automata (DFA)
1. The state diagram of a finite automaton M5
Describing a finite automaton by state diagram is not possible in some cases that may occur
when the diagram would be too big to draw. In these cases, we resort to a formal description to
specify the machine.
17
Deterministic finite automata (DFA)
Language? L = {w ∈ {0,1}* | w starts with none or more 0s followed by at least one 1.}
18
Deterministic finite automata (DFA)
0010001001010
19
NonDeterministic finite automata (NFA)
deterministic computation. computation follows in a unique way from the preceding step. we
know what the next state will be—it is determined.
Every state of a DFA always has exactly one exiting transition arrow for each symbol in the
alphabet.
In a nondeterministic machine, several choices may exist for the next state at any point. NFA is
a generalization of determinism, so every DFA is automatically a nondeterministic finite
automaton.
The NFA shown in Figure above violates that rule. Ex: State q1 has one exiting arrow for 0, but it has two for
1. q2 has one arrow for 0, but it has none for 1, q3 has one arrow for 1 only.
In an NFA, a state may have zero, one, or many exiting arrows for each alphabet symbol.
20
NonDeterministic finite automata (NFA)
21
NonDeterministic finite automata (NFA)
A = (Q, Σ, δ, po, F) δ 0 1
with Q = {q1,q2,q3,q4} q1 {q1} {q1,q2}
Σ = {0,1} q2 {q3} {q3}
δ: Q x Σε → Pow(Q) q3 {q4} {q4}
p0 = q1 q4 ∅ ∅
F = {q4}
22
NonDeterministic finite automata (NFA)
Nondeterministic automata are good for shorter descriptions, good for building an automaton
accepting or not accepting special cases.
23
(NFA) with ε -transitions (ε-NFA)
(Remember that the superscript denotes repetition, not numerical exponentiation.) For
example, This NFA accepts the strings ε, 00, 000, 0000, and 000000, … but not 0 or
00000.
NOTE: The above NFA has an input alphabet {0} consisting of a single symbol. An
alphabet containing only one symbol is called a unary alphabet. 24
DFA vs. NFA
Important: the NFA is defined in the same way as the DFA but with the following
two exceptions:
o Multiple next state.
o ε- transitions.
Multiple next state. in a DFA there is exactly one start state and exactly one transition
out of every state for each symbol in Ʃ. In contrast to a DFA, the next state is not
necessarily uniquely determined by the current state and input symbol in case of an NFA.
In an NFA, a state may have zero, one, or many exiting arrows for each alphabet symbol.
ε- transitions. In an ε-transition, the state of the automata can be changed and go to next
state without consuming the next input. δ(q, ε) = {q1,q2….qk} implying that with ε-
transition the next state could by any one of {q1,q2….qk}
25
Why an NFA?
Every NFA can be converted into an equivalent DFA; but sometimes that DFA may have many
more states.
Furthermore, understanding the functioning of the NFA is much easier, as you may see by
examining the following figure for the DFA.
NFA and DFA that recognize the language A
A = {w | w contains a 1 in the third position from the end}
Two machines
are equivalent if
they recognize
the same
language
Finite automata and regular language RL
Finite automata are good models for computers with an extremely limited amount of memory.
A machine may accept several strings, but it always recognizes only one language. If the
machine accepts no strings, it still recognizes one language namely, the empty language θ.
language of machine M and write L(M) = A. We say that M recognizes language A
We say that M recognizes language A if A = {w | M accepts w}.
Learning Outcomes
28