2

My Question is, what is meant with smallest number N. Does it mean I should try every possible constellation of the n variables and put each one of them into the formula φ and then use 3Sat on that? Then it would be 2$^{n}$? Is that meant?

OttoFran
  • 73
  • 1
  • 8

2 Answers2

2

You are given a machine which solves SAT. You can give it any formula $\varphi$, pay a fee of \$1, and then it immediately tells you whether $\varphi$ is satisfiable or not.

Using this machine, you want to find a satisfying assignment for a formula $\psi$ on $n$ variables which is promised to be satisfiable. How much would it cost you, using the optimal strategy? (You're trying to minimize the cost, which is the same as minimizing the number of invocations of the machine.)

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
  • SAT only tells me if it is satisfiable, so how should I get a satisfiable assignment out of that? Thats why I thought I have to try all possible combinations for the n variables of φ and then use SAT on that. That would be 2$^{n}$ combinations. Is that correct? – OttoFran Dec 07 '21 at 14:49
  • 1
    You can do a lot better. This is your question, though, so I don’t want to ruin it by spelling out the answer. – Yuval Filmus Dec 07 '21 at 14:50
  • I don't get it can you give me at least a small hint. (For me its unclear how i can check with a general SAT check if an explicit assignment is satisfiable) – OttoFran Dec 07 '21 at 15:37
  • It’s not supposed to be obvious or immediate. It requires an idea. – Yuval Filmus Dec 07 '21 at 15:39
2

You could try every possible assignment but you can do better.

Think about how you solve this problem recursively: Given bits $x_0^* \ldots x_i^*$ and we have that $\varphi(x_0^*, \ldots x_i^*, x_{i+1} \ldots x_n)$ is satisfiable for some $x_{i+1} \ldots x_n$. Now you just need to determine whether $\varphi(x_0^*, \ldots x_i^*, x_{i+1}^*, x_{i+2} \ldots x_n)$ is satisfiable if you fix $x_{i+1}^*=1$ or $x_{i+1}^*=0$, which gives you bits $x_0^* \ldots x_{i+1}^*$.

Can you take it from here?

idmean
  • 746
  • 4
  • 12
  • So I start with x0* and set it to 1 and check with the algorithm if it still satisfies, if not I will check x0*=1, then I continue with x1. This means I find a solution after 2n. But is the second check required when we know that the formula is satisfiable? Doesn't that mean if not 1 satisfies then 0 has to satisfy the formular. – OttoFran Dec 07 '21 at 18:27
  • @OttoFran Yes, you technically only need n+1 queries. See also: https://cs.stackexchange.com/questions/29482/is-finding-a-solution-of-a-satisfiability-problem-harder-than-deciding-satisfiab/29483#29483 – idmean Dec 07 '21 at 19:42