%% cars.cr -- CR-Prolog solution to additional exercise for Section 5.5 %% (Indirect Exceptions to Defaults) %% Last Modified: 3/26/14 %% You can run it with CR-Models: %% crmodels cr_cars.cr %% %% Write a program with consistency restoring rules %% representing the following information: %% "Cars normally work; in rare cases, a car does not work. %% Working cars have working engines. %% The engine of John's car does not work." %% Make sure that your program entails that John's car does not work but %% Mary's car does. car(c1). car(c2). works(C) :- car(C), not ab(d(C)), not -works(C). #domain car(C). %% #domain required for cr-rules of CRModels r1(C): -works(C) +-. works(e(C)) :- car(C), works(C). owns(john,c1). -works(e(c1)). owns(mary,c2).