-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathin62.txt
62 lines (59 loc) · 1.63 KB
/
in62.txt
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Schemes:
snap(S,N,A,P)
csg(C,S,G)
cp(C,Q)
cdh(C,D,H)
cr(C,R)
before(C1,C2)
tthCourses(C)
Schedule(N,C,R,D,H)
Grades(N,C,G)
Students(C,R,N,G)
Facts:
snap('12345','C. Brown','12 Apple St.','555-1234').
snap('67890','L. Van Pelt','34 Pear Ave.','555-5678').
snap('22222','P. Patty','56 Grape Blvd.','555-9999').
snap('33333','Snoopy','12 Apple St.','555-1234').
csg('CS101','12345','A').
csg('CS101','67890','B').
csg('EE200','12345','C').
csg('EE200','22222','B+').
csg('EE200','33333','B').
csg('CS101','33333','A-').
csg('PH100','67890','C+').
cp('CS101','CS100').
cp('EE200','EE005').
cp('EE200','CS100').
cp('CS120','CS101').
cp('CS121','CS120').
cp('CS205','CS101').
cp('CS206','CS121').
cp('CS206','CS205').
cdh('CS101','Tu','10AM').
cdh('EE200','M','10AM').
cdh('EE200','W','1PM').
cdh('EE200','F','10AM').
cdh('PH100','Th','11AM').
cr('CS101','Turing Aud.').
cr('EE200','25 Ohm Hall').
cr('PH100','Newton Lab.').
Rules:
before(C1,C2) :- cp(C2,C1).
before(C1,C2) :- cp(C3,C1),before(C3,C2).
tthCourses(C) :- cdh(C,'Tu',H).
tthCourses(C) :- cdh(C,'Th',H).
Schedule(N,C,R,D,H) :- snap(S,N,A,P),csg(C,S,G),cr(C,R),cdh(C,D,H).
Grades(N,C,G) :- snap(S,N,A,P),csg(C,S,G).
Students(C,R,N,G) :- snap(S,N,A,P),csg(C,S,G),cr(C,R).
Queries:
snap(Id,'Snoopy',A,P)?
csg(Course,'33333',Grade)?
cp(Course,'CS100')?
cdh('EE200',Day,Hour)?
cr('CS101',Room)?
tthCourses(C)?
before('CS100','CS206')?
before('CS100',prerequisiteTo)?
Schedule('Snoopy',C,R,D,H)?
Grades('Snoopy',C,G)?
Students('CS101',R,N,G)?