0% found this document useful (0 votes)
7 views34 pages

mod1-2

The document outlines a course on the Theory of Computation, covering topics such as types of grammars, models of automata, and the limitations of computation. It aims to equip students with the ability to analyze computational models, apply formal mathematical methods, and understand the connections between languages, grammars, and automata. The syllabus includes various computational models, operations on languages, and the Chomsky hierarchy of grammars.
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)
7 views34 pages

mod1-2

The document outlines a course on the Theory of Computation, covering topics such as types of grammars, models of automata, and the limitations of computation. It aims to equip students with the ability to analyze computational models, apply formal mathematical methods, and understand the connections between languages, grammars, and automata. The syllabus includes various computational models, operations on languages, and the Chomsky hierarchy of grammars.
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/ 34

Pre-requisite

NIL

Course objectives

1. Types of grammars and models of automata.


2. Limitation of computation: What can be and what cannot be computed.
3. Establishing connections among grammars, automata and formal
languages.

2
Course Outcomes

On completion of this course, student should be able to:


1. Compare and analyse different computational models.
2. Apply rigorously formal mathematical methods to prove properties of
languages, grammars and automata.
3. Identify limitations of some computational models and possible methods
of proving them.
4. Represent the abstract concepts mathematically with notations.
3
Syllabus

4
Syllabus

5
Text Books & References

6
Text Books & References

Text Book

J.E. Hopcroft, R. Motwani and J.D. Ullman, to Automata Theory, Languages


and Third Edition, Pearson Education, India 2008. ISBN: 978-8131720479

Reference Books

Peter Linz, Introduction to Formal Languages and Sixth Edition, Jones &
Bartlett, 2016. ISBN: 978-9384323219

K. Krithivasan and R. Rama, to Formal Languages, Automata and


Pearson Education, 2009. ISBN: 978-8131723562

7
Tentative Assessments

CAT 1

CAT 2

Digital Assignment

Quiz/Other Assignments (2)

Final Assessment Tests

8
Introduction to Theory of Computation
Most fundamental course of Computer Science.
It is branch How efficiently the problems can be solved on a model of
computation using algorithm.
Computation Transform set inputs into output(s) - finite, effective step by step
processes/procedures (algorithms).
Execution of algorithms.
Computation is simply a sequence of steps that can be performed by computer.
Programs to solve some problems. Program express algorithms.
Capabilities and limitations of computer algorithms/computation.
Theory based on the specification of actual hardware would not be useful because
of the technology proliferation.
TOC learn abstract machine or model of computation Defined mathematically.
9
Introduction to Theory of Computation
f: D R (Domain of all inputs and range of all outputs)

Every algorithm computes a function.


A function is a abstract notion which tells the mapping between domain of inputs
and range of outputs.
An algorithms defines how to obtain the output for a specific input.
Sometimes, It is possible to define a function without an idea to obtain the output.
Goal: To identify the class of function which admit algorithms to compute
them.

10
Introduction to Theory of Computation
Branches
Automata Theory Finite Automata, Pushdown Automata, Linear Bounded and
Turing Machine
Formal Languages
Computability Theory Decidable, Undecidable
Computational Complexity Theory Accept Halt, Accept Not Halt (Time and
Space)
Applications
Traffic Lights
Lifts and elevators
Vending machines
Video Games
Cryptography
Speech Recognition.
11
Natural Language Processing.
Introduction to Theory of Computation
Motivation
TOC suggests various abstract models of computation, which are represented
mathematically.
What is computable and what is not?
How to analyze an algorithm?
Whether a program/code is executable or not?
Whether a program/code is erroneous or not?
Is it possible to make a program more efficient?
What is easy, and what is difficult, to compute?
What is easy, and what is hard for computers to do?

12
Module 1

13
Overview of Computational Models
Computation Models describes how an output of a mathematical function is
computed given an input.

Types of Computational Models


Models of computation can be classified in three categories:
Sequential models - FSM, PDA, Random Access Machine, TM
Functional models - Lambda Calculus, General Recursive functions, Combinatory
logic
Concurrent models - Petri nets, DFG (Data Flow Graph), Interaction nets, Actor
model 14
Introduction to Languages and Grammars
Symbols a,..,z,A,...,Z,0,...,9,*,&,@,#
Alphabets ( )
A finite, non-empty set of symbols
Example
a) = {0, 1}, the binary alphabet
b) = {a, b, , z}, the set of all lower-case letter
c) The set of all ASCII characters

15
Introduction to Languages and Grammars
Strings
A string (or word) is a finite sequence of symbols chosen from
some alphabet
Example

Empty string, a string with zero occurrences of symbols


Length |w| of string w the number of positions for symbols in w
Examples:|0111|= 4, | |=0,
16
Introduction to Languages and Grammars
Power of an alphabet, k
Concatenation of two strings x and
A set of all strings of length k y is xy
Examples Example
Given we have
If x = 01101, y = 110,
={ 2 = {00, 01, 10, 11}
then xy = 01101110, and xx
Set of all strings over denoted as
= x = 0110101101

Set of nonempty strings from


is the identity for concatenation
since w = w w
Introduction to Languages and Grammars
Reverse: wR Prefix and suffix:
If w = abc, wR= cba if w = vu
v is a prefix of w
Substring: any string of consecutive
u is a suffix of w
characters in some string w Example
If w= abc If w = abc
, a, ab, abc are substrings of w
a, ab , abc are prefixes of w
c, bc, abc are suffixes of w
Introduction to Languages and Grammars
Identify the Prefix, Suffix and Substring
S = banana
Prefix : ban, banana
Suffix : ana, banana
Substring : nan, ban, ana, banana
Introduction to Languages and Grammars
Notations of Languages
A language is a set of strings all chosen from some *
If is an alphabet, and L *, then L is a language over .
Examples
The set of all legal English words is a language
The set of all strings of n n n 0 {
n 0 {
* is an infinite language for any alphabet

the empty language (not the empty string is a language over any alphabet
{ }
={}
Introduction to Languages and Grammars
Different Notations of a Language
Method 1 Simple statement definition
The language accept set of all strings of n n n 0
Method 2 Set former notation
{0n1n| n 0}
Method 3
L={ * | w has n n }.
Above all definitions represent the L={ ,01,0011,000111,...}
DIY : {0i1j| 0 i j} What are the strings included in the language ???
Introduction to Languages and Grammars
Operations on Languages
Union
Intersection
Concatenation
Complementation
Reversal
Closure
Introduction to Languages and Grammars
Operations on Languages - Union
Definition
Let L1 and L2 be two languages over an alphabet . The union of L1 and L2,
(L1 L2) is denoted as follows
L1 L2 = {x | x is in L1 or L2}.
Example
L1= { x {0,1}* | x with length 2} Then L1={00,01,10,11}
L2= { x {0,1}* | x begins with 0 and its length should be 3} Then
L2={000,001,010,011}
L1 L2 = {00,01,10,11,000,001,010,011}
Introduction to Languages and Grammars
Operations on Languages Intersection
Definition
Let L1 and L2 be languages over an alphabet . The intersection of L1 and L2,
denoted by L1 L2, is { x | x is in L1 and L2}.
Example
L1 = { x {0,1}* | x begins with 0 and its length should be 3}
Then L1={000,001,010,011}
L2 = { x {0,1}* | x ends with 0 and its length should be 3}
Then L2={000,010,100,110}
L1 L2 = {000,010} means L1 L2 = { x {0,1}*| x begins and ends with
0 and its length should be 3}
Introduction to Languages and Grammars
Operations on Languages Concatenation
Definition
Let L1 and L2 be languages over an alphabet . The concatenation of L1 and L2,
denoted by L1.L2, is {w1 w2| w1 is in L1 and w2 is in L2}.
Example
L1 = { x {0,1}* | x begins with 0 and its length should be 3}
Then L1={000,001,010,011}
L2 = { x {0,1}* | x ends with 0 and its length should be 3}
Then L2={000,010,100,110}
L1.L2={000000,000010, 000100, 000110,...}
L1.L2={ x {0,1}*| x begins and ends with 0 and length(x) is equal to 6}
Introduction to Languages and Grammars
Operations on Languages Complementation
Definition
Let L be a language over an alphabet . The complementation of L, denoted by
L , is * L.
Example
Let = {0, 1} be the alphabet.
L= { * | the number of 1 s in is even}.
Note: Here we considered zero occurrence of even ones as even.
L= { 0, 00, 11, 000, 110, 101, 011, 0000, 1100, 1010, 1001, 0110, 0101, 0011, }
L = * L = {1,01,10,001,010,....
Introduction to Languages and Grammars
Operations on Languages Reversal
Definition
Let L be a language over an alphabet . The reversal of L, denoted by LR, is
{wR|w is in L}.
Example
L = {x {0,1}*| x begins with 0}
L = {0,00,01,000,001,010,011,...}
LR = {0,00,10,000,100,010,110,...} = {x {0,1}*| x ends with 0}
Introduction to Languages and Grammars
Operations on Languages Closure
Kleene closure of L - L* - zero or more concatenations of L
L* = L0 L1 L2 ...
L0 = { }, L1 = L, L2 = LL
Ln = L concatenated with itself n times.
Positive closure of L L+ - one or more concatenations of L
Example
L={ x {0,1}* | x with length 2} Then L={00,01,10,11}
L* = { {00,01,10,11} {0000,0001,0010,0011,0100,0101,0110,0111,...}
L+ = {00,01,10,11} {0000,0001,0010,0011,0100,0101,0110,0111,...}
Introduction to Languages and Grammars
Some More Examples Language and String
Eg1.: The language L consists of strings over {a,b} in which each string begins
with an a should have an even length.

Eg2.: The language L consists of strings over {a,b} in which each occurring of b is
immediately preceded by an a.
Introduction to Languages and Grammars
Some More Examples Language and String
Eg3.:

Eg4.:
Introduction to Languages and Grammars
Some More Examples Language and String
Eg5.:

Eg6.:
Introduction to Languages and Grammars
Some More Examples Language and String
Eg7.:

Eg8.:
Introduction to Languages and Grammars
Grammar
A grammar of a language, G is defined as G = (V, T, S, P)
Where,
V or N Finite set of objects called variables/ Non-terminals
T Finite set of objects called terminals
S V Start Symbol
P Finite set of productions

Ex: G = {(S, T), (a, b), S, P}

Note: N T
Introduction to Languages and Grammars
Types of Grammar - Chomsky Hierarchy
Homework
{0i1j| 0 i j} Write some strings that satisfies the given language.

You might also like