You are on page 1of 25

CT-4212

Theory of Automata and Computation

Awot D., Defence University, College of


Engineering

Department of Computer and Information Technology

May 10, 2020

Awot D., Defence University, College of Engineering 1 / 25


Week 1

Chapter 1
Automata

Awot D., Defence University, College of Engineering 2 / 25


Introduction to Theory of Computation
 Theory of Computation/Automata is one of the
fundamental courses of Computer science.
 Theory of Computation tries to answer the following
Questions:-
What are the mathematical properties of computer
hardware and software?
What is a computation and what is an algorithm? Can
we give rigorous mathematical denitions of these
notions?
What are the limitations of computers? Can everything
be computed? (As we will see, the answer to this
question is no.)
 Purpose of the Theory of Computation: Develop
formal mathematical models of computation that reect
real-world computers.

Awot D., Defence University, College of Engineering 3 / 25


Introduction to Theory of Computation. . .

♠ It is mainly about what king of things can you really


compute mechanically, how fast and how much space does it
take to do so.
Example:
1. assume you want to design a machine that accepts all
binary strings that ends with one.
Binary string-ends1
01100101001>computer/machine scans last bit and
decide whether to accept or reject the string.
2. assume you want to design a machine that accepts all valid
java codes
codes->Binary equivalent->valid or not?
such machines are called compilers.
♠ The whole idea of compiler design, it came from the theory
of computation/automata.

Awot D., Defence University, College of Engineering 4 / 25


Complexity theory

♦ The main question asked in this area is What makes some


problems computationally hard and other problems easy?
♦ Informally, a problem is called easy, if it is eciently
solvable.
♦ Examples of easy problems are
1 sorting a sequence of, say, 1,000,000 numbers,
2 searching for a name in a telephone directory
3 computing the fastest way to drive from adama to Adiss
ababa
4 and so on...
♦ On the other hand, a problem is called hard, if it cannot
be solved eciently,or if we don't know whether it can be
solved eciently.
Example:
1 computing a layout for chips in VLSI.
2 large digit random number generating....
Awot D., Defence University, College of Engineering 5 / 25
Automata theory

♠ Automata Theory deals with denitions and properties of


dierent types of computation models. Examples of such
models are:

♦ Finite Automata- These are used in text processing,


compilers, and hardware design.

♦ Context-Free Grammars- These are used to dene


programming languages and in Articial Intelligence.

♦ Turing Machines- These form a simple abstract model


of a real computer, such as your PC at home.

Awot D., Defence University, College of Engineering 6 / 25


what is the course all about

♠ This course is about the fundamental capabilities and


limitations of computers. These topics form the core of
computer science.
♠ It is about mathematical properties of computer hardware
and software.
♠ This theory is very much relevant to practice, for
example, in the design of new programming languages ,
compilers, string searching, pattern matching, computer
security, articial intelligence, etc., etc.
♠ This course helps you to learn problem solving skills.
Theory teaches you how to think, prove, argue, solve
problems, express, and abstract.
♠ This theory simplies the complex computers to an
abstract and simple mathematical model, and helps you
to understand them better.

Awot D., Defence University, College of Engineering 7 / 25
what is the course all about...

♠ This course is about rigorously analyzing capabilities and


limitations of systems.
in general....
 we are going to design a systems or machines that accepts
input and the machine should decide whether to accept or
reject the inputs based on some rules or criteria's.

Awot D., Defence University, College of Engineering 8 / 25


Mathematical preliminaries

♦ Throughout this course, we will assume that you know the


following mathematical concepts:
♠ A set is a collection of well-dened objects.
Example: the collection of three numbers 1,2 and 3 is a
set which can be written as:
S = {1,2,3}
♠ The set of natural numbers is N = {1, 2, 3, . . .}
♠ The set of integers is Z = {. . . ,3,2,1, 0, 1, 2, 3, . . .}
♠ The set of rational numbers is Q = {m/n : m 2 Z, n 2 Z,
n 6= 0}.
♠ If A and B are sets, then A is a subset of B, written as A
⊆ B, if every element of A is also an element of B. For
example, the set of even natural numbers is a subset of
the set of all natural numbers. Every set A is a subset of
itself, i.e., A ⊆ A. The empty set is a subset of every set
A, i.e., ∅⊆ A.
Awot D., Defence University, College of Engineering 9 / 25
Mathematical preliminaries

♠ If A and B are two sets, then


1 their union is dened as A ∪ B = {x : x ∈ A or x ∈ B},
2 their intersection is A ∩ B = x : x ∈ A and x ∈ B,
3 their di. is A \ B = x : x ∈ A and x ∈
/ B,
4 the Cartesian product of A and B is
A B = (x, y) : x ∈ A and y ∈ B,
5 the complement of A is dened as Ā = {x : x ∈
/ A}.
6 A graph G = (V,E) is a pair consisting of a set V , whose
elements are called vertices, and a set E, where each
element of E is a pair of distinct vertices. The elements
of E are called edges. The gure below shows some
well-known graphs: K5 (the complete graph on ve
vertices), K3,3 (the complete bipartite graph on 2 3 = 6
vertices), and the Peterson graph.

Awot D., Defence University, College of Engineering 10 / 25


Mathematical preliminaries

Awot D., Defence University, College of Engineering 11 / 25


Mathematical preliminaries...

The degree of a vertex v, denoted by deg(v), is dened to


be the number of edges that are incident on v.

A path in a graph is a sequence of vertices that are


connected by edges.

A path is a cycle, if it starts and ends at the same vertex.

A simple path is a path without any repeated vertices.

A graph is connected, if there is a path between every


pair of vertices.

Awot D., Defence University, College of Engineering 12 / 25


introduction to Formal proof

† In mathematics, a theorem is a statement that is true. A


proof is a sequence of mathematical statements that form an
argument to show that a theorem is true. †The statements in
the proof of a theorem include

• axioms (assumptions about the underlying mathematical


structures)

• hypotheses of the theorem to be proved, and previously


proved theorems

 How do we go about proving theorems?


• There is no specied way of coming up with a proof, but
there are some generic strategies that could be of help.

Awot D., Defence University, College of Engineering 13 / 25


Proof Techniques

1 Deductive Proof
♠ A Deductive proof consists of a sequence of statements
whose truth leads us from some initial statement, called the
hyphotesis or the given statement, to a conclution statement .
♠ Each step in the proof must follow, by some accepting
logical principle, from either the given fact, or some of the
previous statements in the deductive proof, or a combination
of these.
the hypothesis maybe true or false
the statement that is proved when we go from hypothesis
H to a conclution Cis the statement "if H then C"
we say that C is deduced from H.

Awot D., Defence University, College of Engineering 14 / 25


Deductive Proof...

† Theorem 1.1 if x ≥ 4, then 2x ≥ x 2


 notice that the hypothesis H is "x ≥ 4". this H has a
parameter x and it is neither true nor false. Rather,it is true
depending on the value of x.
 Likewise the conclusion C "2
x
≥ x 2" this statement also
uses a parameter x and is true for a certain value of x.
 perhaps you can see the intuitive argument tells us the
conclusion 2
x
≥ x 2 is true whenever x ≥ 4.
 we already saw that it is true for x = 4 as z grows larger
x
than 4, the left side 2 doubles each time x incremented by 1.
 how ever the right side x2 grows by the ratio ((x + 1)/x)2
 thus, as long as we start from a value like x = 4 where the
x 2
inequality 2 ≥ x is already satised, we can increase x as
much as we like and the inequality will still be satised.

Awot D., Defence University, College of Engineering 15 / 25


Deductive Proof...

† Theorem 1.2 is x is the sum of the squares of four positive


x 2
integers, then 2 ≥ x
♠ proof:
statements justication
2 2 2 2
1 x =a +b +c +d given
2 a > 1; b > 1; c > 1; d > 1 given
3 a2 > 1; b 2 > 1; c 2 > 1; d 2 > 1 (2) and property of arithmetic
4 x ≥4 (1), (3) and property of arth.
x 2
5 2 ≥ x (4) and theorem 1.1

Awot D., Defence University, College of Engineering 16 / 25


Proofs by induction

• This is a very powerful and important technique for proving


theorems. For each positive integer n, let P(n) be a
mathematical statement that depends on n. Assume we wish
to prove that P(n) is true for all positive integers n. A proof
by induction of such a statement is carried out as follows:
• Basis: Prove that P(1) is true.
• Induction step: Prove that for all n ≥ 1, the following
holds: If P(n) is true, then P(n + 1) is also true.
• In the induction step, we choose an arbitrary integer n≥1
and assume that P(n) is true; this is called the induction
hypothesis. Then we prove that P(n + 1) is also true.

Awot D., Defence University, College of Engineering 17 / 25


Proofs by induction

♦ prove that 1 + 3 + 5 + − − − + ( 2n − 1) = n 2 for all


positive integers.
Let Pn be the statement
1+ 3 + 5 + − − − + ( 2n − 1) = n 2 .
2
P1 is true because (2(1) − 1) = 1 .
Assume that Pk is true, so that Pk:
1 + 3 + 5 + − − − − − − +(2k − 1) = k 2 .
The Inductive Hypothesis.
The next term on the left hand side would be
[2(k + 1) − 1] = (2k + 1). Add (2k + 1) on both sides to
Pk.]
1+ 3 + 5 + − − − + ( 2k − 1) + ( 2k + 1) =
k + (2k + 1) = (k + 1)2 = Pk + 1
2

♦ So, the equation is true for n = k + 1.


♦ Therefore, Pn is true for all positive integers, by
mathematical induction.
Awot D., Defence University, College of Engineering 18 / 25
Exercise

♦ Using mathematical induction to prove that


1 + 5 + 9 + − − − − − − +(4n − 3) = n(2n − 1) for all
positive integers.

Awot D., Defence University, College of Engineering 19 / 25


Basics of Automata Theory

(1) Symbol: anything like 1,2,3....,@, , ∗, ,.... a,b,c,....


(2) Alphabet:An alphabet is a nite, non empty set of symbols
P
denoted as .
P
 = {0,1} the Binary alphabet
P
 = {a,b,c,.....z} the set of all lower case letters
P
 = {a,b} ,{0,1,2,3}, {a,1,b,0}

(3) String: A string over an alphabet is a nite sequence of


symbols from that alphabet, which is usually written next to
one another and not separated by commas.
P
 If
P a = {0,1} then 1001 is a string over the alphabet

a .
P P
 If b = {a, b,... z} then axyrpqstcd is a string over b .

Awot D., Defence University, College of Engineering 20 / 25


Basics of Automata Theory

♠ Concatenation of a string
† let x and y be a string. then xy denotes the concatenation of
x and y. that is the string formed by making a copy of x and
fellowing it by a copy of y.
† More precisely if x is a string composed of i symbols
x = a1 a2 ...ai and y is the string composed of y = b1 b2 ...bj
then xy is the string of length i+j: xy = a1 a2 ...ai b1 b2 ...bj
• Example: † let x = 01111 and y = 000
then xy = 01111000 and yx = 00001111

for any string w, ∈w = w∈=w hold.

i.e. ∈ is an identity for concatenation

Awot D., Defence University, College of Engineering 21 / 25


Basics of Automata Theory

(4) Length of String: The length of a string is its length as a


sequence. The length of a string w is written as |w|.
Example: |10011| = 5
(5) the empty string: the empty string is the string with zero
occurrence of symbols. this string, denoted as ∈, is a string
that maybe chosen from any alphabet whatever.
the length of empty string is zero. |∈| = 0
(6) Language: Any set of strings over an alphabet S is called a
language.
exmaple let the given alphabet is {a,b}
P
i.e. = {a,b}
from the given alphabet, we can drive the following language

Awot D., Defence University, College of Engineering 22 / 25


Basics of Automata Theory

♠ L1 = set of all strings of length 2


= {aa,ab,bb,ba}
♠ L2 = set of all strings of length 3 over {a,b}
= {aaa,aab,aba,abb,baa,bab,bba,bbb}
♠ L2 = set of all strings that begins with a
= {a,aa,ab,aaa,aab,aba,....}
 L1 and L2 → nite sets → nite Language
 L3 → is innite set → innite Languages
♠ Cardinality - the number of elements in the set can be
determined as
Pn n
= 2

Awot D., Defence University, College of Engineering 23 / 25


P
Powers of sigma
P
 assume you have the alphabet = {0,1}
P0
♦ = set of all strings of length 0 over {0,1}
= {∈}
P1
♦ = set of all strings of length 1
= {0,1}
P2
♦ = set of all strings of length 2
= {00,01,10,11}
P3
♦ = set of all strings of length 3
= {000,001,010,011,100,101,110,111}
Pn
♦ = set of all strings of length n
P∗ P0 P1 P2 P3
♦ = ∪ ∪ ∪ ∪...
= set of all possible strings of all length over the
alphabet {0,1}
= this set is innite

Awot D., Defence University, College of Engineering 24 / 25


Levels of the subject

Awot D., Defence University, College of Engineering 25 / 25

You might also like