0% found this document useful (0 votes)
9 views

Unit 1

The document outlines the course structure for Automata Theory, covering topics such as Mathematical Induction, Regular Languages, Finite Automata, and Turing Machines. It includes definitions, examples, and applications of various concepts such as grammars, recursive definitions, and finite automata types. Additionally, it provides textbook references and detailed explanations of mathematical principles and automata theory fundamentals.

Uploaded by

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

Unit 1

The document outlines the course structure for Automata Theory, covering topics such as Mathematical Induction, Regular Languages, Finite Automata, and Turing Machines. It includes definitions, examples, and applications of various concepts such as grammars, recursive definitions, and finite automata types. Additionally, it provides textbook references and detailed explanations of mathematical principles and automata theory fundamentals.

Uploaded by

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

Course Name: Automata Theory

Course Code: UCSC0402


Unit 1: Mathematical Induction, Regular Languages &
Finite Automata
Unit 2 : Kleene’s Theorem
Unit 3 : Grammars and Languages
Unit 4 : Push Down Automata
Unit 5 : CFL’s and non CFL’s
Unit 6 : Turing Machines

Text Books:
1.Introduction to languages & Theory of computations – John C.
Martin (MGH) –Chapters 1, 2,3,4,5,6,7,8 2.
2. Discrete Mathematical Structures with applications to Computer
Science—J .P.Trembley & R.Manohar (MGH) Chapter 1,
Unit 1: Mathematical Induction, Regular Languages &
Finite Automata
• The Principle of Mathematical Induction
• Recursive Definitions,
• Definition & types of grammars & languages,
• Regular expressions and corresponding regular
languages, examples and applications,
• unions, intersection & complements of regular
languages,
• Finite automata-definition and representation,
• Non-deterministic F.A.,NFA with null transitions,
• Equivalence of FA’s ,
• NFA’s and NFA’s with null transitions.
The Principle of Mathematical Induction
• Mathematical Induction is a technique of proving a statement,
theorem or formula which is thought to be true, for each and
every natural number n.
• By generalizing this in form of a principle which we would use to
prove any mathematical statement is 'Principle of Mathematical
Induction'.

• For example: 13 +23 + 33 + ….. +n3 = (n(n+1) / 2)2, the statement is


considered here as true for all the values of natural numbers.

The technique involves two steps to prove a statement P(n), as stated


below −
• Step 1(Base step) − It proves that a statement is true for the initial value(a).
• Step 2(Inductive step) − Assume that given statement P(n) is also true for n = k,
where k is any positive integer.
• The base step and the inductive step, together, prove that P(k) => P(k + 1) =>
P(k + 2) …. is true. Therefore, P(n) is true for all integers n ≥ a.
The Principle of Mathematical Induction example
• Example 1:
• Prove the following by Mathematical Induction:
1 + 3 + 5 +.... + 2n - 1 = n2.
Solution:
Step 1: Base step- let us assume that.
P (n) = 1 + 3 + 5 +..... + 2n - 1 = n2.
For n = 1, P (1) = 1 = 12 = 1 It is true for n = 1................ (i)
Induction Step: For n = r,
P (r) = 1 + 3 + 5 +..... +2r-1 = r2 is true......................... (ii)
Adding 2r + 1 in both sides
P (r + 1) = 1 + 3 + 5 +..... +2r-1 + 2r +1 = r2 + (2r + 1)
= r2 + 2r +1
= (r+1)2..................... (iii)
As P(r) is true. Hence P (r+1) is also true.
From (i), (ii) and (iii) we conclude that.
1 + 3 + 5 +..... + 2n - 1 =n2 is true for n = 1, 2, 3, 4, 5 ....Hence Proved.
Example:The Product of Two Odd Integers Is Odd
• To Prove: For every two integers a and b, if a and b are odd,
then ab is odd.
■ Proof :
• The conditional statement can be restated as follows:
• If there exist integers i and j so that a = 2i + 1 and b = 2j + 1,
then there exists an integer k so that ab = 2k + 1.
• Our proof will be constructive—not only will we show that
there exists such an integer k, but we will demonstrate how to
construct it.
• Assuming that a = 2i + 1 and b = 2j + 1,
• we have ab = (2i + 1)(2j + 1) = 4ij + 2i + 2j + 1 = 2(2ij + i + j ) + 1
• Therefore, if we let k = 2ij + i + j, we have the result we want,
ab = 2k + 1.
Recursive Definitions
• Recursion is the general term for the practice of
defining an object in terms of itself or of part of
itself.
• Recursively Defined Functions:
• A recursive or inductive definition of a function
consists of two steps.
– • Basis Step: Specify the value of the function at
initial values. (e.g. f(0) defined)
– • Recursive Step: Give a rule for finding its value at an
integer from its values at smaller integers. (For n > 0,
define f(n) in terms of f(0), f(1), . . . , f(n − 1))
Example of recursive definations of function to calculate the
factorial of any number n>0.
• A function is said to be recursive when it is calling itself (with somewhat less
complex arguments) to solve a problem.
• Now, factorial can be a recursive function as we can calculate factorial of
bigger numbers by calculating factorials of lower numbers.
• e.g., 5! = 5*4! = 5*4*3! = 5*4*3*2! = 5*4*3*2*1! = 5*4*3*2*1 = 120
by taking 1! = 1.
• n! = 1 if n=0
n! = n*(n-1)! If n>0
Recursive Definitions
• Recursion is a technique that is often useful in
writing computer programs.
• Here recursion as a tool for defining sets:
primarily, sets of numbers, sets of strings, and
sets of sets (of numbers or strings).
• A recursive definition of a set begins with a basis
statement that specifies one or more elements in
the set. The recursive part of the definition
involves one or more operations that can be
applied to elements already known to be in the
set, so as to produce new elements of the set
Example of recursive definition is the axiomatic
definition of the set N of natural numbers
• We might write the definition this way:
1. 0 ∈ N .
2. For every n ∈ N , n + 1 ∈ N .
3. Every element of N can be obtained by using statement
1 or statement 2.
In order to obtain an element of N , we use statement 1
once and statement 2 a finite number of times (zero or
more).
To obtain the natural number 7, for example, we use
statement 1 to obtain 0;
then statement 2 with n = 0 to obtain 1;
then statement 2 with n = 1 to obtain 2; ... ;
and finally, statement 2 with n = 6 to obtain 7.
Definition & types of grammars & languages,
• According to Noam Chomosky, there are four
types of grammars − Type 0, Type 1, Type 2, and
Type 3. The scope of each type of grammar −
Type - 0 Grammar
• Type-0 grammars generate recursively enumerable
languages. The productions have no restrictions. They
are any phase structure grammar including all formal
grammars.
• They generate the languages that are recognized by a
Turing machine.
• The productions can be in the form of α → β where α is
a string of terminals and nonterminals with at least one
non-terminal and α cannot be null. β is a string of
terminals and non-terminals.
• Examples : ( includes all natural languages)
S → ACaB
Bc → acB
CB → DB
aD → Db
Type - 1 Grammar
• Type-1 grammars generate context-sensitive languages.
The productions must be in the form
• αAβ→αγβ
• where A ∈ N (Non-terminal)
• and α, β, γ ∈ (T ∪ N)* (Strings of terminals and non-
terminals)
• The strings α and β may be empty, but γ must be non-
empty.
• The rule S → ε is allowed if S does not appear on the
right side of any rule. The languages generated by these
grammars are recognized by a linear bounded
automaton.
• Examples: (most of programming languages)
AB → AbBc
A → bcA
B→b
Type - 2 Grammar
• Type-2 grammars are CFG(context free
grammar) generate context-free languages.
• The productions must be in the form A → γ
where A ∈ N (Non terminal) and
γ ∈ (T ∪ N)* (String of terminals and non-terminals).
• These languages generated by these grammars are be
recognized by a non-deterministic pushdown automaton.
• Examples: (some simple programming languages)
S→Xa
X→a
X → aX
X → abc
X→ε
Type - 3 Grammar
• Type-3 grammars are Regular grammar which generate
Regular languages.
• Type-3 grammars must have a single non-terminal on the left-
hand side and a right-hand side consisting of a single terminal
or single terminal followed by a single non-terminal.
• The productions must be in the form
X → a or X → aY
where X, Y ∈ N (Non terminal) and
a ∈ T (Terminal)
• The rule S → ε is allowed if S does not appear on the right side
of any rule.
• Examples: (pattern matching languages contains regular
expressions)
X→ε
X → a | aY
Y→b
Application of Regular Expression
• Regular expressions are useful in a wide variety of text processing
tasks,and more generally string processing, where the data need
not be textual.
• Common applications include data validation, data scraping
(especially webscraping),data wrangling, simple parsing, the
production of syntax highlighting systems, and many other tasks.
• While regexps would be useful on Internet search engines,
processing them across the entire database could consume
excessive computer resources depending on the complexity and
design of the regex.
• Basically regular expressions are used in search tools
• Text file search in Unix (tool: egrep) This command searches for a
text pattern in the file and list the file names containing that
pattern
Introduction to Finite Automata
• Study a class of machines called finite automata.
• Finite automata are computing devices that
accept/recognize regular languages and are used to
model operations of many systems we find in
practice.
• Their operations can be simulated by a very simple
computer program.
• A language is a subset of the set of strings over an
alphabet.
• A language can be generated by grammar. A
language can also be recognized by a machine. Such
machine is called recognition device.
• The simplest machine is the finite state automaton.
• A finite automaton is a mathematical (model)
abstract machine that has a set of “states” and its
“control”moves from state to state in response to
external “inputs”.
• The finite state machines are used in applications in
computer science and data networking.
• For example, finite-state machines are basis for
programs for spell checking, indexing, grammar
checking, searching large bodies of text, recognizing
speech, transforming text using markup languages
such as XML & HTML, and network protocols that
specify how computers communicate.
Types of Finite Automata
• The control may be either “Deterministic”
meaning that the automation can‘t be in more
than one state at any one time, or “Non
deterministic”, meaning that it may be in several
states at once.
• This distinguishes the class of automata as
– DFA - The DFA, i.e. Deterministic Finite Automata
can‘t be in more than one state at any time.
– NFA. ‐ The NFA, i.e. Non-Deterministic Finite
Automata can be in more than one state at a time.
– NFA with epsilon moves
Deterministic Finite Automata- DFA
• Definition : A deterministic finite automaton is defined
by a quintuple (5-tuple) as (Q, Σ, δ, q0, F). Where,
Q = Finite set of states,
Σ = Finite set of input symbols,
δ = A transition function that maps Q × Σ -> Q
q0 = A start state; q0 ∈ Q
F = Set of final states; F includes in Q.
A transistion function δ that takes as arguments a state
and an input symbol and returns a state. In our diagram,
δ is represented by arcs between states and the labels
on the arcs.
For example:
If S is a state and a is an input symbol then δ(s,a) is
that state F such that there are arcs labled ‘a‘ from S to
F. a
S FS
Examples of DFA
Example 1:
Design a FA with ∑ = {0, 1} accepts those string which starts with 1
and ends with 0.
Solution: The FA will have a start state q0 from which only the
edge with input 1 will go to the next state.
In state q1, if we read 1, we will be in state q1, but if we read 0 at
state q1, we will reach to state q2 which is the final state. In state
q2, if we read either 0 or 1, we will go to q2 state or q1 state
respectively. Note that if the input ends with 0, it will be in the
final state.
• Example 2:
Design a FA with ∑ = {0, 1} accepts the only
input 101.
Solution: In the given solution, we can see that
only input 101 will be accepted. Hence, for
input 101, there is no other path shown for
other input.
• Example 3:
Design FA with ∑ = {0, 1} accepts even
number of 0's and even number of 1's.
• This FA will consider four different stages
for input 0 and input 1. The stages could
be:
• Here q0 is a start state and the final
state also. Note carefully that a
symmetry of 0's and 1's is
maintained. We can associate
meanings to each state as:
• q0: state of even number of 0's and
even number of 1's.
q1: state of odd number of 0's and
even number of 1's.
q2: state of odd number of 0's and
odd number of 1's.
q3: state of even number of 0's and
odd number of 1's.

You might also like