Rejected, even when it works
The rule is cautious: it rejects more than it must.
A tree’s height is one more than its tallest child.
This needs a recursive max, yet the height does have a clear answer:
height(N, max(H)) :- tchild(N, C), height(C, H0), H = H0 + 1. # cannot be recursive
The fix is to stratify: first compute the depth of every descendant (child, grandchild, …), then apply max once.
depth(N, 0) :- tnode(N).
depth(N, D + 1) :- tchild(N, C), depth(C, D).
height(N, max(D)) :- depth(N, D).
As with negation: the restriction is sufficient, not necessary.