Modern SAT solvers: fast, neat and underused – part 2
codingnest.com
codingnest.com
Constraint Programming and SAT are BOTH NP-complete problems, and as such, they are mathematically equivalent. However, its sometimes more "obvious" to write problems in one form vs the other.
For example, Sudoku is simply written 27 constraints:
* All Different (X11, X12, X13, X14, X15, X16, X17, X18, X19)
* All Different (X21, X22, X23, X24, X25, X26, X27, X28, X29)
...
* All Different (X11, X21, X31, X41, X51, X61, X71, X81, X91)
...
* All Different (X11, X12, X13, X21, X22, X23, X31, X32, X34)
...
etc. etc.
Then define each "X" variable as "between 1 and 9" and bam, you're done with defining the problem in terms of "Constraints".
Representing Sudoku as a SAT problem is possible of course, but its just... harder. It just feels more humanly natural to represent Sudoku in terms of constraints. Or maybe not. Read "Part 1" if you want to see how the original blogger solved it in terms of 3-SAT (https://codingnest.com/modern-sat-solvers-fast-neat-underuse...)
----------
Here's an article from IBM hyping up their "CPLEX" Constraint solver for Sudoku for example: https://www.ibm.com/developerworks/community/blogs/jfp/entry...
----------
Anyway, just plugging in a similarly fast, neat, and underused (and mathematically equivalent) solver to what the blogpost talks about. I personally don't know too much about SAT-solvers or their algorithms, aside from "They're same same, but different" to Constraint Programming.
His latest book which is due out this year goes into quite a lot of depth specifically on sudoku. The one he released last year using SAT solvers has a few fun exercises. In particular, he uses a SAT solver to construct sudoku boards that have a unique solution, but do not have any forced moves on the board.
Alternatively - can MKS be applied to cool permissions problems not involving physical keys?
So then if a key gets stolen and you have to replace the system it could be literally impossible to do.
I think the combination of SAT solving, and a formal language like F* that can create executable OCaml or Fsharp code will be very useful in creating a pragmatic path to verified programs.
[1] https://www.fstar-lang.org/
Edit: I wanted to add that I prefer the Lisp syntax of SMT to the python, but that's based upon personal bias. However, a Lisp-like syntax was chosen due to the ease of parsing Lisp s-expressions.