0% found this document useful (0 votes)
291 views30 pages

Automata and Formal Languages Guide

This document discusses automata theory, formal languages, and computation. It defines an automaton as an abstract model of a digital computer that reads input symbols and produces an output. A formal language consists of symbols and rules to combine them into sentences. Computation is defined as finding a solution to a problem using an algorithm. Finite automata are introduced as abstract machines that accept or reject strings using a finite number of states. Deterministic finite automata transition uniquely between states based on input symbols, while nondeterministic finite automata may have ambiguous or undefined transitions. Operations on languages like union, intersection, and concatenation are also covered.

Uploaded by

Tushar Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
291 views30 pages

Automata and Formal Languages Guide

This document discusses automata theory, formal languages, and computation. It defines an automaton as an abstract model of a digital computer that reads input symbols and produces an output. A formal language consists of symbols and rules to combine them into sentences. Computation is defined as finding a solution to a problem using an algorithm. Finite automata are introduced as abstract machines that accept or reject strings using a finite number of states. Deterministic finite automata transition uniquely between states based on input symbols, while nondeterministic finite automata may have ambiguous or undefined transitions. Operations on languages like union, intersection, and concatenation are also covered.

Uploaded by

Tushar Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 30

THEORY OF AUTOMATA

AND
FORMAL LANGUAGES

OR

THEORY OF COMPUTATION
By TUSHAR GUPTA
What is AUTOMATA ?
What is AUTOMATA ?

What is FORMAL LANGUAGES ?


What is AUTOMATA ?

What is FORMAL LANGUAGES ?

What is COMPUTATION ?
COMPUTATION
• Computation can be defined as finding a solution
to a problem from given inputs by means of an
algorithm.
AUTOMATA / AUTOMATON
Automatic machine -> Automation

→ An automata is an abstract model/mechanism of digital


computer.
→ It as a mechanism for reading input , the input mechanism
can read the input file from left to right , one symbol at a time.
→the automaton can produce output of some form.

We assume that input is a string over a given alphabet.


FORMAL LANGUAGES
• By formal we don't mean dressed up, we mean
languages with a form defined by rules that say
which strings are in the language and which are
not. We are only interested in syntax here, not
semantics. We are interested in the form of a
string of symbols, not the meaning of the string.
FORMAL LANGUAGES
• A formal language is an abstraction of the general
characteristics of programming languages.
• A formal language consists of a set of symbols and
some rules of formation by which these symbols can
be combined into entities called sentences .
• A formal language is the set of all strings permitted by
the rules of formation .
Symbol

•A symbol is a single object and is an


abstract entity that has no meaning by
itself.
•It can be alphabet, character or special
character
•Alphabet
An alphabet is a finite, nonempty set of symbols, Σ
(sigma) is used for an alphabet.
• For example
{0, 1} is an alphabet with two symbols
{a, b} is another alphabet with two symbols, and
English alphabet is also an alphabet
• Σ = {0,1}, or Σ = the binary alphabet
• Σ = {a,b,…..z}, or Σ=the set of all lower-case
letters
String

• A string is a finite sequence of symbols chosen from


some alphabet. e.g. 01101 is a string from the binary
alphabet Σ = {0,1}.

• The number of symbols in a string is called the length of


a string. e.g. 011101 has length 5 and the number of
symbols are 2. The standard notation for the length of a
string w is |w|. e.g. |011| = 3 and | ε | = 0
Strings
• The empty string (also called null string) is the string with length
zero. That is, it has no symbols. It is denoted with ε (epsilon), that
may be chosen from any alphabet whatsoever. Thus | ε | = 0.
• Powers of an Alphabet: If Σ is an alphabet, we define Σk to be the
set of strings of length k, each of whose symbols is in Σ. e.g. Σ0 =
{ε}. If Σ = {0,1}, then
Σ1 = {0,1}
Σ2 = {00,01,10,11}
Σ3 = {000,001,010,011,100,101,110,111}
The set of all strings over an alphabet is denoted as Σ*. For
instance, {0,1}* = {ε,0,1,00,01,10,11,000,….}. Put another way,
Σ* = Σ0 U Σ1 U Σ2 U Σ3 ….
Σ+ = Σ1 U Σ2 U Σ3 ….
Strings

• Concatenation of Strings: Let x and y be strings.


Then xy denotes the string obtained by
concatenating x with y, that is, xy is the string
obtained by depending the sequence of symbols of
y to that of x.
• e.g. if x = aab and y = bbab, then xy = aabbbab.

• Note that xy ≠ yx.


Languages

• A language is a set of strings over an alphabet. Thus {a,


ab, baa} is a language (over alphabet {a, b}).

• A set of strings all of which are chosen from some Σ*,


where Σ is a particular alphabet, is called a language. If Σ
is an alphabet, and L Σ* , then L is a language over Σ.
• An example is English, where the collection of legal English words is a
set of strings over the alphabet that consists of all the letters.
Examples of Languages
• The language of all strings consisting of n 0’s followed by n
1’s, for some n ≥ 0:
• {ε, 01, 0011, 000111,…..}
• The set of strings of 0’s and 1’s with an equal number of
each:
• {ε, 01,10,0011,0101,1001,…..}
• The set of binary numbers whose value is a prime:
• {10, 11, 101,111,1011…..}
Note: The only important constraint on what can be a language is that
all alphabets are finite, although they can have an infinite number of
strings.
Some Special Languages
• The empty set Ø is a language which has no
strings.
• The set { ε } is a language which has one string,
namely ε . Though ε has no symbols, this set has
an object in it. So it is not empty.
• For any alphabet Σ, the set of all strings over Σ is
denoted by Σ*. Thus a language over alphabet Σ is
a subset of Σ*.
Operations on Languages
• Since languages are sets, all the set operations can be
applied to languages.
• Thus the union, intersection and difference of two languages
over an alphabet Σ are languages over Σ. The complement of
a language L over an alphabet Σ is Σ* - L and it is also a
language.
• Another operation on a language is concatenation. Let L1 and
L2 be languages. Then the concatenation of L1 with L2 is
denoted as L1L2 and it is defined as
L1L2 = ( xy | x Є L1 and y Є L2}
OPERATIONS ON LANGUAGES
Some operations on language –

• Union ( L1 U L2)
• Intersection (L1 U L2 )
• Concatenation ( L1.L2 )
• Kleen closure / closure ( L* )
Kleen closure :
Let x be an language/set of string. Then x* denotes the
language/set of string obtained by kleen closure of x, that is,
x* is the concatenation of x with itself multiple times.

It is also the universal set of x .

• E.g. X = {ab,ba,aaa}

X* = {ε , ab , ba , aaa , abab , abba , abaaa , baab , baba ,


baaaa , aaaab , aaaba , aaaaaa , …..}
AUTOMATA / AUTOMATON
Automatic machine -> Automation

→ An automata is an absrtract model/machanism of digital computer.


→ It as a mechanism for reading input , the input mechanism can read the
input file from left to right , one symbol at a time.

→the automaton can produce output of some form.

We assume that input is a string over a given alphabet.


Accepter
An automaton whose output response is limited to simple “YES” or “NO”
is called accepter .

transducer

The capability of automaton of producting strings of symbols as output ,


is called transducer .
FINITE AUTOMATA
It takes input in form of strings over language of alphabet ,and
gives the output inform of “YES” or “NO”.

→ If output is YES i.e. inputed string is belong to that


language.
→ If output is NO i.e. inputed string is not belong to that
language .

A finite automata is an accepter.


FINITE AUTOMATA
• Has some (finite) number of states

• Set of transition from state to state thet occur on input


symbol choosen fron alphabet ‘ Σ ‘

• Has a start state and at least one final state


FINITE AUTOMATA
• A finite automata is collection of 5 tupple
• (Q , Σ ,  , q0 , F )
• Q: A finite set of states
• Σ : A finite set known as the alphabet
• q0: The start state (an element of Q)
• F: The final / accepting states (a subset of Q)
•  : Transition function mapping
L(M) = the language of machine M
= set of all strings machine M accepts
Representing Finite Automata
• Finite Automata can be
represented visually by state
diagrams
• M:
• Q = q0, q1
• Σ = {0, 1} (q0, 0) = q1
• F = q2 (q0, 1) = q0
• q0 = q0
(q1, 0) = q0
(q1, 1) = q1
STATE
DIAGRAM
• M = (Q, Σ, δ, q0, F), where
Q = {q0, q1}
Σ = {0,1}
q0 = q0
F = {q0}

STATE DIAGRAM
q Σ δ(q,σ)
q0 0 q0
q0 1 q1
q1 0 q1 STATE
Q1 1 q0 TABLE
FINITE AUTOMATA
• Finite automata cane be
- deterministic
- nondeterministic

-> Deterministic Finite Automata (D F A)

-> Non-deterministic Finite Automata (N F A)


FINITE AUTOMATA
DFA NFA
- Every transition is unique. - There may be some transition is
non-unique.
- Every possible transition must be - some transition may be
defined. undefined.
- ε – transition is not allowed. - ε – transition is allowed.

 (  : Q x Σ -> Q )  (  : Q x (Σ U ε) -> P(Q) )


An DFA State Diagram
An NFA State Diagram

You might also like