Based on SAT problem and Grover's algorithm, I've done some experiments. For the below example, I've received unexpected results:
Input: boolean function:
c example 4 p cnf 3 4 1 -2 -3 0 1 -2 3 0 1 2 -3 0 -1 -2 -3 0
Truth table of boolean function:
- Histogram of results
According to the truth table, the results should be ['000', '001', '011', '101']. Why does the algorithm not return the expected solutions?
EDIT: Regarding the first comment. I've noticed that for boolean function:
c example 3
p cnf 3 3
1 -2 -3 0
1 -2 3 0
1 2 -3 0
We get the correct results. In this example $M>N/2$.Additionally, I've noticed that the first example is a balanced function and the second one is not. Is it relevant?