% This is an ASP encoding of the "shopping example" for % the Epistemic Functional Event Calculus (EFEC) % See http://www.ucl.ac.uk/infostudies/efec/ #const maxworld=9. #const maxinstant=5. % S1 possVal(bought, true). possVal(bought, false). % S2 possVal(collectionPoint, red). possVal(collectionPoint, blue). possVal(collectionPoint, green). % S3 possVal(collected, true). possVal(collected, false). % S4 % no translation necessary given ASP semantics % S5 fluent(collectionPoint). fluent(bought). fluent(collected). % S6 % no translation necessary given ASP semantics % S7 action(purchase). action(collectFromRed). action(collectFromGreen). action(collectFromBlue). action(giveFreeGift). action(sense(F)) :- fluent(F). % S8 % no translation necessary given ASP semantics % S9 initiallyKnowsValueIsNot((W, 0), bought, 0, true) :- world(W). initiallyKnowsValueIsNot((W, 0), collected, 0, true) :- world(W). % S10 causesValue(purchase, collectionPoint, V, T) :- time(T), possVal(collectionPoint, V). causesValue(purchase, bought, true, T) :- time(T). causesValue(collectFromRed, collected, true, T) :- time(T), valueOf(collectionPoint, T, red). causesValue(collectFromRed, bought, false, T) :- time(T), valueOf(collectionPoint, T, V), V != red. causesValue(collectFromBlue, collected, true, T) :- time(T), valueOf(collectionPoint, T, blue). causesValue(collectFromBlue, bought, false, T) :- time(T), valueOf(collectionPoint, T, V), V != blue. causesValue(collectFromGreen, collected, true, T) :- time(T), valueOf(collectionPoint, T, green). causesValue(collectFromGreen, bought, false, T) :- time(T), valueOf(collectionPoint, T, V), V != green. % S11 triggered(giveFreeGift, T) :- valueOf(bought, T, true), happens(collectFromRed, T), valueOf(collectionPoint, T, red). % S12 perform(purchase, 1). perform(sense(collectionPoint), 2). % S13 performIfValueKnownIs(collectFromRed, collectionPoint, red, 3). performIfValueKnownIs(collectFromBlue, collectionPoint, blue, 3). performIfValueKnownIs(collectFromGreen, collectionPoint, green, 3).