A declarative view of modes
This tech report was done in a bit of a hurry because I was
going on leave. The ICLP'96 version is better.
A declarative view of modes
Lee Naish
Mode information in logic programming is concerned with such things as
inputs and outputs of procedures, producers and consumers of variable
bindings, instantiation states of calls during execution and the order
of execution. Modes seem inextricably tied to the procedural rather than
the declarative view of logic programs. Despite this, we argue that
purely declarative information can actually express the essence of modes
remarkable well. The declarative view allows a high level notion of
correctness which is independent of how the information is used.
We start from a framework which includes types and
show how a set of ground atoms related to the success set can be used to
express mode information. We introduce constrained regular trees to
define such sets and show how they can be used as the basis for a
polymorphic mode system. The mode system can express directional types,
back communication and linearity and can be used to infer lower level mode
information for languages such as Mercury.
Keywords:
logic programming, modes, types,
constrained regular trees, linearity, set constraints, multisets.
Lee