0% found this document useful (0 votes)
20 views42 pages

Nmims TCS CH 1

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 42

Theoretical Computer Science

B Tech/ MBA Tech – Comp – TCS


Prof. Stuti N. Ahuja
Unit 1: Introduction to Automata theory
 Basic concepts of String, Formal languages
 Chomsky hierarchy
 Grammar and its type – Type 0, 1, 2 and 3
 Derivation Tree
 Application of the subject in complier construction
Computation

• If it involves a computer, a program running on a computer and


numbers going in and out then computation is likely happening.
Theoryofcomputation

• Study of power and limits of computing.


• It has three interacting components:
# Automata Theory
# Computability Theory
# Complexity Theory
ComputabilityTheory

• What can be computed?


• Are there problems that no program can solve?
ComplexityTheory

• What can be computed efficiently?


• Are there problems that no program can solve in a limited amount of
time or space?
AutomataTheory
• Study of abstract machine and their
properties, providing a
mathematical notion of “computer”
• Automata are abstract mathematical models of
machines that perform computations on
an input by moving through a series of
states or configurations. If the computation of an
automaton reaches an accepting configuration
it accepts that input.
Study ofAutomata

• For software designing and checking behavior of digital circuits.


• For designing software for checking large body of text as a collection
of web pages, to find occurrence of words, phrases, patters (i.e.
pattern recognition, string matching, …)
• Designing “lexical analyzer” of a compiler, that breaks input text into
logical units called “tokens”
AbstractModel

• An abstract model is a model of computer system (considered either


as hardware or software) constructed to allow a detailed and precise
analysis of how the computer system works.
• Such a model usually consists of input, output and operations that
can be performed and so can be thought of as a processor.

E.g. an abstract machine that models a banking system can have


operations like
“deposit”, “withdraw”, “transfer”, etc.
BriefHistory
• Before 1930’s, no any computer were there and Alen Turing introduced an
abstract machine that had all the capabilities of today’s computers. This
conclusion applies to today’s real machines.
• Later in 1940’s and 1950’s, simple kinds of machines called finite
automata were introduced by a number of researchers.
• In late 1950’s the linguist N. Chomsky begun the study of formal grammar
which are closely related to abstract automata.
• In 1969 S. Cook extended Turing’s study of what could and what couldn’t
be computed and classified the problem as:
o Decidable
o Tractable/intractable
BasicConceptofAutomataTheory

• The basic terms that pervade the theory of automata include


“alphabets”, “strings”, “languages”, etc.
Alphabets:(Representedby‘∑’)

• Alphabet is a finite non-empty set of symbols. The symbols can be the


letters such as {a, b, c}, bits {0, 1}, digits {0, 1, 2, 3… 9}.
• Common characters like $, #, etc.
• {0,1} – Binary alphabets
• {+, −, *} – Special symbols
Strings:- (Stringsaredenotedbylowercase
letters)
• String is a finite sequence of symbols taken from some alphabet. E.g.
0110 is a string from binary alphabet, “automata” is a string over
alphabet {a, b, c … z}.
Empty String
• It is a string with zero occurrences of symbols. It is denoted by ‘ε’
(epsilon).
Length of String
• The length of a string w,denoted by | w |, is the number of positions
for symbols in w. we have for every string s, length (s) ≥ 0.
• | ε | = 0 as empty string have no symbols.
• | 0110 | = 4
• The set of Power of alphabet
• all strings of certain length k from an alphabet is the kth power of
that alphabet. i.e. ∑k = {w / |w| = k}

If ∑ = {0, 1} then,
∑0 = {ε}
∑1 = {0, 1}
∑2 = {00, 01, 10, 11}
∑3 = {000, 001, 010, 011, 100, 101, 110, 111}
Kleen Closure
• The set of all the strings over an alphabet ∑ is called kleen closure of ∑
& is denoted by ∑*. Thus, kleen closure is set of all the strings over
alphabet ∑ with length 0 or more.

• ∴∑* = ∑0 ∪ ∑1 ∪ ∑2 ∪ ∑3 ∪……………
• E.g. A = {0}
• A* = {0n / n = 0, 1, 2, …}
Positive Closure
• The set of all the strings over an alphabet ∑, except the empty string
is called positive closure and is denoted by ∑+.
• ∴∑+ = ∑1 ∪ ∑2 ∪ ∑3 ∪ ……………
Language

• A language L over an alphabet ∑ is subset of all the strings that can be formed out of ∑; i.e. a
language is subset of kleen closure over an alphabet ∑; L ⊆ ∑*. (Set of strings chosen from ∑*
defines language).

For example;
• Set of all strings over ∑ = {0, 1} with equal number of 0’s & 1’s.
L = {ε, 01, 0011, 000111, ………}
• φ is an empty language & is a language over any alphabet.
• {ε} is a language consisting of only empty string.
• Set of binary numbers whose value is a prime:
L = {10, 11, 101, 111, 1011, ……}
ConcatenationofStrings

• Let x & y be strings then xy denotes concatenation of x & y, i.e. the


string formed by making a copy of x & following it by a copy of y.
• More precisely, if x is the string of i symbols as x = a1a2a3…ai & y is
the string of j symbols as y = b1b2b3…bj then xy is the string of i + j
symbols as xy = a1a2a3…aib1b2b3…bj.
• For example; x = 000 y = 111 xy = 000111 & yx = 111000
• Note: ‘ε’ is identity for concatenation; i.e. for any w,εw = wε = w
Suffix of a string
• A string s is called a suffix of a string w if it is obtained by removing 0
or more leading symbols in w. For example; w = abcd s = bcd is suffix
of w.

Prefix of a string
• A string s is called a prefix of a string w if it is obtained by removing 0
or more trailing symbols of w. For example; w = abcd s = abc is prefix
of w,
Substring
• A string s is called substring of a string w if it is obtained by removing
0 or more leading or trailing symbols in w. It is proper substring of w if
s ≠ w.
• If s is a string then Substr (s, i, j) is substring of s beginning at ith
position & ending at jth position both inclusive.
Problem
• A problem is the question of deciding whether a given string is a
member of some particular language.
• In other words, if ∑ is an alphabet & L is a language over ∑, then
problem is
• Given a string w in ∑*, decide whether or not w is in L.
Tutorial 0

1. If S is the set {a, b, c}, then its powerset is


2. Construct a graph with five vertices, ten edges, and no cycles.
3. Give the languages in the form of set L = {anbn : n ≥ 0}
4. How many substrings aab are in wwRw, where w = aabbab?
5. Let L = {ab, aa, baa}. Which of the following strings are in L*:
abaabaaabaa, aaaabaaaa, baaaaabaaaab, baaaaabaa?
6. Find languages for Σ = {a, b} that generate the sets of
(a) all strings with exactly two a’s.
(b) all strings with at least two a’s.
(c) all strings with no more than three a’s.
(d) all strings with at least three a’s.
(e) all strings that start with a and end with b.
(f) all strings with an even number of b’s.

1. 2.
Chomsky Hierarchy
Application of automata in compiler construction

In automata theory, the main focus is on the study of automata, which are
mathematical models of computation. These automata are used to describe and
analyze various computational processes, such as the behavior of computer
programs and the recognition of patterns in text or other data.

There are several types of automata, including finite automata, pushdown


automata, and Turing machines. Each type of automaton has its own unique set
of features and capabilities, and each can be used to model different types of
computational processes.

Automata theory has many applications, including the design and analysis of
programming languages, the development of compilers and interpreters, the
construction of efficient algorithms for problem-solving, and the analysis of
natural language processing and machine learning. It is a fundamental area of
study for computer science and is essential for the development of modern
computer systems.
Application of automata in compiler construction

Finite Automata
a. Recognizing patterns in text or other data
b. Implementing regular expressions in programming languages
c. Validating input in form fields on websites
d. Modeling digital circuits and switching systems
e. Designing and analyzing computer algorithms and programs
f. Building compilers and interpreters
g. Analyzing the behavior of software and hardware systems
h. Verifying the correctness of software and hardware systems
i. Developing language models and machine learning algorithms
j. Studying formal languages and their properties
https://www.tutorialspoint.com/compiler_design/compile
r_design_syntax_analysis.htm

https://www.javatpoint.com/application-of-different-automata-theory-of-
computation#:~:text=Automata%20theory%20has%20many%20applications,language
%20processing%20and%20machine%20learning.
Thank You

You might also like