You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
2.3 KiB

9 months ago
  1. \begin{itemize}
  2. \item \emph{Row-constraints:} \emph{If} a cell in a row has a certain value, \emph{then} no other cell in that row can have that value. For each $i$, and each $k$ we have:
  3. $$x_{i1k} \imp \lnot x_{i2k} \land \lnot x_{i3k} \land ... \land \lnot x_{i9k}$$
  4. $$x_{i2k} \imp \lnot x_{i1k} \land \lnot x_{i2k} \land ... \land \lnot x_{i9k}$$
  5. $$\vdots$$
  6. $$x_{i9k} \imp \lnot x_{i1k} \land \lnot x_{i2k} \land ... \land \lnot x_{i8k}$$
  7. \item \emph{Column-constraints:} \emph{If} a cell in a column has a certain value, \emph{then} no other cell in that column can have that value. For each $j$, and each $k$ we have:
  8. $$x_{1jk} \imp \lnot x_{2jk} \land \lnot x_{3jk} \land ... \land \lnot x_{9jk}$$
  9. $$x_{2jk} \imp \lnot x_{1jk} \land \lnot x_{2jk} \land ... \land \lnot x_{9jk}$$
  10. $$\vdots$$
  11. $$x_{9jk} \imp \lnot x_{1jk} \land \lnot x_{2jk} \land ... \land \lnot x_{8jk}$$
  12. \item \emph{Square-constraints:} \emph{If} a cell in a 3x3 square has a certain value, \emph{then} no other cell in that square can have that value. For the first square, we have for each $k$:
  13. $$x_{11k} \imp \lnot x_{12k} \land \lnot x_{13k} \land \lnot x_{21k} \land \lnot x_{22k} \land \lnot x_{23k} \land \lnot x_{31k} \land \lnot x_{32k} \land \lnot x_{33k}$$
  14. $$\vdots$$
  15. $$x_{33k} \imp \lnot x_{11k} \land \lnot x_{12k} \land \lnot x_{13k} \land \lnot x_{21k} \land \lnot x_{22k} \land \lnot x_{23k} \land \lnot x_{31k} \land \lnot x_{32k}$$
  16. The constraints for the remaining squares are similar.
  17. \item \emph{Predefined-number-constraints:} If a cell has a predefined value, we need to set the corresponding variable to true, e.g., the cell in the fifth row and the fifth column has the value 9.
  18. Therefore we have $$x_{559}.$$
  19. \item \emph{Cell-constraints:} Each cell must contain a number ranging from one to nine.
  20. For each $i$, and each $j$ we have
  21. $$x_{ij1} \lor x_{ij2} \lor ... \lor x_{ij9}.$$ On its own, this constraint would allow for a cell to have more than one value. However, this is not possible due to the other constraints.
  22. \end{itemize}
  23. To construct the final propositional formula, all constraints need to be connected via conjunctions.
  24. A satisfying assignment for the final formula represents one possible solution for the Sudoku puzzle.
  25. In case that there does not exists a solution, the SAT sovler would return UNSAT.