p(X):- body(X). p(X):- body1(X), body2(X). ---------------------------------- p(X):- body(X), assert(p(X)). p(X):- body1(X), assert(p(X):-body2(X)).
inc_counter:- counter(X), X1 is X + 1, retract(counter(X)), assert(counter(X1)).