From the slides you are given the following prolog rules instructor(chan, math27
ID: 3876148 • Letter: F
Question
From the slides you are given the following prolog rules instructor(chan, math273) instructor(patel, ee222) instructor(grossman, cs301) enrolled(kevin, math273) enrolled(juana, ee222) enrolled(juana, cs301) enrolled(kiko, math273) enrolled(kiko, cs301). These rules are setup as Verb(A, B), but read as A verb B. So the first rule would be read as "chan instructor math273" or "Chan is the instructor for math273. The last rule would be read as a "kiko enrolled cs301" or "Kiko is enrolloed in cs301 We also have a rule teaches(P,S):- instructor(P,C), enrolled(S, C) This rule is read as P teaches S if P is instructor for course C and S is enrolled in course C Capital letters are used as variables. The:- defines the rule So your initial prolog program will look like this instructor(chan, math273) instructor(patel, ee222) instructor(grossman, cs301) enrolled(kevin, math273) enrolled(juana, ee222) enrolled(juana, cs301) enrolled(kiko, math273) enrolled(kiko, cs301). teaches(P,S) instructor(P,C), enrolled(S,c)Explanation / Answer
New facts:
---------------
department(math,math273).
department(math,math101).
department(math,math401).
department(electriicalengineering,ee222).
department(computerscience,cs301).
department(computerscience,cs315).
department(computerscience,cs215).
instructor(smith,cs301).
instructor(yan,math101).
instructor(yan,cs215).
enrolled(kiko,math273).
enrolled(kevin,math401).
enrolled(jane,cs301).
prerequisite(math273,math101).
prerequisite(cs301,cs215).
-----------------------------------------------------------------------------------------------------------------------------------------------------
New Rules:
classmate(S,T) :- enrolled(S,C),enrolled(T,C),not(S=T).
faculty(X,Y) :- instructor(X,Z),department(Y,Z).
hasTaken(X,Y) :- enrolled(X,A),prerequisite(A,Y).
majoring(X,B) :- enrolled(X,Y),department(B,Y),enrolled(X,A),department(B,A),not(Y,A).
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.