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...
-
Give the names of the following ions. a. Mn2+ b. Ni2+ c. Co2+ d. Co3+
-
A nonideal ammeter that has an internal resistance of \(0.503 \Omega\) is connected in series with a \(3.00-\mathrm{V}\) battery and a \(40.0-\Omega\) resistor. By what percentage does the measured...
-
The table shows the numbers (in thousands) of earned degrees by level in two different fields, conferred in the United States in a recent year. A person who earned a degree in the year is randomly...
-
Universal Bank is a relatively young bank growing rapidly in terms of overall customer acquisition. The majority of these customers are liability customers (depositors) with varying sizes of...
-
Two electric motors (A and B) are being considered to drive a centrifugal pump. Each motor is capable of delivering 50 horsepower (output) to the pumping operation. It is expected that the motors...
-
You have been asked by management to explain the variances in costs under your inpatient capitates contract. The following data is provided. Requirements: 1: What dollar amount of the total variance...
-
Consider a system with a two-level cache having the followingcharacteristics: L1 cache has an access time of 1 clock cycle withan average hit rate of 95%; L2 cache has an access time of 5 clockcycles...
-
Use a t-test to test the significance of the estimated elasticities.
-
A double-pipe heat exchanger is to be designed to cool 5.5 gal/min of a hot oil from 250F to 120F using 11 gal/min of cooling water available at 70F. The exchanger is to consist of 12-ft-long...
-
Plastic spheres, 0.02 m in diameter and initially at 120C, are cooled by allowing them to drop into a large pool of water at 20C. The spheres have a density of 1050 kg/m 3 , a heat capacity of 900...
-
Construct a 90 % confidence interval for the parameter estimates from question 40. Assume n = 30. Question 40 Buford Lightfoot, a stock market analyst, is interested in finding a model to describe...
-
We want to cool a solution containing 100 mg/mL of a monoclonal antibody from an initial temperature of 25C to 10C by having the solution flow through a coil of stainless-steel tubing immersed in a...
-
1. Let A=(4,5,6) and B-(5,6,7) and define R, S, and T as follows: For all (x,y) e AxB, (x,y) ER if x y. (x,y) E x-y Sif is an integer, and T=((4,7),(6,5),(6,7)} 2 a. Draw arrow diagrams for R, S, and...
-
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?
-
E = 0.05. Estimate the minimum sample size needed to achieve the given margin of error.
-
Figure 9 shows a histogram for a random sample of n = 264 women (drawn from the same NHANES III study used for the sample of men in Figure 6). The mean of these data is x = 59.6 grams and the...
-
Consider the distribution of sample proportions shown in Figure 5. Suppose you randomly select the following sample of 32 responses: Compute the sample proportion, p, for this sample. How far does it...
Study smarter with the SolutionInn App