Incremental Evaluation of Lattice-Based Aggregates in Logic Programming Using Modular TCLP

  • Conference paper
  • First Online:
Practical Aspects of Declarative Languages (PADL 2019)

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

Included in the following conference series:

  • 427 Accesses

Abstract

Aggregates are used to compute single pieces of information from separate data items, such as records in a database or answers to a query to a logic program. The maximum and minimum are well-known examples of aggregates. The computation of aggregates in Prolog or variant-based tabling can loop even if the aggregate at hand can be finitely determined. When answer subsumption or mode-directed tabling is used, termination improves, but the behavior observed in existing proposals is not consistent. We present a framework to incrementally compute aggregates for elements in a lattice. We use the entailment and join relations of the lattice to define (and compute) aggregates and decide whether some atom is compatible with (entails) the aggregate. The semantics of the aggregates defined in this way is consistent with the LFP semantics of tabling with constraints. Our implementation is based on the TCLP framework available in Ciao Prolog, and improves its termination properties w.r.t. similar approaches. Defining aggregates that do not fit into the lattice structure is possible, but some properties guaranteed by the lattice may not hold. However, the flexibility provided by this possibility justifies its inclusion. We validate our design with several examples and we evaluate their performance.

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

Access this chapter

Subscribe and save

Springer+ Basic
EUR 32.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or Ebook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (Canada)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (Canada)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (Canada)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free ship** worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    This definition would usually be based on a set instead of a multiset. The reason to choose explicitly a multiset will be clear in Sect. 4.5, when we apply our implementation to operations that cannot be embedded in a lattice.

  2. 2.

    The original example used max. For coherence with the rest of the cases in this paper, we have converted it to use min.

  3. 3.

    Batch scheduling returns answers as soon as they are found.

  4. 4.

    Stable versions of Ciao Prolog are available at http://www.ciao-lang.org. However, ATCLP is still in development and not fully available yet in the stable versions.

References

  1. Arias, J., Carro, M.: Description and evaluation of a generic design to integrate CLP and tabled execution. In: International Symposium on Principles and Practice of Declarative Programming, pp. 10–23. ACM, September 2016

    Google Scholar 

  2. Arias, J., Carro, M.: Description, implementation, and evaluation of a generic design for tabled CLP. Theory and Practice of Logic Programming (2018) (to appear)

    Google Scholar 

  3. Bratko, I.: Prolog Programming for Artificial Intelligence. Pearson Education, London (2001)

    MATH  Google Scholar 

  4. Chico de Guzmán, P., Carro, M., Hermenegildo, M.V., Stuckey, P.: A general implementation framework for tabled CLP. In: Schrijvers, T., Thiemann, P. (eds.) FLOPS 2012. LNCS, vol. 7294, pp. 104–119. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-29822-6_11

    Chapter  Google Scholar 

  5. Cui, B., Warren, D.S.: A system for tabled constraint logic programming. In: Lloyd, J., Dahl, V., Furbach, U., Kerber, M., Lau, K.-K., Palamidessi, C., Pereira, L.M., Sagiv, Y., Stuckey, P.J. (eds.) CL 2000. LNCS (LNAI), vol. 1861, pp. 478–492. Springer, Heidelberg (2000). https://doi.org/10.1007/3-540-44957-4_32

    Chapter  Google Scholar 

  6. Guo, H.F., Gupta, G.: Simplifying dynamic programming via mode-directed tabling. Softw. Pract. Exp. 1, 75–94 (2008)

    Article  Google Scholar 

  7. Holzbaur, C.: Metastructures vs. attributed variables in the context of extensible unification. In: Bruynooghe, M., Wirsing, M. (eds.) PLILP 1992. LNCS, vol. 631, pp. 260–268. Springer, Heidelberg (1992). https://doi.org/10.1007/3-540-55844-6_141

    Chapter  Google Scholar 

  8. Kemp, D.B., Stuckey, P.J.: Semantics of logic programs with aggregates. In: Saraswat, V.A., Ueda, K. (eds.) International Symposium on Logic Programming, pp. 387–401. October 1991

    Google Scholar 

  9. Pelov, N., Denecker, M., Bruynooghe, M.: Well-founded and stable semantics of logic programs with aggregates. Theory Pract. Log. Program. 3, 301–353 (2007)

    Article  MathSciNet  Google Scholar 

  10. Picard, G.: Artificial intelligence - implementing minimax with prolog. https://www.emse.fr/~picard/cours/ai/minimax/

  11. Santos Costa, V., Rocha, R., Damas, L.: The YAP prolog system. Theory Pract. Log. Program. 1–2, 5–34 (2012)

    Article  MathSciNet  Google Scholar 

  12. Schrijvers, T., Demoen, B., Warren, D.S.: TCHR: a Framework for tabled CLP. Theory Pract. Log. Program. 4, 491–526 (2008)

    Article  MathSciNet  Google Scholar 

  13. Swift, T., Warren, D.S.: Tabling with answer subsumption: implementation, applications and performance. In: Janhunen, T., Niemelä, I. (eds.) JELIA 2010. LNCS (LNAI), vol. 6341, pp. 300–312. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-15675-5_26

    Chapter  Google Scholar 

  14. Swift, T., Warren, D.S.: XSB: extending prolog with tabled logic programming. Theory Pract. Log. Program. 1–2, 157–187 (2012)

    Article  MathSciNet  Google Scholar 

  15. Vandenbroucke, A., Pirog, M., Desouter, B., Schrijvers, T.: Tabling with sound answer subsumption. Theory Pract. Log. Program. 16(5–6), 933–949 (2016). 32nd International Conference on Logic Programming

    Article  MathSciNet  Google Scholar 

  16. Zhou, N.F.: The language features and architecture of B-Prolog. Theory Pract. Log. Program. 1–2, 189–218 (2012)

    Article  MathSciNet  Google Scholar 

  17. Zhou, N.F., Kameya, Y., Sato, T.: Mode-directed tabling for dynamic programming, machine learning, and constraint solving. In: International Conference on Tools with Artificial Intelligence, No. 2, pp. 213–218. IEEE, October 2010

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Joaquín Arias .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Arias, J., Carro, M. (2019). Incremental Evaluation of Lattice-Based Aggregates in Logic Programming Using Modular TCLP. In: Alferes, J., Johansson, M. (eds) Practical Aspects of Declarative Languages. PADL 2019. Lecture Notes in Computer Science(), vol 11372. Springer, Cham. https://doi.org/10.1007/978-3-030-05998-9_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-05998-9_7

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-05997-2

  • Online ISBN: 978-3-030-05998-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics

Navigation