Towards a Type Discipline for Answer Set Programming

  • Camillo Fiorentini
  • Alberto Momigliano
  • Mario Ornaghi
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5497)


We argue that it is high time that types had a beneficial impact in the field of Answer Set Programming and in particular Disjunctive Datalog as exemplified by the DLV system. Things become immediately more challenging, as we wish to present a type system for DLV-Complex, an extension of DLV with uninterpreted function symbols, external implemented predicates and types. Our type system owes to the seminal polymorphic type system for Prolog introduced by Mycroft and O’Keefe, in the formulation by Lakshman and Reddy. The most innovative part of the paper is developing a declarative grounding procedure which is at the same time appropriate for the operational semantics of ASP and able to handle the new features provided by DLV-Complex. We discuss the soundness of the procedure and evaluate informally its success in reducing, as expected, the set of ground terms. This yields an automatic reduction in size and numbers of (non isomorphic) models. Similar results could have only been achieved in the current untyped version by careful use of generator predicates in lieu of types.


Answer set programming type checking grounding many sorted interpretation 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Baral, C.: Knowledge Representation, Reasoning and Declarative Problem Solving. CUP (2003)Google Scholar
  2. 2.
    Baselice, S., Bonatti, P.A., Gelfond, M.: Towards an integration of answer set and constraint solving. In: Gabbrielli, M., Gupta, G. (eds.) ICLP 2005. LNCS, vol. 3668, pp. 52–66. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  3. 3.
    Bertoni, A., Mauri, G., Miglioli, P.: A characterization of abstract data as model-theoretic invariants. In: Maurer, H.A. (ed.) ICALP 1979. LNCS, vol. 71, pp. 26–37. Springer, Heidelberg (1979)CrossRefGoogle Scholar
  4. 4.
    Buneman, P., Ohori, A.: Polymorphism and type inference in database programming. ACM Trans. Database Syst. 21(1), 30–76 (1996)CrossRefGoogle Scholar
  5. 5.
    Calimeri, F., Cozza, S., Ianni, G.: External sources of knowledge and value invention in logic programming. Ann. Math. Artif. Intell. 50(3-4), 333–361 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Calimeri, F., Cozza, S., Ianni, G., Leone, N.: Computable functions in ASP: Theory and implementation. In: de la Banda, M.G., Pontelli, E. (eds.) ICLP 2008. LNCS, vol. 5366, pp. 407–424. Springer, Heidelberg (2008)Google Scholar
  7. 7.
    Van den Bussche, J., Waller, E.: Polymorphic type inference for the relational algebra. J. Comput. Syst. Sci. 64(3), 694–718 (2002)MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    Ricca, F., Gallucci, L., Schindlauer, R., Dell’Armi, T., Grasso, G., Leone, N.: OntoDLV: an ASP-based system for enterprise ontologies. Journal of Logic and Computation (to appear, 2009)Google Scholar
  9. 9.
    Gelfond, M.: Answer sets. In: van Harmelen, F., Lifschitz, V., Porter, B. (eds.) Handbook of knowledge representation, vol. 7. Elsevier, Amsterdam (2007)Google Scholar
  10. 10.
    Gelfond, M., Lifschitz, V.: The stable model semantics for logic programming. In: ICLP/SLP, pp. 1070–1080 (1988)Google Scholar
  11. 11.
    Hanus, M.: Horn clause programs with polymorphic types: Semantics and resolution. Theor. Comput. Sci. 89(1), 63–106 (1991)MathSciNetCrossRefzbMATHGoogle Scholar
  12. 12.
    Hermenegildo, M.V., Puebla, G., Bueno, F., López-García, P.: Integrated program debugging, verification, and optimization using abstract interpretation (and the Ciao system preprocessor). Sci. Comput. Programming 58(1-2), 115–140 (2005)MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    Hill, P.M., Topor, R.W.: A semantics for typed logic programs. In: Types in Logic Programming, pp. 1–62. MIT Press, Cambridge (1992)Google Scholar
  14. 14.
    Jefferey, D.: Expressive Type Systems for Logic Programming Languages. PhD thesis, The University of Melbourne (2002)Google Scholar
  15. 15.
    Lakshman, T.L., Reddy, U.S.: Typed PROLOG: A semantic reconstruction of the Mycroft-O’Keefe type system. In: ISLP, pp. 202–217 (1991)Google Scholar
  16. 16.
    Leone, N., et al.: The DLV system for knowledge representation and reasoning. ACM TOCL 7(3), 499–562 (2006)MathSciNetCrossRefGoogle Scholar
  17. 17.
    Lloyd, J.W.: Foundations of logic programming (2nd extended ed.). Springer, Heidelberg (1987)CrossRefGoogle Scholar
  18. 18.
    Mycroft, A., O’Keefe, R.A.: A polymorphic type system for PROLOG. Artif. Intell. 23(3), 295–307 (1984)MathSciNetCrossRefzbMATHGoogle Scholar
  19. 19.
    Nadathur, G., Qi, X.: Optimizing the runtime processing of types in polymorphic logic programming languages. In: Sutcliffe, G., Voronkov, A. (eds.) LPAR 2005. LNCS, vol. 3835, pp. 110–124. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  20. 20.
    Overton, D., Somogyi, Z., Stuckey, P.J.: Constraint-based mode analysis of Mercury. In: PPDP, pp. 109–120. ACM, New York (2002)Google Scholar
  21. 21.
    Pfenning, F.: Types in logic programming. MIT Press, Cambridge (1992)Google Scholar
  22. 22.
    Simons, P., Niemelä, I., Soininen, T.: Extending and implementing the stable model semantics. Artif. Intell. 138(1-2), 181–234 (2002)MathSciNetCrossRefzbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Camillo Fiorentini
    • 1
  • Alberto Momigliano
    • 1
  • Mario Ornaghi
    • 1
  1. 1.Dipartimento di Scienze dell’InformazioneUniversità degli Studi di MilanoItaly

Personalised recommendations