all top level facts:
root_hyp(H) :- hyp(H, _), \+ hyp(_, H).
leafs don't have children:
leaf_hyp(L) :- hyp(_, L), \+ hyp(L, _).
if your Prolog doesn't have library(aggregate), you can count elements with this snippet
count_synset_daughters(S, N) :-
s(S,_,_,_,_,_),
setof(D, hyp(S,D), L),
length(L, N).
then simply combine (join) them:
?- root_hyp(R), count_synset_daughters(R, N).