3 ms·
SICP contains a chapter on non-deterministic programming that’s similar to how Prolog executes: https://mitp-content-server.mit.edu/books/content/sectbyfn/books
by i_don_t_know 4y ago
SICP contains a chapter on non-deterministic programming that’s similar to how Prolog executes: https://mitp-content-server.mit.edu/books/content/sectbyfn/books_pres_0/6515/sicp.zip/full-text/book/book-Z-H-28.html#%_sec_4.3 https://mitp-content-server.mit.edu/books/content/sectbyfn/b...
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/books_pres_0/6515/sicp.zip/full-text/book/book-Z-H-29.html#%_sec_4.4 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 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/ 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 https://www.coursera.org/learn/discrete-optimization
Solving Algorithms for Discrete Optimization by Lee and Stuckey https://www.coursera.org/learn/solving-algorithms-discrete-optimization 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 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/ https://www.metalevel.at/
- LunaSea 4y agoMany thanks for this very complete response! It seems to be a niche topic so I didn't expect to find a resource that exactly matched.
- deleted 4y ago[deleted]
- i_don_t_know 4y agoI found a paper on compiling constraints for clp(fd) in the context of GNU Prolog: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.30.6051&rep=rep1&type=pdf https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.30...