half(0,0).
half(s(s(X)),s(Y)):- half(X,Y).
log(s(0),0).
log(s(s(X)),s(Y)):- half(X,Z), log(s(Z),Y).