Prev Up Next
Go backward to Solution to part (a)
Go up to Question 1
Go forward to Solution to part (c)

Solution to part (b)

Axiomatize the domain so that you can determine whether there is flow in the drains for various situations. You need to consider both the bath and the sink, but you don't need to consider how the floor gets wet.

We can just copy the solution to assignment 2, adding a situation term to each predicate. Note that all of these can be considered to be derived predicates. [I also added a flow from the sink spout.]

pressurised(p1,init).
pressurised(p1,do(A,S)) <- pressurised(p1,S).
pressurised(p2,S) <- on(t1,S) & pressurised(p1,S).
pressurised(p3,S) <-  on(t1,S) & pressurised(p1,S).
flow(shower,S) <- on(t2,S) & pressurised(p2,S).
wet(bath,S) <- flow(shower,S).
flow(sink,S) <- on(t3,S) & pressurised(p3,S).
wet(sink,S) <- flow(sink,S).
flow(d2,S) <- wet(bath,S) & unplugged(bath,S).
flow(d1,S) <- flow(d2,S).
flow(d3,S) <- wet(sink,S) & unplugged(sink,S).
flow(d1,S) <- flow(d3,S).

David Poole

Prev Up Next