A theory of observables for logic programs