## Prolog Snippets |

More to come here.

Feedback is welcome: David Reitter, or .

Keywords: Prolog, SWI-Prolog/font>

The sbt/2 predicate tries to visualize the *intension* of a term rather than its extension. What's that? In term(D, D), the two arguments are co-bound. Normally, if D is instantiated, the value of D will be printed twice:

T=term(D,D), D=bound(a,b), write(T)

will print

term(bound(a,b),bound(a,b))

This does not reveal the binding, and leads to large output, especially when working with unification-based mechanisms where bindings occur frequently and contain large structures. The predicate sbt/2 converts the above example as follows:

T=term(D,D), D=bound(a,b), sbt(T, T2), write(T2)

yields

term(<V1>=bound(a, b), <V1>)

This attempts to show the intensional description of the term rather than its extensional one. In unification-based formalisms, this representation is much shorter, as it shows shared structures.

However, it cannot circumvent the property of common Prolog implementations that keeps the system from unifying extension and intension.

Download: sbt.prolog

,-------------------------------, | k,d | |-------------------------------| | ,-----------, | | ,----------, | d | | | | k | |-----------| | | |----------| -> | boxer(d) | | | | woman(k) | | love(k,d) | | | `----------' `-----------' | `-------------------------------' |

The PROLOG predicate display_drs will visualize a prolog term (drs/2, drs/4) in text mode. Additionally, drs2clip can draw a prolog term (drs/2) using the CLIG, the *Computational Linguistics Interactive Grapher*,
which has to be installed before using the predicate. The ASCII predicate
can handle lambda, merge, neg, or, implication and other operations. The
current Version 1 is a beta version. Feedback is welcome!

Download: drs_vis.zip