# Introduction to Theory of Computation

**KR Chowdhary Professor & Head
**

Email: kr.chowdhary@gmail.com

Department of Computer Science and Engineering MBM Engineering College, Jodhpur

kr chowdhary

TOC

1/ 17

by Michael Sipser. Pearson Education Introduction to languages and Theory of computation.Books
Introduction to Theory of Computation. Pearson
kr chowdhary
TOC
2/ 17
. Ullman. motwani. Tata McGrawHill Introduction to formal languages. by Hpcroft. and Computation. Martin. Languages. Kamala Krithivasan. Thompson Publication Introduction to Automata Theory. Automata Theory and Computation.

The concept of generative grammar was given ﬁrst time by Prof. 3 Theory of Computation: The contributors are Kurt Godel. spoken languages grammars. with in between states. Alan Turing. which does not change with time & technology. where there is always start state. Kleene. now a professor of Linguistics at Harvard. who gave the concept of Turing machine in his 1936 paper (much before the computers came into existence). The course is divided into: 1 Theory of automata: Every process (including computing) can be divided into discrete sequence of states.What is TOC?
The TOC is that knowledge of computer science.
kr chowdhary TOC 3/ 17
. Alonzo Church. we may consider the computation. Noam Chomsky. In this category. and there is a ﬁnal state. in the form of cellular automata. and growth of life. in 1940s. in 1956. the maximum contribution is due to Alan Turing. and even the planatary motions. However. The concept of automata was given by Von Neumann. and all corresponding languages. All these systems are automata. and yet unkown grammars. 2 Theory of languages: Under this comes all types of grammars computers’ langauages grammars.

What is TOC?
TOC attempts to establish a theory to all subjects of cs. complexity? Application of computer theory: writing programs to construct compilers. . and languages
kr chowdhary
TOC
4/ 17
. assemblers. { x |x ∈ / x } Russell’s Paradox TOC deals with Physical limits of computing. etc. storage. transmission of information Nature of problems... representation. just like classical dynamics to motion of objects Solvability of a problem ⇒ existence of algorithm.. CS is : Science of algorithm processing. Methodologies of algorithm design. OS.

Execution of a sequence of program statements is deductive proof
kr chowdhary
TOC
5/ 17
. then iterating is proof by induction.e. E.Meta Theory and Proofs
Meta Theory: Theory about the theory (mathematics) .Limits of computation Proofs: A statement is valid if there is no counter example..g. Proofs by Deduction Proof by Induction Taking one value. All integers are divisible by 2. .. is false : Find a proof by contradiction. ﬁnd at least a single case. where this is not true.Deﬁne computable: A thing is computable if it can be representable by an algorithm. i.

Functions
f :D→R for a. . there is always a ∈ D such that f (a) = b . f is surjection (onto) A relation which is both injection and surjection is called bijection. {φ }} 2+ = 3 = .. set 0 as element}={φ } 1+ = 2 = {φ . . . b ∈ D . f is injection or one-to-one mapping. Deﬁning Natural Numbers 0 = {} = φ 0+ = 1 = {elements of 0.
kr chowdhary
TOC
6/ 17
. f (a) = f (b ) ⇒ a = b .. for each b ∈ R .

Example: Hilbert’s Hotel: To accommodate more guests in this hotel. You can subtract any thing from inﬁnity. then A is inﬁnite. . you can map 40 onwards to inﬁnity. it results inﬁnite only. (say 1). 40 ↔ 1. For example. If there is a bijection between any set A and set N. 41 ↔ 2. . You can add any thing into an inﬁnite. push occupant of room 1 into 2. For example.Inﬁnite sets
Hence. alternatively. The room 1 is vacated. and ready for new guest. and so on. i )0 ∈ N ii)if n ∈ N.
kr chowdhary
TOC
7/ 17
. . of 2 into room 3. it remains inﬁnity. ∴ n+ ∈ N If there is a bijection between any set A and set n ∈ N.then A is ﬁnite. 43 ↔ 3.

. .. . .. .b00 b01 b02 .Diagonalization Theorem
Theorem
There is no bijection between inﬁnite sets N and R. R is uncountably inﬁnite. .
kr chowdhary
TOC
8/ 17
. . . i 0 . N R 0 0. 1 0. the mapping is not bijection. ∴..¬b00 ¬b11 ¬b22 .b10 b11 b12 .b i 0 b i 1 b i 2 . Thus. .. 1} ˙ Now consider the number. bij ∈ {0. Therefore this list of R is exhaustive.
Proof. 2 0. .b20 b21 b22 . Since x is new. x = 0. . this contradicts the assumption.
Assume that f : N → R is bijection. hence the list of R is not exhaustive. .

as an image of an element of A. this proves that f is not a surjection. Assume that f is surjection. and hence not a bijection also. Thus. for all a ∈ A. B is not in the image of f . which does not include the element itself. Hence. we have a ∈ B iﬀ a ∈ / f (a). for every a ∈ A.
For f : A → ℘(A). ∴.Cantor’s Theorem
Theorem Proof. consider B ⊆ A. Since ℘(A) are all subsets of A. This contracts our assumption that we considered in the beginning of this proof.
kr chowdhary
TOC
9/ 17
. ∴ B = f (a). B = {a ∈ A|a ∈ / f (a)} Thus. f is not surjection.

This shows that f is not surjection.2. (Note: Compare this with previous). D is not any image!).3} as nonselﬁsh. And. ⇔ . D = {d |d ∈ N. f is not surjection. and between 1 and {2.This is contradiction.5} 3 ⇔ {2.. to ultimately contradict it.
kr chowdhary TOC 10/ 17
For f : N → ℘(N).Cantor’s Theorem for inﬁnite sets
Theorem Proof.5} as selﬁsh. to arrive at contradiction.3} 2 ⇔ {1. Consider now: N ⇔ ℘(N) 0 ⇔ {5} 1 ⇔ {2.
Assume that f is surjection. D ∈ ℘(N)..
.. Naturally.e. We call the mapping between 2 and {1. Next we build a special set D of nonselﬁsh numbers.2..4. ∴ D = f (d ) (i.8} . d ∈ / f (d )}..

x ∈ N. x ∈ N A partial function can be used to model an iteration or inﬁnite loops. F } Total Function: deﬁned over the entire domain f : x → 2 x . N = { 0 . f (x ) : if (x==0) then 1 else f(x)
kr chowdhary
TOC
11/ 17
. 1 . . } Partial Function: deﬁned over some domain points only. .Functions
f :D→R + : int × int → int ⊆: S1 × S2 → {T . 2 . f : x → 2/x . .

. there is a ∗ b ∈ S ..g.Strings
a.g. Σ = {a. ⊗. Set of all strings on the alphabet set Σ are represented by Σ∗ (Kleene Star). for individual alphabets x . Strings have only one operation:Concatenation. b . The semigroup is an algebra. y .. for variable names for strings We use symbol Σ for alphabet set for languages. E. e. S . such that for a. c . ∗ .. b }. It can be helpful in mapping all the string operations in computer to this algebra so that they can be formally treated.g. Monoid is semigroup with a neutral element. b ∈ S . without technology boundaries of computers. M . z . d ... E. w . 1 is a Monoid with multiplication operation. For example. x ◦ y . ε ◦x = x ◦ε = x Semigraoups are algebraic systems which are closed on some binary operation.
kr chowdhary TOC 12/ 17
. . and have the property of associativity..

b }. 01. ab . bb . ba. L 5 ⊆ Σ∗ . . . which contains all the binary words. . 00. ba. 001. b }. . abbbb . 000. aaa} is ﬁnite language L4 = {ap | p is prime}. bba. then Σ∗ = {ε . baaa}. ε . aa. 1}. ab . 11. L5 = {ai b i |i ∈ N} L 3 . φ are the languages over the alphabet set Σ = {a.Languages
language: set of words (or strings) deﬁned over some alphabet. 1. . language with single null sentence Let Σ = {a. L 6 = { a i b i c i |i ∈ N }
kr chowdhary
TOC
13/ 17
. bbbb . aaa. {aab . {ε . a. These words are simpler form of sentences. L1 = {w ∈ Σ∗ |w has property P } L2 = {}. } L3 = {a. } is an inﬁnite language over Σ = {0. aaa}. For example. . {0. a. b . 10. language with no sentences Lε = {ε }. L 4 .

if two algorithms A and B produce same output for same input. what ever may be advancement of technology or science!) Algorithmic problems: ∗ A : Σ∗ 1 → Σ2 . if ∀x A(x ) = B (x ). it cannot be possible to design machines to recognize some languages.
kr chowdhary
TOC
14/ 17
. which is uncountably inﬁnite. f : N → N. Think of the mapping. some languages cannot be represented ! (what ever tools. say N. and methods may be used. Say N ∗ Languages over Σ∗ are 2|Σ | . Also. ∴ A ≡ B . It is not bijection. A is an algorithm which maps input strings to output. i. then they are equal..e. in some complex manner. as N > N.Representation of Languages
Strings oveer Σ∗ are countably inﬁnite. ∴.

L1 . with L0 1 = {ε }
∗ k L∗ 1 = {w ∈ Σ |∃k ≥ 0. w ∈ L1 }.
kr chowdhary
TOC
15/ 17
. y ∈ L2 } L 1 = { w ∈ Σ ∗ |w ∈ / L1 } k L1 = (L1 ◦ L1 ) . then there are following operations on L1 . This is called Kleene Star of language L1 . L2 : L1 ∪ L2 = {w |w ∈ L1 or w ∈ L2 } L1 ◦ L2 = {w = xy |x ∈ L1 . . . w ∈ L1 }. ∗ k L+ 1 = {w ∈ Σ |∃k ≥ 1.Operations on Languages
Let L1 . k-times. L2 be languages over the same alphabet Σ.

kr chowdhary
TOC
16/ 17
.. independent of technology.. like from thermodynamic we conclude that perpetual machines cannot be made The course gives treatment to the subject.g. sorting the numbers Those that produce Y/N : Called Membership Problem. e. Is x ∈ A? Another.unsolvable. that produce a deﬁnite output: e. e. What problems we can solve by computers?
1 2
3
Those. given a C program. to determine whether it will halt on so and so given input? (Halting Problem) . we reach to important conclusions in computation.Conclusion
By study of theory of computation.g.g..

McGraw-Hill.
kr chowdhary
TOC
17/ 17
. India.Bibliography
John C. Martin. Pearson Press. ”Introduction to Theory of Computation”. ”Introduction to Languages and Theory of Computation”. Pearson Press. John E. Languages. India Sipster. Languages. Thompson Press. Ullman. Rajeev Motwani. Hopcroft. Papadimitriou and Harry Lewis.PHI. and Computation”. ”Elements of the Theory of Computation (2nd Edition)”. Jeﬀrey D. Mishra and Chandrashekharan. ”Theory of Computer Science (Automata. India. ”Introduction to Automata Theory. and Computation) ”. Christos H.