Submitted:
14 March 2024
Posted:
14 March 2024
Read the latest preprint version here
Abstract
P versus NP is considered as one of the most fundamental open problems in computer science. This consists in knowing the answer of the following question: Is P equal to NP? It was essentially mentioned in 1955 from a letter written by John Nash to the United States National Security Agency. However, a precise statement of the P versus NP problem was introduced independently by Stephen Cook and Leonid Levin. Since that date, all efforts to find a proof for this problem have failed. Another major complexity class is NP-complete. It is well-known that P is equal to NP under the assumption of the existence of a polynomial time algorithm for some NP-complete. We show that the Monotone Weighted Xor 2-satisfiability problem (MWX2SAT) is NP-complete and P at the same time. Certainly, we make a polynomial time reduction from every directed graph and positive integer k in the K-CLOSURE problem to an instance of MWX2SAT. In this way, we show that MWX2SAT is also an NP-complete problem. Moreover, we create and implement a polynomial time algorithm which decides the instances of MWX2SAT. Consequently, we prove that P = NP.
Keywords:
Complexity classes
; boolean formula
; graph
; completeness
; polynomial time
MSC: 68Q15; 68Q17; 68Q25
1. Introduction
P versus is one of the most important and challenging problems in computer science [1]. It asks whether every problem whose solution can be quickly verified can also be quickly solved. The informal term “quickly” here refers to the existence of an algorithm that can solve the task in polynomial time [1]. The general class of problems for which such an algorithm exists is called P or “class P” [1].
Another class of problems called , which stands for “nondeterministic polynomial time”, is defined by the property that if an input to a problem is a solution, then it can be quickly verified [1]. The P versus problem asks whether P equals . If it turns out that , which is widely believed to be the case, it would mean that there are problems in that are harder to compute than to verify [1]. This would have profound implications for various fields, including cryptography and artificial intelligence [2].
Solving the P versus problem is considered to be one of the greatest challenges in computer science [1]. A solution would have a profound impact on our understanding of computation and could lead to the development of new algorithms and techniques that could solve many of the world’s most pressing problems [1]. The problem is so difficult that it is considered to be one of the seven Millennium Prize Problems, which are a set of seven unsolved problems that have been offered a 1 million prize for a correct solution [1].
2. Materials and Methods
-complete problems are a class of computational problems that are at the heart of many important and challenging problems in computer science. They are defined by the property that they can be quickly verified, but there is no known efficient algorithm to solve them. This means that finding a solution to an -complete problem can be extremely time-consuming, even for relatively small inputs. In computational complexity theory, a problem is considered -complete if it meets the following two criteria:
- Membership in NP: A solution to an -complete problem can be verified in polynomial time. This means that there is an algorithm that can quickly check whether a proposed solution is correct [3].
- Reduction to NP-complete problems: Any problem in can be reduced to an -complete problem in polynomial time. This means that any -problem can be transformed into an -complete problem by making a small number of changes [3].
If it were possible to find an efficient algorithm for solving any one -complete problem, then this algorithm could be used to solve all problems in polynomial time. This would have a profound impact on many fields, including cryptography, artificial intelligence, and operations research [2]. Here are some examples of -complete problems:
- Boolean satisfiability problem (SAT): Given a Boolean formula, determine whether there is an assignment of truth values to the variables that makes the formula true [4].
- K-CLOSURE problem: Given a directed graph (V is the set of vertices and A is the set of edges) and positive integer k, determine whether there is a set of at most k vertices such that for all either or (see reference [Queyranne, 1976] from the Johnson and Garey book) [4]. Note that in this problem the statement “either or ” does mean the same as: ( or ) or ( or ) since the logical implication of the word “Either” indicates that at least one of the following statements must be true, but not necessarily both.
These are just a few examples of the many -complete problems that have been studied and have a close relation with our current result. On the one hand, a vertex cover (sometimes called a node cover) of a graph G is a subset of its vertices, denoted by , such that every edge in G has at least one endpoint in . On the other hand, an independent set is a subset of vertices in a graph G where no two vertices in the set are connected by an edge.
Definition 1.
Vertex Cover and Independent Set
INSTANCE: An undirected graph and a positive integer k.
QUESTION: Is there set of at most k vertices such that is both a vertex cover and an independent set in G?
REMARKS: This problem can be easily solved in polynomial time [4].
In this work, we show there is an -complete problem that can be solved in polynomial time using the previous problem. Consequently, we prove that P is equal to .
3. Results
Formally, an instance of Boolean satisfiability problem (SAT) is a Boolean formula which is composed of:
- Boolean variables: ;
- Boolean connectives: Any Boolean function with one or two inputs and one output, such as ∧(AND), ∨(OR), ⇁(NOT), ⇒(implication), ⇔(if and only if);
- and parentheses.
A truth assignment for a Boolean formula is a set of values for the variables in . A satisfying truth assignment is a truth assignment that causes to be evaluated as true. A Boolean formula with a satisfying truth assignment is satisfiable. The problem asks whether a given Boolean formula is satisfiable [4].
We define a 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 , 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 2-conjunctive normal form or , if each clause has exactly two distinct literals [3].
For example, the Boolean formula:
is in . The first of its three clauses is , which contains the two literals and .
We define the following problem:
Definition 2.
Monotone Weighted Xor 2-satisfiability problem (MWX2SAT)
INSTANCE: An n-variable formula with monotone clauses (meaning the variables are never negated) using logic operators ⊕ (instead of using the operator ∨) and a positive integer k.
QUESTION: Is there exists a satisfying truth assignment in which at most k of the variables are true?
The following is key Lemma.
Lemma 1.
.
Proof.
For any given instance of the problem, one can construct an equivalent problem with a variable for each vertex of a graph and two variables for each edge of a graph. Each edge of the graph may be represented by the clauses where and are two new variables such that for a possible satisfying truth assignment, either both variables u and v are true and belong to a closure or both variables u and v are false and belong to . By definition, the k-vertex closure cannot have any outgoing edges pointing to vertices outside the closure. Therefore, no edge can exist where one vertex belongs to the solution and the other does not. Both endpoints of any edge must either be inside the closure or outside it. Then the satisfying instances of the resulting formula using logic operators ⊕ encode solutions to the problem, and there is a satisfying truth assignment with at most true variables if and only if there is a closure with at most k vertices where is the cardinality set function. Therefore, like , is -complete. □
This is the main insight.
Theorem 1.
.
Proof.
There is a connection between finding a satisfying truth assignment in with at most k true variables and finding a set of at most k vertices that is both a vertex cover and an independent set in a specific graph construction.
Here’s a breakdown of the equivalence:
-
Graph Construction:
- Each vertex in the original graph represents a variable in the formula.
- Edges are created between variables based on the structure of the 2CNF clauses: If two variables appear in a clause (e.g., ), then an edge is drawn between the corresponding vertices in the graph.
-
and the Graph:
- A truth assignment in where at most k variables are true directly translates to a set of at most k vertices in the constructed graph where true variables correspond to the vertices included in the set.
-
The properties of clauses ensure that:
- Vertex Cover: The chosen vertices cover all the edges (due to the structure of the clauses and the way edges are formed). This satisfies the vertex cover condition.
- Independent Set: The chosen vertices don’t have any edges connecting them (because the variables are connected in the graph, and only one variable from each clause can be true). This satisfies the independent set condition.
Therefore, finding a satisfying truth assignment with at most k true variables in is indeed equivalent to finding a set of at most k vertices that fulfills both vertex cover and independent set requirements in the corresponding graph. However, we know the problem of finding a set of at most k vertices that is both a vertex cover and an independent set can be easily solved in polynomial time [4]. Consequently, the instances of the problem can be solved in polynomial time as well. □
This is the main theorem.
Theorem 2.
There is a quadratic polynomial time algorithm for the problem .
Proof.
Suppose we have the following sequence of variables in a given instance of :
For each variable in the formula, we define the functions f and g as,
- is the number of variables such that either or belongs to the formula whenever ;
- is the number of variables such that either or belongs to the formula whenever .
We define a state as a quadruple of integers. This state represents the fact that,
where m is the amount of clauses into the formula. Each state has two next states:
- , implying that is included in the subset and it is evaluated as true;
- , implying that is included in the subset and it is evaluated as false.
Starting from the initial state , it is possible to use any graph search algorithm (e.g. Breadth-first search (BFS) [3]) to search any state such that . Certainly, we satisfy all the clauses if they contain exactly one true literal just adding 1 by the true literal from the left most position (otherwise adding 1 by the false literal from the left most position) and subtracting 1 by the false literal from the right most position (otherwise subtracting 1 by the true literal from the right most position). The run-time of this algorithm is at most linear in the number of states. The number of states is at bounded by times and therefore, the whole time required is . We create our software programming implementation in Python for this algorithm [5]. This is placed into a GitHub repository under my GitHub username “frankvegadelgado” [5]. The last commit was on February 27th of 2024 with a SHA commit eec2ccb2bba51e3efaf3ad7d722b948b88861ea9 [5]. □
References
- Cook, S.A. The P versus NP Problem, Clay Mathematics Institute. 2022. Available online: https://www.claymath.org/wp-content/uploads/2022/06/pvsnp.pdf (accessed on 1 March 2024).
- Fortnow, L. The status of the P versus NP problem. Communications of the ACM 2009, 52, 78–86. [Google Scholar] [CrossRef]
- Cormen, T.H.; Leiserson, C.E.; Rivest, R.L.; Stein, C. Introduction to Algorithms, 3rd ed.; The MIT Press: Cambridge, MA, USA, 2009. [Google Scholar]
- Garey, M.R.; Johnson, D.S. Computers and Intractability: A Guide to the Theory of NP-Completeness, 1st ed.; W. H. Freeman and Company: San Francisco, CA, USA, 1979. [Google Scholar]
- Vega, F. ALMA| MWX2SAT Solver. 2024. Available online: https://github.com/frankvegadelgado/alma (accessed on 1 March 2024).
Short Biography of Author
![]() |
Frank Vega is essentially a Back-End Programmer and Mathematical Hobbyist who graduated in Computer Science in 2007. In May 2022, The Ramanujan Journal accepted his mathematical article about the Riemann hypothesis. The article “Robin’s criterion on divisibility” makes several significant contributions to the field of number theory. It provides a proof of the Robin inequality for a large class of integers, and it suggests new directions for research in the area of analytic number theory. |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the author. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
