A derivate of this report appeared in A. Bossi, editor, Selected Papers of the 9th International Workshop on Logic-Based Program Synthesis and Transformation (LOPSTR'99), Venezia, LNCS 1817, pp. 234-254, 2000. http://www.springer.de/comp/lncs/, see also here.
M. Kulas. Port annotations for Prolog. Informatik Berichte 254, FernUniversität Hagen, June 1999.
A concept of annotations for rendering procedural aspects of Prolog is presented, built around well-known procedural concepts of Standard Prolog. Annotations describe properties of predicates. Such properties can be pre or post conditions, which must hold true when a predicate is called or exited, respectively.
Our concept transcends pre/post conditions: we introduce two more kinds of annotations, fail and redo annotations, hence incorporating a whole model of Prolog execution into our language. This enables natural rendering of many procedural properties of Prolog which cannot be expressed with only pre/post conditions.
There are four more novelties in our approach. First, any annotation can be "narrowed down" to a subset of calls, via templates and contexts, giving much more flexible assertions. Notably the novel idea of calling context adds significant expressive power, as a bridge towards program-point assertions. The annotations are defined simply as Prolog goals, making them fully parametric and therefore very comfortable for debugging. Finally, the annotations are applied via a general kind of matching instead of unification, enabling the use of local variables.
We provide many detailed illustrations of the potentials of the approach. All examples presented here are actual runs of our system Nope, which is a Prolog module.
Available: BibTeX entry