Prolog is a language that is suitable for solving problems in the field of artificial intelligence....
Fantastic news! We've Found the answer you've been seeking!
Transcribed Image Text:
Prolog is a language that is suitable for solving problems in the field of artificial intelligence. That is, it can be used to solve problems that used to be solvable only by human brains. In this assignment, you are asked to write a Prolog program to solve a logic puzzle. II. Using Prolog Gnu Prolog and SWI Prolog have been installed on most computers on campus. If you prefer to use prolog on your own computer, Gnu Prolog can be downloaded from http://www.gprolog.org and SWI Prolog can be downloaded from http://www.swi-prolog.org. To load your program into prolog, you can use the "consult" command, as in the following example: 1 ?- consult ('myProgram.pl'). If you are using Gnu Prolog on Microsoft Windows, you can also use the "File | Consult." menu selection to load the file from a chooser. III. The Puzzle The highlight of a recent conference on medieval literature was the talks given by five professors. Although each scholar (including Professor Santora) hails from a different dubious-sounding institute, he or she presented a different piece of evidence (one is a thank-you note) proving the factual existence of a different character from Beowulf (including Wiglaf). At the end of the seminar, the five professors announced their plans to travel to Scandinavia to unearth the mummified remains of Grendel himself! From the information provided, can you determine the character discussed and the piece of evidence presented by the professor from each institute? 1. The professor who discussed Unferth is not Professor Lund. 2. The professor who discussed Unferth is not the one who presented the canceled check. 3. The professor who presented the canceled check is not the professor from Mountebank University. 4. The professor from the Institute of Pseudoscience is not Professor Eccles. 5. Professor Eccles discussed Breca. 6. Professor Grove of the Charlatan Institute is not the scholar who presented an armory receipt that proved the existence of Hrothgar. 7. The professor from Quackerville University propounded the existence of Unferth. 8. The professor from Quackerville University is not Professor Ibanez. 9. Professor Ibanez presented the love letter. 10. The scholar who presented the grocery list is not the one who talked about Breca. 11. The scholar who talked about Breca is not the one from Hoaxtown College. 12. Professor Ibanez is not the scholar who proved he existence of Hygelac. 13. Professor Lund is not from Hoaxtown College. IV. Analysis Let's first do some book-keeping work, there are: 5 professors: Eccles, Grove, Ibanez, Lund, and Santora; 5 institutions: Charlatan Institute, Hoaxtown College, Institute of Pseudoscience, Mountebank University, and Quackerville Univeristy; 5 characters: Breca, Hrothgar, Hygelac, Unferth, and Wiglaf; and 5 evidences: armory receipt, canceled check, grocery list, love letter, and thank-you note. Now let's define a data structure to hold the information about the scholar. There are many ways to do this. The following is only one of the many possibilities: /* scholar (name, institution,character, evidence). */ Note that you only have to keep this structure in mind. You do not have to enter it into your Prolog program. That is why we put it here as a comment (Prolog comments are enclosed in "/" and "*/", you can also use the single line comments which start with triple percentage sign "*4" and extend until the end of the line). Next, we define a scholarList that contains the five scholars (note that the underscore character " " by itself is used to represent the "don't care" or "don't know" values in Prolog): scholarList ((scholar (eccles,, ), scholar (grove, ), scholar (ibanez,,,), scholar (lund, , , , scholar (santora,,_)1). In our program, we will need to use variables to represent different scholars. We will use the following system of variables: We use the variables Charlatan, Hoaxtown, Pseudoscience, Mountebank, and Quackerville to represent the scholars from Charlatan Institute, Hoaxtown College, Institute of Pseudoscience, Mountebank University, and Quackerville Univeristy, respectively. We use the variables Breca, Hrothgar, Hygelac, Unferth, and wiglaf to represent the scholars who discussed Breca, Hrothgar, Hygelac, Unferth, and Wiglaf, respectively. We use the variables Receipt, Check, List, Letter, and Note to represent the scholars who presented as evidence armory receipt, canceled check, grocery list, love letter, and thank-you note, respectively. We can now define the solution and encode the variables: solution (S) :- scholarList (S), member (scholar (Charlatan, charlatan institute,,_), S), member (scholar (Breca,, breca,_), S), member (scholar (Receipt,_,_armory_receipt), S), The first line says that s is a solution only if s is a scholarList. The comma at the end of the line means the rule is not completed yet. It still has other conditions to satisfy. These additional conditions are specified in the subsequent lines. The other lines establish the variables we will use in our program. Now we can encode the hints into the solution (Hint 1 is encoded below for you): solution (S) :- scholarList (S), member (scholar (Charlatan, charlatan_institute, ,_), S), member (scholar (Breca,_,breca,) , S), member (scholar (Armory,_ armory_receipt), S), /* Hint 1: The professor who discussed Unferth is not Professor Lund */ Unferth \= lund, The last condition in the rule should end with a period. Also note that in Prolog, names start with a lowercase letter are literals (constants), while names start with an uppercase letter are variables. Once your program is loaded into Prolog, simply issuing the following command should give you the answer (Hint: There is exactly one solution to this puzzle): solution (Ans). schedule ( [marriage (1,,_), marriage (2,,), marriage (3, , ), marriage (4,_,), marriage (5,__) ]). solution (S) :- schedule (S), member (marriage (Anne, anne, _), S), member (marriage (, cathy, ), S), member (marriage (Eve, eve, _), S), member (marriage (Fren, fren, ), S), member (marriage (Ida, ida, _), S), member (marriage (_, /* The brides */ /* Rule 6 */ - paul), S), /* The grooms */ /* Rule 5 */ member (marriage (Rob, member (marriage (Stan, member (marriage (Vern, member (marriage (Wally, Anne =:= 1, Wally =\= 1, Stan =:= 3, Rob =:- 5, Ida =\= 5, Vern =:= Fren, rob), S), stan), S), vern), S), _- wally), S), /* Rule 1 */ /* Rule 1 * / /* Rule 2 */ /* Rule 3 */ /* Rule 3 * / /* Rule 4 * / /* Rule 4 */ Vern =:= Eve + 1. Copy and paste your program in the box below: Copy and paste the output of your program in the box below: Solution of the puzzle: Professor Institution Character Evidence Eccles Grove Ibanez Lund Santora Prolog is a language that is suitable for solving problems in the field of artificial intelligence. That is, it can be used to solve problems that used to be solvable only by human brains. In this assignment, you are asked to write a Prolog program to solve a logic puzzle. II. Using Prolog Gnu Prolog and SWI Prolog have been installed on most computers on campus. If you prefer to use prolog on your own computer, Gnu Prolog can be downloaded from http://www.gprolog.org and SWI Prolog can be downloaded from http://www.swi-prolog.org. To load your program into prolog, you can use the "consult" command, as in the following example: 1 ?- consult ('myProgram.pl'). If you are using Gnu Prolog on Microsoft Windows, you can also use the "File | Consult." menu selection to load the file from a chooser. III. The Puzzle The highlight of a recent conference on medieval literature was the talks given by five professors. Although each scholar (including Professor Santora) hails from a different dubious-sounding institute, he or she presented a different piece of evidence (one is a thank-you note) proving the factual existence of a different character from Beowulf (including Wiglaf). At the end of the seminar, the five professors announced their plans to travel to Scandinavia to unearth the mummified remains of Grendel himself! From the information provided, can you determine the character discussed and the piece of evidence presented by the professor from each institute? 1. The professor who discussed Unferth is not Professor Lund. 2. The professor who discussed Unferth is not the one who presented the canceled check. 3. The professor who presented the canceled check is not the professor from Mountebank University. 4. The professor from the Institute of Pseudoscience is not Professor Eccles. 5. Professor Eccles discussed Breca. 6. Professor Grove of the Charlatan Institute is not the scholar who presented an armory receipt that proved the existence of Hrothgar. 7. The professor from Quackerville University propounded the existence of Unferth. 8. The professor from Quackerville University is not Professor Ibanez. 9. Professor Ibanez presented the love letter. 10. The scholar who presented the grocery list is not the one who talked about Breca. 11. The scholar who talked about Breca is not the one from Hoaxtown College. 12. Professor Ibanez is not the scholar who proved he existence of Hygelac. 13. Professor Lund is not from Hoaxtown College. IV. Analysis Let's first do some book-keeping work, there are: 5 professors: Eccles, Grove, Ibanez, Lund, and Santora; 5 institutions: Charlatan Institute, Hoaxtown College, Institute of Pseudoscience, Mountebank University, and Quackerville Univeristy; 5 characters: Breca, Hrothgar, Hygelac, Unferth, and Wiglaf; and 5 evidences: armory receipt, canceled check, grocery list, love letter, and thank-you note. Now let's define a data structure to hold the information about the scholar. There are many ways to do this. The following is only one of the many possibilities: /* scholar (name, institution,character, evidence). */ Note that you only have to keep this structure in mind. You do not have to enter it into your Prolog program. That is why we put it here as a comment (Prolog comments are enclosed in "/" and "*/", you can also use the single line comments which start with triple percentage sign "*4" and extend until the end of the line). Next, we define a scholarList that contains the five scholars (note that the underscore character " " by itself is used to represent the "don't care" or "don't know" values in Prolog): scholarList ((scholar (eccles,, ), scholar (grove, ), scholar (ibanez,,,), scholar (lund, , , , scholar (santora,,_)1). In our program, we will need to use variables to represent different scholars. We will use the following system of variables: We use the variables Charlatan, Hoaxtown, Pseudoscience, Mountebank, and Quackerville to represent the scholars from Charlatan Institute, Hoaxtown College, Institute of Pseudoscience, Mountebank University, and Quackerville Univeristy, respectively. We use the variables Breca, Hrothgar, Hygelac, Unferth, and wiglaf to represent the scholars who discussed Breca, Hrothgar, Hygelac, Unferth, and Wiglaf, respectively. We use the variables Receipt, Check, List, Letter, and Note to represent the scholars who presented as evidence armory receipt, canceled check, grocery list, love letter, and thank-you note, respectively. We can now define the solution and encode the variables: solution (S) :- scholarList (S), member (scholar (Charlatan, charlatan institute,,_), S), member (scholar (Breca,, breca,_), S), member (scholar (Receipt,_,_armory_receipt), S), The first line says that s is a solution only if s is a scholarList. The comma at the end of the line means the rule is not completed yet. It still has other conditions to satisfy. These additional conditions are specified in the subsequent lines. The other lines establish the variables we will use in our program. Now we can encode the hints into the solution (Hint 1 is encoded below for you): solution (S) :- scholarList (S), member (scholar (Charlatan, charlatan_institute, ,_), S), member (scholar (Breca,_,breca,) , S), member (scholar (Armory,_ armory_receipt), S), /* Hint 1: The professor who discussed Unferth is not Professor Lund */ Unferth \= lund, The last condition in the rule should end with a period. Also note that in Prolog, names start with a lowercase letter are literals (constants), while names start with an uppercase letter are variables. Once your program is loaded into Prolog, simply issuing the following command should give you the answer (Hint: There is exactly one solution to this puzzle): solution (Ans). schedule ( [marriage (1,,_), marriage (2,,), marriage (3, , ), marriage (4,_,), marriage (5,__) ]). solution (S) :- schedule (S), member (marriage (Anne, anne, _), S), member (marriage (, cathy, ), S), member (marriage (Eve, eve, _), S), member (marriage (Fren, fren, ), S), member (marriage (Ida, ida, _), S), member (marriage (_, /* The brides */ /* Rule 6 */ - paul), S), /* The grooms */ /* Rule 5 */ member (marriage (Rob, member (marriage (Stan, member (marriage (Vern, member (marriage (Wally, Anne =:= 1, Wally =\= 1, Stan =:= 3, Rob =:- 5, Ida =\= 5, Vern =:= Fren, rob), S), stan), S), vern), S), _- wally), S), /* Rule 1 */ /* Rule 1 * / /* Rule 2 */ /* Rule 3 */ /* Rule 3 * / /* Rule 4 * / /* Rule 4 */ Vern =:= Eve + 1. Copy and paste your program in the box below: Copy and paste the output of your program in the box below: Solution of the puzzle: Professor Institution Character Evidence Eccles Grove Ibanez Lund Santora
Expert Answer:
Related Book For
Spreadsheet Modeling & Decision Analysis A Practical Introduction to Management Science
ISBN: 978-0324656633
5th edition
Authors: Cliff T. Ragsdale
Posted Date:
Students also viewed these accounting questions
-
Self-employed taxpayers pay self-employment tax on: O The gross profit of the business reduced by 15.3%. The net profit of the business reduced by 15.3% wy The net profit of the business reduced by...
-
The exponential distribution can be used to solve Poisson-type problems in which the intervals are not time. The Air Travel Consumer Report published by the U.S. Department of Transportation reported...
-
Is it true that Botox injections can be used to treat spasticity?
-
A force F = (3.00 N)i + (7.00 N)j + (7.00 N)k acts on a 2.00 kg mobile object that moves from an initial position of di = (3.00 m)i (2.00 m)i + (5.00 m)k to a final position of df = (5.00 m)i +...
-
Using concentration as a conversion factor, how many moles of solute are in 844 mL of 2.09 M MgSO4?
-
The records of Shepard Aviation include the following accounts for inventory of aviation fuel at October 31 of the current year: Requirements 1. Prepare a partial income statement through gross...
-
Brian Rafferty ingested finasteride, a drug prescribed to him to treat an enlarged prostate. Finasteride is a generic version of Proscar, a drug manufactured by Merck. Some time after he started to...
-
On January 1, 2008, Wilke Corp. had 480,000 shares of common stock outstanding. During 2008, it had the following transactions that affected the common stock account. February 1 ..........Issued...
-
2. A muon is created in our upper atmosphere and travels toward the ground at 0.998 c. If it's lifetime is 2.2 x 10-6 seconds. What is the lifetime of the muon as observed by the earth's frame of...
-
Determine vo for each network of Fig. 2.173 for the input shown. 20 V 2 V Ideal Ideal 2.2 k -5 V
-
When comparing the Life-Cycle Cost (LCC), what are the three basic financial analysis tools employed to convert annual cash flows into numbers suitable for comparison? Explain.
-
f'(x) = f'(1) = Let f(x) = (x + 5x +4) 0
-
A small village on the Bintangor river, a tributary of the Sarawak in Malaysia, is considering installing a 3 6 0 kW hydroelectric plant, for the benefit of its 9 9 residents. The capital cost will...
-
5. Shown below is a WHILE-DO loop statement which replaces the value stored in x with the absolute value of x. Using r0 to represent x, implement the IF-THEN statement in ARM assembly language. while...
-
Discuss the backoff policies used in our implementation. Does it make sense to use the same shared Backoff object for both pushes and pops in our LockFreeStack object? How else could we structure the...
-
The Akimbo Company issues bonds with a face value of $12 million on June 1, Year One, for 93 percent of face value plus accrued interest. The bonds pay an annual cash interest rate of 10 percent with...
-
Let A = {1, 2, 3,6} and B = {2,3,5,6}. Let S be a set, and Pow(S) be the power set of S. (a) What is Pow(A)|? (b) List the elements of Pow(A). (c) What is Pow(AUB)|? (d) What is Pow(An B)|? (e) List...
-
Extend Algorithms 3.4 and 3.5 to include as output the first and second derivatives of the spline at the nodes.
-
Seabreeze Furniture in Orlando maintains a large central warehouse where it stores items until they are sold or needed by the companys many stores in the central Florida area. A four-person crew...
-
Refer to question 5. The MBA director could make two types of admission mistakes using DA. One mistake is to classify a student into the weak category (and, therefore, not admit the student) when, in...
-
Create a Sensitivity Report for Electro-Polys make vs. buy problem in section 3.8 of Chapter 3 and answer the following questions. a. Is the solution degenerate? b. How much can the cost of making...
-
As shown in Exhibit 5, LOral reported an operating margin of 16% in 2011, which makes it the most profitable company among beauty companies. However, the average operating margin of 18% for home and...
-
The consumer goods company Unilever reported an overall operating margin of 14.9% in 2011. As shown in Exhibit 7, the operating margin is higher in the slower growing Western European and Americas...
-
Dutch grocer Ahold has a debt structure with a relatively high amount of cash on its balance sheet. i. Calculate the interest expense on the average gross debt and interest rate on the average cash...
Study smarter with the SolutionInn App