# Design and Implementation of Aggregate Functions in the DLV System

**Authors:** Wolfgang Faber, Gerald Pfeifer, Nicola Leone, Tina Dell'Armi, Giuseppe, Ielpa

arXiv: 0802.3137 · 2008-02-22

## TL;DR

This paper extends Disjunctive Logic Programming with aggregate functions to better express properties involving sums, counts, and products, without increasing computational complexity, and demonstrates its practical implementation and benefits in the DLV system.

## Contribution

It introduces a conservative extension of DLP with stratified aggregate functions, formalizes its semantics, and implements it in the DLV system, enhancing expressiveness without added complexity.

## Key findings

- Aggregates do not increase computational complexity.
- Implementation in DLV confirms practical usefulness.
- Extension improves natural representation of aggregate properties.

## Abstract

Disjunctive Logic Programming (DLP) is a very expressive formalism: it allows for expressing every property of finite structures that is decidable in the complexity class SigmaP2 (= NP^NP). Despite this high expressiveness, there are some simple properties, often arising in real-world applications, which cannot be encoded in a simple and natural manner. Especially properties that require the use of arithmetic operators (like sum, times, or count) on a set or multiset of elements, which satisfy some conditions, cannot be naturally expressed in classic DLP.   To overcome this deficiency, we extend DLP by aggregate functions in a conservative way. In particular, we avoid the introduction of constructs with disputed semantics, by requiring aggregates to be stratified. We formally define the semantics of the extended language (called DLP^A), and illustrate how it can be profitably used for representing knowledge. Furthermore, we analyze the computational complexity of DLP^A, showing that the addition of aggregates does not bring a higher cost in that respect. Finally, we provide an implementation of DLP^A in DLV -- a state-of-the-art DLP system -- and report on experiments which confirm the usefulness of the proposed extension also for the efficiency of computation.

## Full text

Tomesphere does not host the full text of arXiv papers. Read it on arXiv: https://arxiv.org/abs/0802.3137

## References

48 references — full list in the complete paper: https://tomesphere.com/paper/0802.3137/full.md

---
Source: https://tomesphere.com/paper/0802.3137