Lecture 2 Algorithm
Lecture 2 Algorithm
Constructive Objects.
What objects are given as input to an algorithm, and what objects are produced as output during
the computational process?
The simplest example of a constructive object is words composed of a given alphabet. Suppose a
finite set A = {a, b, c, ...} is given. Let us call this set an alphabet. The elements of A are letters
and words. We may also consider countable alphabets, where the letters could be, for example,
a1, b’, etc.
where the sequence consists of letters from the given alphabet. If n ≥ 0 is a natural number, then
the length of word u is n. In algorithm theory, 0 is considered a natural number. Therefore, the
set of natural numbers is represented as:
N0 = {0, 1, 2, .....}.
Let us illustrate that the addition of two natural numbers is an algorithm that processes words.
Suppose the input of the algorithm is the word P = 12+24 of length 5. The output of the
algorithm is the word Q = 36. Both words P and Q are formed using the alphabet
A = {0,1,2,...,9,+}, which consists of 11 symbols, namely digits from 0 to 9 and the + sign. Thus,
the algorithm of the addition operation processes constructive objects, namely words in the
alphabet A.
Other examples of constructive objects include natural numbers written in any numeral system,
formulas in propositional calculus, and more. In school algebra, literal expressions are
considered; in higher algebra, matrices; in discrete mathematics, graphs; in computer science, a
program written in any programming language can be a constructive object.
10 12 5
A= 3 24 7
6 5 −3
A = [[10,12,5],[3,24,7],[6,5,-3]].
This representation of matrix A in the GAP computer system is intended for computations in
discrete mathematics.
A constructive object A can be constructed using sub-objects A1, A2, ..., which in turn consist of
smaller components B1, B2, ..., and so on. Ultimately, we reach the smallest components that
cannot be further divided. These symbols are immediately recognizable and form the alphabet of
words used to represent the examined objects in a linear form. The transformation of matrix A
into the linear word form A = [[10,12,5],[3,24,7],[6,5,-3]] follows this principle. Here, the parts
of the matrix are its rows, which, in turn, consist of smaller parts—the elements of the row. The
row elements are composed of symbols from the alphabet {0,1,2,...,9,-}.
Constructive objects can be described as words in a finite alphabet with a specific writing format.
Definition 2.1. A set A is computable if and only if its elements can be described as a non-
repeating infinite sequence:
For example, the set of integers Z is computable because it can be described as the sequence
0,1,-1,2,-2,3,-3, ...
5. If A is a finite alphabet and X is the set of words in this alphabet, then X is a computable
set.
If M is a set of infinite constructive objects and serves as an infinite set of input objects for an
algorithm, then M can be considered a set of words in an alphabet. According to Definition 2.2
(5), M is a computable set.
Algorithms and Functions. The exact definition of the algorithm proposed by George and
Klini, the algorithmic process is reduced to the calculation of the value of a certain function f in
the set of natural numbers N. Let us consider what this position is based on.
Suppose that we have some algorithm ℳ. The input of this algorithm is an object P consisting of
the data set u1,u2,...,un. Each ui - constructive object is a word of the alphabet A -. In the
alphabet A - words form a countable (countable) set and are numbered by natural numbers.
Therefore, each u - constructive object has a number x ϵ N. The operation of assigning such
numbers is called encoding of objects. The x-numbers assigned (assigned) to objects are called
their code numbers. Note that the determination of an object by number and a number by an
object is carried out with the help of algorithms. We will consider this topic in lecture 8.
code numbers x1,x2,...,xn. Suppose that the input of the algorithm ℳ is a string of constructive
During various calculations, instead of the constructive objects u1,u2,...,un, we can consider their
objects u1,u2,...,un, and the output of the algorithm is an object v with the number y. In this case,
after switching to code numbers, we can consider that the input of the algorithm is a string
(x1,x2,...,xn) consisting of n natural numbers, and the output is a number y ϵ N.
The ℳ -algorithm computes the n -dimensional function f(x1,x2,...,xn ) defined in the set N –
arguments (x1,x2,...,xn) corresponds to one value of the function, we get the following.
natural numbers.
From the above, it becomes clear why functions defined on the set of natural numbers are the
subject of discussion in the theory of algorithms.
Partial functions. When considering the above, it is necessary to take into account the following
the output as a result of processing. Therefore, the f - function calculated by the algorithm ℳ is
facts. The object P given to the input of the algorithm does not always turn into an object Q at
not always defined for all arguments. Therefore, the concept of a partial function arises. Suppose
that n ϵ N.
Definition 2.1. By an n -dimensional partial f - function defined on the set of natural numbers,
we mean a rule that assigns to a certain set (x1,x2,...,xn ) natural numbers of the same amount
f( x1,x2,...,xn )∈ N.
Thus, the function f(x1,x2,...,xn ) may not have a value. The values of the set X (x1,x2,...,xn )
where the values of the function are determined are called the domain of the function f and are
denoted as Dom(f). The values that the function f takes are called the range of the function and
are denoted as Ran(f). The nth degree of the set of rows (x1,x2,...,xn ) is called N n and is denoted
as Nn. Here xi N and i=1,2,,...,n. According to what was said
Then
Definition 2.2. If there is an algorithm ℳ that can compute the f -function, then
value of the function must also be a natural number.
2. If the input of the algorithm ℳ is given arguments that do not belong to the
result f( x1,x2,...,xn ).
domain of the function f – then the algorithm will either run infinitely or
will finish without giving any result.
The concept of a computable function is based on the intuitively defined concept of
an algorithm and does not yet have a precise definition. Therefore, the following
statement is true. The concept of a computable function is intuitive and does not
have a precise definition.
In the following lectures, the intuitive concept of computable functions will be
contrasted with the mathematically defined concept of a partially recursive
function.
INTUITIVE DEFINITION OF THE CONCEPT OF ALGORITHM AND ITS
PROPERTIES
Even in ancient times, in Egypt and Greece, problems were solved using
various calculation rules. Here, problems were solved by applying precisely
defined operations to the initial data. Finding an algorithm for solving a certain
class of problems is one of the main goals of mathematics. For example, any
algebraic equation of degree k has no more than k distinct roots. Here, the problem
arises of creating an algorithm that would make it possible to solve the problems of
determining the number of roots of an algebraic equation, whether it is repeated or
not, and determining the roots of the solution with a certain accuracy.
We know that in algebra, the Sturm rule was found for determining the real
roots of an algebraic equation, and the Lobachevsky algorithm for determining
these roots.
The history of the emergence of the algorithm is very ancient. Thus, in the
9th century, an Uzbek mathematician first discovered the rule for performing four
mathematical operations. The Greeks called this rule an algorithm, and the
Europeans called it an algorithm. If we generalize, the algorithm can be defined as
follows.