Quantum Algorithm for Solving Tautology and Satisfiability Problems

Abstract

This paper proposes a quantum algorithm for solving the tautology and the satisfiability problems for a Boolean formula. Let’s say we are given a Boolean formula. The variables of the Boolean formula can take only two values—TRUE or FALSE. The tautology problem asks whether the Boolean formula always evaluates to TRUE for all values of its Boolean variables. The satisfiability problem asks whether the Boolean formula can evaluate to TRUE for at least one set of values of its Boolean variables. This paper proposes that both problems can be solved using the proposed quantum algorithm. The tautology problem is known to be co-NP-complete. The satisfiability problem is known to be NP-complete.

Share and Cite:

Mitra, A. (2026) Quantum Algorithm for Solving Tautology and Satisfiability Problems. Journal of Quantum Information Science, 16, 120-131. doi: 10.4236/jqis.2026.161004.

1. Introduction

Let’s say we are given a Boolean formula with n number of Boolean variables— x 0 , x 1 ,, x n1 . Each of these n variables can take two possible values: TRUE or FALSE. Therefore, n variables can take 2 n different values in total. If the Boolean formula is a tautology, then the Boolean formula will always evaluate to TRUE, regardless of the values of the variables.

The tautology problem is co-NP-complete [1]. As we know, a problem is in co-NP if its complement is in NP. For example, the complement of the tautology problem asks whether the Boolean formula evaluates to TRUE for at least one combination of values of the Boolean variables. Please note that this is the same problem as the satisfiability problem.

The satisfiability problem is in NP. If the variables of the Boolean formula are assigned Boolean values, we can verify in polynomial time whether the Boolean formula evaluates to TRUE.

Moreover, the satisfiability problem is known to be NP-complete. As the satisfiability problem is the complement of the tautology problem, the tautology problem is a co-NP-complete problem.

A qubit does not always take the values 0 or 1. It can take any values of the form ( α|0+β|1 ) , where α and β are two complex numbers and | α | 2 + | β | 2 =1 . We can leverage this to solve the tautology and the satisfiability problem using a quantum algorithm.

2. The Proposed Quantum Algorithm

Let’s say is a Boolean formula consisting of n input variables. The input variables are Boolean and can take the values TRUE or FALSE. Depending on these n Boolean variables, can evaluate to any value, TRUE or FALSE.

Let’s also assume that f: { 0,1 } n { 0,1 } is a function. The n input Boolean variables of the function f: { 0,1 } n { 0,1 } represent the n Boolean variables of . And the output of f represents the output of the Boolean formula .

In other words, let’s say x 0 , x 1 ,, x n1 are the n input variables of f: { 0,1 } n { 0,1 } . f( x n1 , x n2 ,, x 0 ) represents the value that the Boolean formula evaluates for the same set of values of its Boolean variables. Let’s also assume that the function f: { 0,1 } n { 0,1 } can be implemented as an oracle.

Therefore, if is a tautology, then f: { 0,1 } n { 0,1 } always evaluates to 1. If is not satisfiable, then f: { 0,1 } n { 0,1 } always evaluates to 0. In all other cases, if f: { 0,1 } n { 0,1 } evaluates to 1 for at least one set of values of the input variables, then is satisfiable.

For our purpose, we can use the quantum circuit as shown in Figure 1. The first n qubits are initialized to |0 n , and the last qubit is initialized to |0 .

We can apply the Hadamard gate on the first n qubits. As a result, after applying the Hadamard gate, we will obtain the following state:

1 2 n x=0 2 n 1 |x|0 (1)

Now, we can apply the oracle [2] U f that implements the function f . Therefore, if we query the oracle, we obtain the following state:

|ψ= 1 2 n x=0 2 n 1 |x| f( x ) (2)

Figure 1. Quantum circuit implementing the proposed quantum algorithm.

For example, if n=2 , we will get the following state:

|ψ= 1 2 2 x=0 3 |x| f( x ) = | 00| f( 00 )+| 01| f( 01 )+| 10| f( 10 )+| 11| f( 11 ) 2 (3)

At this point, if is a tautology, we will get the following state:

|ψ= 1 2 2 x=0 3 |x| f( x )= | 001+| 011+| 101+| 111 2 (4)

If is not satisfiable, we will get the following state:

|ψ= 1 2 2 x=0 3 |x| f( x )= | 000+| 010+| 100+| 110 2 (5)

However, if is satisfiable, it can be in any other state, like the following, for example:

|ψ= 1 2 2 x=0 3 |x| f( x )= | 000+| 011+| 100+| 110 2 (6)

The ( n+1 ) qubits of the quantum state |ψ now passes through the quantum gate G. We will use the unitary matrix M to implement G. The construction of the 2N×2N unitary matrix M is explained in Section 3.

The output of G is ( n+1 ) qubit. The measurements of the output qubits specify whether is satisfiable, unsatisfiable, or a tautology.

3. Construction of the Unitary Matrix M

The quantum gate G is implemented using the unitary matrix M. n is the number of Boolean variables of and N= 2 n .

Let’s consider the quantum state |ψ .

|ψ= 1 N x=0 N1 |x| f( x )= a 0 | x 0 + a 1 | x 1 ++ a 2N1 | x 2N1 (7)

Please note that | x i for 0i2N1 has ( n+1 ) qubits. a i and a i+1 cannot be non-zero simultaneously, as the output of f( x ) for a specific x cannot be both 0 and 1. For example, if n = 2 and f( 00 )=0 , then the coefficient a 0 for | 000 is 1 N and the coefficient a 1 for | 001 is 0.

Let’s say the output of the quantum gate G is the following:

b 0 | x 0 + b 1 | x 1 ++ b 2N1 | x 2N1 (8)

Therefore, we can write the following:

M[ a 0 a 1 a 2N1 ]=[ b 0 b 1 b 2N1 ] (9)

In our case, M is a 2N×2N unitary matrix. Let’s say M is the following block matrix:

M= 1 2 [ A A A A ] (10)

As M is a unitary and real matrix, we can write the following:

M M T =I

or, 1 2 [ A A A A ][ A A A A ]=I

or, 1 2 [ 2 A 2 0 0 2 A 2 ]=I

A 2 =I (11)

We will consider the following initial value for A:

A 0 =[ 0 1 1 0 ] (12)

We observe that

A 0 2 =[ 0 1 1 0 ]×[ 0 1 1 0 ]=[ 1 0 0 1 ]=I (13)

We can now put the value of A 0 and construct M 0 as follows:

M 0 = 1 2 [ A 0 A 0 A 0 A 0 ]= 1 2 [ 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 ] (14)

We can now set A 1 = M 0 and calculate M 1 as M 1 = 1 2 [ A 1 A 1 A 1 A 1 ] .

Similarly, we can continue to construct the 2 n+1 × 2 n+1 matrix M= M n1 where N= 2 n . We will discuss the time complexity of constructing matrix M in Section 5.

4. Some Properties of the Matrix M

Property 1: The first and second rows of M 2 n+1 × 2 n+1 will always contain 0 and 1 2 n alternately.

We can use mathematical induction to prove this.

M 0 = M 2 2 × 2 2 = 1 2 [ A 0 A 0 A 0 A 0 ]= 1 2 [ 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 ] (15)

M 0 contains 0 and 1 2 alternately in the first and second rows. Therefore, the property holds for M 0 . Let’s say the property holds for all M k for 0kn . We will prove that the property holds for M k+1 .

M k+1 = 1 2 [ A k+1 A k+1 A k+1 A k+1 ] (16)

A k+1 = M k (17)

As per our assumption, the property holds for M k = M 2 k+2 × 2 k+2 . As the number of rows of A k+1 = M k for k0 is more than 2, the first and second rows of M k+1 = M 2 k+3 × 2 k+3 will contain 1 2 k+1 × 1 2 = 1 2 k+2 and 0 alternately. Hence, the property holds for all k0 .

Property 2: Each row i of M 2 n+1 × 2 n+1 , for 2i< 2 n+1 1 , contains 1 2 n and 1 2 n alternately as non-zero elements.

We can use mathematical induction to prove this.

M 0 = M 2 2 × 2 2 = 1 2 [ A 0 A 0 A 0 A 0 ]= 1 2 [ 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 ] 2 2 × 2 2 (18)

Each row i for 2i 2 2 1 contains 1 2 and 1 2 alternately as non-zero elements. Therefore, the property holds for M 0 .

Let’s say the property holds for all M k for 0kn . We will prove that the property also holds for M k+1 .

M k+1 = 1 2 [ A k+1 A k+1 A k+1 A k+1 ] (19)

A k+1 = M k (20)

As the property holds for M k , it will hold for A k+1 . And the non-zero elements of M k+1 = M 2 k+3 × 2 k+3 will be 1 2 × 1 2 k+1 = 1 2 k+2 and 1 2 k+2 alternately. Therefore, the property holds for M k+1 . Hence, the property holds for all k0 .

Property 3: The matrix M is unitary.

M is constructed recursively from A 0 . Therefore, the following holds:

M 0 = 1 2 [ A 0 A 0 A 0 A 0 ]= 1 2 [ 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 ] 2 2 × 2 2

M 1 = 1 2 [ A 1 A 1 A 1 A 1 ]= 1 2 2 [ 0 1 0 1 0 1 ] 2 3 × 2 3

M 2 = 1 2 [ A 2 A 2 A 2 A 2 ]= 1 2 3 [ 0 1 0 1 0 1 ] 2 4 × 2 4

M n1 = 1 2 [ A n1 A n1 A n1 A n1 ]= 1 2 n [ 0 1 0 1 0 1 ] 2 n+1 × 2 n+1 (21)

We can use mathematical induction to prove that A k is an involutory [3] matrix for k0 .

A 0 =[ 0 1 1 0 ]

A 0 A 0 T =[ 0 1 1 0 ][ 0 1 1 0 ]=I (22)

As A 0 is a symmetric matrix, A 0 = A 0 T . Therefore,

A 0 2 = A 0 A 0 T =[ 0 1 1 0 ][ 0 1 1 0 ]=I (23)

Therefore, A k is an involutory matrix for k=0 . Let’s assume that A k is an involutory matrix for all k where 0kn1 .

A k = M k1 = 1 2 [ A k1 A k1 A k1 A k1 ]

A k 2 = A k A k T = 1 2 [ A k1 A k1 A k1 A k1 ]× 1 2 [ A k1 A k1 A k1 A k1 ] = 1 2 [ A k1 A k1 A k1 A k1 ] 2 = 1 2 [ 2 A k1 2 0 0 2 A k1 2 ]=[ A k1 2 0 0 A k1 2 ] (24)

As per our assumption, A k1 is involutory.

A k 2 =[ A k1 2 0 0 A k1 2 ]=[ I 0 0 I ] (25)

Therefore, A k is an involutory matrix for all k where 0kn1 .

As M k = 1 2 [ A k A k A k A k ] , we can write the following:

M k M k T = 1 2 [ A k A k A k A k ]× 1 2 [ A k A k A k A k ] T = 1 2 [ A k A k A k A k ] 2 = 1 2 [ 2 A k 2 0 0 2 A k 2 ]=[ I 0 0 I ] (26)

Hence, M n1 = 1 2 [ A n1 A n1 A n1 A n1 ]= 1 2 n [ 0 1 0 1 0 1 ] 2 n+1 × 2 n+1 is a unitary matrix.

5. Output of the Quantum Gate G

As discussed in Section 3,

|ψ= 1 N x=0 N1 |x| f( x )= a 0 | x 0 + a 1 | x 1 ++ a 2N1 | x 2N1 (27)

And the output of the quantum gate G is the following:

b 0 | x 0 + b 1 | x 1 ++ b 2N1 | x 2N1 (28)

Therefore, we can write the following:

M[ a 0 a 1 a 2N1 ]=[ b 0 b 1 b 2N1 ] (29)

As discussed in Section 4, the first two rows of M alternate between 0 and 1. Therefore, we can write the following:

1 N [ 0 1 0 1 0 1 ][ a 0 a 1 a 2N1 ]=[ b 0 b 1 b 2N1 ]

b 0 = 1 N ( a 1 + a 3 + a 5 + )

b 1 = 1 N ( a 0 + a 2 + a 4 + ) (30)

The input of the quantum gate G is the following:

|ψ= 1 N x=0 N1 |x| f( x )= a 0 | x 0 + a 1 | x 1 ++ a 2N1 | x 2N1 (31)

The first n qubits of | x k for 0k2N1 and N= 2 n specify the input of the given Boolean function and the ( n+1 ) th qubit of | x k is the output of the Boolean function. Therefore, a i and a i+1 cannot be 1 together for 0i2N2 .

If the given Boolean function is a tautology, the ( n+1 ) th qubit of | x k for 0k2N1 and N= 2 n is always 1. Therefore, in that case, a 0 , a 2 , a 4 , are zeros and a 1 , a 3 , a 5 , are all ones.

b 0 = 1 N ( a 1 + a 3 + a 5 + )=1

b 1 = 1 N ( a 0 + a 2 + a 4 + )=0

b i =0for2i2N1 (32)

Please note that b i =0 for 2i2N1 as per Property 2. Therefore, the output of the quantum gate G, in that case, will be the following:

[ 1 0 0 0 ]

Similarly, if the given Boolean function is not satisfiable, the ( n+1 ) th qubit of | x k for 0k2N1 and N= 2 n is always 0. Therefore, in that case, a 0 , a 2 , a 4 , are all ones and a 1 , a 3 , a 5 , are all zeros. Therefore, in that case,

b 0 = 1 N ( a 1 + a 3 + a 5 + )=0 (33)

b 1 = 1 N ( a 0 + a 2 + a 4 + )=1 (34)

b i =0for2i2N1 (35)

Therefore, the output of the quantum gate G, in that case, will be the following:

[ 0 1 0 0 ]

In all other cases, the output of the quantum gate G will be different from | 000 or | 001 . The Boolean function, in that case, is satisfiable. We can detect that by measuring the ( n+1 ) output qubits.

If we repeat the experiment, the ( n+1 ) output qubits, in that case, will collapse to different values each time. The ( n+1 ) output qubits, in that case, will not be | 000 or | 001 .

6. Time Complexity for Constructing M

M is constructed recursively from A 0 .

M 0 = 1 2 [ A 0 A 0 A 0 A 0 ]= 1 2 [ 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 ] 2 2 × 2 2

M 1 = 1 2 [ A 1 A 1 A 1 A 1 ]= 1 2 2 [ 0 1 0 1 0 1 ] 2 3 × 2 3

M 2 = 1 2 [ A 2 A 2 A 2 A 2 ]= 1 2 3 [ 0 1 0 1 0 1 ] 2 4 × 2 4

M n2 = 1 2 [ A n2 A n2 A n2 A n2 ]= 1 2 n1 [ 0 1 0 1 0 1 ] 2 n × 2 n (36)

In the ith iteration, we compute M i . Therefore, we need O( n ) iterations to compute M n1 = M 2 n+1 × 2 n+1 , where n is the number of variables of the Boolean function .

7. Discussion on a Specific Corner Case

Let’s consider a scenario where the Boolean function has n variables. And it evaluates to 1 in only one specific assignment of Boolean values to the set of n variables.

N= 2 n

|ψ= 1 N x=0 N1 |x| f( x )= a 0 | x 0 + a 1 | x 1 ++ a 2N1 | x 2N1

M[ a 0 a 1 a 2N1 ]=[ b 0 b 1 b 2N1 ]

b 0 = 1 N ( a 1 + a 3 + a 5 + )= 1 N

b 1 = 1 N ( a 0 + a 2 + a 4 + )= ( N1 ) 1 N N =1 1 N

| b i |= 1 N for2i2N1 (37)

As discussed earlier, if the given Boolean function is not satisfiable, a 0 , a 2 , a 4 , are all ones and a 1 , a 3 , a 5 , are all zeros. Therefore, in that case,

b 0 = 1 N ( a 1 + a 3 + a 5 + )=0

b 1 = 1 N ( a 0 + a 2 + a 4 + )=1

b i =0for2i2N1 (38)

Therefore, the probability of incorrectly getting | 0001 instead of | 0000 is significantly high.

To address this problem, we can use Unambiguous State Discrimination [4] [5].

Let’s say the Boolean formula evaluates to 1 for ( N1 ) cases and to 0 in one case. Let’s also assume that | ψ 1 is a state that indicates a tautology and | ψ 2 is the state that we derive. We need to unambiguously distinguish between these two non-orthogonal states.

Let’s assume that M 0 , M 1 , and M 2 be three operators such that if we get the outcome M 1 , we will be certain that the state was | ψ 1 . If we get the outcome M 2 , we will be certain that the state was | ψ 2 . The outcome M 0 means that the result is inconclusive.

In other words, M 1 must never trigger for | ψ 2 . M 2 must never trigger for | ψ 1 . And, the following holds:

M 0 + M 1 + M 2 =I (39)

Let | ψ 1 and | ψ 2 be the states orthogonal to | ψ 1 and | ψ 2 , respectively. Therefore, we can construct M 1 and M 2 in the following way:

M 1 =a| ψ 2 ψ 2 |

M 2 =b| ψ 1 ψ 1 |

M 0 =I M 1 M 2 (40)

We choose a and b in such a way that M 0 is minimized. We choose the following value for a and b :

a=b= 1 1+| ψ 1 | ψ 2 | (41)

Let’s look at an example. Let’s say the Boolean formula has two variables. It evaluates to 1 for 3 cases and to 0 in one case. The output state we obtain in this case is the following:

| ψ 2 =[ 0.75 0.25 0.25 0.25 0.25 0.25 0.25 0.25 ] (42)

If the Boolean formula was a tautology, we would have obtained the following state:

| ψ 1 =[ 1 0 0 0 0 0 0 0 ] (43)

Therefore, a and b , in our case, will be:

a=b= 1 1+| ψ 1 | ψ 2 | = 1 1.75 =0.57 (44)

Therefore, the probability of getting M 0 will be the following:

M 1 =a| ψ 2 ψ 2 |

M 2 =b| ψ 1 ψ 1 |

M 0 =I M 1 M 2

P( failure )= ψ 1 | M 0 | ψ 1 =0.75 (45)

Table 1 shows the probability of failures for different numbers of Boolean variables.

Table 1. Probability of failures.

Number of Boolean variables

Probability of failure

Minimum number of times the experiment should be repeated (k = a positive constant)

2

0.75

100

3

0.875

100

4

0.9375

100

5

0.96875

100

6

0.9843

100 × k

7

0.9921

100 × k

8

0.9960

100 × k

9

0.9980

100 × k

10

0.9990

1000 × k

11

0.99951

1000 × k

12

0.99975

1000 × k

13

0.999877

1000 × k

Therefore, we will get an inconclusive result 75% of the time, in which case we need to repeat the experiment. If the number of Boolean variables is 10, then the probability of getting an inconclusive result becomes 0.9990. In that case, if we repeat the experiment, for example, 1000 or 2000 times, in the worst case, we can correctly determine whether the Boolean formula is a tautology, satisfiable, or unsatisfiable.

Hence, if we repeat the experiment the required number of times, the proposed quantum algorithm can correctly predict whether the Boolean formula is a tautology, satisfiable, or unsatisfiable.

8. Time Complexity of The Proposed Quantum Algorithm

The value of M 2N×2N is constant for a given value of N= 2 n where n is the number of Boolean variables in . Therefore, once M is constructed for a specific N , we can use the same value of M for all Boolean functions with n variables.

The proposed quantum algorithm must be run a constant number of times to test whether the corresponding qubits are consistently | 000 or | 001 . If no, then the Boolean formula is satisfiable. If yes, then we need to repeat this experiment as described in Section 7.

Therefore, once we construct M , we can correctly determine whether the given Boolean function is a tautology, satisfiable, or non-satisfiable. And, construction M takes O( n ) time where n is the number of Boolean variables in the given Boolean function.

9. Conclusion

This paper proposes a quantum algorithm to solve the tautology and the satisfiability problems. In a classical computer, we may need to evaluate all 2 n assignments on n Boolean variables in the worst case. As a result, these problems can take O( 2 n ) time for n Boolean variables. However, the proposed quantum algorithm shows significant improvement, as the stated problem can be solved in O( 1 ) time, in most cases, once M is constructed. Only when we get the result | 0000 or | 0001 , we need to repeat the experiment as mentioned in the paper. Constructing M takes O( n ) time, where n is the number of Boolean variables of the given Boolean function.

Conflicts of Interest

The author declares no conflicts of interest regarding the publication of this paper.

References

[1] Goldreich, O. (2010) P, NP, and NP-Completeness: The Basics of Computational Complexity. Cambridge University Press.[CrossRef]
[2] Nielsen, M.A. and Chuang, I.L. (2010) Quantum Computation and Quantum Information: 10th Anniversary Edition. Cambridge University Press.
[3] Horn, R.A. and Johnson, C.R. (2012) Matrix Analysis. Cambridge University Press.[CrossRef]
[4] Paris, M. and Rehacek, J. (2004) Quantum State Estimation. Springer Science & Business Media.[CrossRef]
[5] (2025) POVM.
https://en.wikipedia.org/wiki/POVM

Copyright © 2026 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.