• Home
  • Textbooks
  • Artificial Intelligence. A Modern Approach [Global Edition]
  • Knowledge Representation

Artificial Intelligence. A Modern Approach [Global Edition]

Stuart Russell, Peter Norvig

Chapter 12

Knowledge Representation - all with Video Answers

Educators


Chapter Questions

Problem 1

Define an ontology in first-order logic for tic-tac-toe. The ontology should contain situations, actions, squares, players, marks ( $\mathrm{X}, \mathrm{O}$, or blank), and the notion of winning, losing, or drawing a game. Also define the notion of a forced win (or draw): a position from which a player can force a win (or draw) with the right sequence of actions. Write axioms for the domain. (Note: The axioms that enumerate the different squares and that characterize the winning positions are rather long. You need not write these out in full, but indicate clearly what they look like.)

Check back soon!

Problem 2

You are to create a system for advising computer science undergraduates on what courses to take over an extended period in order to satisfy the program requirements. (Use whatever requirements are appropriate for your institution.) First, decide on a vocabulary for representing all the information, and then represent it; then formulate a query to the system that will return a legal program of study as a solution. You should allow for some tailoring to individual students, in that your system should ask what courses or equivalents the student has already taken, and not generate programs that repeat those courses.

Suggest ways in which your system could be improved-for example to take into account knowledge about student preferences, the workload, good and bad instructors, and so on. For each kind of knowledge, explain how it could be expressed logically. Could your system easily incorporate this information to find all feasible programs of study for a student? Could it find the best program?

Check back soon!

Problem 2

Our description of Internet shopping omitted the all-important step of actually buying the product. Provide a formal logical description of buying, using event calculus. That is, define the sequence of events that occurs when a buyer submits a credit-card purchase and then eventually gets billed and receives the product.

Check back soon!

Problem 3

Develop a representational system for reasoning about windows in a window-based computer interface. In particular, your representation should be able to describe:
$\bullet$The state of a window: minimized, displayed, or nonexistent.
$\bullet$ Which window (if any) is the active window.
$\bullet$ The position of every window at a given time.
$\bullet$ The order (front to back) of overlapping windows.
$\bullet$ The actions of creating, destroying, resizing, and moving windows; changing the state of a window; and bringing a window to the front. Treat these actions as atomic; that is, do not deal with the issue of relating them to mouse actions. Give axioms describing the effects of actions on fluents. You may use either event or situation calculus.

Assume an ontology containing situations, actions, integers (for $x$ and $y$ coordinates) and windows. Define a language over this ontology; that is, a list of constants, function symbols, and predicates with an English description of each. If you need to add more categories to the ontology (e.g., pixels), you may do so, but be sure to specify these in your write-up. You may (and should) use symbols defined in the text, but be sure to list these explicitly.

Check back soon!
03:27

Problem 4

State the following in the language you developed for the previous exercise:
a. In situation $S_0$, window $W_1$ is behind $W_2$ but sticks out on the top and bottom. Do not state exact coordinates for these; describe the general situation.
b. If a window is displayed, then its top edge is higher than its bottom edge.
c. After you create a window $w$, it is displayed.
d. A window can be minimized only if it is displayed.

Akash M
Akash M
Numerade Educator

Problem 5

(Adapted from an example by Doug Lenat.) Your mission is to capture, in logical form, enough knowledge to answer a series of questions about the following simple scenario:
Yesterday John went to the North Berkeley Safeway supermarket and bought two pounds of tomatoes and a pound of ground beef.

Start by trying to represent the content of the sentence as a series of assertions. You should write sentences that have straightforward logical structure (e.g., statements that objects havecertain properties, that objects are related in certain ways, that all objects satisfying one property satisfy another). The following might help you get started:
$\bullet$Which classes, objects, and relations would you need? What are their parents, siblings and so on? (You will need events and temporal ordering, among other things.)
$\bullet$ Where would they fit in a more general hierarchy?
$\bullet$What are the constraints and interrelationships among them?
$\bullet$How detailed must you be about each of the various concepts?

To answer the questions below, your knowledge base must include background knowledge. You'll have to deal with what kind of things are at a supermarket, what is involved with purchasing the things one selects, what the purchases will be used for, and so on. Try to make your representation as general as possible. To give a trivial example: don't say "People buy food from Safeway," because that won't help you with those who shop at another supermarket. Also, don't turn the questions into answers; for example, question (c) asks "Did John buy any meat?"-not "Did John buy a pound of ground beef?"

Sketch the chains of reasoning that would answer the questions. If possible, use a logical reasoning system to demonstrate the sufficiency of your knowledge base. Many of the things you write might be only approximately correct in reality, but don't worry too much; the idea is to extract the common sense that lets you answer these questions at all. A truly complete answer to this question is extremely difficult, probably beyond the state of the art of current knowledge representation. But you should be able to put together a consistent set of axioms for the limited questions posed here.
a. Is John a child or an adult? [Adult]
b. Does John now have at least two tomatoes? [Yes]
c. Did John buy any meat? [Yes]
d. If Mary was buying tomatoes at the same time as John, did he see her? [Yes]
e. Are the tomatoes made in the supermarket? [No]
f. What is John going to do with the tomatoes? [Eat them]
g. Does Safeway sell deodorant? [Yes]
h. Did John bring some money or a credit card to the supermarket? [Yes]
i. Does John have less money after going to the supermarket? [Yes]

Check back soon!
00:28

Problem 6

Make the necessary additions or changes to your knowledge base from the previous exercise so that the questions that follow can be answered. Include in your report a discussion of your changes, explaining why they were needed, whether they were minor or major, and what kinds of questions would necessitate further changes.
a. Are there other people in Safeway while John is there? [Yes-staff!]
b. Is John a vegetarian? [No]
c. Who owns the deodorant in Safeway? [Safeway Corporation]
d. Did John have an ounce of ground beef? [Yes]
e. Does the Shell station next door have any gas? [Yes]
f. Do the tomatoes fit in John's car trunk? [Yes]

Wendi Zhao
Wendi Zhao
Numerade Educator
02:26

Problem 7

Represent the following seven sentences using and extending the representations developed in the chapter:
a. Water is a liquid between 0 and 100 degrees.
b. Water boils at 100 degrees.
c. The water in John's water bottle is frozen.
d. Perrier is a kind of water.
e. John has Perrier in his water bottle.
f. All liquids have a freezing point.
g. A liter of water weighs more than a liter of alcohol.

David Collins
David Collins
Numerade Educator
01:47

Problem 8

Write definitions for the following:
a. ExhaustivePartDecomposition
b. PartPartition
c. PartwiseDisjoint

These should be analogous to the definitions for ExhaustiveDecomposition, Partition, and Disjoint. Is it the case that PartPartition $(s, B u n c h O f(s))$ ? If so, prove it; if not, give a counterexample and define sufficient conditions under which it does hold.

Aman Gupta
Aman Gupta
Numerade Educator
01:05

Problem 9

An alternative scheme for representing measures involves applying the units function to an abstract length object. In such a scheme, one would write Inches $\left(\operatorname{Length}\left(L_1\right)\right)=$ 1.5. How does this scheme compare with the one in the chapter? Issues include conversion axioms, names for abstract quantities (such as " 50 dollars"), and comparisons of abstract measures in different units ( 50 inches is more than 50 centimeters).

Ronald Prasad
Ronald Prasad
Numerade Educator
00:12

Problem 10

Write a set of sentences that allows one to calculate the price of an individual tomato (or other object), given the price per pound. Extend the theory to allow the price of a bag of tomatoes to be calculated.

Kristen Frankie
Kristen Frankie
Numerade Educator

Problem 11

Add sentences to extend the definition of the predicate $\operatorname{Name}(s, c)$ so that a string such as "laptop computer" matches the appropriate category names from a variety of stores. Try to make your definition general. Test it by looking at ten online stores, and at the category names they give for three different categories. For example, for the category of laptops, we found the names "Notebooks," "Laptops," "Notebook Computers," "Notebook," "Laptops and Notebooks," and "Notebook PCs." Some of these can be covered by explicit Name facts, while others could be covered by sentences for handling plurals, conjunctions, etc.

Check back soon!
01:50

Problem 12

Write event calculus axioms to describe the actions in the wumpus world.

Katelyn Chen
Katelyn Chen
Numerade Educator
00:46

Problem 13

State the interval-algebra relation that holds between every pair of the following realworld events:
$L K$ : The life of President Kennedy.
$I K:$ The infancy of President Kennedy.
PK: The presidency of President Kennedy.
LJ: The life of President Johnson.
PJ: The presidency of President Johnson.
LO: The life of President Obama.

Erika Bustos
Erika Bustos
Numerade Educator
02:15

Problem 14

This exercise concerns the problem of planning a route for a robot to take from one city to another. The basic action taken by the robot is $G o(x, y)$, which takes it from city $x$ to city $y$ if there is a route between those cities. $\operatorname{Road}(x, y)$ is true if and only if there is a road connecting cities $x$ and $y$; if there is, then Distance $(x, y)$ gives the length of the road. See the map on page 68 for an example. The robot begins in Arad and must reach Bucharest.
a. Write a suitable logical description of the initial situation of the robot.
b. Write a suitable logical query whose solutions provide possible paths to the goal.
c. Write a sentence describing the Go action.
d. Now suppose that the robot consumes fuel at the rate of .02 gallons per mile. The robot starts with 20 gallons of fuel. Augment your representation to include these considerations.
e. Now suppose some of the cities have gas stations at which the robot can fill its tank. Extend your representation and write all the rules needed to describe gas stations, including the Fillup action.

Harsh Gadhiya
Harsh Gadhiya
Numerade Educator
00:58

Problem 15

Investigate ways to extend the event calculus to handle simultaneous events. Is it possible to avoid a combinatorial explosion of axioms?

Lucas Finney
Lucas Finney
Numerade Educator
01:03

Problem 16

Construct a representation for exchange rates between currencies that allows for daily fluctuations.

Kaylee Mcclellan
Kaylee Mcclellan
Numerade Educator
00:47

Problem 17

Define the predicate Fixed, where Fixed (Location $(x))$ means that the location of object $x$ is fixed over time.

Joshua Eastwood
Joshua Eastwood
Numerade Educator

Problem 18

Describe the event of trading something for something else. Describe buying as a kind of trading in which one of the objects traded is a sum of money.

Check back soon!

Problem 19

The two preceding exercises assume a fairly primitive notion of ownership. For example, the buyer starts by owning the dollar bills. This picture begins to break down when, for example, one's money is in the bank, because there is no longer any specific collection of dollar bills that one owns. The picture is complicated still further by borrowing, leasing, renting, and bailment. Investigate the various commonsense and legal concepts of ownership, and propose a scheme by which they can be represented formally.

Check back soon!

Problem 20

(Adapted from Fagin et al. (1995).) Consider a game played with a deck of just 8 cards, 4 aces and 4 kings. The three players, Alice, Bob, and Carlos, are dealt two cards each. Without looking at them, they place the cards on their foreheads so that the other players can see them. Then the players take turns either announcing that they know what cards are on their own forehead, thereby winning the game, or saying "I don't know." Everyone knows the players are truthful and are perfect at reasoning about beliefs.
a. Game 1. Alice and Bob have both said "I don't know." Carlos sees that Alice has two aces (A-A) and Bob has two kings (K-K). What should Carlos say?
b. Describe each step of Game 1 using the notation of modal logic.
c. Game 2. Carlos, Alice, and Bob all said "I don't know" on their first tum. Alice holds $\mathrm{K}-\mathrm{K}$ and Bob holds A-K. What should Carlos say on his second tum?
d. Game 3. Alice, Carlos, and Bob all say "I don't know" on their first turn, as does Alice on her second turn. Alice and Bob both hold A-K. What should Carlos say?
e. Prove that there will always be a winner to this game.

Check back soon!
View

Problem 21

The assumption of logical omniscience, discussed on page 453 , is of course not true of any actual reasoners. Rather, it is an idealization of the reasoning process that may be more or less acceptable depending on the applications. Discuss the reasonableness of the assumption for each of the following applications of reasoning about knowledge:
a. Chess with a clock. Here the player may wish to reason about the limits of his opponent's or his own ability to find the best move in the time available. For instance, if player A has much more time left than player B, then A will sometimes make a move that greatly complicates the situation, in the hopes of gaining an advantage because he has more time to work out the proper strategy.
b. A shopping agent in an environment in which there are costs of gathering information.
c. An automated tutoring program for math, which reasons about what students understand.
d. Reasoning about public key cryptography, which rests on the intractability of certain computational problems.

Oluwadamilola Ameobi
Oluwadamilola Ameobi
Numerade Educator

Problem 22

Translate the following description logic expression (from page 457) into first-order logic, and comment on the result:
$$
\begin{aligned}
& \text { And(Man, AtLeast }(3, \text { Son }), \text { AtMost }(2, \text { Daughter }), \\
& \quad \text { All }(\text { Son, And }(\text { Unemployed, Married, All(Spouse, Doctor }))), \\
& \text { All(Daughter, And(Professor, Fills(Department, Physics, Math)))) . }
\end{aligned}
$$

Check back soon!

Problem 23

Recall that inheritance information in semantic networks can be captured logically by suitable implication sentences. This exercise investigates the efficiency of using such sentences for inheritance.
a. Consider the information in a used-car catalog such as Kelly's Blue Book-for example, that 1973 Dodge vans are (or perhaps were once) worth $$\$ 575$$. Suppose all this information (for 11,000 models) is encoded as logical sentences, as suggested in the chapter. Write down three such sentences, including that for 1973 Dodge vans. How would you use the sentences to find the value of a particular car, given a backwardchaining theorem prover such as Prolog?
b. Compare the time efficiency of the backward-chaining method for solving this problem with the inheritance method used in semantic nets.
c. Explain how forward chaining allows a logic-based system to solve the same problem efficiently, assuming that the KB contains only the 11,000 sentences about prices.
d. Describe a situation in which neither forward nor backward chaining on the sentences will allow the price query for an individual car to be handled efficiently.
e. Can you suggest a solution enabling this type of query to be solved efficiently in all cases in logic systems?

Check back soon!

Problem 24

One might suppose that the syntactic distinction between unboxed links and singly boxed links in semantic networks is unnecessary, because singly boxed links are always attached to categories; an inheritance algorithm could simply assume that an unboxed link attached to a category is intended to apply to all members of that category. Show that this argument is fallacious, giving examples of errors that would arise.

Check back soon!

Problem 25

A complete solution to the problem of inexact matches to the buyer's description in shopping is very difficult and requires a full array of natural language processing and information retrieval techniques. (See Chapters 22 and 23.) One small step is to allow the user to specify minimum and maximum values for various attributes. The buyer must use the following grammar for product descriptions:
\begin{tabular}{|c|c|c|}
\hline tion & $\rightarrow$ Category & [Connector Modifier] \\
\hline Con & $\rightarrow$ "with"|" & "and"|"," \\
\hline Mod & $\rightarrow$ Attribute & Attribute $O p$ Val \\
\hline$O p$ & $\rightarrow "=" \mid ">"$ & $" \mid "<"$ \\
\hline
\end{tabular}

Here, Category names a product category, Attribute is some feature such as "CPU" or "price," and Value is the target value for the attribute. So the query "computer with at least a 2.5 GHz CPU for under $$\$ 500$$ " must be re-expressed as "computer with CPU $$>2.5 \mathrm{GHz}$$ and price $$<\$ 500$$." Implement a shopping agent that accepts descriptions in this language.

Check back soon!