P versus NP

The term P, or polynomial time, refers to the class of (decisional) problems that can be efficiently solved by an algorithm. NP, for nondeterministic polynomial time, is the class of (decisional) problems for which “solutions” or certificates are efficiently verifiable. Therefore the question of whether P is equal to NP means whether solving is harder than verifying. Yet in other words, we want to know whether there is always an efficient alternative to brute force search. Formal definitions will be given in the next section.


Introduction
The P versus N P problem is a major unsolved problem in computer science [1]. This is considered by many to be the most important open problem in the field [1]. It is one of the seven Millennium Prize Problems selected by the Clay Mathematics Institute to carry a US$1,000,000 prize for the first correct solution [1]. It was essentially mentioned in 1955 from a letter written by John Nash to the United States National Security Agency [1]. However, the precise statement of the P = N P problem was introduced in 1971 by Stephen Cook in a seminal paper [1].
In 1936, Turing developed his theoretical computational model [8]. The deterministic and nondeterministic Turing machines have become in two of the most important definitions related to this theoretical model for computation [8].
A deterministic Turing machine has only one next action for each step defined in its program or transition function [8]. A nondeterministic Turing machine could contain more than one action defined for each step of its program, where this one is no longer a function, but a relation [8].
Another relevant advance in the last century has been the definition of a complexity class. A language over an alphabet is any set of strings made up of symbols from that alphabet [3]. A complexity class is a set of problems, which are represented as a language, grouped by measures such as the running time, memory, etc [3].
In the computational complexity theory, the class P contains those languages that can be decided in polynomial time by a deterministic Turing machine [4]. The class N P consists in those languages that can be decided in polynomial time by a nondeterministic Turing machine [4]. The biggest open question in theoretical computer science concerns the relationship between these classes: Is P equal to N P ?
A logarithmic Turing machine has a read-only input tape, a write-only output tape, and a read/write work tape [8]. The work tape may contain O(log n) symbols [8]. LOGSP ACE is the complexity class containing those decision problems that can be decided by a deterministic logarithmic Turing machine [8]. On the other hand, LOGT IM E is another language based on the languages that can be decided by a logarithmic time algorithm [7]. In this work, we prove the complexity class LOGSP ACE is equal to P . Moreover, we demonstrate the complexity class P is not equal to N P .

Basic Definitions
Let Σ be a finite alphabet with at least two elements, and let Σ * be the set of finite strings over Σ [2]. A Turing machine M has an associated input alphabet Σ [2]. For each string w in Σ * there is a computation associated with M on input w [2]. We say that M accepts w if this computation terminates in the accepting state, that is M (w) = "yes" [2]. Note that M fails to accept w either if this computation ends in the rejecting state, that is M (w) = "no", or if the computation fails to terminate [2].
The language accepted by a Turing machine M , denoted L(M ), has an associated alphabet Σ and is defined by We denote by t M (w) the number of steps in the computation of M on input w [2]. For n ∈ N we denote by T M (n) the worst case running time of M ; that is where Σ n is the set of all strings over Σ of length n [2]. The notations we use to describe the asymptotic running time of an algorithm are defined in terms of functions whose domains are the set of natural numbers [3]. Such notations are convenient for describing the worst and better case running time functions, which is usually defined only on integer input sizes [3]. For a given function g(n), we denote by O(g(n)) the set of functions O(g(n)) = {f (n) : There exist positive constants c and n 0 such that 0 ≤ f (n) ≤ c × g(n) for all n ≥ n 0 }.
O-notation provides an asymptotic upper bound [3]. We say that M runs in polynomial time if there is a constant k such that for all n, T M (n) ≤ n k + k [2]. In other words, this means the language L(M ) can be accepted by the Turing machine M in polynomial time or more specific in a running time O(n k ) for some constant k [2]. Therefore, P is the complexity class of languages that can be accepted in polynomial time by deterministic Turing machines [3]. A verifier for a language L is a deterministic Turing machine M , where L = {w : M (w, c) = "yes" for some string c}.
We measure the time of a verifier only in terms of the length of w, so a polynomial time verifier runs in polynomial time in the length of w [2]. A verifier uses additional information, represented by the symbol c, to verify that a string w is a member of L. This information is called certificate. N P is also the complexity class of languages defined by polynomial time verifiers [7]. If N P is the class of problems that have succinct certificates, then the complexity class coN P must contain those problems that have succinct disqualifications [7]. That is, a "no" instance of a problem in coN P possesses a short proof of its being a "no" instance [7].
A logarithmic space transducer is a Turing machine with a read-only input tape, a write-only output tape, and a read/write work tape [2]. The work tapes must contain at most O(log n) symbols [2]. A logarithmic space transducer M computes a function f : Σ * → Σ * , where f (w) is the string remaining on the output tape after M halts when it is started with w on its input tape [2]. We call f a logarithmic space computable function [2]. We say that a language L 1 ⊆ {0, 1} * is logarithmic space reducible to a language L 2 ⊆ {0, 1} * , written L 1 ≤ l L 2 , if there exists a logarithmic space computable function f : {0, 1} * → {0, 1} * such that for all x ∈ {0, 1} * , An important complexity class is P-complete [5]. A language L ⊆ {0, 1} * is P-complete if -L ∈ P , and -L ≤ l L for every L ∈ P .
If L is a language such that L ≤ l L for some L ∈ P-complete, then L is P-hard [7]. Moreover, if L ∈ P , then L ∈ P-complete [7]. A Boolean formula φ is composed of 1. Boolean variables: x 1 , x 2 , . . . , x n ; 2. Boolean connectives: Any Boolean function with one or two inputs and one output, such as ∧(AND), ∨(OR), (NOT), ⇒(implication), ⇔(if and only if); 3. and parentheses.
A truth assignment for a Boolean formula φ is a set of values for the variables in φ. We define a CN F Boolean formula using the following terms. A literal in a Boolean formula is an occurrence of a variable or its negation [3]. A Boolean formula is in conjunctive normal form, or CN F , if it is expressed as an AND of clauses, each of which is the OR of one or more literals [3]. A Boolean formula is in 3-conjunctive normal form or 3CN F , if each clause has exactly three distinct literals [3].
For example, the Boolean formula: is in 3CN F . The first of its three clauses is ( , which contains the three literals x 1 , x 1 , and x 2 . For every n, m ∈ N a Boolean circuit C with n inputs and m outputs is a directed acyclic graph [2]. It contains n nodes with no incoming edges; called the input gates and m nodes with no outgoing edges, called the output gates [2]. All other nodes are labeled with one of ∨, ∧ or (in other words, the logical operations OR, AND, and NOT) [2]. The ∨ and ∧ nodes have fanin (i.e., number of incoming edges) of 2 and the nodes have fanin 1. The size of C is the number of nodes in it [2]. Proof. How many comparisons are necessary to determine whether a positive integer x is the maximum of a collection of n positive integers? We can easily obtain an upper bound of n comparisons: examine each element of the collection in turn and keep track of the largest element seen so far and finally, we compare the ultimate result with x. In the following procedure, we assume that the collection resides in an array A of length n. Is this the best amount of comparisons we can do? Yes, since we can obtain a lower bound of n − 1 comparisons for the problem of determining the maximum and one another comparison to check whether this is equal to x [3]. Think of any algorithm that determines the maximum as a tournament among the elements [3]. Each comparison is a match in the tournament in which the larger of the two elements wins [3]. The key observation is that every element except the winner must lose at least one match [3]. Finally, we compare the winner with x [3]. Hence, n comparisons are necessary to determine whether x is the maximum of the collection of positive integers, and the algorithm M AXIM U M is optimal with respect to the number of comparisons performed [3]. QUESTION: Is the truth assignment T the maximum cost assignment of φ over all neighbors of T ? The cost of the assignment is the sum of the weights of the clauses it satisfies. The neighbors of T are truth assignments that differ from T in one bit position.
REMARKS: We denote this language as U 3N SAT F LIP [5].
Proof. Given a Boolean formula φ in 3CN F and a truth assignment T , we can calculate the cost assignment of T based on the not-all-equals criterion in a logarithmic space algorithm. In the following function COST , we assume the Algorithm 2 COST's Logarithmic space algorithm 1: function COST(φ, T ) 2: /*Initialize the cost assignment to 0*/ 3: /*Increment num because c complies with the not-all-equals criterion*/ 9: num ← num + 1 10: end if 11: end for 12: /*Return the cost assignment*/ 13: return num 14: end function truth assignment T is a dictionary that maps every variable in φ to 1 or 0 (true or false).
This function uses logarithmic space in its work tapes and assumes the clauses contain only positive literals. Certainly, the calculation of T [p] + T [q] + T [r] can be made storing a constant amount of space where p, q and r are the positive literals of each clause c in φ. In addition, if m is the number of clauses in φ, then the number num will not exceed the number m and thus, the work tapes will contain at most O(log m) space.
On the other hand, we can reduce an instance of U 3N SAT F LIP into another of M AXIM U M in logarithmic space. For this purpose, we are going to use the function COST into a new algorithm. In the following function REDU CE, we represent the input instance as a given Boolean formula φ in 3CN F of n − 1 variables with a truth assignment T and the output instance as a positive integer x with an array A filled with n elements of a collection of positive integers. We will assume the truth assignment T given in the input is a dictionary that maps every variable in φ to 1 or 0 (true or false) as well.
Is this a logarithmic space reduction from U 3N SAT F LIP to M AXIM U M ? Given a Boolean formula φ in 3CN F and a truth assignment T , we will obtain the positive integer x as the cost assignment of φ in T and in the array A the cost assignment of φ from all the neighbors of T included the cost assignment of T . return (x, A) 25: end function truth assignment after flipping one bit position in T . Moreover, the bit position that we flip in T will use at most two symbols encoded in binary over the work tapes: the new bit value and the variable. In addition, the algorithm COST runs in logarithmic space in relation to φ and the truth assignment T with at most one bit flipped. The algorithm COST will take into account the original truth assignment T which remains in the input tape and the changed bit position which is stored in the work tapes. After the computation of COST over each iteration, we will erase from the work tapes the at most O(log m) space that could contain those tapes where m is the number of clauses in φ. Furthermore, we do not need to store the value of the elements of A in the work tapes since they can be written directly to the output tape. The array A can be written to the output tape as the pairs (i, v i ) where i is an index between 0 and n − 1 and  Proof. Given a positive integer x and a collection S of positive integers, we are going to demonstrate we can decide this problem in logarithmic space. In the following procedure, we assume that the collection resides in array A of length n. Besides, we assume the function length calculates the bit-length of a binary string and uses a logarithmic space for the calculation. For this purpose, we compare only two bits in the input tape over the same position j from x and A[i] in a descending order for each step. Notice, that we start to compare from the last bit position in a descending order. For example, in the binary string 100 which represents the number 4, we start iterating from the last bit element, that is the bit 1. Moreover, we store the position j in the work tapes and this value has at most O(log x) space. If it would be the case that A[i] and x have the same bit-length, but A[i] is greater than x, then we reject. We continue the iteration with the next value i while the property that x is the maximum number in the array remains as true. However, we only accept when the value of the variable /*Accept if answer = "yes" and reject when answer = "no"*/ 41: return answer 42: end procedure answer is "yes" when initially has the value of "no" by default. The value will be "yes" in the variable answer after the whole iteration for each element in the array if and only if there is at least one element A[i] that is equal to x. Furthermore, if the iteration is completed until the last item, then x is greater than or equal to every element in the array A. To sum up, we show we can decide whether x is the maximum of the collection represented by the array A in logarithmic space and thus, M AXIM U M ∈ LOGSP ACE. Theorem 4. LOGSP ACE = P .
Proof. As result of Theorems 2 and 3 we obtain LOGSP ACE = P , because the complexity class LOGSP ACE is closed under logarithmic space reductions [7]. Proof. The language of CIRCUIT-MAXIMUM is in coN P . Certainly, we can check in polynomial time a disqualification from an instance x, C of this language that is a positive integer y where x < y and y is in S or we can simply verify in polynomial time when x is not in S where . . . is the binary encoding. Indeed, we can check whether the both evaluations of y and x in C accept and check later whether x < y or we can just verify when C(x) does not accept. Certainly, we can polynomially make the verification when x, C is a "no" instance of the problem CIRCUIT-MAXIMUM, because the evaluation in the Boolean circuit can be done in polynomial time as well.
Given a Boolean circuit C, the problem coCIRCUIT-SAT consists in deciding whether there is not any input such that C accepts [7]. Theorem 6. coCIRCUIT-SAT ≤ l CIRCUIT-MAXIMUM.
Proof. Given a Boolean circuit C we can check whether C(0) does not accept. In that case, we create a succinct Boolean circuit C which only accepts the input string 0 and has the same number of input gates of C. We combine C with C through the input gates into a new Boolean circuit C which accepts only when C or C accept. This is possible just adding an OR gate between the output gates of C and C . The instance of the positive integer 0 and the final Boolean circuit C belongs to CIRCUIT-MAXIMUM if and only if C is in coCIRCUIT-SAT. Certainly, 0 is the maximum of the collection that represents C if there is not any other input which C accepts. In addition, C accepts the positive integer 0 because of the construction of C on C. Since we can create the succinct Boolean circuit C and evaluate C on the input 0 in logarithmic space due to Theorem 4, then coCIRCUIT-SAT ≤ l CIRCUIT-MAXIMUM.
Proof. coCIRCUIT-SAT is a known coNP-complete problem [7]. Hence, the language CIRCUIT-MAXIMUM is in coNP-hard because of the Theorem 6 and due to the logarithmic reduction is also a polynomial reduction [7]. As result of Theorem 5, we obtain CIRCUIT-MAXIMUM is in coN P and thus, the proof is completed.
Proof. Given a positive integer x and a collection of positive integers S represented by an array, we can convert them into another instance the same x with a Boolean circuit C where some positive integer i belongs to S if and only if C(i) accepts. Certainly, we can construct C just iterating from each element i of the array and creating a single circuit C i which only accepts i. We assume that every circuit C i has the same number of input gates. Later, we create C just unifying all the circuits C i coinciding their input gates and joining all their output gates with an OR gate for obtaining a single output gate. In this way, we obtain a Boolean circuit where some positive integer i belongs to S if and only if C(i) accepts. Given a Boolean circuit C, MINIMUM-CIRCUIT is the problem of deciding whether there is no circuit with fewer gates that computes the same Boolean function of C [7]. This problem belongs to P H [7]. However, if P = N P then the polynomially hierarchy collapses to the first level [7]. In this way, MINIMUM-CIRCUIT would be in P when P = N P . Consequently, the complement language of MINIMUM-CIRCUIT would be in P because P is closed under complement. Moreover, the function problem of this complement would be in F P and that would mean, with a circuit C as input we can find another circuit C which has the fewest gates such that C and C compute the same Boolean function. Certainly, we can try with that function problem the search of another circuit with fewer gates and we can repeat this process over and over again until we reach the circuit C with the fewest amount of gates. This can be done in polynomial time, because the class F P finds the solutions in polynomial time and the search of C depends mostly of the amount of gates in the original C.
In this way, given an instance of M AXIM U M represented by some positive integer x and a Boolean circuit C, we could reduce it in polynomial time to another instance of CIRCUIT-MAXIMUM that would be the same x with a succinctly representation of S that would be the circuit C with the fewest gates which computes the same of C. Since the positive integer x and the circuit C can be reduced into an exponentially more succinct way such as x and C , then we can pad x and C by enough "quasiblanks" symbols ∇ such that x, C ∇∇∇∇ . . . has the same string length of x, C where . . . is the binary encoding. Since this polynomial reduction under the assumption of P = N P is possible, then this can be converted into a logarithmic reduction according to Theorem 4. Consequently, the padded version of the language CIRCUIT-MAXIMUM would be in P-hard. Nevertheless, every instance x, C ∇∇∇∇ . . . of the padded version of the language CIRCUIT-MAXIMUM can be decided in logarithmic time, because x, C can be decided in polynomial time due to P would be equal to coN P when P = N P and x, C is exponentially more succinct than its padded version. As result, the padded version of CIRCUIT-MAXIMUM would be in LOGT IM E and in P-hard under the assumption of P = N P , but that would mean the existence of a P-complete problem that can be decided in logarithmic time which is a trivial contradiction [7]. In conclusion, we demonstrate P = N P based on the reduction ad absurdum logic rule after finding a contradiction assuming that P = N P .

Conclusions
The proof P = N P explains why after decades of studying the N P problems no one has been able to find a polynomial time algorithm for many important known NP-complete problems [4]. Indeed, it shows in a formal way that many currently mathematically problems cannot be solved efficiently, so that the attention of researchers can be focused on partial solutions or solutions to other problems. In addition, it proves that could be safe most of the existing cryptosystems such as the public-key cryptography [4]. The proof of LOGSP ACE = P is a breakthrough result that will open a new spectrum in the field of complexity theory and provide many practical computational benefits. LOGSP ACE is a subclass of N LOGSP ACE, which is the class of languages decidable in a nondeterministic logarithmic Turing machine [8]. It is known LOGSP ACE ⊆ N LOGSP ACE ⊆ P [7]. In this way, our proof implies the complexity class LOGSP ACE is equal to N LOGSP ACE which was a problem that remained open for a long time [7].