Situation Calculus
?- holds(on(b,table),S,3).
holds(on(b,table),[puton(b,table)|Rest],3):- 3ɬ, M is 3-1,
holds(clear(table),Rest,M).
holds(clear(b),[puton(a,table)|Rest1],2) :-
2ɬ, M is 2-1,neq(a,table),
holds(clear(a), Rest1,M),
holds(clear(table), Rest1,M).