Skip to main content

Extending Answer Set Programs with Interpreted Functions as First-Class Citizens

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 10137))

Abstract

Answer Set Programming (ASP) is a well-known problem solving approach based on nonmonotonic logic programs. Existing approaches towards integrating function terms into ASP can be organized in two classes: uninterpreted function symbols and interpreted functions; we focus on the latter. Existing approaches usually define interpreted functions in the program (e.g. using term equations), while evaluation wrt. to a pre-existing external semantics is neglected. However, this is useful if existing function libraries shall be accessed or if a function is more naturally implemented in procedural code. In this paper, we propose the declarative language of \(\textsc {hex}^{\textsc {ifu}}\) -programs which extends answer set programs (ASP) with such interpreted functions. However, rather than just providing a means for evaluating functions, it further turns interpreted functions into first-class citizens, i.e., functions are represented by accessible objects in the program. This paves the way for functionals (higher-order functions), i.e., functions that take other functions as arguments or return them. We provide then a rewriting of such programs to hex-programs, an extension of ASP with external sources, and an implementation based on this rewriting. Afterwards we present applications which motivated our work, e.g. the adoption of design pattern from software engineering. Finally, we discuss properties of the formalism and differences to related work.

This research has been supported by the Austrian Science Fund (FWF) project P27730.

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.

    We let \(\bar{T}\) denote a meta-variable (not to be confused with ASP variables in the object language) which represents a constant from \(\mathscr {C}\), an ASP variable from \(\mathscr {V}\), or a ground or non-ground functional terms (e.g. f(a), g(X)).

  2. 2.

    For ordinary \(\varPi \), these are Gelfond & Lifschitz’s answer sets.

  3. 3.

    The external atom is intended to return the neighbors Y of X in a fixed finite graph, thus \(\varPi \) computes the nodes which are reachable from a given start node s.

  4. 4.

    http://www.lua.org.

  5. 5.

    To see that this is always possible, let \( runTM (m, i)\) be a function which maps the definition of a turing machine m and an input string i to the tape content after the machine encoded by m under input i terminates. Then any function \(f(\mathbf{x})\) can be defined as \( runTM (m_f, i)\), where i encodes arguments \(\mathbf{x}\) and \(m_f\) is a turing machine which computes f.

References

  1. Alviano, M., Calimeri, F., Ianni, G., Faber, W., Leone, N.: Function symbols in ASP: overview and perspectives 31 (2011)

    Google Scholar 

  2. Balduccini, M.: ASP with non-herbrand partial functions: a language and system for practical use. TPLP 13(4–5), 547–561 (2013)

    MathSciNet  MATH  Google Scholar 

  3. Bartholomew, M., Lee, J.: Stable models of formulas with intensional functions. In: Proceedings of International Conference on Principles of Knowledge Representation and Reasoning KR, pp. 2–12 (2012)

    Google Scholar 

  4. Bartholomew, M., Lee, J.: Functional stable model semantics and answer set programming modulo theories. In: Proceedings of the Twenty-Third International Joint Conference on Artificial Intelligence, IJCAI 2013, pp. 718–724. AAAI Press (2013)

    Google Scholar 

  5. Brewka, G., Roelofsen, F., Serafini, L.: Contextual default reasoning. In: Proceedings of the Twentieth International Joint Conference on Artificial Intelligence (IJCAI 2007), January 6–12, 2007, Hyderabad, India (2007)

    Google Scholar 

  6. Burstall, R.: Christopher strachey-understanding programming languages. Higher-Order Symbolic Comput. 13(1), 51–55 (2000)

    Article  MATH  Google Scholar 

  7. Cabalar, P.: Functional answer set programming. CoRR abs/1006.3678. http://arxiv.org/abs/1006.3678(2010)

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

    Article  MathSciNet  MATH  Google Scholar 

  9. Dantsin, E., Eiter, T., Gottlob, G., Voronkov, A.: Complexity and expressive power of logic programming. ACM Comput. Surv. 33(3), 374–425 (2001)

    Article  Google Scholar 

  10. Eiter, Thomas, Fink, Michael, Krennwallner, Thomas, Redl, Christoph: hex-programs with existential quantification. In: Hanus, Michael, Rocha, Ricardo (eds.) WLP 2013. LNCS (LNAI), vol. 8439, pp. 99–117. Springer, Cham (2014). doi:10.1007/978-3-319-08909-6_7

    Google Scholar 

  11. Eiter, T., Fink, M., Krennwallner, T., Redl, C.: Domain expansion for ASP-programs with external sources. Artif. Intell. 233, 84–121 (2016)

    Article  MathSciNet  MATH  Google Scholar 

  12. Eiter, T., Ianni, G., Schindlauer, R., Tompits, H.: A uniform integration of higher-order reasoning and external evaluations in answer-set programming. In: IJCAI, pp. 90–96. Professional Book Center (2005)

    Google Scholar 

  13. Faber, W., Leone, N., Pfeifer, G.: Semantics and complexity of recursive aggregates in answer set programming. Artif. Intell. 175(1), 278–298 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  14. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-oriented Software. Addison-Wesley Longman Publishing Co. Inc., Boston (1995)

    MATH  Google Scholar 

  15. Gebser, M., Kaminski, R., König, A., Schaub, T.: Advances in gringo series 3. In: Delgrande, J.P., Faber, W. (eds.) LPNMR 2011. LNCS (LNAI), vol. 6645, pp. 345–351. Springer, Heidelberg (2011). doi:10.1007/978-3-642-20895-9_39

    Chapter  Google Scholar 

  16. Gebser, M., Kaufmann, B., Kaminski, R., Ostrowski, M., Schaub, T., Schneider, M.: Potassco: the potsdam answer set solving collection. AI Commun. 24(2), 107–124 (2011)

    MathSciNet  MATH  Google Scholar 

  17. Gebser, M., Schaub, T., Thiele, S.: GrinGo: a new grounder for answer set programming. In: Baral, C., Brewka, G., Schlipf, J. (eds.) LPNMR 2007. LNCS (LNAI), vol. 4483, pp. 266–271. Springer, Heidelberg (2007). doi:10.1007/978-3-540-72200-7_24

    Chapter  Google Scholar 

  18. Gelfond, M., Lifschitz, V.: Classical negation in logic programs and disjunctive databases. New Gener. Comput. 9(3–4), 365–386 (1991)

    Article  MATH  Google Scholar 

  19. Greco, S., Molinaro, C., Trubitsyna, I.: Bounded programs: A new decidable class of logic programs with function symbols. In: Proceedings of the Twenty-Third International Joint Conference on Artificial Intelligence (IJCAI 2013), pp. 926–931. AAAI Press (2013)

    Google Scholar 

  20. Hanus, M.: Multi-paradigm declarative languages. In: Dahl, V., Niemelä, I. (eds.) ICLP 2007. LNCS, vol. 4670, pp. 45–75. Springer, Berlin (2007). doi:10.1007/978-3-540-74610-2_5

    Chapter  Google Scholar 

  21. Hanus, M.: The integration of functions into logic programming: From theory to practice. J. Logic Program. 1920, Supplement 1, 583–628 , special Issue: Ten Years of Logic Programming (1994)

    Google Scholar 

  22. Leone, N., Pfeifer, G., Faber, W., Eiter, T., Gottlob, G., Perri, S., Scarcello, F.: The DLV system for knowledge representation and reasoning. ACM TOCL 7(3), 499–562 (2006)

    Article  MathSciNet  Google Scholar 

  23. Lierler, Y., Lifschitz, V.: One more decidable class of finitely ground programs. In: Hill, P.M., Warren, D.S. (eds.) ICLP 2009. LNCS, vol. 5649, pp. 489–493. Springer, Heidelberg (2009). doi:10.1007/978-3-642-02846-5_40

    Chapter  Google Scholar 

  24. Lifschitz, V.: Logic programs with intensional functions. In: Proceedings of International Conference on Principles of Knowledge Representation and Reasoning (KR) (2012)

    Google Scholar 

  25. Lin, F., Wang, Y.: Answer set programming with functions. In: Brewka, G., Lang, J. (eds.) Proceedings of the Eleventh International Conference on Principles of Knowledge Representation and Reasoning, KR 2008, Sydney, Australia, September 16–19, 2008, pp. 454–465. AAAI Press (2008)

    Google Scholar 

  26. Pearce, D., Valverde, A.: Towards a first order equilibrium logic for nonmonotonic reasoning. In: Alferes, J.J., Leite, J. (eds.) JELIA 2004. LNCS (LNAI), vol. 3229, pp. 147–160. Springer, Berlin (2004). doi:10.1007/978-3-540-30227-8_15

    Chapter  Google Scholar 

  27. Ross, K.A.: On negation in HiLog. J. Logic Program. 18(1), 206–215 (1994)

    Article  MathSciNet  MATH  Google Scholar 

  28. Schönfinkel, M.: Über die bausteine der mathematischen logik. Math. Ann. 92, 305–316 (1924)

    Article  MathSciNet  MATH  Google Scholar 

  29. Syrjänen, T.: Omega-restricted logic programs. In: Eiter, T., Faber, W., Truszczyński, M. (eds.) LPNMR 2001. LNCS (LNAI), vol. 2173, pp. 267–280. Springer, Berlin (2001). doi:10.1007/3-540-45402-0_20

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Christoph Redl .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Springer International Publishing AG

About this paper

Cite this paper

Redl, C. (2017). Extending Answer Set Programs with Interpreted Functions as First-Class Citizens. In: Lierler, Y., Taha, W. (eds) Practical Aspects of Declarative Languages. PADL 2017. Lecture Notes in Computer Science(), vol 10137. Springer, Cham. https://doi.org/10.1007/978-3-319-51676-9_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-51676-9_5

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-51675-2

  • Online ISBN: 978-3-319-51676-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics