Is there an instance 3-SAT on which this algorithm fails?Is this a correct planar graph testing algorithm?Las Vegas algorithm to satisfy most clauses in SATNot All Equal 2-Sat Problemis this k-SAT or 3-SAT reduction?Finding a special sequence of colors in an edge-colored graphAlgorithm to check if there's a vertex where all other vertices are reachable from it.An example when greedy algorithm won't solve 3-SAT problemRandomized algorithm to satisfy conjunctive clausesShow that the depth of a BFS tree can't be larger than the depth of a DFS tree while they're operate on the same vertexHow would I reduce the Minimum Vertex Cover problem to a Weighted MAX SAT problem?

Dot above capital letter not centred

Is there any easy technique written in Bhagavad GITA to control lust?

Is there a problem with hiding "forgot password" until it's needed?

How does it work when somebody invests in my business?

How to be diplomatic in refusing to write code that breaches the privacy of our users

Failed to fetch jessie backports repository

Is this Spell Mimic feat balanced?

Can I Retrieve Email Addresses from BCC?

How can I use the arrow sign in my bash prompt?

apt-get update is failing in debian

Was the picture area of a CRT a parallelogram (instead of a true rectangle)?

Products and sum of cubes in Fibonacci

How could Frankenstein get the parts for his _second_ creature?

What would be the benefits of having both a state and local currencies?

Modify casing of marked letters

How can I replace every global instance of "x[2]" with "x_2"

The plural of 'stomach"

Will it be accepted, if there is no ''Main Character" stereotype?

There is only s̶i̶x̶t̶y one place he can be

How do I rename a LINUX host without needing to reboot for the rename to take effect?

What's a natural way to say that someone works somewhere (for a job)?

If you attempt to grapple an opponent that you are hidden from, do they roll at disadvantage?

Implement the Thanos sorting algorithm

Is there any reason not to eat food that's been dropped on the surface of the moon?



Is there an instance 3-SAT on which this algorithm fails?


Is this a correct planar graph testing algorithm?Las Vegas algorithm to satisfy most clauses in SATNot All Equal 2-Sat Problemis this k-SAT or 3-SAT reduction?Finding a special sequence of colors in an edge-colored graphAlgorithm to check if there's a vertex where all other vertices are reachable from it.An example when greedy algorithm won't solve 3-SAT problemRandomized algorithm to satisfy conjunctive clausesShow that the depth of a BFS tree can't be larger than the depth of a DFS tree while they're operate on the same vertexHow would I reduce the Minimum Vertex Cover problem to a Weighted MAX SAT problem?













0












$begingroup$


I'm not sure on how to express that in a very formal and absolutly correct way so I hope it is still understandable. I have found this algorithm and been struggling for a while proving it does or doesn't solve 3-SAT, maybe one of you can help find an example where it fails. It is inspired by this 2-SAT algorithm and is, I believe, polynomial time in the amount of variables, hence there probably exists a example where it fails. The idea is to represent higher order relations in the graph to be able to represent clauses that are made of a combination of 3 variables.



Suppose we have $m$ clauses and $n$ variables $x_1,dots,x_n$ in the usual setting, without loss of generality we can assume all the closes are made of exactly $3$ variables, that may not be distinct. A close $alor blor c$ where $a$, $b$, $c$ can be any variable or a variable negation can be rewritten in equivalent ways as
beginalign*
&lnot arightarrow (lnot brightarrow c)&&lnot (lnot brightarrow c)rightarrow a\
&lnot brightarrow (lnot arightarrow c)&&lnot (lnot arightarrow c)rightarrow b\
&lnot crightarrow (lnot arightarrow b)&&lnot (lnot arightarrow b)rightarrow c\
endalign*

using only implications and negation. From all the variables and clauses we construct a graph. For any variables $x_i$ and $x_j$ with $i<j$, then we have all the vertex labeled



  • $x_i$, $x_j$, $lnot x_i$ and $lnot x_j$


  • $x_irightarrow x_j$, $lnot x_irightarrow x_j$, $x_irightarrow lnot x_j$ and $lnot x_irightarrow lnot x_j$


  • $lnot(x_irightarrow x_j)$, $lnot(lnot x_irightarrow x_j)$, $lnot(x_irightarrow lnot x_j)$ and $lnot(lnot x_irightarrow lnot x_j)$


We also add the vertex labeled $0$ and $1$, they represent false and true and if there is an edge $1rightarrow a$ or $lnot a rightarrow 0$, then $a$ needs to be true. The total amount of vertices is $2+2n+8nchoose 2=4n^2+6n+1$. Regarding edges, they represent logical implication and so before taking a look at clauses the graph should contain some edges such as $lnot (arightarrow b) rightarrow lnot b$, $lnot a rightarrow (arightarrow b)$ but it turns out that only the edge from $0$ to $1$ and those from $a$ to $a$ (for any vertex $a$) are needed when taking into account the algorithm. The $m$ clauses all add exactly $6$ edges mentioned above to the graph and this is the initial graph.



The algorithm try to see if there exists a vertex (that may be the composition of $2$ variables) that is strongly connected to it's negation but for now it is not possible since edges only goes from vertex of the form $lnot(arightarrow b)$ to $lnot a$ and from $a$ to $lnot a rightarrow b$ but we can combine two edges into an other one to expend knowledge that can be deduced. Suppose we have that for some vertex $a$, $b$, $c$ and $d$ the edges from $a$ to $b$ and from $c$ to $d$, then we can deduce the two implications



  • $(aland c)rightarrow(bland d)$

  • $(alor c)rightarrow(blor d)$

where the $land$ and $lor$ operator are the usual logical and and or. If the logical values of $(aland c)$ and of $(bland d)$ both matches with the logical value of two vertices then we add the corresponding edge to the graph, the same happen for the second line. $aland b$ is the combination of at most $4$ variables and so we can extends the tables of values it can take (as a function of the variables it is made of) which is at most $16$ different possibilities, then we can compare those the one we would obtain with any vertex of the graph that involve the same variables ($2$ by $2$, $1$ by $1$ or even the vertex $0$ or $1$). This operation can be done in constant time.



The algorithm is just an iterative application of these edges deductions, suppose we have the directed graph $G=(V,E)$ in input then a pseudo code for the algorithm is




  • $Sleftarrow emptyset$

  • $Rleftarrow (e,e')in Etimes E, eneq e'$

  • while $Rneq emptyset$

    • $E'leftarrow emptyset$

    • for all $(a,b),(c,d) in R$

    • if $aland cin G$ and $bland din G$ : $E'leftarrow E' cup (aland c,bland d)$

    • if $alor cin G$ and $blor din G$ : $E'leftarrow E' cup (alor c,blor d)$

    • $Sleftarrow Scup R$

    • $Eleftarrow Ecup E'$

    • run BFS on $G=(V,E)$ and add all deduced edges that correspond to paths in $E'$

    • $Rleftarrow e,e' setminus S$


  • return true if $(1,0)in E$ and false otherwise



The BFS line is just running BFS and adding to $E'$ an edge from $a$ to $b$ if there exists a path from $a$ to $b$, this can be optimized by remembering all visited edges from iterations to iterations of this BFS but it doesn't matter since BFS is polynomial in the number of vertex and hence of variable.



The set $S$ contains the pair of edges we have already tried to combine and $R$ is the set of new pair of edges we could combine, since we iterate until we don't have anything else to combine, the cardinality of $S$ is strictly increasing at each iterations and so the worst case is an increase by one at each steps. The amount of edges of the graph is at most $|V|(|V|-1)=O(n^4)$ and so the amount of combination of two different edge we can have is $O(n^8)$ and this is the complexity of the number of time we do any of the line inside the inner and outer loop, hence I think that this algorithm runs in polynomial time.



The return condition is equivalent to the one of having a vertex and its logical negation strongly connected, indeed if for some vertex $a$ we have $arightarrow lnot a$ then we combine it with the edge $lnot arightarrow lnot a$ to get $1=alor lnot a rightarrow lnot a lor lnot a = lnot a$, if we also have $lnot a rightarrow a$, we can combine it with $lnot arightarrow lnot a$ to get $lnot a = lnot a land lnot a rightarrow lnot aland 0 = 0$ and hence, combining the two we can deduce a path from $1$ to $0$.




Here I list some of the things the algorithm does or preserves. First observe that there should be a lot of edges in the graph in the beginning such as $arightarrow (lnot arightarrow b)$ since they are tautologies, those edges are always deduced at the first iteration of the algorithm since we can combine the two edges $b rightarrow b$ and $0rightarrow 1$ with $land$ to get that $0rightarrow b$ and then we can combine this one with $arightarrow a$ using $lor$ to get that $arightarrow (lnot arightarrow b)= alor b$.



If there is an edge from $1$ to $arightarrow b$ then the later is considered true and we would like to add an edge from $a$ to $b$ (which are in the graph), this is done combining the edge with $arightarrow (lnot arightarrow b)$ using $land$ to get that $aland 1 = arightarrow b=(lnot arightarrow b)land (arightarrow b)$, the converse is also true, if we have an edge from $a$ to $b$ and they are either variable or negation of variable, then combining them using $lor$ gets us $1rightarrow (arightarrow b)$.



At the end of the while loop (or begining) it is always true that if we have an edge from any vertex $a$ to $b$, then we also have an edge from $lnot b$ to $lnot a$, indeed this property is true in the begining of the algorithm and if we combine $arightarrow b$ and $crightarrow d$, then we also combine $lnot brightarrow lnot a$ and $lnot drightarrow lnot c$ to get the two wanted edges.



If we have the two clauses $(alor blor c)land(lnot alor d lor e)$, then there will be an edge from $(lnot brightarrow c)$ to $(lnot drightarrow e)$, this is seen easily from the initial edges plus the BFS. In particular $(alor blor c)land(lnot alor b lor c)$ will add an edge from $lnot b$ to $c$.




Since we don't add any implication that may be false, then of course if the algorithm returns false, then the 3-SAT was not satisfiable so the only thing to prove or disprove is that if the algorithm return true, then the 3-SAT has solution. My guess is that there is probably a example of 3-SAT that is not satisfiable where my algorithm return true but I failed to find one.










share|cite|improve this question











$endgroup$
















    0












    $begingroup$


    I'm not sure on how to express that in a very formal and absolutly correct way so I hope it is still understandable. I have found this algorithm and been struggling for a while proving it does or doesn't solve 3-SAT, maybe one of you can help find an example where it fails. It is inspired by this 2-SAT algorithm and is, I believe, polynomial time in the amount of variables, hence there probably exists a example where it fails. The idea is to represent higher order relations in the graph to be able to represent clauses that are made of a combination of 3 variables.



    Suppose we have $m$ clauses and $n$ variables $x_1,dots,x_n$ in the usual setting, without loss of generality we can assume all the closes are made of exactly $3$ variables, that may not be distinct. A close $alor blor c$ where $a$, $b$, $c$ can be any variable or a variable negation can be rewritten in equivalent ways as
    beginalign*
    &lnot arightarrow (lnot brightarrow c)&&lnot (lnot brightarrow c)rightarrow a\
    &lnot brightarrow (lnot arightarrow c)&&lnot (lnot arightarrow c)rightarrow b\
    &lnot crightarrow (lnot arightarrow b)&&lnot (lnot arightarrow b)rightarrow c\
    endalign*

    using only implications and negation. From all the variables and clauses we construct a graph. For any variables $x_i$ and $x_j$ with $i<j$, then we have all the vertex labeled



    • $x_i$, $x_j$, $lnot x_i$ and $lnot x_j$


    • $x_irightarrow x_j$, $lnot x_irightarrow x_j$, $x_irightarrow lnot x_j$ and $lnot x_irightarrow lnot x_j$


    • $lnot(x_irightarrow x_j)$, $lnot(lnot x_irightarrow x_j)$, $lnot(x_irightarrow lnot x_j)$ and $lnot(lnot x_irightarrow lnot x_j)$


    We also add the vertex labeled $0$ and $1$, they represent false and true and if there is an edge $1rightarrow a$ or $lnot a rightarrow 0$, then $a$ needs to be true. The total amount of vertices is $2+2n+8nchoose 2=4n^2+6n+1$. Regarding edges, they represent logical implication and so before taking a look at clauses the graph should contain some edges such as $lnot (arightarrow b) rightarrow lnot b$, $lnot a rightarrow (arightarrow b)$ but it turns out that only the edge from $0$ to $1$ and those from $a$ to $a$ (for any vertex $a$) are needed when taking into account the algorithm. The $m$ clauses all add exactly $6$ edges mentioned above to the graph and this is the initial graph.



    The algorithm try to see if there exists a vertex (that may be the composition of $2$ variables) that is strongly connected to it's negation but for now it is not possible since edges only goes from vertex of the form $lnot(arightarrow b)$ to $lnot a$ and from $a$ to $lnot a rightarrow b$ but we can combine two edges into an other one to expend knowledge that can be deduced. Suppose we have that for some vertex $a$, $b$, $c$ and $d$ the edges from $a$ to $b$ and from $c$ to $d$, then we can deduce the two implications



    • $(aland c)rightarrow(bland d)$

    • $(alor c)rightarrow(blor d)$

    where the $land$ and $lor$ operator are the usual logical and and or. If the logical values of $(aland c)$ and of $(bland d)$ both matches with the logical value of two vertices then we add the corresponding edge to the graph, the same happen for the second line. $aland b$ is the combination of at most $4$ variables and so we can extends the tables of values it can take (as a function of the variables it is made of) which is at most $16$ different possibilities, then we can compare those the one we would obtain with any vertex of the graph that involve the same variables ($2$ by $2$, $1$ by $1$ or even the vertex $0$ or $1$). This operation can be done in constant time.



    The algorithm is just an iterative application of these edges deductions, suppose we have the directed graph $G=(V,E)$ in input then a pseudo code for the algorithm is




    • $Sleftarrow emptyset$

    • $Rleftarrow (e,e')in Etimes E, eneq e'$

    • while $Rneq emptyset$

      • $E'leftarrow emptyset$

      • for all $(a,b),(c,d) in R$

      • if $aland cin G$ and $bland din G$ : $E'leftarrow E' cup (aland c,bland d)$

      • if $alor cin G$ and $blor din G$ : $E'leftarrow E' cup (alor c,blor d)$

      • $Sleftarrow Scup R$

      • $Eleftarrow Ecup E'$

      • run BFS on $G=(V,E)$ and add all deduced edges that correspond to paths in $E'$

      • $Rleftarrow e,e' setminus S$


    • return true if $(1,0)in E$ and false otherwise



    The BFS line is just running BFS and adding to $E'$ an edge from $a$ to $b$ if there exists a path from $a$ to $b$, this can be optimized by remembering all visited edges from iterations to iterations of this BFS but it doesn't matter since BFS is polynomial in the number of vertex and hence of variable.



    The set $S$ contains the pair of edges we have already tried to combine and $R$ is the set of new pair of edges we could combine, since we iterate until we don't have anything else to combine, the cardinality of $S$ is strictly increasing at each iterations and so the worst case is an increase by one at each steps. The amount of edges of the graph is at most $|V|(|V|-1)=O(n^4)$ and so the amount of combination of two different edge we can have is $O(n^8)$ and this is the complexity of the number of time we do any of the line inside the inner and outer loop, hence I think that this algorithm runs in polynomial time.



    The return condition is equivalent to the one of having a vertex and its logical negation strongly connected, indeed if for some vertex $a$ we have $arightarrow lnot a$ then we combine it with the edge $lnot arightarrow lnot a$ to get $1=alor lnot a rightarrow lnot a lor lnot a = lnot a$, if we also have $lnot a rightarrow a$, we can combine it with $lnot arightarrow lnot a$ to get $lnot a = lnot a land lnot a rightarrow lnot aland 0 = 0$ and hence, combining the two we can deduce a path from $1$ to $0$.




    Here I list some of the things the algorithm does or preserves. First observe that there should be a lot of edges in the graph in the beginning such as $arightarrow (lnot arightarrow b)$ since they are tautologies, those edges are always deduced at the first iteration of the algorithm since we can combine the two edges $b rightarrow b$ and $0rightarrow 1$ with $land$ to get that $0rightarrow b$ and then we can combine this one with $arightarrow a$ using $lor$ to get that $arightarrow (lnot arightarrow b)= alor b$.



    If there is an edge from $1$ to $arightarrow b$ then the later is considered true and we would like to add an edge from $a$ to $b$ (which are in the graph), this is done combining the edge with $arightarrow (lnot arightarrow b)$ using $land$ to get that $aland 1 = arightarrow b=(lnot arightarrow b)land (arightarrow b)$, the converse is also true, if we have an edge from $a$ to $b$ and they are either variable or negation of variable, then combining them using $lor$ gets us $1rightarrow (arightarrow b)$.



    At the end of the while loop (or begining) it is always true that if we have an edge from any vertex $a$ to $b$, then we also have an edge from $lnot b$ to $lnot a$, indeed this property is true in the begining of the algorithm and if we combine $arightarrow b$ and $crightarrow d$, then we also combine $lnot brightarrow lnot a$ and $lnot drightarrow lnot c$ to get the two wanted edges.



    If we have the two clauses $(alor blor c)land(lnot alor d lor e)$, then there will be an edge from $(lnot brightarrow c)$ to $(lnot drightarrow e)$, this is seen easily from the initial edges plus the BFS. In particular $(alor blor c)land(lnot alor b lor c)$ will add an edge from $lnot b$ to $c$.




    Since we don't add any implication that may be false, then of course if the algorithm returns false, then the 3-SAT was not satisfiable so the only thing to prove or disprove is that if the algorithm return true, then the 3-SAT has solution. My guess is that there is probably a example of 3-SAT that is not satisfiable where my algorithm return true but I failed to find one.










    share|cite|improve this question











    $endgroup$














      0












      0








      0


      0



      $begingroup$


      I'm not sure on how to express that in a very formal and absolutly correct way so I hope it is still understandable. I have found this algorithm and been struggling for a while proving it does or doesn't solve 3-SAT, maybe one of you can help find an example where it fails. It is inspired by this 2-SAT algorithm and is, I believe, polynomial time in the amount of variables, hence there probably exists a example where it fails. The idea is to represent higher order relations in the graph to be able to represent clauses that are made of a combination of 3 variables.



      Suppose we have $m$ clauses and $n$ variables $x_1,dots,x_n$ in the usual setting, without loss of generality we can assume all the closes are made of exactly $3$ variables, that may not be distinct. A close $alor blor c$ where $a$, $b$, $c$ can be any variable or a variable negation can be rewritten in equivalent ways as
      beginalign*
      &lnot arightarrow (lnot brightarrow c)&&lnot (lnot brightarrow c)rightarrow a\
      &lnot brightarrow (lnot arightarrow c)&&lnot (lnot arightarrow c)rightarrow b\
      &lnot crightarrow (lnot arightarrow b)&&lnot (lnot arightarrow b)rightarrow c\
      endalign*

      using only implications and negation. From all the variables and clauses we construct a graph. For any variables $x_i$ and $x_j$ with $i<j$, then we have all the vertex labeled



      • $x_i$, $x_j$, $lnot x_i$ and $lnot x_j$


      • $x_irightarrow x_j$, $lnot x_irightarrow x_j$, $x_irightarrow lnot x_j$ and $lnot x_irightarrow lnot x_j$


      • $lnot(x_irightarrow x_j)$, $lnot(lnot x_irightarrow x_j)$, $lnot(x_irightarrow lnot x_j)$ and $lnot(lnot x_irightarrow lnot x_j)$


      We also add the vertex labeled $0$ and $1$, they represent false and true and if there is an edge $1rightarrow a$ or $lnot a rightarrow 0$, then $a$ needs to be true. The total amount of vertices is $2+2n+8nchoose 2=4n^2+6n+1$. Regarding edges, they represent logical implication and so before taking a look at clauses the graph should contain some edges such as $lnot (arightarrow b) rightarrow lnot b$, $lnot a rightarrow (arightarrow b)$ but it turns out that only the edge from $0$ to $1$ and those from $a$ to $a$ (for any vertex $a$) are needed when taking into account the algorithm. The $m$ clauses all add exactly $6$ edges mentioned above to the graph and this is the initial graph.



      The algorithm try to see if there exists a vertex (that may be the composition of $2$ variables) that is strongly connected to it's negation but for now it is not possible since edges only goes from vertex of the form $lnot(arightarrow b)$ to $lnot a$ and from $a$ to $lnot a rightarrow b$ but we can combine two edges into an other one to expend knowledge that can be deduced. Suppose we have that for some vertex $a$, $b$, $c$ and $d$ the edges from $a$ to $b$ and from $c$ to $d$, then we can deduce the two implications



      • $(aland c)rightarrow(bland d)$

      • $(alor c)rightarrow(blor d)$

      where the $land$ and $lor$ operator are the usual logical and and or. If the logical values of $(aland c)$ and of $(bland d)$ both matches with the logical value of two vertices then we add the corresponding edge to the graph, the same happen for the second line. $aland b$ is the combination of at most $4$ variables and so we can extends the tables of values it can take (as a function of the variables it is made of) which is at most $16$ different possibilities, then we can compare those the one we would obtain with any vertex of the graph that involve the same variables ($2$ by $2$, $1$ by $1$ or even the vertex $0$ or $1$). This operation can be done in constant time.



      The algorithm is just an iterative application of these edges deductions, suppose we have the directed graph $G=(V,E)$ in input then a pseudo code for the algorithm is




      • $Sleftarrow emptyset$

      • $Rleftarrow (e,e')in Etimes E, eneq e'$

      • while $Rneq emptyset$

        • $E'leftarrow emptyset$

        • for all $(a,b),(c,d) in R$

        • if $aland cin G$ and $bland din G$ : $E'leftarrow E' cup (aland c,bland d)$

        • if $alor cin G$ and $blor din G$ : $E'leftarrow E' cup (alor c,blor d)$

        • $Sleftarrow Scup R$

        • $Eleftarrow Ecup E'$

        • run BFS on $G=(V,E)$ and add all deduced edges that correspond to paths in $E'$

        • $Rleftarrow e,e' setminus S$


      • return true if $(1,0)in E$ and false otherwise



      The BFS line is just running BFS and adding to $E'$ an edge from $a$ to $b$ if there exists a path from $a$ to $b$, this can be optimized by remembering all visited edges from iterations to iterations of this BFS but it doesn't matter since BFS is polynomial in the number of vertex and hence of variable.



      The set $S$ contains the pair of edges we have already tried to combine and $R$ is the set of new pair of edges we could combine, since we iterate until we don't have anything else to combine, the cardinality of $S$ is strictly increasing at each iterations and so the worst case is an increase by one at each steps. The amount of edges of the graph is at most $|V|(|V|-1)=O(n^4)$ and so the amount of combination of two different edge we can have is $O(n^8)$ and this is the complexity of the number of time we do any of the line inside the inner and outer loop, hence I think that this algorithm runs in polynomial time.



      The return condition is equivalent to the one of having a vertex and its logical negation strongly connected, indeed if for some vertex $a$ we have $arightarrow lnot a$ then we combine it with the edge $lnot arightarrow lnot a$ to get $1=alor lnot a rightarrow lnot a lor lnot a = lnot a$, if we also have $lnot a rightarrow a$, we can combine it with $lnot arightarrow lnot a$ to get $lnot a = lnot a land lnot a rightarrow lnot aland 0 = 0$ and hence, combining the two we can deduce a path from $1$ to $0$.




      Here I list some of the things the algorithm does or preserves. First observe that there should be a lot of edges in the graph in the beginning such as $arightarrow (lnot arightarrow b)$ since they are tautologies, those edges are always deduced at the first iteration of the algorithm since we can combine the two edges $b rightarrow b$ and $0rightarrow 1$ with $land$ to get that $0rightarrow b$ and then we can combine this one with $arightarrow a$ using $lor$ to get that $arightarrow (lnot arightarrow b)= alor b$.



      If there is an edge from $1$ to $arightarrow b$ then the later is considered true and we would like to add an edge from $a$ to $b$ (which are in the graph), this is done combining the edge with $arightarrow (lnot arightarrow b)$ using $land$ to get that $aland 1 = arightarrow b=(lnot arightarrow b)land (arightarrow b)$, the converse is also true, if we have an edge from $a$ to $b$ and they are either variable or negation of variable, then combining them using $lor$ gets us $1rightarrow (arightarrow b)$.



      At the end of the while loop (or begining) it is always true that if we have an edge from any vertex $a$ to $b$, then we also have an edge from $lnot b$ to $lnot a$, indeed this property is true in the begining of the algorithm and if we combine $arightarrow b$ and $crightarrow d$, then we also combine $lnot brightarrow lnot a$ and $lnot drightarrow lnot c$ to get the two wanted edges.



      If we have the two clauses $(alor blor c)land(lnot alor d lor e)$, then there will be an edge from $(lnot brightarrow c)$ to $(lnot drightarrow e)$, this is seen easily from the initial edges plus the BFS. In particular $(alor blor c)land(lnot alor b lor c)$ will add an edge from $lnot b$ to $c$.




      Since we don't add any implication that may be false, then of course if the algorithm returns false, then the 3-SAT was not satisfiable so the only thing to prove or disprove is that if the algorithm return true, then the 3-SAT has solution. My guess is that there is probably a example of 3-SAT that is not satisfiable where my algorithm return true but I failed to find one.










      share|cite|improve this question











      $endgroup$




      I'm not sure on how to express that in a very formal and absolutly correct way so I hope it is still understandable. I have found this algorithm and been struggling for a while proving it does or doesn't solve 3-SAT, maybe one of you can help find an example where it fails. It is inspired by this 2-SAT algorithm and is, I believe, polynomial time in the amount of variables, hence there probably exists a example where it fails. The idea is to represent higher order relations in the graph to be able to represent clauses that are made of a combination of 3 variables.



      Suppose we have $m$ clauses and $n$ variables $x_1,dots,x_n$ in the usual setting, without loss of generality we can assume all the closes are made of exactly $3$ variables, that may not be distinct. A close $alor blor c$ where $a$, $b$, $c$ can be any variable or a variable negation can be rewritten in equivalent ways as
      beginalign*
      &lnot arightarrow (lnot brightarrow c)&&lnot (lnot brightarrow c)rightarrow a\
      &lnot brightarrow (lnot arightarrow c)&&lnot (lnot arightarrow c)rightarrow b\
      &lnot crightarrow (lnot arightarrow b)&&lnot (lnot arightarrow b)rightarrow c\
      endalign*

      using only implications and negation. From all the variables and clauses we construct a graph. For any variables $x_i$ and $x_j$ with $i<j$, then we have all the vertex labeled



      • $x_i$, $x_j$, $lnot x_i$ and $lnot x_j$


      • $x_irightarrow x_j$, $lnot x_irightarrow x_j$, $x_irightarrow lnot x_j$ and $lnot x_irightarrow lnot x_j$


      • $lnot(x_irightarrow x_j)$, $lnot(lnot x_irightarrow x_j)$, $lnot(x_irightarrow lnot x_j)$ and $lnot(lnot x_irightarrow lnot x_j)$


      We also add the vertex labeled $0$ and $1$, they represent false and true and if there is an edge $1rightarrow a$ or $lnot a rightarrow 0$, then $a$ needs to be true. The total amount of vertices is $2+2n+8nchoose 2=4n^2+6n+1$. Regarding edges, they represent logical implication and so before taking a look at clauses the graph should contain some edges such as $lnot (arightarrow b) rightarrow lnot b$, $lnot a rightarrow (arightarrow b)$ but it turns out that only the edge from $0$ to $1$ and those from $a$ to $a$ (for any vertex $a$) are needed when taking into account the algorithm. The $m$ clauses all add exactly $6$ edges mentioned above to the graph and this is the initial graph.



      The algorithm try to see if there exists a vertex (that may be the composition of $2$ variables) that is strongly connected to it's negation but for now it is not possible since edges only goes from vertex of the form $lnot(arightarrow b)$ to $lnot a$ and from $a$ to $lnot a rightarrow b$ but we can combine two edges into an other one to expend knowledge that can be deduced. Suppose we have that for some vertex $a$, $b$, $c$ and $d$ the edges from $a$ to $b$ and from $c$ to $d$, then we can deduce the two implications



      • $(aland c)rightarrow(bland d)$

      • $(alor c)rightarrow(blor d)$

      where the $land$ and $lor$ operator are the usual logical and and or. If the logical values of $(aland c)$ and of $(bland d)$ both matches with the logical value of two vertices then we add the corresponding edge to the graph, the same happen for the second line. $aland b$ is the combination of at most $4$ variables and so we can extends the tables of values it can take (as a function of the variables it is made of) which is at most $16$ different possibilities, then we can compare those the one we would obtain with any vertex of the graph that involve the same variables ($2$ by $2$, $1$ by $1$ or even the vertex $0$ or $1$). This operation can be done in constant time.



      The algorithm is just an iterative application of these edges deductions, suppose we have the directed graph $G=(V,E)$ in input then a pseudo code for the algorithm is




      • $Sleftarrow emptyset$

      • $Rleftarrow (e,e')in Etimes E, eneq e'$

      • while $Rneq emptyset$

        • $E'leftarrow emptyset$

        • for all $(a,b),(c,d) in R$

        • if $aland cin G$ and $bland din G$ : $E'leftarrow E' cup (aland c,bland d)$

        • if $alor cin G$ and $blor din G$ : $E'leftarrow E' cup (alor c,blor d)$

        • $Sleftarrow Scup R$

        • $Eleftarrow Ecup E'$

        • run BFS on $G=(V,E)$ and add all deduced edges that correspond to paths in $E'$

        • $Rleftarrow e,e' setminus S$


      • return true if $(1,0)in E$ and false otherwise



      The BFS line is just running BFS and adding to $E'$ an edge from $a$ to $b$ if there exists a path from $a$ to $b$, this can be optimized by remembering all visited edges from iterations to iterations of this BFS but it doesn't matter since BFS is polynomial in the number of vertex and hence of variable.



      The set $S$ contains the pair of edges we have already tried to combine and $R$ is the set of new pair of edges we could combine, since we iterate until we don't have anything else to combine, the cardinality of $S$ is strictly increasing at each iterations and so the worst case is an increase by one at each steps. The amount of edges of the graph is at most $|V|(|V|-1)=O(n^4)$ and so the amount of combination of two different edge we can have is $O(n^8)$ and this is the complexity of the number of time we do any of the line inside the inner and outer loop, hence I think that this algorithm runs in polynomial time.



      The return condition is equivalent to the one of having a vertex and its logical negation strongly connected, indeed if for some vertex $a$ we have $arightarrow lnot a$ then we combine it with the edge $lnot arightarrow lnot a$ to get $1=alor lnot a rightarrow lnot a lor lnot a = lnot a$, if we also have $lnot a rightarrow a$, we can combine it with $lnot arightarrow lnot a$ to get $lnot a = lnot a land lnot a rightarrow lnot aland 0 = 0$ and hence, combining the two we can deduce a path from $1$ to $0$.




      Here I list some of the things the algorithm does or preserves. First observe that there should be a lot of edges in the graph in the beginning such as $arightarrow (lnot arightarrow b)$ since they are tautologies, those edges are always deduced at the first iteration of the algorithm since we can combine the two edges $b rightarrow b$ and $0rightarrow 1$ with $land$ to get that $0rightarrow b$ and then we can combine this one with $arightarrow a$ using $lor$ to get that $arightarrow (lnot arightarrow b)= alor b$.



      If there is an edge from $1$ to $arightarrow b$ then the later is considered true and we would like to add an edge from $a$ to $b$ (which are in the graph), this is done combining the edge with $arightarrow (lnot arightarrow b)$ using $land$ to get that $aland 1 = arightarrow b=(lnot arightarrow b)land (arightarrow b)$, the converse is also true, if we have an edge from $a$ to $b$ and they are either variable or negation of variable, then combining them using $lor$ gets us $1rightarrow (arightarrow b)$.



      At the end of the while loop (or begining) it is always true that if we have an edge from any vertex $a$ to $b$, then we also have an edge from $lnot b$ to $lnot a$, indeed this property is true in the begining of the algorithm and if we combine $arightarrow b$ and $crightarrow d$, then we also combine $lnot brightarrow lnot a$ and $lnot drightarrow lnot c$ to get the two wanted edges.



      If we have the two clauses $(alor blor c)land(lnot alor d lor e)$, then there will be an edge from $(lnot brightarrow c)$ to $(lnot drightarrow e)$, this is seen easily from the initial edges plus the BFS. In particular $(alor blor c)land(lnot alor b lor c)$ will add an edge from $lnot b$ to $c$.




      Since we don't add any implication that may be false, then of course if the algorithm returns false, then the 3-SAT was not satisfiable so the only thing to prove or disprove is that if the algorithm return true, then the 3-SAT has solution. My guess is that there is probably a example of 3-SAT that is not satisfiable where my algorithm return true but I failed to find one.







      graph-theory algorithms satisfiability






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Mar 17 at 15:03







      P. Quinton

















      asked Mar 17 at 13:04









      P. QuintonP. Quinton

      1,9411214




      1,9411214




















          0






          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "69"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3151521%2fis-there-an-instance-3-sat-on-which-this-algorithm-fails%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Mathematics Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3151521%2fis-there-an-instance-3-sat-on-which-this-algorithm-fails%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Lowndes Grove History Architecture References Navigation menu32°48′6″N 79°57′58″W / 32.80167°N 79.96611°W / 32.80167; -79.9661132°48′6″N 79°57′58″W / 32.80167°N 79.96611°W / 32.80167; -79.9661178002500"National Register Information System"Historic houses of South Carolina"Lowndes Grove""+32° 48' 6.00", −79° 57' 58.00""Lowndes Grove, Charleston County (260 St. Margaret St., Charleston)""Lowndes Grove"The Charleston ExpositionIt Happened in South Carolina"Lowndes Grove (House), Saint Margaret Street & Sixth Avenue, Charleston, Charleston County, SC(Photographs)"Plantations of the Carolina Low Countrye

          random experiment with two different functions on unit interval Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)Random variable and probability space notionsRandom Walk with EdgesFinding functions where the increase over a random interval is Poisson distributedNumber of days until dayCan an observed event in fact be of zero probability?Unit random processmodels of coins and uniform distributionHow to get the number of successes given $n$ trials , probability $P$ and a random variable $X$Absorbing Markov chain in a computer. Is “almost every” turned into always convergence in computer executions?Stopped random walk is not uniformly integrable

          How should I support this large drywall patch? Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How do I cover large gaps in drywall?How do I keep drywall around a patch from crumbling?Can I glue a second layer of drywall?How to patch long strip on drywall?Large drywall patch: how to avoid bulging seams?Drywall Mesh Patch vs. Bulge? To remove or not to remove?How to fix this drywall job?Prep drywall before backsplashWhat's the best way to fix this horrible drywall patch job?Drywall patching using 3M Patch Plus Primer