(0) Obligation:

Clauses:

kay4(I) :- ','(length(.(X1, .(X2, L)), I), ','(top(L), ','(mid([], L), bot(L)))).
top(L) :- ','(write(a), ','(mwrite('-', L), ','(write(b), nl))).
bot(L) :- ','(write(c), ','(mwrite('-', L), ','(write(d), nl))).
mid(X, []).
mid(X, .(X3, [])) :- ','(write('|'), ','(mwrite(' ', X), ','(write('X'), ','(mwrite(' ', X), ','(write('|'), nl))))).
mid(X, .(X4, .(X5, Y))) :- ','(write('|'), ','(mwrite(' ', X), ','(write('\\'), ','(mwrite(' ', Y), ','(write('/'), ','(mwrite(' ', X), ','(write('|'), ','(nl, ','(mid(.(X6, X), Y), ','(write('|'), ','(mwrite(' ', X), ','(write('/'), ','(mwrite(' ', Y), ','(write('\\'), ','(mwrite(' ', X), ','(write('|'), nl)))))))))))))))).
mwrite(Char, L) :- findall(X7, ','(member(X8, L), write(Char)), X9).
member(X, .(X, X10)).
member(X, .(X11, Xs)) :- member(X, Xs).

Query: kay4(g)

(1) PrologToTRSTransformerProof (SOUND transformation)

Transformed Prolog program to TRS.

(2) Obligation:

Q restricted rewrite system:
R is empty.
Q is empty.

(3) RisEmptyProof (EQUIVALENT transformation)

The TRS R is empty. Hence, termination is trivially proven.

(4) YES