1% CILog code for the electrical environment.
2% This is the code discussed in Section 3.2 of Computational Intelligence.
3% Copyright (c) Poole, Mackworth and Goebel and Oxford University Press, 1998
4
5% lit(L) is true if light L is lit.
6lit(L) <-
7 light(L) &
8 ok(L) &
9 live(L).
10
11% live(W) is true if W is live (i.e., current will flow through it if grounded)
12live(W) <-
13 connected_to(W,W1) &
14 live(W1).
15
16live(outside).
17
20
21connected_to(l1,w0).
22connected_to(w0,w1) <- up(s2).
23connected_to(w0,w2) <- down(s2).
24connected_to(w1,w3) <- up(s1).
25connected_to(w2,w3) <- down(s1).
26connected_to(l2,w4).
27connected_to(w4,w3) <- up(s3).
28connected_to(p1,w3).
29connected_to(w3,w5) <- ok(cb1).
30connected_to(p2,w6).
31connected_to(w6,w5) <- ok(cb2).
32connected_to(w5,outside).
33
35light(l1).
36light(l2).
37
40
41up(s2).
42down(s1).
43up(s3).
44
46ok(l1).
47ok(l2).
48ok(cb1).
49ok(cb2).
50