and TOMASZ IMIELINSKI
Rutgers UniversityWe define here a formal notion of finite representation of infinite query answers in logic programs. We apply this notion to Datalog.s (Datalog with n successors): an extension of Datalog capable of representing infinite phenomena like flow of time or plan construction. Predicates in Datalogns can have arbitrary unary and limited n-ary function symbols m one fixed position. This class of logic programs is known to be decidable.However, least Herbrand modek of Data log.~programs may be infinite and consequently queries may have infinite answers.We present a method to finitely represent infinite least Herbrand models of Datalog.s programs as relational specifications. A relational specificationconsistsof a finite set of facts and a finitely specified congruencerelation. A relational specification has the following desirable properties: First, it is explicit in the sense that once it is computed, the original Datalog,zs program (and its underlying computational engine) can be forgotten. Given a query to be evaluated, it is easy to obtain from the relational specification finitely many answer substitutions that represent infinitely many answer substitutions to the query. The method involved is a combination of a simple, unificationless, computational mechanism(graph traversal, congruence closure, or term rewriting) and standard relational query evaluation methods. Second,a relationa I specificationis effectively computable and its computation is no harder, in the senseof the comp~exityclass,than answering yes-noqueries.Our method is applicable to every range-restricted Datalogns program. We also showthat for somevery simple non-Datalogn~logic programs, finite representations of query answers do not exist.