# Aggregation and well-founded semantics+

## Abstract

Set-grouping and aggregation are powerful non-monotonic operations of practical interest in database query languages. We consider the problem of expressing aggregation via negation as failure (NF). We study this problem in the framework of partial-order clauses introduced in [JOM95]. We show a translation of partial-order programs to normal programs that is very natural: Any *costmonotonic* partial-order program P becomes a *stratified* normal program transl(P) such that the declarative semantics of P is equivalent to the *stratified* semantics of transl(P). The ability to effect such a translation is significant because the resulting normal programs do not make any explicit use of the *aggregation* capability, yet they are concise and intuitive. The success of this translation is due to the fact that the translated program is a *stratified* normal program. That would not be the case for other more general classes of programs than *cost-monotonic* partial-order programs. We therefore investigate a second (and more natural) translation that does not require the translated programs to be *stratified*, but requires the use of a suitable NF strategy. The class of normal programs originating from this translation is itself interesting. Every program in this class has a clear intended total model, although these programs are in general not stratified and not even call-consistent and do not have a stable model. The partial model given by the well-founded semantics is consistent with the intended total model and the extended well founded semantics WFS^{+} indeed defines the intended model. Since there is a well-defined and efficient operational semantics for partial-order programs [JOM95, JM95] we conclude that the gap between expression of a problem and computing its solution can be reduced with the right level of notation.

## Keywords

Partial Order Clauses Aggregation Negation as Failure Well-Founded Semantics Database Query Languages Declarative Programming Deductive Databases## Preview

Unable to display preview. Download preview PDF.

## References

- [AG91]S. Abiteboul and S. Grumbach, “A Rule-Based Language with Functions and Sets,”
*ACM Trans. on Database Systems*, 16(1):1–30, 1991.CrossRefGoogle Scholar - [AD94]C. Aranvindam and P.M. Dung, “Partial deduction of Logic Programs wrt Well-Founded Semantics,”
*New Generation Computing*,*13*pp. 45–74, 1994Google Scholar - [BN87]C. Beeri, S. Naqvi, et al, “Sets and Negation in a Logic Database Language (LDL1),”
*Proc. 6th ACM Symp. on Principles of Database Systems*, pp. 21–37, 1987.Google Scholar - [Dix92]J.Dix, “A framework for representing and characterizing semantics of Logic Programs,”
*Proc. 3rd Intl. Conf. on Principles of Knowledge Representation and Reasoning*pp. 591–602, 1992.Google Scholar - [Dix95a]J. Dix, “A Classification-Theory of Semantics of Normal Logic Programs: I. Strong Properties,”
*Fundamenta Informaticae XXII*(*3*) pp. 227–255, 1995.Google Scholar - [Dix95b]J. Dix, “A Classification-Theory of Semantics of Normal Logic Programs: II. Weak Properties,”
*Fundamenta Informaticae XXII*(*3*) pp. 257–288, 1995.Google Scholar - [GGZ91]G. Ganguly, S. Greco, and C. Zaniolo, “Minimum and maximum predicates in logic programs”,
*Proc. 10th ACM Symp. on Principles of Database Systems*, pp 154–163, 1991.Google Scholar - [GL88]Gelfond and V. Lifschitz, “The Stable Model Semantics for Logic Programming,”
*Proc. 5th Intl. Conf. of Logic Programming*, pp. 1070–1080, Seattle, August 1988.Google Scholar - [JM95]B. Jayaraman, and K. Moon, “Implementation of Subset-Logic Programs,” Submitted for publication.Google Scholar
- [JOM95]B. Jayaraman, M. Osorio and K. Moon, “Partial Order Programming (revisited)”,
*Proc. Algebraic Methodology and Software Technology*, Springer-Verlag, July 1995.Google Scholar - [Liu95]M. Liu, “Relationlog: A typed Extension to Datalog with Sets and Tuples,”
*Proc. Intl. Symp. of Logic Programming*, pp 83–97, 1995.Google Scholar - [Llo87]J. Lloyd, “Foundations of Logic Programming,” (2 ed.) Springer-Verlag, 1987.Google Scholar
- [Moo97]K. Moon, “Implementation of Subset Logic Languages,” Ph.D. dissertation, Department of Computer Science, SUNY-Buffalo, 1997.Google Scholar
- [Prz88]T.C. Przymusinski, “On the Declarative Semantics of Stratified Deductive Databases” in J. Minker (ed.),
*Foundations of Deducive Databases and Logic Programming*, 1988, pp. 193–216.Google Scholar - [PP90]T.C. Przymusinski and H. Przymusinska, “Semantic Issues in Deductive Databases and Logic Programs” in R.B. Banerji (ed.),
*Formal Techniques in Artificial Intelligence*, 1990, pp. 321–367.Google Scholar - [RS92]K.A. Ross and Y. Sagiv, “Monotonic Aggregation in Deductive Databases,”
*Proc. 11th ACM Symp. on Principles of Database Systems*, pp. 114–126, San Diego, 1992.Google Scholar - [Sch92b]J. Schlipf, “Formalizing a Logic for Logic Programming”,
*Annals of Mathematics and Artificial Intelligence*, 5:279–302, 1992.Google Scholar - [SZ90]D. Sacca and C. Zaniolo, “Stable models and non-determinism in logic programs with negation”,
*Proc. 9th ACM Symp. on Principles of Database Systems*, 1990, pp. 205–217.Google Scholar - [Van92]A. Van Gelder, “The Well-Founded Semantics of Aggregation,”
*Proc. ACM 11th Principles of Database Systems*, pp. 127–138, San Diego, 1992.Google Scholar - [VRS91]A. Van Gelder, K.A. Ross, and J.S. Schlipf, “The Well-Founded Semantics for General Logic Programs,”
*JACM*, 38(3):620–650.Google Scholar