Escolar Documentos
Profissional Documentos
Cultura Documentos
Computation
Lecture # 1-2-3
Book
Introduction to Theory of Computation by Anil
Edition
Introduction
Main contents
RE
NFA
DFA
CFG
PDA
NPDS
TM(The Church-Turing Thesis )
Decidable and Undecidable Languages
NP Completeness Complexity Theory
Reducibility & Intractability
Language
Natural Languages
English, Chinese, French, Urdu etc
Programming Languages
Basic, Fortran, C, C++, Java etc
Mathematics
State diagram
etc
Components of Language
Alphabets
Basic elements
Set of letters or characters
Rules
Grammar
Tells you that words belongs to a language
Syntax
Meaning
Semantics
Definition
Language
Set of strings of characters from the alphabets
Word
A set of characters belongs to the language
English Words
Alphabets
a b cz A B C .Z punctuation marks,
Words
All words in standard dictionary
What is on the exam
The quick brown fox jumped over the lazy dog
E.g
context-free, regular
C-Language
Alphabets
ASCII characters
Words
Programs
#include<conio.h> main()
{printf(Hello);}
Conventions
a more mathematical
practical.
subject
and
less
the
Theory of Automata
Applications
This subject plays a major role in:
Defining computer languages
Compiler Construction
Parsing
etc
Types of languages
There are two types of languages
Formal Languages are used as a basis for
defining computer languages
A predefined set of symbols and string
Formal language theory studies purely syntactical
aspects of a language (e.g., word abcd)
Informal Languages
different versions
from an alphabet.
Example:
If = {1,0} then some sample strings are
0, 1, 110011, ..
Similarly, If = {a, b} then some sample strings
are
a, b, abbbbbb, aaaabbbbb, ..
and.
language.
Example:
If = {a} then a language L can be defined as
L={a,aa,aaa,.} where L is a set of words of
the language define by given set of alphabets.
Also a, aa, are the words of L but not ab.
finite
Should not be ambiguous
Example: an alphabet may contain letters consisting
Ambiguity Examples
1= {A, aA, bab, d}
2= {A, Aa, bab, d}
1 is a valid alphabet while 2 is an in-valid alphabet.
Similarly,
1= {a, ab, ac}
2= {a, ba, ca}
In this case, 1 is a invalid alphabet while 2 is a
valid alphabet.
Length of Strings
Definition:
The length of string s, denoted by |s|, is the
number of letters/symbols in the string.
Example:
={a,b}
s=aaabb
|s|=5
Reverse of a String
The reverse of a string s denoted by Rev(s) or
Example:
If s=abc is a string defined over ={a,b,c}
sr,
is
PALINDROME
(Palindrome examples: CIVIC, MADAM, RADAR, STATS, TALLAT, ROTATOR)
The language consisting of and the strings s
Even Even
All strings that contains even number of as
.}
Plus Operation
With Plus Operation, combination of different
Plus Operation
Examples
If = {x}
Then + = { x, xx, xxx, xxxx, .}
If = {0,1}
Then + = { 0, 1, 00, 01, 10, 11, .}
If = {aaB, c}
Then + = {aaB, c, aaBaaB, aaBc, caaB, cc,
.}
Defining language
Four different ways, in which a language can be defined
There are four ways that we will study in this course:
Descriptive way
Recursive way
Regular Expression
Finite Automata
English.
Example:
The language L of strings of even length, defined over ={b}, can
be written as
L={bb, bbbb, ..}
Example:
The language L of strings that does not start with a, defined over
L={000,
Example:
The
Example:
The
Example:
The language {anbncn}, of strings defined over