a) Write a Prolog KB that expresses the following facts. Anwar is a graduate stu
ID: 3756742 • Letter: A
Question
a) Write a Prolog KB that expresses the following facts. Anwar is a graduate student. Bader is a graduate student. Caser is an undergraduate student. Dani is an undergraduate student. Dani cheats on the exam Bader is letting Caser see his exam. If one student is helping another student with the exam, both cheat Whoever is cheating on the exam gets an F. A graduate student who cheats is expelled from the school b) Then write queries to find out and give Prolog's answers: i) Who is expelled from the school? ii) Which undergraduate students get an F? i) Who is helping whom? c) The instructor decides that whoever does not cheat will get rewarded. Write the corresponding rule. d) Use SWI-Prolog software to implement and answer the above assignment questions. Solution:Explanation / Answer
a)Prolog Knowledge Bases For the Given Facts:::
1.Anwar is a graduate student: graduate(Anwar)
2.Bader is a graduate student: graduate(Bader)
3.Caser is an undergraduate student: undergraduate(Caser)
4.Dani is an undergraduate student: undergraduate(Dani)
5.Dani cheats on the exam: CheatsOnTheExam(Dani)
6.Bader is letting Caser see his exam: LettingCaserSeeHisExam(Bader)
7.If one student is helping another student with the exam,both cheat: BothCheat(HelpingAnother Student in the Exam)
8.Whoever is cheating on the exam gets an F.:GetsAnF(Cheating on the Exam)
9.A graduate student who cheats is expelled from the school: ExpelledFromTheSchool(Graduate Student Cheats)
a)Prolog Knowledge Bases For the Given Facts:::
1.graduate(Anwar)
2.graduate(Bader)
3.undergraduate(Caser)
4.undergraduate(Dani)
5.CheatsOnTheExam(Dani)
6.LettingCaserSeeHisExam(Bader)
7.BothCheat(HelpingAnother Student in the Exam)
8.GetsAnF(Cheating on the Exam)
9.ExpelledFromTheSchool(Graduate Student Cheats)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.