Skip to main content

Predicate Specialization for Definitional Higher-Order Logic Programs

  • Conference paper
  • First Online:
  • 208 Accesses

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 11408))

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.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    The implementation of the transformation is open source and can be accessed at http://bitbucket.org/antru/firstify.

  2. 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. 3.

    version 3.7, cf. http://xsb.sourceforge.net/.

  4. 4.

    version 7.2.3, cf. http://www.swi-prolog.org/.

  5. 5.

    version 6.2.2, cf. http://www.dcc.fc.up.pt/~vsc/Yap/.

References

  1. Albert, E., Hanus, M., Vidal, G.: A practical partial evaluation scheme for multi-paradigm declarative languages. J. Funct. Logic Program. 2002 (2002)

    Google Scholar 

  2. Charalambidis, A., Handjopoulos, K., Rondogiannis, P., Wadge, W.W.: Extensional higher-order logic programming. ACM Trans. Comput. Logic 14(3), 21 (2013)

    Article  MathSciNet  Google Scholar 

  3. Charalambidis, A., Rondogiannis, P., Troumpoukis, A.: Higher-order logic programming: an expressive language for representing qualitative preferences. Sci. Comput. Program. 155, 173–197 (2018)

    Article  Google Scholar 

  4. Chen, W., Kifer, M., Warren, D.S.: HiLog: a foundation for higher-order logic programming. J. Logic Program. 15(3), 187–230 (1993)

    Article  MathSciNet  Google Scholar 

  5. Chin, W., Darlington, J.: A higher-order removal method. Lisp Symbolic Comput. 9(4), 287–322 (1996)

    Article  Google Scholar 

  6. 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)

    Google Scholar 

  7. Jones, N.D.: The expressive power of higher-order types or, life without CONS. J. Funct. Program. 11(1), 5–94 (2001)

    Article  MathSciNet  Google Scholar 

  8. Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice Hall, Upper Saddle River (1993)

    MATH  Google Scholar 

  9. 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)

    Chapter  Google Scholar 

  10. Leuschel, M., Vidal, G.: Fast offline partial evaluation of logic programs. Inf. Comput. 235, 70–97 (2014)

    Article  MathSciNet  Google Scholar 

  11. Lloyd, J.W., Shepherdson, J.C.: Partial evaluation in logic programming. J. Log. Program. 11(3&4), 217–242 (1991)

    Article  MathSciNet  Google Scholar 

  12. Miller, D., Nadathur, G.: Programming with Higher-Order Logic, 1st edn. Cambridge University Press, New York (2012)

    Book  Google Scholar 

  13. 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)

    Google Scholar 

  14. Nelan, G.: Firstification. Ph.D. thesis, Arizona State University (1991)

    Google Scholar 

  15. Pope, B.J., Naish, L.: Specialisation of higher-order functions for debugging. Electr. Notes Theor. Comput. Sci. 64, 277–291 (2002)

    Article  Google Scholar 

  16. 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)

    Google Scholar 

  17. Reynolds, J.C.: Definitional interpreters for higher-order programming languages. In: Proceedings of the 25th ACM National Conference, pp. 717–740. ACM (1972)

    Google Scholar 

  18. 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)

    Google Scholar 

  19. Shepherdson, J.C.: Unfold/fold transformations of logic programs. Math. Struct. Comput. Sci. 2(2), 143–157 (1992)

    Article  MathSciNet  Google Scholar 

  20. Swift, T., Warren, D.S.: XSB: extending prolog with tabled logic programming. TPLP 12(1–2), 157–187 (2012)

    MathSciNet  MATH  Google Scholar 

  21. Warren, D.H.: Higher-order extensions to prolog-are they needed. Machine Intell. 10, 441–454 (1982)

    Google Scholar 

Download references

Acknowledgements

We would like to thank the anonymous reviewers for providing constructive comments on our original submission.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Angelos Charalambidis .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics