This example is from unpublished (to the best of my knowledge) notes by Maarten
Van Emden.

The extensional representation of the (knight) move relation follows.  It
consists of 336 facts; only a few are shown.  In particular, all moves from
position (5,3) on the chess board are shown.
move(1,1,2,3).
move(1,1,3,2).
....
move(5,3,6,5).
move(5,3,7,4).
move(5,3,7,2).
move(5,3,6,1).
move(5,3,4,1).
move(5,3,3,2).
move(5,3,3,4).
move(5,3,4,5).
...
move(8,8,7,6).
move(8,8,6,7).

The intensional representation of the (knight) move relation follows.  It
consists of facts (to define extensionally the relation succ/2) and rules (to
define the relations move, diff1, and diff2.

move(X1,Y1,X2,Y2) :- diff1(X1,X2), diff2(Y1,Y2).
move(X1,Y1,X2,Y2) :- diff2(X1,X2), diff1(Y1,Y2).

diff1(X,Y) :- succ(X,Y).
diff1(X,Y) :- succ(Y,X).

diff2(X,Z) :- succ(X,Y), succ(Y,Z).
diff2(X,Z) :- succ(Z,Y), succ(Y,X).

succ(1,2).
succ(2,3).
succ(3,4).
succ(4,5).
succ(5,6).
succ(6,7).
succ(7,8).
