Sudoku puzzles and propositional logic

5.4k Views Asked by At

I am currently reading about how to solve Sudoku puzzles using propositional logic. More specifically, they use the compound statement

$$\bigwedge_{i=1}^{9} \bigwedge_{n=1}^{9} \bigvee_{j=1}^{9}~p(i,j,n)$$

where $p(i,j,n)$ is the proposition that is true when the number $n$ is in the cell in the $ith$ row and $jth$ column, to denote that every row contains every number. I know that this is what the entire compound statement implies, but I am trying to read each individual statement together. Taking one single case, does

$$\bigwedge_{i=1}^{9} \bigwedge_{n=1}^{9} \bigvee_{j=1}^{9}~p(i,j,n)$$

say that in the first row, the number one will be found in the first column, or second column, or third column, etc?

1

There are 1 best solutions below

2
On BEST ANSWER

The formula says "for every allowed value of the row $i$ and the value $n$, there is at least one column $j$ for which the $(i,j)$ location of the grid is filled with the value $n$".

The translation of Sudoko to propositional logic does not make the problem fundamentally easier. Any logic problem can be rewritten as a Sudoku, too, and solving either type of problem in general is computationally difficult (NP-complete).

does $\bigwedge_{i=1}^{9} \bigwedge_{n=1}^{9} \bigvee_{j=1}^{9}~p(i,j,n)$ say that in the first row, the number one will be found in the first column, or second column, or third column, etc?

No, the formula saying that is $\bigvee_{j=1}^{9}~p(1,j,1)$ which is the $i=1$,$n=1$ specialization of the first formula. The disjunction indexed by $j$ unpacks to "p(1,1,1) OR p(1,2,1) OR p(1,3,1) OR ... p(1,9,1)".