William Byrd explains the ideas behind logic programming languages (like Prolog) and relational programming. Also: miniKanren and core.logic, program synthesis, and much more.
A Hitchhiker s Guide to Reinventing a Prolog Machine
pdf-format:
Abstract
We take a fresh, clean-room look at implementing Prolog by deriving its translation to an executable representation
and its execution algorithm from a simple Horn Clause meta-interpreter.
The resulting design has some interesting properties.
The heap representation of terms and the abstract machine instruction encodings are the same.
No dedicated code area is used as the code is placed directly on the heap.
Unification and indexing operations are orthogonal.
Filtering of matching clauses happens without building new structures on the heap.
Variables in function and predicate symbol positions are handled with no performance penalty.