Skip to main content

Typed SLD-Resolution: Dynamic Typing for Logic Programming

  • Conference paper
  • First Online:
Logic-Based Program Synthesis and Transformation (LOPSTR 2022)

Abstract

The semantic foundations for logic programming are usually separated into two different approaches. The operational semantics, which uses SLD-resolution, the proof method that computes answers in logic programming, and the declarative semantics, which sees logic programs as formulas and its semantics as models. Here, we define a new operational semantics called TSLD-resolution, which stands for Typed SLD-resolution, where we include a value “wrong”, that corresponds to the detection of a type error at run-time. For this we define a new typed unification algorithm. Finally we prove the correctness of TSLD-resolution with respect to a typed declarative semantics.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 44.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 59.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

Institutional subscriptions

References

  1. Apt, K.R.: From Logic Programming to Prolog. Prentice-Hall Inc., Upper Saddle River (1996)

    Google Scholar 

  2. Barbosa, J., Florido, M., Costa, V.S.: A three-valued semantics for typed logic programming. In: Proceedings 35th International Conference on Logic Programming (Technical Communications), ICLP 2019 Technical Communications, Las Cruces, NM, USA, 20–25 September 2019. EPTCS, vol. 306, pp. 36–51 (2019)

    Google Scholar 

  3. Barbosa, J., Florido, M., Costa, V.S.: Data type inference for logic programming. In: De Angelis, E., Vanhoof, W. (eds.) LOPSTR 2021. LNCS, pp. 16–37. Springer, Cham (2022). https://doi.org/10.1007/978-3-030-98869-2_2

    Chapter  Google Scholar 

  4. Barbosa, J., Florido, M., Santos Costa, V.: Typed SLD-resolution: dynamic typing for logic programming. arXiv (2022)

    Google Scholar 

  5. Beall, J.: Off-topic: a new interpretation of weak-kleene logic. Australas. J. Logic 13(6) (2016)

    Google Scholar 

  6. Bochvar, D., Bergmann, M.: On a three-valued logical calculus and its application to the analysis of the paradoxes of the classical extended functional calculus. Hist. Philos. Logic 2(1–2), 87–112 (1981)

    Article  MathSciNet  Google Scholar 

  7. Bruynooghe, M., Janssens, G.: An instance of abstract interpretation integrating type and mode inferencing. In: Fifth International Conference and Symposium, Washington, 1988, pp. 669–683 (1988)

    Google Scholar 

  8. Costa, V.S., Rocha, R., Damas, L.: The YAP prolog system. Theor. Pract. Log. Program. 12(1–2), 5–34 (2012)

    Article  MathSciNet  Google Scholar 

  9. Dart, P.W., Zobel, J.: A regular type language for logic programs. In: Pfenning, F. (ed.) Types in Logic Programming, pp. 157–187. The MIT Press, Cambridge (1992)

    MATH  Google Scholar 

  10. Deransart, P., Ed-Dbali, A., Cervoni, L.: Prolog - the Standard: Reference Manual. Springer, Heidelberg (1996). https://doi.org/10.1007/978-3-642-61411-8

    Book  MATH  Google Scholar 

  11. Deransart, P., Smaus, J.-G.: Well-typed logic programs are not wrong. In: Kuchen, H., Ueda, K. (eds.) FLOPS 2001. LNCS, vol. 2024, pp. 280–295. Springer, Heidelberg (2001). https://doi.org/10.1007/3-540-44716-4_18

    Chapter  MATH  Google Scholar 

  12. Drabent, W., Małuszyński, J., Pietrzak, P.: Using parametric set constraints for locating errors in CLP programs. Theor. Pract. Logic Program. 2(4–5), 549–610 (2002). https://doi.org/10.1017/S1471068402001473

    Article  MathSciNet  MATH  Google Scholar 

  13. van Emden, M.H., Kowalski, R.A.: The semantics of predicate logic as a programming language. J. ACM 23(4), 733–742 (1976)

    Article  MathSciNet  Google Scholar 

  14. Frühwirth, T.W., Shapiro, E.Y., Vardi, M.Y., Yardeni, E.: Logic programs as types for logic programs. In: Proceedings of the Sixth Annual Symposium on Logic in Computer Science (LICS ’91), Netherlands, 1991, pp. 300–309 (1991)

    Google Scholar 

  15. Hanus, M.: Multiparadigm languages. In: Computing Handbook, Third Edition: Computer Science and Software Engineering, vol. 66, pp. 1–17. Springer, Cham (2014)

    Google Scholar 

  16. Herbrand, J.: Recherches sur la théorie de la démonstration. Numdam (1930). http://eudml.org/doc/192791

  17. Kleene, S.C.: On notation for ordinal numbers. J. Symbolic Logic 3(4), 150–155 (1938)

    Article  Google Scholar 

  18. Lakshman, T.L., Reddy, U.S.: Typed Prolog: a semantic reconstruction of the Mycroft-O’Keefe type system. In: Logic Programming, Proceedings of the 1991 International Symposium, San Diego, California, USA (1991)

    Google Scholar 

  19. Lloyd, J.W.: Foundations of Logic Programming. Springer-Verlag, Berlin (1984). https://doi.org/10.1007/978-3-642-96826-6

    Book  MATH  Google Scholar 

  20. Lu, L.: On Dart-Zobel algorithm for testing regular type inclusion. Sigplan Not. 36(9), 81–85 (2001)

    Article  Google Scholar 

  21. Martelli, A., Montanari, U.: An efficient unification algorithm. ACM Trans. Program. Lang. Syst. 4(2), 258–282 (1982). https://doi.org/10.1145/357162.357169

    Article  MATH  Google Scholar 

  22. Milner, R.: A theory of type polymorphism in programming. J. Comput. Syst. Sci. 17(3), 348–375 (1978)

    Article  MathSciNet  Google Scholar 

  23. Mycroft, A., O’Keefe, R.A.: A polymorphic type system for Prolog. Artif. Intell. 23(3), 295–307 (1984)

    Article  MathSciNet  Google Scholar 

  24. Robinson, J.A.: A Machine-Oriented Logic Based on the Resolution Principle. J. ACM 12(1), 23–41 (1965)

    Article  MathSciNet  Google Scholar 

  25. Schrijvers, T., Bruynooghe, M., Gallagher, J.P.: From monomorphic to polymorphic well-typings and beyond. In: Hanus, M. (ed.) LOPSTR 2008. LNCS, vol. 5438, pp. 152–167. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-00515-2_11

    Chapter  MATH  Google Scholar 

  26. Schrijvers, T., Santos Costa, V., Wielemaker, J., Demoen, B.: Towards typed prolog. In: Garcia de la Banda, M., Pontelli, E. (eds.) ICLP 2008. LNCS, vol. 5366, pp. 693–697. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-89982-2_59

    Chapter  Google Scholar 

  27. Wadler, P., Findler, R.B.: Well-typed programs can’t be blamed. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 1–16. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-00590-9_1

    Chapter  Google Scholar 

  28. Yardeni, E., Frühwirth, T.W., Shapiro, E.: Polymorphically typed logic programs. In: Pfenning, F. (ed.) Types in Logic Programming, pp. 63–90. The MIT Press (1992)

    Google Scholar 

  29. Zobel, J.: Derivation of polymorphic types for Prolog programs. In: Logic Programming, Proceedings of the Fourth International Conference, Melbourne (1987)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to João Barbosa .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Barbosa, J., Florido, M., Costa, V.S. (2022). Typed SLD-Resolution: Dynamic Typing for Logic Programming. In: Villanueva, A. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2022. Lecture Notes in Computer Science, vol 13474. Springer, Cham. https://doi.org/10.1007/978-3-031-16767-6_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-16767-6_7

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-16766-9

  • Online ISBN: 978-3-031-16767-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics