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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Apt, K.R.: From Logic Programming to Prolog. Prentice-Hall Inc., Upper Saddle River (1996)
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)
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
Barbosa, J., Florido, M., Santos Costa, V.: Typed SLD-resolution: dynamic typing for logic programming. arXiv (2022)
Beall, J.: Off-topic: a new interpretation of weak-kleene logic. Australas. J. Logic 13(6) (2016)
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)
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)
Costa, V.S., Rocha, R., Damas, L.: The YAP prolog system. Theor. Pract. Log. Program. 12(1–2), 5–34 (2012)
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)
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
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
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
van Emden, M.H., Kowalski, R.A.: The semantics of predicate logic as a programming language. J. ACM 23(4), 733–742 (1976)
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)
Hanus, M.: Multiparadigm languages. In: Computing Handbook, Third Edition: Computer Science and Software Engineering, vol. 66, pp. 1–17. Springer, Cham (2014)
Herbrand, J.: Recherches sur la théorie de la démonstration. Numdam (1930). http://eudml.org/doc/192791
Kleene, S.C.: On notation for ordinal numbers. J. Symbolic Logic 3(4), 150–155 (1938)
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)
Lloyd, J.W.: Foundations of Logic Programming. Springer-Verlag, Berlin (1984). https://doi.org/10.1007/978-3-642-96826-6
Lu, L.: On Dart-Zobel algorithm for testing regular type inclusion. Sigplan Not. 36(9), 81–85 (2001)
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
Milner, R.: A theory of type polymorphism in programming. J. Comput. Syst. Sci. 17(3), 348–375 (1978)
Mycroft, A., O’Keefe, R.A.: A polymorphic type system for Prolog. Artif. Intell. 23(3), 295–307 (1984)
Robinson, J.A.: A Machine-Oriented Logic Based on the Resolution Principle. J. ACM 12(1), 23–41 (1965)
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
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
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
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)
Zobel, J.: Derivation of polymorphic types for Prolog programs. In: Logic Programming, Proceedings of the Fourth International Conference, Melbourne (1987)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
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)