Yoav Shoham, "Consistency enforcing in temporal reasoning", Section 6.4 in Y. Shoham, Artificial Intelligence techniques in Prolog, Morgan Kaufmann, San Francisco, CA, 1994, pp. 152--161 (references are on pp. 317--323).
This section describes Allen's interval formalism for temporal reasoning. In this formalism, different events $A,B,\ldots,$ are represented by (time) intervals, and expert knowledge consists of relations $ARB$ between pairs $(A,B)$ of events, e.g., "$A$ precedes $B$", "$A$ ends $B$", etc. Initially, we know some relations between some pairs of intervals. A natural problem is to describe what relations can be deduced from the given ones. For that, the author uses Allen's "propagate-interval-constraints" algorithm that is based on statements of the type "If $AR_1B$ and $BR_2C$, then $AR_3C$". This idea is similar to transitive closure, and, similarly to transitive closure, it leads to a cubic-time algorithm.
A Prolog program implementing this algorithm is described and traced on an example of robot control.