Posterous theme by Cory Watilo

A Logic Programming Reading List

A couple of people have asked me if there are any texts that I might recommend on logic programming. First off, let me clarify that I’m very new to the practice of logic programming myself. It’s an incredibly rich field with decades worth of research that’s still being actively explored from many different perspectives. The following list will reflect my biases - I’m as interested in implementation as I am in its practical use.

Thanks to Jim Duey, I became acquainted with logic programming via The Reasoned Schemer.

9780262562140-f30

Written in the same Socratic style as The Little Schemer, The Reasoned Schemer is an incredible well of entertainment, frustration, and outright mysteries. After struggling through its particular flavor of Hard Fun™ , I found it even more confounding that the entire implementation consists of 200 lines of very subtle Scheme.

So while I love The Reasoned Schemer, I do not think it’s the best introduction to logic programming. But if you savor challenges … look no further. 

I recommend a gentler approach - install a well supported open source Prolog implementation (SWI-Prolog, CiaoProlog) and get Sterling & Shapiro’s The Art of Prolog or Ivan Bratko’s Prolog Programming for Artificial Intelligence, or both.

9780262193382-f30

0201403757

After that, if you’re like me, you’ll want to solidify your understanding of the paradigm by actually building a simple implementation. While I had an intuitive understanding of objects, until I built the object oriented system presented in The Structure and Interpretation of Computer Programs, OOP always seemed a bit magical. Logic programming is no different. Building a simple logic engine will deepen your understanding in incomparable ways.

Peter Norvig’s Paradigms of Artificial Intelligence Programming has a classic implementation in Common Lisp.

Paradigms-artificial-intelligence-programming-case-studies-common-lisp_3618_500

William Byrd’s dissertation on miniKanren covers the entire implementation behind The Reasoned Schemer in one chapter. Norvig’s approach will probably be more digestable for someone comfortable with imperative approaches. Similarly, miniKanren will be somewhat daunting if you’re not acquainted with building interpreters or the monadic approach. But if you’re an experienced functional programmer or just plain stubborn, it’s worth it. Sadly I’m not aware of any succinct yet relatively performant non-Lisp approaches - if you know of one, please let me know!

At this point you’ll have quite a bit of knowledge but perhaps it will still be difficult to see how to put any of this into practice if object oriented programming or functional programming pays the bills. How can logic programming be incorporated sensibly into everday practice? 

Concepts, Techniques, and Models of Computer Programming (CTMCP) compellingly describes what a truly multi-paradigm approach to software construction might look like.

9780262220699-f30

Armed with an understanding of the paradigm and basic implementation experience, perhaps this book will give you cool ideas on how to idiomatically embed a simple logic engine into your programming language of choice! CTMCP also covers constraint logic programming which considerably broadens the scope where logic programming can be practically applied.

This short list can serve only as introduction. But hopefully this reading list will provide enough basic material to make approaching the deeper literature less daunting.  Fortunately all the recommended texts here have extensive bibliographies to guide your adventures.