initial commit
[ker2014-2.git] / pl-ail-files / exercise0.pl
1 /* The facts about the Dutch Royal Family */
2
3 mother(wilhelmina, juliana).
4 mother(juliana, beatrix).
5 mother(juliana, christina).
6 mother(juliana, irene).
7 mother(juliana, margriet).
8 mother(beatrix, friso).
9 mother(beatrix, alexander).
10 mother(beatrix, constantijn).
11 mother(emma, wilhelmina).
12
13 father(hendrik, juliana).
14 father(bernard, beatrix).
15 father(bernard, christina).
16 father(bernard, irene).
17 father(bernard, margriet).
18 father(claus, friso).
19 father(claus, alexander).
20 father(claus, constantijn).
21 father(willem, wilhelmina).
22
23 queen(beatrix).
24 queen(juliana).
25 queen(wilhelmina).
26 queen(emma).
27 king(willem).
28
29 /* rules */
30
31 parent(X, Y) :- mother(X, Y).
32 parent(X, Y) :- father(X, Y).
33
34 ruler(X) :- queen(X).
35 ruler(X) :- king(X).
36
37 predecessor(X, Y) :-
38 parent(X, Y),
39 ruler(X),
40 ruler(Y).
41 predecessor(X, Y) :-
42 ruler(X),
43 parent(X, Z),
44 predecessor(Z, Y).