Questions tagged [2-sat]

60 questions
14
votes
3 answers

Is 2-SAT with XOR-relations NP-complete?

I'm wondering if there is a polynomial algorithm for "2-SAT with XOR-relations". Both 2-SAT and XOR-SAT are in P, but is its combination? Example Input: 2-SAT part: (a or !b) and (b or c) and (b or d) XOR part : (a xor b xor c xor 1) and (b xor c…
Albert Hendriks
  • 2,481
  • 16
  • 35
9
votes
1 answer

Is a "local" version of 3-SAT NP-hard?

Below is my simplification of part of a larger research project on spatial Bayesian networks: Say a variable is "$k$-local" in a string $C \in 3\text{-CNF}$ if there are fewer than $k$ clauses between the first and last clause in which it appears…
SapereAude
  • 339
  • 1
  • 10
5
votes
1 answer

Show that the SAT Problem for CNF formulas with at most two occurences of each variable can be solved in polynomial time

Assuming I have an arbitrary CNF Formula in which each variable has at most two occurrences, how can I prove/show that this can be solved in polynomial time? My first thoughts so far: because each variable has at most two occurrences, the formula…
Eden Hassard
  • 63
  • 1
  • 3
5
votes
1 answer

Even, Itai & Shamir's limited backtracking algorithm for 2-SAT: is it really linear?

I have read in Wikipedia (and other sources) about the limited backtracking algorithm of Even, Itai & Shamir for solving 2-SAT problem in a linear time, but the approach doesn't seem to be linear, there is no demonstration nor algorithm…
younes zeboudj
  • 219
  • 1
  • 10
5
votes
2 answers

Can you solve 2-sat problem when truth assignments of some variables are determined

I am trying to find a assignment to satisfy a 2-sat statement. Problem is some of the clauses are 0 or x or 1 or x. I think the 1 or x clauses have no effect on the solution, but the 0 or x clauses determine the value for x. As I have clauses like…
Saeid
  • 349
  • 3
  • 15
4
votes
2 answers

2-SAT implication Understanding

Having a simple 2-SAT problem where the equation is simply: $a \lor b$ We have two implications: $\lnot a \Rightarrow b$ $\lnot b \Rightarrow a$ Thus, in the graph we build we add edges similar to the arrows above. What exactly do the arrows…
fragga
  • 41
  • 2
4
votes
1 answer

How to do last step of Krom's algorithm for solving 2SAT problems

I was making a program for solving 2 SAT problems, using Krom's algorithm. I did not found a lot of information searching in Google, so I used Wikipedia's description of Krom's algorithm to implement it but I'm stuck in the last step. If I…
RabidTunes
  • 143
  • 6
4
votes
1 answer

3-SAT with atmost 3 variables and variable occuring once per clause

I've stumbled across this problem on CSES https://cses.fi/345/task/E/ and was wondering is it somehow reducible to 2-SAT with given constraints? So, the problem states that you need to solve a 3-SAT given in a CNF form, albeit a special case,…
4
votes
3 answers

Why can $2$-SAT be solvable efficiently, but $3$-SAT not?

I am aware that 2SAT is polynomial while 3SAT is not, but I am looking for an intuition why its so. After all, even in 2SAT we can attempt all possible truth functions and its $2^n$. So I am hoping not for a formal proof, but for intuition or…
V. Prasad
  • 135
  • 7
4
votes
2 answers

How Tarjan algorithm work for the 2-SAT

Tarjan's algorithm for 2-SAT is based on the truth: a 2-CNF formula is satisfiable if and only if there is no variable that belongs to the same strongly connected component as its negation. But I don't find any reason for the right to left…
Asherydev
  • 41
  • 1
3
votes
1 answer

Is SAT-Problem with XOR and AND NP-complete

Is this problem NP-complete? I have many restrictions like this and want to find a feasible solution: ((a and b) xor (c and d)) = 1 with a,b,c,d are arbitrary literals. It looks similar to XOR-2SAT but has additional ANDs inside the clause.
guest1000
  • 31
  • 2
3
votes
0 answers

"Balancing" positive and negative literals in 2-sat

I saw in an answer to this post that it is possible to construct 3-sat clauses with extra variables such that the number of positive and negative literals for each variable are equal. Does anyone know of a construction for 2-sat instances to…
Ari
  • 1,661
  • 10
  • 23
3
votes
1 answer

Is 2-SAT over Linear Real Arithmetic in P or NP?

The general boolean satisfiability problem (SAT) is NP-complete, and thus can't be solved in polynomial time (assuming $P \neq NP$). But the special case of 2-SAT is in P, and can be solved in linear time. 2-SAT formulas consist of the conjunction…
3
votes
1 answer

Expected length of a random walk on a line

I am given the following randomized algorithm for SAT, Input: A satisfiable CNF-formula $\varphi$. Output: An assignment $\rho$, such that $\rho \models \varphi$. The algorithm works as follow: Choose an arbitrary assignment $\rho$. As long as…
3
votes
2 answers

Give an NL-algorithm for complement of 2-SAT

Question1: What is the difference between 2SAT and the complement of 2SAT? Question2: It is known that NL is contained in P, but what we know about P over NL? can be said that an algorithm that runs in P, uses NL space? Information That I gather I…
user2668676
  • 101
  • 1
  • 8
1
2 3 4