%% local_cwa.lp %% Last Modified: 3/16/14 %% Additional Exercise Solution -- ASP version %% Suppose we have a list of members of the Knowledge Representation Lab. %% We assume that we have complete information on the workplace of %% current members, but not necessarily for former or affiliate members. %% Encode this information in ASP. Define predicate employed(X) which is true %% if we know that a person has a workplace, false if a person does not have %% a workplace, and unknown if we don't have information on his workplace. place(ttu). place(ut). membership(john, member). membership(lori, member). membership(mary, former_member). membership(bob, affiliate). workplace(john, ttu). workplace(bob, ut). %% CWA for workplace for members -workplace(X,Y) :- membership(X,member), place(Y), %% added for safety not workplace(X,Y). %% Note that CWA is not present for former and affiliate members. employed(X) :- workplace(X,Y). -employed(X) :- membership(X,member), not employed(X).