-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhw1_9.sp
More file actions
40 lines (30 loc) · 808 Bytes
/
hw1_9.sp
File metadata and controls
40 lines (30 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
sorts
#typebird = {eagles, robins}.
#objects = {sr71blackbird, jo, eagle1}.
predicates
jet(#objects).
bird(#objects).
birdtype(#objects,#typebird).
faster(#objects, #objects).
robin(#objects).
eagle(#objects).
rules
% X is faster than Y if X is a Jet and Y is a Bird.
faster(X, Y) :- jet(X), bird(Y).
% X is faster than Y if X is an eagle and Y is a robin.
faster(X, Y) :- birdtype(X, eagles), birdtype(Y, robins).
% X is a bird if X is of any birdtype.
bird(X) :- birdtype(X, Y).
% X is of birdtype robins if X is a robin.
birdtype(X, robins) :- robin(X).
% X is of birdtype robins if X is a robin.
birdtype(X, eagles) :- eagle(X).
% Facts
jet(sr71blackbird).
robin(jo).
eagle(eagle1).
%CWA
-jet(X) :- bird(X).
-bird(X) :- jet(X).
-faster(Y,X) :- faster(X,Y).
-birdtype(X,Y) :- not birdtype(X, Y).