Hello HN,
I'like to implement my own little custom constraint logic programming language.
Features like declarative integer arithmetic as implemented by Prolog's
CLP(FD) module are especially interesting to me.
Would anyone advise books or other types of resources that would help implementing a project like this?
I've seen some resource about SAT solvers but couldn't find much on the actual implementation of a constraint logic programming language or library.
Anything regarding logical purity and SAT solvers if also appreciated.
Thanks in advance
There’s also a chapter on logic programming but it doesn’t quite work the same way as Prolog: https://mitp-content-server.mit.edu/books/content/sectbyfn/b...
Peter Norvig has a couple of chapters (11,12) on how to implement Prolog in his book PAIP. He also has a chapter (17) on constraint satisfaction but IIRC it’s not integrated into his Prolog system: https://github.com/norvig/paip-lisp
Many real Prolog implementations are based on the WAM. For an excellent introduction to the WAM look at: http://wambook.sourceforge.net/
I don’t have books or papers on implementing constraints and how to integrate them with Prolog. But here are two great classes on Coursera that explain how constraints and constraint propagation work. You can audit them for free:
Discrete Optimization by Hentenryck https://www.coursera.org/learn/discrete-optimization
Solving Algorithms for Discrete Optimization by Lee and Stuckey https://www.coursera.org/learn/solving-algorithms-discrete-o...
I believe constraints are typically integrated into Prolog through attributed variables: https://www.metalevel.at/prolog/attributedvariables
But I don’t really know how that works. Markus Triska has a few papers on constraint solvers for SWI Prolog on his webpage. He can probably give you more and better pointers: https://www.metalevel.at/