JUCS - Journal of Universal Computer Science 6(4): 433-446, doi: 10.3217/jucs-006-04-0433
Functional Reading of Logic Programs
expand article infoSilvija Seres, Michael Spivey
‡ Oxford University Computing Laboratory, Wolfson Building, Parks Road, Oxford, United Kingdom
Open Access
We propose an embedding of logic programming into lazy functional programming in which each predicate in a Prolog program becomes a Haskell function, in such a way that both the declarative and the procedural reading of the Prolog predicate are preserved. The embedding computes by means of operations on lazy lists. The state of each step in computation is passed on as a stream of answer substitutions, and all the logic operators of Prolog are implemented by explicit Haskell operators on these streams. The search strategy can be changed by altering the basic types of the embedding and the implementation of these operators. This model results in a perspicuous semantics for logic programs, and serves as a good example of modularisation in functional programming.
logic programming, functional embedding, program transformation, algebraic methods