A concise introduction to Computer Science

S. E. Venegas-Andraca
Quantum Information Processing Group
Tecnológico de Monterrey - Escuela de Ciencias e Ingeniería
http://www.mindsofmexico.org/sva
salvador.venegas-andraca@keble.oxon.org
August 2015

1

Introduction

The Theory of Computation is a scientific field devoted to understanding the
fundamental capabilities and limitations of computers, and it is divided into
three areas:
1. Automata Theory. The study of different models of computation.
2. Computability Theory. This focuses on determining which problems can
be solved by computers and which cannot.
3. Complexity Theory. The objective in this area is to understand what
makes some problems computationally hard and others easy.
The development and analysis of algorithms starts with defining a problem in proper mathematical jargon, followed by choosing a model of computation upon which we first determine whether such a problem is solvable, in
principle, by implementing a series of steps in the model of computation we
have adopted. If that were the case, then the last step would be to quantify
the amount of resources needed to execute the algorithm.
In the following lines we present a very concise introduction to the concepts and ideas in computer science that lead us to consider the use of stochastic and quantum mechanical processes for algorithm development.
This introduction to theoretical computer science is mainly based on [2],
[3], and [1].

1

a theory designed to be applied only to decision problems. The Traveling Salesman Problem (decision problem version) INSTANCE: A finite set C = {c1 .1. that is. the set of natural numbers. cΠ(1) ) is minimum? Definition 2. Definition 2. . cj ) ∈ N. it suffices to execute a polynomial time algorithm to determine whether the decision-problem version of TSP can be satisfied or not. . .2. . cΠ(m) ] of C such that P [ m−1 i=1 d(cΠ(i) . For example. if we know the shortest tour of all cities. that is. . Formally speaking. cm } of “cities” and a “distance” d(ci . . QUESTION: Which is the shortest “tour” of all the cities in C. cΠ(i+1) )] + d(cΠ(m) . . for an arbitrary threshold B. cΠ(m) ] of C such that [ i=1 d(cΠ(i) .e. . an ordering [cΠ(1) . Pm−1 an ordering [cΠ(1) . so long as the cost function is relatively easy to evaluate. cΠ(2) . encoding schemes and languages Central to the use of sophisticated mathematical structures and physical theories in the creation of algorithms is the concept of NP-completeness. cΠ(i+1) )] + d(cΠ(m) . c2 . . . . cΠ(1) ) ≤ B? Notes: 1) The key point to observe about this optimization-decision problems correspondence is that. 2 . c2 . If we were able to find the shortest tour of all cities then we could easily use that minimum cost in order to determine whether it is possible to satisfy the inequality of the decision-problem version of TSP.000 cities all connected (i. QUESTION: Is there a “tour” of all the cities in C having total length no more than B. the decision problem can be no harder than the corresponding optimization problem. suppose we have an instance of the TSP composed of 10. The Traveling Salesman Problem (optimization version) INSTANCE: A finite set C = {c1 . cj ) ∈ N and a bound B ∈ N. . the system can be represented by a fully connected undirected graph). .. cm } of “cities” a “distance” d(ci . Let us briefly review what a decision problem is by using a primus inter pares example: The Traveling Salesman Problem. cΠ(2) . .2 Decision problems.

Alphabet. Optimization problems are members of a set known as NP-Hard problems. 2) For any alphabet Σ. 3) A word of caution: The previous words do not mean that optimization problems are NOT amenable to computer analysis. a most interesting topic we shall address shortly as soon as we understand the fundamentals of NP-completeness. This counterpart is called a language. The correspondence between decision problems and languages is brought about by the encoding schemes we use for specifying problem instances whenever we intend to compute with them. This third class of strings is the language we associate with Π and e: Definition 2. Language for problem Π under encoding e.5. 3 . 1) Any finite set of symbols Σ is an alphabet. if a result holds for the language L(Π. An encoding scheme e for a problem Π provides a way for describing each instance of Π by an appropriate string of symbols over some fixed alphabet Σ. Thus the problem Π and the encoding scheme e for Π partition Σ∗ into three classes of strings: those that are not encodings for instances of Π. Definition 2.e)= { x ∈ Σ∗ | Σ is the alphabet used by e.4. Definition 2. which is a suitable object to study in a mathematically precise theory of computation.e) ⇒ it also holds for the problem Π under the encoding scheme e.2) The reason for the restriction to decision problems is that they have a very natural formal counterpart. and those that encode instances of Π for which the answer is ‘yes’. Encoding scheme. In fact. those that encode instances of Π for which the answer is ‘no’. we denote by Σ∗ the set of all finite strings of symbols from Σ. L(Π.3. optimization problems are very well placed at the heart of state-of-the-art applications of computer science. and x is the encoding under e of an instance I ∈ YΠ } Our formal theory is applied to decision problems by saying that.

we are assuming we have a computer. When every step of a computation follows in a unique way from the preceding step we are doing deterministic computation. However. i. (1). Non determinism is a generalization of determinism. a set of steps executed in a computer. Consequently. we must define a computer. before delivering such a definition. After reading input symbol i. Every branching point in the tree corresponds to a point in the computation at which the machine has multiple choices. being that a preliminary step towards the definition of an algorithm.e.e. that copy of the machine dies. prior to the definition of an algorithm. i.3 Models of computation So far we have formally defined what a language is. 4 . let us make a quick reflection: when we think of an algorithm. In a nondeterministic machine. If the next input symbol does not appear on any of the arrows exiting the state occupied by a copy of the machine. 3. The machine accepts if at least one of the computation branches ends in an accept state. How does a nondeterministic machine (NM) compute? Suppose that we are running an NM on input symbol i and come to a qi state with multiple states to proceed. the machine splits into multiple copies of itself and follows all the possibilities in parallel. several choices may exist for the next state at any point. it is possible to define two variants: deterministic and nondeterministic versions. a physical machine or a mathematical model upon which we may be able to execute such steps.1 Deterministic vs Nondeterministic models of computation For every single mathematical model of a computer machine. along with the branch of the computation associated with it. The root of the tree corresponds to the start of the computation. the machine splits again. A graphical illustration of a nondeterministic computation is given in Fig. If there are subsequent choices. Another way to think of a nondeterministic computation is as a tree of possibilities. Each copy of the machine takes one of the possible ways to proceed and continues as before.

can do everything a real computer can do (more on this in the following subsection.erase. . a nondeterministic computer machine makes n copies of itself. every single step is fully determined by the previous step. one square at a time. . one for each possibility. The scanner is able to examine only one square of tape at a time (the ‘scanned square’). . The scanner has mechanisms that enable it to erase the symbol on the scanned square. 3.. The operations just described . for example). pictured schematically in Fig.Deterministic Computation 000 000 111 Start 111 0 1 000 111 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 00 11 00 11 0 1 00 11 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 00 11 00 11 00 11 0 1 0 1 0 1 0 1 0 1 0 1 .2 Deterministic Turing Machines A Deterministic Turing Machine (DTM) is an accurate model of a general purpose computer. equivalently. a step may be followed by n new steps or. (2). . Complexity of operation is achieved by chaining together large numbers of these simple basic operations. The tape is divided into squares. move. . and the scanner is able to alter the state of this device whenever necessary. the scanner is able to alter the state of the machine: a device within the scanner is capable of adopting a number of different states. print. . and change state .are the basic operations of a DTM. . In nondeterministic computation. A DTM. 0 1 0 1 0 1 0 1 111 000 0 1 000 111 000 111 000 111 00 11 11 00 11 00 11 00 00 11 00 11 00 11 00 11 000 111 000 00 111 11 00 11 000 111 000 111 000 000 111 Accept 111 000 111 000 111 .) A DTM consists of a scanner and a limitless memory-tape that moves back and forth past the scanner. Accept 00 11 00 11 00 11 00 11 1111 0000 000 111 0 1 0000 1111 000 111 0 1 0000 1111 000 111 0 1 0000 1111 000 111 0 1 0000 1111 000 0 111 1 0000 1111 000 111 0 1 00 11 000 111 00 11 00 11 000 111 00 00 111 11 000 11 00 11 Figure 1: In deterministic computation.1 0 Accept or Reject 1 0 0 1 0 1 0 1 00 11 0 1 00 11 00 11 00 11 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 00 11 00 11 00 11 Reject Non−deterministic Computation 00 11 00 11 00 11 111111 000000 00000000 11111111 0 1 00 11 000000 111111 00000000 11111111 0 1 000000 111111 00000000 011111111 1 000000 111111 00000000 11111111 0 1 000000 111111 00000000 11111111 0 1 000000 111111 00000000 11111111 000 111 000 111 00 11 0 1 000000 111111 000 111 000 111 00 11 000 111 00000000 11111111 0 1 000 111 00 11 00000 11111 0 1 000 111 000 111 00 11 000 111 00000000 11111111 0 1 000 111 00 11 00000 11111 0 1 000 111 00000000 11111111 0 1 000 111 00 11 00000 11111 0 1 000 111 00000000 11111111 0 1 000 111 00 11 00000 11111 0 1 000 1 111 00000000 11111111 0 000 111 00 11 00000 11111 0 1 000 111 00 11 00000000 11111111 0 000 111 00 11 000 111 000 111 00 11 00000 11111 0 1 000 1 111 000 111 00 11 11 00 11 00000000 11111111 00 11 00 000 111 000 111 00 11 000 111 00 11 00 11 00 11 000 111 000 111 00 11 000 111 00 111 11 00 11 00 11 000 111 000 00 11 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 00 11 00 11 Reject 00 11 . 5 . Also. Each square may be blank (t) or may bear a single symbol (0 or 1. and to move the tape to the left or right. .

1. qreject ).. 3. If neither occurs. Definition 3. Σ. R} is the transition function. Let M = (Q. Γ. the computation proceeds according to the rules described by δ. Γ is the tape alphabet.. Γ are all finite sets and 1. qreject ∈ Q is the reject state. Q is the set of states 2. so the first blank appearing on the tape marks the end of the input. q0 ∈ Q is the start state.. where Q. 5. and the rest of the tape is filled with blank symbols. Γ.2.Finite State Control Read−Write Head 00000000000000000000000000000000000000 11111111111111111111111111111111111111 111111 000000 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 11111111111111111111111111111111111111 00000000000000000000000000000000000000 111111 000000 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 . qreject ) be a DTM. The head starts on the leftmost square of the tape (Σ does not contain the blank symbol. . The computation continues until it enters either the accept or reject states at which point it halts.) Once M has started. −3 −2 −1 0 1 2 3 Figure 2: The ‘hardware’ elements of a Deterministic Turing Machine (DTM) are a scanner (read-write head plus a finite state control system) and a limitless memory-tape (the tape is divided into squares or cells). δ. 6 . and 7. Definition 3. The scanner reads and writes information on the cells of the tape and controls the state of the DTM. where t ∈ Γ and Σ ⊂ Γ 4. δ. Σ is the input alphabet not containing the blank symbol t. Deterministic Turing Machine.. q0 . Σ. qaccept . M just does not stop. Σ. qaccept ∈ Q is the accept state. 6. Initially M receives its input w ∈ Σ∗ on the leftmost n squares of the tape. δ : Q × Γ → Q × Γ × {L. A Deterministic Turing Machine (DTM) is a 7-tuple M = (Q. where qaccept 6= qreject . qaccept . q0 . Computation with a Deterministic Turing Machine.

provided in Table 1. i. t. . where 1. L) (q3 . A configuration C1 yields configuration C2 if the Turing machine can legally go from C1 to C2 in a single step. Example of 0 (q0 . q3 . C1 is the start configuration of M on input w. A is the set of all strings accepted by M . qreject } and δ. t. Table Q/Γ q0 q1 q2 q3 1. t. R) (q1 . Ck exists.e. t. L) (qreject . 2. C2 . L) (qreject . L) (qreject . t. Q = {q0 . q1 . equivalently. are two consecutive zeros. t} (t is the blank symbol).3 Example. t. L) 7 . qaccept . Accepting and rejecting configurations are halting configurations and do not yield further configurations. changes occur in the current state. L) a deterministic Turing machine. 1. A DTM M accepts input w if a sequence of configurations C1 . is used in a deterministic Turing machine M to determine whether a number can be divided by 4 or. A setting of these three items is called a configuration of the DTM. L) (qaccept . In an accepting configuration the state of the configuration is qaccept . whether the last two digits of a binary number. Running a program in a Deterministic Turing Machine The program specified by Γ = {0. In a rejecting configuration the state of the configuration is qreject . 3. and 3. q2 . . each Ci yields Ci+1 . 1. 1 t (q0 . L) (qreject . t. We say that M accepts language A if A = {w|M accepts w}.As a DTM computes. Ck is an accepting configuration. . and the current head location. reading from left to right. t. 0. t. L) (qreject . R) (q2 . the current tape contents. L) (qreject . t.

M must take q0 as new state.e. write the value 1 in the cell where its read-write head is now located (1) and take its read-write head one cell forward. t10100t → q0 . The transition function specifies that for a state q0 and input symbol 1. t1010 t t q2 . 0 and its tape reads as t 1 0 1 0 0 t . i. The full run Step 1: Step 2: Step 3: Step 4: Step 5: Step 6: Step 7: Step 8: of this program is given in the following sequence q0 . t10100t q0 . q3 } specified in the LHS column and a given alphabet symbol sj ∈ {0. t10100t . t10100t q1 . t1010bt → qy . So. t10100t → q0 . t10100t q0 . let X = 10100 be an input binary string (we shall read the input string from left to right). t10100t → q0 . The initial state of M is q0 and M ’s tape reads as t 1 0 1 0 0 t where our first input symbol (in bold face) is the leftmost 1. t10100t q0 . 1. t} specified in the top row. the second symbol is the new alphabet symbol that will be written in the current cell (substituting symbol si ) and the third symbol specifies the motion direction of the readwrite head. the box that corresponds to row qi and column sj and contains three symbols: the first symbol is the new state of M . For a state qi ∈ {q0 . to the right. 1. M is now in the configuration q0 .the initial configuration of M is q0 . t101 t tt 8 . row qi and column sj are the current configuration of M and the symbols contained in the box corresponding to row qi and column sj are the next configuration of M . t10100t → q0 . q1 . t10100t q0 .The program works as follows. q0 . t10100t → q2 . q2 . t10100t → q1 . t10100t → q0 . So. So. For example.

e. i. In [5]. 5) Explained the fundamental principle of the modern computer. a transducer T computes f if the computation T (w) reaches a final state containing f (w) as output whenever f (w) is defined (if f is not defined. are capable of those computations. If the Church-Turing thesis is correct. Given a function f . Turing: 1) Defined a systematic method.3. 4) Conjectured the Church-Turing Thesis. Transducer Machines.4 The Church-Turing Thesis Alan Turing published a most influential paper in 1936 [5] in which he pionereed the theory of computation. introducing the famous abstract computing machines now known as Turing Machines. T never reaches a final state). 6) Proved that not all precisely stated mathematical problems can be solved by computing machines (examples: the decision and the halting problems.) 9 . the idea of controlling the machine’s operation by means of a program of coded instructions stored in the computer’s memory. a powerful model of computation.We have said that DTMs can do everything a real computer can do. i. 3. Output y is stored in a special tape called the output tape. in which he established an equivalence correspondence between the existence of Turing machines and that of systematic methods. A function f is computable if a Turing Machine T exists capable of computing it. then the existence or non-existence of systematic methods can be replaced throughout mathematics by the existence or non-existence of Turing machines. a DTM variant. Definition 3.e. T has a string w ∈ Σ∗ as input and produces another string y as output. Transducer Machines. and real computers compute values of functions. 2) Provided a rigorous definition of a Turing machine. a Turing machine capable of simulating any other Turing machine (the Universal Turing Machine being the actual digital computer and the simulated Turing machine the program that has been encoded in the digital computer’s memory). 3) Proved that it was possible to build a particularly powerful machine called Universal Turing Machine (UTM) that could simulate any other Turing machine in reasonable time. A transducer machine T is used to compute functions. our modern definition of an algorithm.

Every function which would be naturally regarded as computable can be computed by the Universal Turing Machine. The Church-Turing principle [6]. Every finitely realizable physical system can be perfectly simulated by a universal model computing machine operating by finite means. and conversely”. What Turing did in [5] was to propose a mathematical formalism for the idealization of a human computer as well as to study the calculation capabilites and limitations of that mathematical model. rests upon a conjecture! This is one of the reasons for the tremendous philosophical and scientific relevance of David Deutsch’s formulation of the Church-Turing principle: 3. It is somewhat ironic. A computer was a mathematical assistant who calculated by rote. 2. 3. The UTM can perform any calculation that any human computer can carry out. Three ways to express the thesis are: 1. in accordance with a systematic method. a computer was not a machine at all. 10 . The method was supplied by an overseer prior to the calculation. The Church-Turing Thesis. For it would surely be hard to regard a function ‘naturally’ as computable if it could not be computed in Nature. 3. that the branch of S&T that is perceived by society at large as a very precise and quantitative discipline. Any systematic method can be carried out by the UTM. at least for me.No wonder why Alan Turing is such a big name! When Turing wrote [5]. In Deutsch’s words. the rationale behind the Church-Turing priciple was “to reinterpret Turing’s ‘functions which would be naturally regarded as computable’ as the functions which may in principle be computed by a real physical system.2. It is in that sense that Turing uses the word ‘computer’ in [5] and a Turing machine is an idealized version of this human computer.1. but a human being.

we focus on time) needed to find a solution to a problem is usually a complex process. the function F (n) = 18n6 + 8n5 − 3n4 + 4n2 − π has five terms. f (n) = O(g(n)) means informally that f grows as g or slower. and the highest order term is 18n6 . Big O notation says that one function is asymptotically no more than another. we use a form of estimation called Asymptotic Analysis in which we are interested in the maximum number of steps Sm that an algorithm must be run on large inputs. we then say that f is asymptotically at most n6 . we just estimate it. We do so by considering only the highest order term of the expression that quantifies Sm . Let f. Big O Notation. Bounds of the form nβ . g : N → R+ . To do so. g(n) is an asymptotic upper bound for f (n) (“f is of the order of g”). no ∈ N such that ∀ n ≥ no f (n) ≤ αg(n) So. The following definition formalises this idea. Since the quantification of resources (in our case. β > 0 are called polynomial bounds.5 Algorithmic Complexity for DTMs The performance of models of computation in the execution of an algorithm is a fundamental topic in the theory of computation. A warm-up: 1) Linear complexity 2) Quadratic complexity 11 . Prove the following statements: P 1) Pni=1 i = O(n2 ) 2) Pni=1 i2 = O(n3 ) 3) ni=1 3i = O(3n ) Example 2. and bounds γ of the form 2n . Since we disregard constant factors. We say that f (n) = O(g(n)) if ∃ α.3. For example. Definition 3. γ ∈ R+ are called exponential bounds.4. Example 1.

Class P. the largest amount of time needed by A to solve a problem instance of that size. The class of languages that are decidable in polynomial time on a deterministic single-tape Turing machine is denoted by P S and is defined as P = k TIME(nk ) As an example. for each input length.A DTM can be used to find a solution to a problem. Time Complexity Class for DTMs. what is the meaning of ‘elementary step’ in both a Turing machine and an algorithm? The central idea here is: for each algorithmic elementary step one has to perform a polynomial number of steps in a DTM. the language provided in subsection (3. Definition 3. Executing this algorithm under the rational of a DTM would be living hell! 12 . where f (n) is the maximum number of steps that M uses on any input of length n. as the collection of all languages that are decidable by an O(t(n)) time DTM. We define the time complexity class TIME(t(n)). Let us now introduce a few concepts needed to quantify the efficiency of an algorithm. we shall be interested in finding the fastest algorithms. What is the relationship between the algorithmic complexities introduced in example 2 and the formal definition of complexity in DTMs? In other words. A most important question to reflect on: 1.5.3) is in P. Let M be a DTM. The time complexity of an algorithm A expresses its time requirements by giving.Computational complexity of an algorithm that computes the multiplication of two matrices of order n by using the textbook definition.6. Time Complexity Function for a DTM. Definition 3. Let t : N → R+ be a function.7. so how efficiently such solution can be found? As stated previously. Example: . We define f : N → N as the time complexity function of M . Definition 3.

intractable algorithms are usually solutions obtained by exhaustion. 13 . Finding a tractable algorithm is usually the result of obtaining a deep mathematical insight into a problem. Factorial complexity. Tractable algorithms are considered as acceptable. intractable problems. All solutions proposed so far are based on enumerating all possible solutions. Example of tractable and ingenious algorithms.Computational complexity of an algorithm that computes the multiplication of two matrices of order n by using the textbook definition. O(n3 ). In contrast.A polynomial time or tractable algorithm is defined to be one whose time complexity function is O(p(n)) for some polynomial function p. .e.Computational complexity of 3SAT (formal definition in pages 18-19 of this document). So. It could be either that we need a deeper knowledge of the characteristics of this problem or.1) is known so far. However. and are not considered satisfactory solutions. simply. O(nlog2 7 ) Example of intractable algorithms. as a sign that a satisfactory solution for a problem has been found. Any algorithm whose time complexity function cannot be so bounded is called an exponential time or intractable algorithm. no tractable algorithm for the Traveling Salesman Problem (2. i.Strassen’s algorithm for matrix multiplication. where n is used to denote the input length. If n binary variables ⇒ 2n different n-bit strings! . . no proof for neither of these two alternatives has been supplied so far. the so called brute-force method. that the Traveling Salesman problem is inherently intractable. . Why is the Traveling Salesman problem intractable? Nobody knows for sure.Computational complexity for TSP.

For the sake of this discussion. We define the time complexity class NTIME(t(n)).9. Definition 3. 14 . If interested in the formal definition of such a computational beast. Let MN be an NTM. this computational equivalence does not mean that both models of computation spend the same amount of resources for solving the same problems. However. i. 3. you may want to look at my DPhil thesis (http://mindsofmexico. as the collection of all languages that are decidable by an O(t(n)) time nondeterministic Turing machine.8.e. as we shall see in the following section.org/sva/vitae. Definition 3. I just want to say that it is possible to prove that deterministic Turing machines and nondeterministic Turing machines are equivalent in computational power. Let t : N → R+ be a function. any problem a deterministic Turing machine can solve. We define g : N → N as the time complexity function of MN . where g(n) is the maximum number of steps that MN uses on any branch of its computation on any input length n.3.6 Nondeterministic Turing Machines (NTMs) It is indeed possible to define a nondeterministic version of a Turing machine.7 Algorithmic Complexity for NTMs We start by offering the definitions of time complexity function and time complexity class for NTMs. Time Complexity Class for NTMs. can also be solved by a nondeterministic Turing machine. Time Complexity Function for an NTM.html) as well as to the references provided therein.

where A = {w|V accepts (w. a practical problem with this definition is to find b as an NTM can have an infinite (or exponentially big) number of different branches. A language is in NP if and only if it is decided by a nondeterministic polynomial time Turing machine. We measure the time of a verifier only in terms of the length of w.10. The string c. Theorem 1. Definition 3. 15 . is additional information needed by the verifier.8 Verifiability and NP problems Let us suppose we have a proposed solution for the Traveling Salesman problem (2. Verifier.For an NTM to accept string w it is enough to find just one branch b in its computation tree that accepts w. Class NP. 3. A verifier for a language A is an algorithm V .11. a certificate. Therefore. while a verifier only checks whether a proposal is a solution or not. Note that a fundamental difference between an NTM and a verifier is that an NTM finds solutions. we could easily check whether such a proposal is indeed a solution. In this case. An important discovery in the theory of computation is the fact that the complexities of many problems are linked by means of a concept closely related to the definition of NP problems: verifiability. a more operational method for doing nondeterministic computation is needed. c) for some string c}. We now proceed to define a most important class of languages in Computer Science: Definition 3. What is the relation between the abstract model of an NTM and the concepts of verifiers and NP languages class? The answer is given in Theorem (1) and its proof can be found in [2]. all we need is a DTM that verifies whether the proposed solution is right or not. A language A is polynomially verifiable if it has a polynomial time verifier. The class of languages that have polynomial time verifiers is known as NP. However.2). so a polynomial time verifier runs in polynomial time in the length of w.

for some problems). However.e. with associated encoding schemes e1 and e2 . we are getting closer to the kind of problems for which we need both stochastic processes and quantum mechanics to tackle them. e1 ] to L[Π2 . we shall write Π1 ∝ Π2 (with respect to the given encoding schemes) whenever there exists a polynomial transformation from L[Π1 . we write L1 ∝ L2 and read ‘L1 transforms to L2 ’. 16 . it can be proved [3] that Theorem 2. Definition 5. such exponential upper bounds are not necessarily minimum upper bounds. It is known that P ⊂ NP as any polynomial language can be checked with a polynomial verifier. x ∈ L1 ⇒ f (x) ∈ L2 If there is a polynomial transformation from L1 to L2 . In some cases (i. e2 ]. 3) Due to theorem (2) there is a widespread belief that P 6= NP although ? no proof has been delivered and therefore P = NP remains an open problem. The key idea to understand NP-completeness is that of polynomial transformation.4 ? P = NP and NP-complete problems ? The problem P = NP is a fundamental topic in the theory of computation. If a problem ζ ∈ NP then ∃ a polynomial p such that ζ can be solved by a deterministic algorithm having time complexity O(2p(n) ). If Π1 and Π2 are decision problems. Also. A polynomial transformation from a language L1 ⊆ Σ∗1 to a language L2 ⊆ Σ∗2 is a function f : Σ∗1 → Σ∗2 that satisfies the following two conditions: 1) There is a polynomial time DTM that computes f 2) ∀ x ∈ Σ∗1 . 2) We are sure that some NP problems (those that are also P) are also solved by algorithms that have polynomial functions as upper bounds. 1) NP problems can all be solved by algorithms that have exponential functions as upper bounds.1. Therefore. 5 NP-completeness OK. we know whether those polynomial upper bounds are optimal.

Lemma 1. If B is NP-complete and B ∈ P . L has a polynomial time verifier or. polynomial equivalence and the previous lemma build an equivalence relation. for all other decision problems ζi ∈ NP we find that ζi ∝ ζ. Polynomially equivalent languages. when I learned Complexity Theory. A language L is NP-complete if 1) L ∈ NP. the following lemma and definition will provide the grounds for defining classes of problems. like The Beatles of Computer Science :) Theorem 3. also conform a class. B = O(p(n)) for some polynomial p(n) ⇒ P = NP. Definition 5. jewels of the crown. The following theorem could be the key. not only to get 1×106 USD in the pocket (http://www. If L1 ∝ L2 and L2 ∝ L3 ⇒ L1 ∝ L3 .org/millennium/).e. for any of us. whether L is decidable in polynomial time by a nondeterministic Turing machine. NP-Complete Languages and Problems.2. i. we can also say that a decision problem ζ is NPcomplete if ζ ∈ NP and.3. ∀ Li ∈ NP ∃ a polynomial transformation from Li to L. in practice. because that proof requires to build a polynomial transformation which takes an arbitrary NP problem and converts it into A. Fortunately for us computer scientists. The class P forms the equivalence class of the computationally easiest problems.claymath. there is an easier way to make this proof: 17 . but also to immortality. I found a bit difficult (and tiresome) to imagine how to prove.e. Let us formally define these lovely beasts. Two languages L1 and L2 (two decision problems Π1 and Π2 ) are polynomially equivalent whenever L1 ∝ L2 and L2 ∝ L1 (both Π1 ∝ Π2 and Π2 ∝ Π1 ) Together. the membership of a problem A to the NP-complete sphere.e. i. and 2) For all other languages Li ∈ NP ⇒ Li ∝ L.Now. NP-complete problems. Now. i. Definition 5. Due to our capacity to go from problem instances to languages by means of encoding schemes. equivalently.

where each clause is a disjunction of literals: ^_ P = ( xj )i i j Thus. i. makes the formula evaluate to 1. i. L1 ∝ L2 . Let us now define SAT as well as several variants of SAT that are also members of the NP-complete set. it is possible to express the SAT problem in CNF: Definition 5. ∃ a polynomial transformation f such that ∀ Li ∈NP ⇒ Li ∝ L1 . Satisfiability.1 SAT The first NP-complete problem (chronologically speaking) is the Satisfiability problem.e. we conclude that L2 is NP-complete. ∀ Li ∈NP. Definition 5. 5. L1 is NP-complete and L1 ∝ L2 ⇒ L2 is NP-complete.e. Instance: A set U of variables and a conjunction of clauses C over U . can be expressed in Conjunctive Normal Form (CNF). Boolean formulae generated by a formal language). also known as SAT problem. Definition 5. For example: φ = (x∧y)∨(¯ x ∧z) A Boolean formula is satisfiable iff some assignments of 0s and 1s to the variables. and. by hypothesis. Proof. A Boolean formula is an expression involving Boolean variables and operations. i. Boolean formula.6. in a conjunction of clauses. This membership was proved by Stephen Cook ([7]).Theorem 4. SAT = {φ|φ is a satisfiable formula} All propositional forms. there is another polynomial transformation g from L1 to L2 as. If L1 and L2 belong to NP.5. well formed Boolean formulae (that is to say. Question: Is there a satyisfying truth assignment for C? 18 .e.e. L1 is NP-complete. The satisfiability problem is to test whether a Boolean formula is satisfiable. i. Moreover. since L2 is a member of NP. Therefore Li ∝ L1 and L1 ∝ L2 ⇒ Li ∝ L2 .4. SAT problem.

400(1818). Turing. pp. 42. [3] M. . Proc.7. [7] SAT is NP-complete Due to Theorem (5). The Complexity of Theorem-Proving Procedures. Raghavan. C is a conjunction of disjunctions C = i [( j=1 xj )]. with an application to the Entscheidung problem”. i. . Thus. The K-SAT Problem. Proceedings of the London Mathematical Society. . Cook.A. PWS (2005). Motwani and P. xn } be a set of Boolean variables and C be a collection of clauses over SVwhere Wk each clause has k literals. the SAT problem is a key element in the theory of computation. 97–117 (1985). Let S = {x1 . Introduction to the Theory of Computation. in order to make SAT amenable to algorithmic analysis we define a variation with a limited number of literals per clause: Definition 5. Series A.Theorem 5.e. [6] D. . QUESTION: Is there a satisfying truth assignment for C? Examples of NP-completeness. Randomized Algorithms. 151-158 (1971). “On Computable Numbers. CUP (1995). Let us remark that in the above definitions of SAT problem there is no constraint neither in the number of clauses nor in the number of literals per clause.3SAT is NP-complete (polynomial transformation from KSAT to 3SAT). NY (1979). DPhil thesis: Discrete Quantum Walks and Quantum Image Processing. INSTANCE: A set S of variables and a collection of clauses over S. Johnson. 19 . A Guide to the Theory of NP-Completeness. Venegas-Andraca. [5] A. References [1] S.R. ACM Symposium on the Theory of Computing. Computers and Intractability. pp.A more difficult proof: KSAT is NP-complete (polynomial transformation from any NP problem to KSAT).H. 3rd Ann. [4] R. Proc. Freeman and Co. W.. of London.E. Sipser. Deutsch.S. [7] S. Garey and D. the church-turing principle and the universal quantum computer”. “Quantum theory. CQC.M. pp. . x2 . University of Oxford (2006) [2] M. Royal Soc. . 230-265 (1936-37).