1 Introduction

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 18

KINGDOM OF SAUDI ARABIA

Ministry of Higher Education


Northern Borders University
College of Science and Arts
Department of Computer Sciences and Information
Technology

Theory of Computation

instructor :Ammar Mohammed Ali


introduction

 Two main parts of Theory

Computability Theory

What are the fundamental capabilities and limitations of


? computers ? What can(not) computers solve

Complexity Theory

? What can be solved given limited resources of time and space

2 Theory of Computation, 5105232, Semester 1


introduction
 Mathematics is the language of science, it is certainly the
language of the theory of computation.

 The mathematics employed in the theory of computation


is different from mathematics used in other applied
disciplines .

 The language of mathematics deals with:


 Sets.
 Statements about objects and the relations between them.
 Alphabets and language.
3 Theory of Computation, 5105232, Semester 1
Mathematical Notions and Terminology
 Sets : Set, element, subset, proper subset, power set, infinite set,
natural numbers, integers, empty set, union of sets, intersection of
sets, complement of a set, Venn diagrams.

 Functions and Relations : Function (mapping), domain, range, onto


function, arguments of a function, unary function, binary function,
infix notation, prefix notation, predicate ( property), relation, binary
relation, equivalence relation (reflexive, symmetric and transitive).

4 Theory of Computation, 5105232, Semester 1


Mathematical Notions and Terminology
 Graphs : Undirected graph, nodes ,edges, degree of a node, labeled
graph, subgraph, path, simple path, connected graph, cycle, simple
cycle, tree, root of a tree, leaves of a tree, directed graph, outdegree,
indegree, directed path, strongly connected graph.

 Boolean Logic : Boolean logic, boolean values (True and False),


boolean operations, negation (NOT), conjunction (AND), disjunction
(OR), operands of an operation, exclusive OR (XOR), equality,
implication, distributive law.

 Strings and Languages : Alphabet, symbols of alphabet, string over


an alphabet, length of a string, empty string, reverse of a string,
substring, concatenation, language,

5 Theory of Computation, 5105232, Semester 1


Alphabets and language

 In computational practice, data are encoded as strings of


bits or other symbols appropriate for manipulation by a
computer.

 Therefore the theory of computation begin by


understanding the mathematics of strings of symbols.

6 Theory of Computation, 5105232, Semester 1


Alphabets and language
Alphabets:

a finite set of symbols. We denote it by ∑. For example:


∑ 1= { a, b, c, d, …, z } : the set of (lowercase) letters in
English
∑ 2 = { 0, 1, …, 9 } : the set of (base 10) digits.
∑ 3 = {0,1} binary alphabet

7 Theory of Computation, 5105232, Semester 1


Alphabets and language
 Power of an alphabets
If ∑ is an alphabet , we can express the set of all strings of a
certain length from that alphabet by using an exponential
notation, denoted by ∑k

 Forexample if = {0 ,1} then:


}1 , 0{ =1 ∑
}11 ,10 , 01 ,00{ =2 ∑
}..……{ =3 ∑

8 Theory of Computation, 5105232, Semester 1


Alphabets and language

String:

 A string over alphabet ∑ is a finite sequence of symbols in ∑. For


example: the strings over the alphabet {a, b} are: a, baa, aab and
aabba

 Strings are usually denoted using the letters from the ending portion in
English alphabet, for example, s, t, u, v, w, x, y, z etc.

 The length of a string x over ∑ is the number of symbols in the string,


and we denote this number by |x|. For example,:
|a| = 1, |baa| = |aab| = 3 and |aabba| = 5.

9 Theory of Computation, 5105232, Semester 1


Alphabets and language

 The null string or empty string


 Is the string of length 0. We denote it by (epsilon), or λ
(lowercase Greek Lambda), or Λ (uppercase Greek
Lambda).

For any alphabet S, the set of all strings over ∑ is



denoted by ∑ *.For example, for ∑ = {a, b}, we have
∑ * = {a, b}* = { , a, b, aa, ab, bb, ba, aaa, aab, aba,
…}

10 Theory of Computation, 5105232, Semester 1


Alphabets and language
 Concatenation
 Two strings over the same alphabet can be combined
to form a third string.

 If x and y are elements of ∑ *, the concatenation of x and


y is the string xy formed by writing the symbols of x and
the symbols of y consecutively. Formally w = x о y For
example:
if x = abb and y = ba, then
w (xy) = x о y = abbba
w (yx) = y о x = baabb.
11 Theory of Computation, 5105232, Semester 1
Alphabets and language
 Substring
 A string v is a substring of another string w if and only
if there are strings x and y (either or both of which may be
null), such that w = xvy.

 A prefix of a string is an initial substring. For example,


the prefixes of aba are ɛ (which is a prefix of ever
string), a, ab and aba.

 A suffix is a final substring

12 Theory of Computation, 5105232, Semester 1


Alphabets and language
Language:
 Any set of strings over an alphabet .Languages are usually
denoted by L.

 A few examples of languages over ∑ are:


L1 = { , a, b, aa, ab, bb, ba}
*L2 = { ab, bab }* U { b }{ bb }
L3 = { x {a, b}* | |x| ≤ 10}
L4 = { x {a, b}* | |x| is odd}

13 Theory of Computation, 5105232, Semester 1


Alphabets and language
 ∑ * is a language for any alphabet ∑ .

 , the empty or null language, is a language over any alphabet. A null


language means that there is no string in that language.

 {}, the language consisting of only the empty string, is also a


language over any alphabet.

 Note that ≠ {}; the former has no strings and the latter has one string.

 As the set of all strings over ∑ is ∑ *, therefore, a language over ∑ is


a subset of ∑ *. That is,: L Í ∑ *

 The only important constraint on what can be a language is that all


alphabets are finite.
14 Theory of Computation, 5105232, Semester 1
Alphabets and language
 Languages are sets, and so one way of constructing new
languages from existing ones is to use set operations.
• Union
• Intersection
• Difference

 For two languages L1 and L2 over the alphabet ∑,


L1 ∪ L2, L1 ∩ L2, and L1 − L2 are also languages over ∑.

If L ⊆ ∑*, then by the complement of L we will mean


∑*−L
15 Theory of Computation, 5105232, Semester 1
Alphabets and language
 Concatenation of language:

If L1 and L2 are language over ∑ , their concatenation is


L = L1о L2 (L = L1L2), where
L = {w ∑* : w = x о y for some x L1 and y L2}

 For example, if ∑ = {0, 1 } , L1 = {w ∑*: w has an even number of


0’s} ,L2 = {w : w starts with a 0 the rest of the symbols are 1’s} ,
then :
L1 L2 ={ w : w has an odd number of 0’s}

 Concatenation is an associative operation; that is, (xy)z = x(yz), for


all possible strings x, y, and z.
16 Theory of Computation, 5105232, Semester 1
Alphabets and language
 For any language L, we define L n as follows:
L 0 = {},
L n+1 = L nL.
 Kleene ∗-closure :
 Is a unary operation, either on sets of strings or on sets of symbols or
characters.
 Instring is the set of all strings obtained by concatenating zero or more
strings from L, denoted by L*
L* = {w ∑* : w = w1 о w2 о...о wk for some k ≥ 0 and some w1 ,w2,.. wk L}

 For example, if L = {01 , 1 , 100} then 110001110011 L*


L∗=L0∪L1∪L2∪...∪Ln∪....

17 Theory of Computation, 5105232, Semester 1


Alphabets and language

 The Kleene +-closure:


L + of L is the infinite union, L + = L 1 ∪ L 2 ∪ . . . ∪ L n
∪..

18 Theory of Computation, 5105232, Semester 1

You might also like