Abstract
Higher-order logic programming is an interesting extension of traditional logic programming that allows predicates to appear as arguments and variables to be used where predicates typically occur. Higher-order characteristics are indeed desirable but on the other hand they are also usually more expensive to support. In this paper we propose a program specialization technique based on partial evaluation that can be applied to a modest but useful class of higher-order logic programs and can transform them into first-order programs without introducing additional data structures. The resulting first-order programs can be executed by conventional logic programming interpreters and benefit from other optimizations that might be available. We provide an implementation and experimental results that suggest the efficiency of the transformation.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
The implementation of the transformation is open source and can be accessed at http://bitbucket.org/antru/firstify.
- 2.
An edge from the predicate \(\mathsf {p}\) to predicate \(\mathsf {q}\) in the predicate dependency graph means that there exists a clause that \(\mathsf {p}\) appears in the head and \(\mathsf {p}\) appears in the body of the same clause.
- 3.
version 3.7, cf. http://xsb.sourceforge.net/.
- 4.
version 7.2.3, cf. http://www.swi-prolog.org/.
- 5.
version 6.2.2, cf. http://www.dcc.fc.up.pt/~vsc/Yap/.
References
Albert, E., Hanus, M., Vidal, G.: A practical partial evaluation scheme for multi-paradigm declarative languages. J. Funct. Logic Program. 2002 (2002)
Charalambidis, A., Handjopoulos, K., Rondogiannis, P., Wadge, W.W.: Extensional higher-order logic programming. ACM Trans. Comput. Logic 14(3), 21 (2013)
Charalambidis, A., Rondogiannis, P., Troumpoukis, A.: Higher-order logic programming: an expressive language for representing qualitative preferences. Sci. Comput. Program. 155, 173–197 (2018)
Chen, W., Kifer, M., Warren, D.S.: HiLog: a foundation for higher-order logic programming. J. Logic Program. 15(3), 187–230 (1993)
Chin, W., Darlington, J.: A higher-order removal method. Lisp Symbolic Comput. 9(4), 287–322 (1996)
Gallagher, J.P.: Tutorial on specialisation of logic programs. In: Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, PEPM 1993, Copenhagen, Denmark, 14–16 June 1993, pp. 88–98 (1993)
Jones, N.D.: The expressive power of higher-order types or, life without CONS. J. Funct. Program. 11(1), 5–94 (2001)
Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice Hall, Upper Saddle River (1993)
Leuschel, M.: Logic program specialisation. In: Partial Evaluation - Practice and Theory, DIKU 1998 International Summer School, Copenhagen, Denmark, June 29–July 10 1998, pp. 155–188 (1998)
Leuschel, M., Vidal, G.: Fast offline partial evaluation of logic programs. Inf. Comput. 235, 70–97 (2014)
Lloyd, J.W., Shepherdson, J.C.: Partial evaluation in logic programming. J. Log. Program. 11(3&4), 217–242 (1991)
Miller, D., Nadathur, G.: Programming with Higher-Order Logic, 1st edn. Cambridge University Press, New York (2012)
Mitchell, N., Runciman, C.: Losing functions without gaining data: another look at defunctionalisation. In: Proceedings of the 2nd ACM SIGPLAN Symposium on Haskell, Haskell 2009, Edinburgh, Scotland, UK, 3 September 2009, pp. 13–24 (2009)
Nelan, G.: Firstification. Ph.D. thesis, Arizona State University (1991)
Pope, B.J., Naish, L.: Specialisation of higher-order functions for debugging. Electr. Notes Theor. Comput. Sci. 64, 277–291 (2002)
Ramos, J.G., Silva, J., Vidal, G.: Fast narrowing-driven partial evaluation for inductively sequential programs. In: Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming, ICFP 2005, Tallinn, Estonia, 26–28 September 2005, pp. 228–239 (2005)
Reynolds, J.C.: Definitional interpreters for higher-order programming languages. In: Proceedings of the 25th ACM National Conference, pp. 717–740. ACM (1972)
Sagonas, K., Warren, D.S.: Efficient execution of HiLog in WAM-based prolog implementations. In: Proceedings of the 12th International Conference on Logic Programming, Tokyo, Japan, 13–16 June 1995, pp. 349–363 (1995)
Shepherdson, J.C.: Unfold/fold transformations of logic programs. Math. Struct. Comput. Sci. 2(2), 143–157 (1992)
Swift, T., Warren, D.S.: XSB: extending prolog with tabled logic programming. TPLP 12(1–2), 157–187 (2012)
Warren, D.H.: Higher-order extensions to prolog-are they needed. Machine Intell. 10, 441–454 (1982)
Acknowledgements
We would like to thank the anonymous reviewers for providing constructive comments on our original submission.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2019 Springer Nature Switzerland AG
About this paper
Cite this paper
Troumpoukis, A., Charalambidis, A. (2019). Predicate Specialization for Definitional Higher-Order Logic Programs. In: Mesnard, F., Stuckey, P. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2018. Lecture Notes in Computer Science(), vol 11408. Springer, Cham. https://doi.org/10.1007/978-3-030-13838-7_8
Download citation
DOI: https://doi.org/10.1007/978-3-030-13838-7_8
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-13837-0
Online ISBN: 978-3-030-13838-7
eBook Packages: Computer ScienceComputer Science (R0)