You are on page 1of 5

ASSIGNMENT#2

Decision Support System


SUBMISSION DATE
19th April, 2023
SUBMITTED TO
Mam SALWA Muhamad Akhtar
SECTION
B
SUBMITTED BY
MUHAMMAD WASIB (F2020054080)
University of Management and Technology
QUESTION.1
FACTS:

• Burger is a food
• Sandwich is a food
• Pizza is a food
• Sandwich is a lunch
• Pizza is a dinner
RULES:
• Every food is a meal
• Anything is a meal if it is a food
QUERIES:
 Is pizza a food?
 Which food is meal?
 Which food is lunch?
 Is sandwich a dinner?
 Which food is meal and lunch?
 What is both meal and lunch?
PROLOG FACTS:
• food(‘burger’).
• food(‘sandwich’).
• food(‘pizza’).
• lunch(‘sandwich’).
• dinner(‘pizza’).
PROLOG RULES:
• meal(X) :- food(X).
• meal(X) :- X = food(X).

PROLOG QUERIES AND RESPONSES:

• Prolog query: food(‘pizza’).


• Response: true.
• Prolog query: meal(X).
• Response: X = burger; X = sandwich; X = pizza.
• Prolog query: lunch(X).
• Response: X = sandwich.
• Prolog query: dinner (‘sandwich’).
Response: false.
• Prolog query: meal(X), lunch(X).
• Response: X = sandwich.
• Prolog query: meal(X), lunch(X), food(X).
• Response: X = sandwich.

Explanation:

1. If pizza is a food, that is the first question. The answer is "Yes" since the data indicate
that pizza is a food.
2. Which foods also serve as meals is the question. The correct answer is "burger, sandwich,
pizza" since every food is a meal and anything that is a food is also a meal.
3. Which meals are regarded as lunch is the question. The appropriate response is
"sandwich" because it is true that a sandwich counts as lunch.
4. Is a sandwich considered a dinner? Sandwich is not a dinner, hence the answer is "No,"
based on the facts.
5. Which items qualify as both meals and lunch is the question. The correct response is
"sandwich, pizza" because every food is a meal in accordance with the facts and a
sandwich counts as lunch.

QUESTION 2
FACTS:
• The university has multiple departments, professors, and
students.
• The list of professors and the courses they are teaching is
available.
• The list of students and the courses they are studying is
available.
• Charlie studies csc135.
• Olivia studies csc135.
• Jack studies csc131.
• Arthur studies csc134.
• Kirke teaches csc135.
• Collins teaches csc131 and csc171.
• Juniper teaches csc134.
• X is a professor of Y if X teaches C and Y studies C.
RULES:
X is a professor of Y if X teaches C and Y studies C.
QUERIES:
• Charlie studies what?
• What does Charlie study?
• Who are the students of professor Kirke?
• Kirke is a professor of which students?
PROLOG FACTS:
• student (‘Charlie, csc135’).
• student (‘Olivia, csc135’).
• student (‘jack, csc131’).
• student (‘Arthur, csc134’).
• professor (‘Kirke, csc135’).
• professor (‘Collins, csc131’).
• professor (‘Collins, csc171’).
• professor (‘juniper, csc134’).
4
PROLOG RULES:
professor of (X, Y): - professor (‘X, C’), student (‘Y, C’).
QUERY RESPONSE:
• Charlie studies what?
? - student (‘Charlie, X’).
X = csc135.
• What does Charlie study?
? - student (‘Charlie, X’).
X = csc135.
• Who are the students of professor Kirke?
? - professor of (‘Kirke, Y’).
Y = Charlie;
Y = Olivia.
• Kirke is a professor of which students?
? - professor of (‘Kirke, Y’).
Y = Charlie;
Y = Olivia.

Explanation:
1. studies(charlie, X): This search enquires about Charlie's course of study. Charlie
studies csc135 because the answer is X = csc135.
2.?- studies(X, csc135). This command inquires about the students who are taking
csc135. The answer is X = Charlie and X = Olivia, indicating that Charlie and Olivia are
both studying CSC 135 respectively.
3. Which students are being taught by Professor Kirke, according to the query
professor_of(kirke, X). The answer is X = Charlie, indicating that Professor Kirke is
Charlie's instructor.
4. Which professors are instructing Arthur, according to the query professor_of(X,
arthur). Arthur is being instructed by either Professor Kirke or Professor Collins,
according to the response of X = kirke and X = collins.

You might also like