Stepping through an Answer-Set Program

  • Johannes Oetsch
  • Jörg Pührer
  • Hans Tompits
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6645)


We introduce a framework for interactive stepping through an answer-set program as a means for debugging. In procedural languages, stepping is a widespread and effective debugging strategy. The idea is to gain insight into the behaviour of a program by executing statement by statement, following the program’s control flow. Stepping has not been considered for answer-set programs so far, presumably because of their lack of a control flow. The framework we provide allows for stepwise constructing interpretations following the user’s intuition on which rule instances to become active. That is, we do not impose any ordering on the rules but give the programmer the freedom to guide the stepping process. Due to simple syntactic restrictions, each step results in a state that guarantees stability of the intermediate interpretation. We present how stepping can be started from breakpoints as in conventional programming and discuss how the approach can be used for debugging using a running example.


answer-set programming program analysis debugging 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Gelfond, M., Leone, N.: Logic programming and knowledge representation - the A-Prolog perspective. Artificial Intelligence 138(1-2), 3–38 (2002)MathSciNetCrossRefMATHGoogle Scholar
  2. 2.
    Brain, M., Gebser, M., Pührer, J., Schaub, T., Tompits, H., Woltran, S.: Debugging ASP programs by means of ASP. In: Baral, C., Brewka, G., Schlipf, J. (eds.) LPNMR 2007. LNCS (LNAI), vol. 4483, pp. 31–43. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  3. 3.
    Syrjänen, T.: Debugging inconsistent answer set programs. In: Proc. NMR 2006, pp. 77–83 (2006)Google Scholar
  4. 4.
    Gebser, M., Pührer, J., Schaub, T., Tompits, H.: A meta-programming technique for debugging answer-set programs. In: Proc. AAAI 2008, pp. 448–453. AAAI Press, Menlo Park (2008)Google Scholar
  5. 5.
    Oetsch, J., Pührer, J., Tompits, H.: Catching the Ouroboros: Towards debugging non-ground answer-set programs. Theory and Practice of Logic Programming 10(4-6), 513–529 (2010)MathSciNetCrossRefMATHGoogle Scholar
  6. 6.
    Faber, W., Leone, N., Pfeifer, G.: Recursive aggregates in disjunctive logic programs: Semantics and complexity. In: Alferes, J.J., Leite, J. (eds.) JELIA 2004. LNCS (LNAI), vol. 3229, pp. 200–212. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  7. 7.
    Gelfond, M., Lifschitz, V.: Classical negation in logic programs and disjunctive databases. New Generation Computing 9(3-4), 365–386 (1991)CrossRefMATHGoogle Scholar
  8. 8.
    Shapiro, E.Y.: Algorithmic Program Debugging. PhD thesis, Yale University, New Haven, CT, USA (May 1982)Google Scholar
  9. 9.
    Denecker, M., Vennekens, J., Bond, S., Gebser, M., Truszczyński, M.: The second answer set programming competition. In: Erdem, E., Lin, F., Schaub, T. (eds.) LPNMR 2009. LNCS, vol. 5753, pp. 637–654. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  10. 10.
    Bösel, A., Linke, T., Schaub, T.: Profiling answer set programming: The visualization component of the noMoRe system. In: Alferes, J.J., Leite, J. (eds.) JELIA 2004. LNCS (LNAI), vol. 3229, pp. 702–705. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  11. 11.
    Pontelli, E., Son, T.C., El-Khatib, O.: Justifications for logic programs under answer set semantics. Theory and Practice of Logic Programming 9(1), 1–56 (2009)MathSciNetCrossRefMATHGoogle Scholar
  12. 12.
    Calimeri, F., Leone, N., Ricca, F., Veltri, P.: A visual tracer for DLV. In: Proc. SEA 2009 (2009)Google Scholar
  13. 13.
    Iwayama, N., Satoh, K.: Computing abduction by using TMS with top-down expectation. Journal of Logic Programming 44(1-3), 179–206 (2000)MathSciNetCrossRefMATHGoogle Scholar
  14. 14.
    Gebser, M., Gharib, M., Mercer, R.E., Schaub, T.: Monotonic answer set programming. Journal of Logic and Computation 19(4), 539–564 (2009)MathSciNetCrossRefMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Johannes Oetsch
    • 1
  • Jörg Pührer
    • 1
  • Hans Tompits
    • 1
  1. 1.Institut für Informationssysteme 184/3Technische Universität WienViennaAustria

Personalised recommendations