Write a prolog program with following facts and rules to create database and answer queries mentioned...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a prolog program with following facts and rules to create database and answer queries mentioned at the end of this document. Your program will have following 7 facts: 1. course(X) is a single argument predicate, where X can take the names of the course as elements. 2. department(X) is a single argument predicate, where X can take the names of the department as elements. 3. professor(X) is a single argument predicate, where X can take the names of the professor as elements. 4. student(X) is a single argument predicate, where X can take the names of the student as elements. 5. course in department(C, D) is a two argument predicate, where C represent a course in department D. 6. course-professor (C, P) is a two argument predicate, where C represent a course taught by professor P. 7. student enrolled_in.course(S, C) is a two argument predicate, where S represent a student enrolled for course C. Your program will have rules in prolog format for the following 1. predicate student in.department(X,Y) says X is a student in department Y if X is a student and Y is a department and X is enrolled for any courses in department Y. 2. predicate professor of_student(X, Y) says X is a professor of student Y if Y is a student and X is professor and Y is enrolled for any course taught by X. 3. predicate professor.in_same department(X,Y) says X and Y are professor in the same department if X teaches a course C1 and Y teaches a course C2 and both C1 and C2 are course in the same department. Evaluate the following queries in Prolog compiler: 1. ?- student in_department(X,Y). Whether person X is a student in department Y. 2. ?- student.in.department(X, -). Person X is a student in which department. 3. ?- professor of student(X,Y). Whether Person X is a professor of a person Y. 4. ?- professor _in_same_department(X, Y) Whether person X and Y are in the same department. 5. ?- professor in_same_department(X,-) Who all are in the same department with person X. Write a prolog program with following facts and rules to create database and answer queries mentioned at the end of this document. Your program will have following 7 facts: 1. course(X) is a single argument predicate, where X can take the names of the course as elements. 2. department(X) is a single argument predicate, where X can take the names of the department as elements. 3. professor(X) is a single argument predicate, where X can take the names of the professor as elements. 4. student(X) is a single argument predicate, where X can take the names of the student as elements. 5. course in department(C, D) is a two argument predicate, where C represent a course in department D. 6. course-professor (C, P) is a two argument predicate, where C represent a course taught by professor P. 7. student enrolled_in.course(S, C) is a two argument predicate, where S represent a student enrolled for course C. Your program will have rules in prolog format for the following 1. predicate student in.department(X,Y) says X is a student in department Y if X is a student and Y is a department and X is enrolled for any courses in department Y. 2. predicate professor of_student(X, Y) says X is a professor of student Y if Y is a student and X is professor and Y is enrolled for any course taught by X. 3. predicate professor.in_same department(X,Y) says X and Y are professor in the same department if X teaches a course C1 and Y teaches a course C2 and both C1 and C2 are course in the same department. Evaluate the following queries in Prolog compiler: 1. ?- student in_department(X,Y). Whether person X is a student in department Y. 2. ?- student.in.department(X, -). Person X is a student in which department. 3. ?- professor of student(X,Y). Whether Person X is a professor of a person Y. 4. ?- professor _in_same_department(X, Y) Whether person X and Y are in the same department. 5. ?- professor in_same_department(X,-) Who all are in the same department with person X.
Expert Answer:
Answer rating: 100% (QA)
The seven facts are courseX departmentX professorX studentX c... View the full answer
Related Book For
Posted Date:
Students also viewed these mathematics questions
-
The directed reading at the end of this chapter describes four tools for crises in projects. Might any of these be useful to Iceland in their planning?
-
The On the Job example at the end of this chapter provides a brief description of many training methods used in management development. To understand those methods better, the class breaks into teams...
-
X Ltd. is a GST registrant. At the end of last year, the class 10.1 UCC balance was $24,500. In the current year, X Ltd. disposed of the class 10.1 car for $28,000. The car had originally cost...
-
You believe that oil prices will be rising more than expected, and that rising prices will result in lower earnings for industrial companies that use a lot of petroleum-related products in their...
-
Consider the vehicle suspension problem in Example 13.1.1. Suppose the amplitude of variation of the road surface is 5/8 in. Determine a set of values for the suspension's stiffness k and damping c...
-
1. Using the Buyers Perception of Value presented in Figure 6.1, discuss the value provided by the MDVIP business model. Do you believe that MDVIP offers a good value to patients? 2. Based on the 10...
-
Analyze the Frank-Kamenetskii problem for the three standard geometries of slab, cylinder, and sphere. You will need to discretize the operators suitably for the cylinder and sphere. Plot the...
-
Based on the balance sheet and income statement data contained in Exhibit 9-5, and using the suggested worksheet format shown in Exhibit 9-20 or one of your own choosing, show how the statement of...
-
Tax on purchases during the year Interest from a savings account Interest from City of Boston Bonds Dividend from 3 M stock $ 1 , 4 0 0 5 0 0 9 , 0 0 0 2 , 6 0 0 1 , 0 0 0 6 , 2 0 0 8 0 0 7 0 0 4 0 0...
-
Solve this in python. **[70 pts]** You will be writing code for recording the menuitems and daily sales of a lemonade stand. It will have theseclasses: MenuItem, SalesForDay, and LemonadeStand. All...
-
The local government is worried that profits in the industry may lead to high levels of production of alcoholic beverages if the government issues additional licenses, but it also does not want...
-
Distinguish between learning and performance.
-
What is (a) a multi-team-system, (b) a project team, (c) a venture team, (d) a global team, (e) team efficacy, (f) Team X, and (g) mental models?
-
Identify ways in which culture manifests itself within organizations.
-
What do we mean by organizational socialization?
-
What do we mean by the dysfunctional aspects of bureaucracy?
-
Assume quantities do not need to be integers. There are 1,000 wheat farmers each of whose marginal cost of production is given by MC(t)=17 (6/10) t, where t is the number tons produced by that...
-
Briefly discuss the implications of the financial statement presentation project for the reporting of stockholders equity.
-
You are a human resource consultant. You have been called by the newly appointed president of a large paper manufacturing firm: President: I have been in this job for about one month now, and all I...
-
Discuss the following statement: An individual who owns a business should be able to recruit and hire whomever he or she pleases.
-
Why are many employees unaware of some of the benefits provided by their organization?
-
Explain the meaning of capital maintenance.
-
The four conditions of IAS 11 [see Section 8.4.4] provide entirely adequate safeguards for the use of the percentage-of-completion method for long-term contracts. When these requirements are met,...
-
Motor vehicles are necessarily non-current (fixed) assets when: A. They are intended for continuing use in the business. B. They are more than one year old. C. They are parked with the handbrake on....
Study smarter with the SolutionInn App