Here is one such sequence:
This is the sequence that results from selecting the topmost applicable rule at each stage. Many other sequences are possible, as long as the body of a clause is derived before the head.pressurised(p1) on(t1) pressurised(p2) pressurised(p3) on(t2) flow(shower) wet(bath) off(t3) off(t4) off(t5) on(t6) unplugged(bath) flow(d2) flow(d1) plugged(sink)
?flow(d1).
Here is such a derivation (always selecting the leftmost atom in the body):
yes <- flow(d1). yes <- flow(d2). yes <- wet(bath) & unplugged(bath). yes <- flow(shower) & unplugged(bath). yes <- on(t2) & pressurised(p2) & unplugged(bath). yes <- pressurised(p2) & unplugged(bath). yes <- on(t1) & pressurised(p1) & unplugged(bath). yes <- pressurised(p1) & unplugged(bath). yes <- unplugged(bath). yes <- .
Here is a failing derivation (always selecting the leftmost atom in the body):
yes <- flow(d1). yes <- flow(d3). yes <- wet(sink) & unplugged(sink). yes <- on(t3) & pressurised(p3) & unplugged(sink).