Improving Logic Programs by Adding Functions (LOPSTR 2024 Best Paper Award)

by Michael Hanus

Proceedings of the 34th International Symposium on Logic-Based Program Synthesis and Transformation (LOPSTR 2024), Springer LNCS 14919, pp. 27-44, 2024
© Springer-Verlag

Logic programming is based on defining relations. Functions are often considered as syntactic sugar which can be transformed into predicates so that their logic is not used for computational purposes. In this paper, we present a method to use functions to improve the operational behavior of logic programs without loosing the flexibility of logic programming. For this purpose, predicates and goals are transformed into functions and nested expressions. By evaluating these functions in a demand-driven manner wherever possible and taking potential failures into account, we ensure that the execution of the transformed programs will never require more steps than the original programs but can decrease the number of steps - in the best case reducing infinite search spaces to finite ones. Thus, we obtain a systematic method to improve the operational behavior of logic programs without changing their semantics.

Preprint (PDF) BibTeX-Entry Online