Axiomatize, using the situation calculus, how on, plugged and unplugged are affected by the actions.
These are all primitive, and so we axiomatize how they are true initially and how they are true after an action depending on what's true before the action.
on(T,do(turnon(T),S)) <- poss(turnon(T),S). on(T,do(A,S)) <- poss(A,S) & on(T,S) & A \= turnoff(T). unplugged(B,do(unplug(B),S)) <- poss(unplug(B),S). unplugged(B,do(A,S)) <- poss(A,S) & unplugged(B,S) & A \= plug(B). unplugged(B,init). plugged(B,do(plug(B),S)) <- poss(unplug(B),S). plugged(B,do(A,S)) <- poss(A,S) & plugged(B,S) & A \= unplug(B).We also need to state that all actions are always possible:
poss(wait,S). poss(turnon(T),S). poss(turnoff(T),S). poss(unplug(B),S). poss(plug(B),S).As all of the actions are always possible, one could omit all mention of poss, but then the representation doesn't let us easily add another action that does have a prerequisite.
Alternatively, you could give reasonable preconditions:
poss(wait,S). poss(turnon(T),S) <- off(T,S). poss(turnoff(T),S) <- on(T,S). poss(unplug(B),S) <- plugged(B,S). poss(plug(B),S) <- unplugged(B,S).