Prolog Queries in Discrete Mathematics
In this exercise, Prolog queries are used to determine instructor assignments, enrollments, and teaching relationships in a discrete mathematics context. The responses to specific queries are provided along with explanations based on the given predicates and quantifiers.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Discrete Math: Predicates and Quantifiers Exercise 28
Exercise What would Prolog return given these queries? a) ?instructor(chan,math273) b) ?instructor(patel,cs301) c) ?enrolled(X,cs301) d) ?enrolled(kiko,Y) e) ?teaches(grossman,Y)
Solution A Prolog query returns a yes/no answer if there are no variables in the query, and it returns all values that make the query true if there are. a) One of the facts was that Chan was the instructor of Math 273, so the response is yes. b) None of the facts was that Patel was the instructor of CS 301, so the response is no. c) Prolog returns the names of the people enrolled in CS 301, namely juana and kiko. d) Prolog returns the names of the courses Kiko is enrolled in, namely math273 and cs301. e) Prolog returns the names of the students enrolled in courses which Grossman is the instructor for (which is just CS 301), namely juana and kiko.
References Discrete Mathematics and Its Applications, McGraw-Hill; 7th edition (June 26, 2006). Kenneth Rosen Discrete Mathematics An Open Introduction, 2nd edition. Oscar Le in A Short Course in Discrete Mathematics, 01 Dec 2004, Edward Bender & S. Gill Williamson