Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

GLO161 Automata Theory

Bachelor of Technology

SEMESTER – IV
YEAR 2022

Name: Khan Anas


Waqar

URN: 2020-B-19062002

School of Engineering
Ajeenkya D Y Patil University, Pune

DY Patil Knowledge City Road Via Lohegaon,


Airport Rd, Charholi Budruk, Pune, Maharashtra 412105
DATE:

CERTIFICATE

This is to certify that Mr/Miss Khan Anas Waqar bearing URN number 2020-B-
19062002 of B.Tech Second year Computer Engineering has successfully completed
Automata Theory practice session as per the university requirements during the
academic year 2022.

Neha Vekhande Dr. Biswajeet Champaty


Head-School of Engineering

Date: Internal Examiner Internal Examiner


INDEX

Sr. No. Context Page No. Sign


1 Abstract
2 Introduction
3 Recall Theorem
4 Pumping Lemma
5 Proof Idea
6 Turing Machines
7 TM Example

Faculty-In-charge
Abstract
In computer science, in particular in formal language
theory, the pumping lemma for context-free languages,
also known as the Bar-Hillel lemma, is a lemma that gives
a property shared by all context-free languages and
generalizes the pumping lemma for regular languages.

The pumping lemma can be used to construct a proof by


contradiction that a specific language is not context-free.
Conversely, the pumping lemma does not suffice to
guarantee that a language is context-free; there are other
necessary conditions, such as Ogden's lemma, or the
Interchange lemma.

Introduction
The machine operates on an infinite memory tape divided into
discrete "cells". The machine positions its "head" over a cell and
"reads" or "scans" the symbol there. Then, based on the symbol
and the machine's own present state in a "finite table" of user-
specified instructions, the machine first writes a symbol (e.g., a
digit or a letter from a finite alphabet) in the cell (some models
allow symbol erasure or no writing), then either moves the tape
one cell left or right (some models allow no motion, some models
move the head), then, based on the observed symbol and the
machine's own state in the table, either proceeds to another
instruction or halts computation.
The Turing machine was invented in 1936 by Alan Turing, who
called it an "a-machine" (automatic machine). It was Turing's
Doctoral advisor, Alonzo Church, who later coined the term
"Turing machine" in a review. With this model, Turing was able
to answer two questions in the negative:

➢ Does a machine exist that can determine whether any


arbitrary machine on its tape is "circular" (e.g., freezes, or
fails to continue its computational task)?
➢ Does a machine exist that can determine whether any
arbitrary machine on its tape ever prints a given symbol?

Recall Theorem: A is a CFL if some PDA recognizes A.


Corollaries:
1. Every regular language is a CFL.
2. If A is a CFL and B is regular then A∩B is a CFL.

Theorem 1 (pumping lemma for CFL)


Pumping Lemma for CFLs: For every CFL A, there is ap such that if s∈A
and |s|≥p then s= uvxyz where
1. uvixyiz ∈ A for all i ≥ 0
2. vy ≠ ε
3. |vxy| ≤ p.
Pumping Lemma – Proof details

Let b= the length of the longest right-hand side of a rule (E →E+T)


=the max branching of the parse tree
Let h= the height of the parse tree for s.

A tree of height h and max branching b has at most bh leaves.


So |s| ≤ bh .

Let p=b|V|+1 where |V|=#variables in the grammar.

So if |s| ≥p>b|V| then |s|>b|V| and so h>|V|.

Thus at least |V|+1 variables occur in the longest path.


So some variables R must repeat on a path.

Proof Idea
o Recall our proof for the pumping lemma for regular
languages.
o How do we know that the DFA would visit the same state
twice?
o This time, we want the same variable to appear twice on some
path in the parse tree.
o Any idea? (Any hint?) Yes, the Pigeon-Hole Principle.
o Since we have |V| variables, if, on the parse tree, the path
from the start variable to some terminal is long enough (how
long?) we should see the same variable twice.
o How can we make sure that the parse tree is very tall?

G1
S → AB
A → 1A0|0A1|ε
B → BB|0|1

➢ What is the longest string whose longest path from


S to any terminal is ≤ 4?
➢ Any bound on the length of the string generated by
G2 that guarantees that the height of its parse tree is
at least 5?

Tall parse tree: general case


✓ Let G be a CFG for CFL A.
✓ Let b be the maximum number of symbols generated from one
variable by one of the substitution rules. (E.g., in G1, b is 3.)
✓ Thus, any node on a parse tree of grammar G can’t have more than
b children.
✓ Therefore, a tree of height 1 can’t have more than b leaves. A tree
of height 2 can’t have more than b 2 leaves. In general a tree of
height h can’t have more than b h leaves.
✓ The length of a string is the number of leaves on a parse tree.
✓ Therefore a parse tree of a string of length b h + 1 must be at least
h + 1 high.

Example of Proving Non-CF


Pumping Lemma for CFLs: For every CFL A, there is ap such that if s∈A
and |s|≥p then s= uvxyz where
1. uvixyiz ∈ A for all i ≥ 0
2. vy ≠ ε
3. |vxy| ≤ p.

Let B= {0k1k2k|k≥0}
Show: B is not a CFL
Let A1-{0k1k2l|k,l≥0} (equal #s of 0s and 1s)
Let A2-{0l1k2k|k,l≥0} (equal #s of 1s and 2s)
Observe that PDAs can recognize A1 and A2. What can we now
conclude?
➢ The class of CFLs is not closed under intersection.
➢ The Pumping Lemma shows that A1 ∪ A2 is not a CFL.
➢ The class of CFLs is closed under complement.

Turing machine
A Turing machine is a mathematical model of computation that
defines an abstract machine that manipulates symbols on a strip of
tape according to a table of rules. Despite the model's simplicity,
given any computer algorithm, a Turing machine capable of
implementing that algorithm's logic can be constructed.

1. Head can read and write


2. Head is two ways (can move left or right)
3. Tape is infinite (to the right)
4. Infinitely many blanks “˽“ follow input
5. Can accept or reject any time (not only at end of input)

TM Example
TM recognises B= {akbkck|k ≥ 0}
1. Scan right until ˽ while checking if input is in a ∗b ∗c, reject if not.
2. Return head to left end.
3. Scan right, crossing off single a, b, and c.
4. If the last one of each symbol, accept.
5. If the last one of some symbols but not others, reject.
6. If all symbols remain, return to left end and repeat from (3).

TM Recognizers and Deciders


Let M be a TM. Then L(M)= {w|M accepts w}.
Say that M recognizes A if A= L(M).
Defn: A is Turing – recognizable if A=L(M)for some TM M.

Defn: TM M is a decider if M halts on all inputs.


Say that M decides A if A=L(M) and M is a decider.
Defn: A is Turing- decidable if A = L(M) for some TM decider M.
Thank You

You might also like