With variables, we can now express conditional, context-sensitive preferences:
bird(tweety).
penguin(tweety).
water_shy(tweety).
bird(opus).
emu(opus).
bird(scully).
toy(scully).
flies(X) :- name(r1(X)), not neg flies(X), bird(X).
neg flies(X) :- name(r2(X)), not flies(X), penguin(X).
neg flies(X) :- name(r3(X)), not flies(X), emu(X).
neg flies(X) :- name(r4(X)), not flies(X), toy(X).
(r1(X) < r2(X)) :- not water_shy(X).
(r1(X) < r3(X)).
For treating such programs, they are preprocessed in two steps: