• Home
  • Textbooks
  • Artificial Intelligence. A Modern Approach [Global Edition]
  • Logical Agents

Artificial Intelligence. A Modern Approach [Global Edition]

Stuart Russell, Peter Norvig

Chapter 7

Logical Agents - all with Video Answers

Educators


Chapter Questions

03:18

Problem 1

Suppose the agent has progressed to the point shown in Figure 7.4(a), page 239, having perceived nothing in $[1,1]$, a breeze in [2,1], and a stench in [1,2], and is now concerned with the contents of $[1,3],[2,2]$, and $[3,1]$. Each of these can contain a pit, and at most one can contain a wumpus. Following the example of Figure 7.5, construct the set of possible worlds. (You should find 32 of them.) Mark the worlds in which the KB is true and those in which each of the following sentences is true:
$\alpha_2=$ "There is no pit in [2,2],"
$\alpha_3=$ "There is a wumpus in $[1,3]$."

Hence show that $K B \models \alpha_2$ and $K B \models \alpha_3$.

VS
Vivek Singh
Numerade Educator
00:55

Problem 2

(Adapted from Barwise and Etchemendy (1993).) Given the following, can you prove that the unicorn is mythical? How about magical? Horned?
If the unicorn is mythical, then it is immortal, but if it is not mythical, then it is a mortal mammal. If the unicorn is either immortal or a mammal, then it is homed. The unicorn is magical if it is homed.

Clarissa Noh
Clarissa Noh
Numerade Educator

Problem 3

Consider the problem of deciding whether a propositional logic sentence is true in a given model.
a. Write a recursive algorithm $\operatorname{PL}-\operatorname{True} ?(s, m)$ that returns true if and only if the sentence $s$ is true in the model $m$ (where $m$ assigns a truth value for every symbol in $s$ ). The algorithm should run in time linear in the size of the sentence. (Alternatively, use a version of this function from the online code repository.)
b. Give three examples of sentences that can be determined to be true or false in a partial model that does not specify a truth value for some of the symbols.
c. Show that the truth value (if any) of a sentence in a partial model cannot be determined efficiently in general.
d. Modify your PL-TRUE? algorithm so that it can sometimes judge truth from partial models, while retaining its recursive structure and linear run time. Give three examples of sentences whose truth in a partial model is not detected by your algorithm.
e. Investigate whether the modified algorithm makes TT-ENTAILS? more efficient.

Check back soon!
01:18

Problem 4

Which of the following are correct?
a. False $\models$ True.
b. True $\models$ False.
c. $(A \wedge B) \models(A \Leftrightarrow B)$.
d. $A \Leftrightarrow B \models A \vee B$.
e. $A \Leftrightarrow B \models \neg A \vee B$.
f. $(A \vee B) \wedge(\neg C \vee \neg D \vee E) \models(A \vee B \vee C) \wedge(B \wedge C \wedge D \Rightarrow E)$.
g. $(A \vee B) \wedge(\neg C \vee \neg D \vee E) \models(A \vee B) \wedge(\neg D \vee E)$.
h. $(A \vee B) \wedge \neg(A \Rightarrow B)$ is satisfiable.
i. $(A \wedge B) \Rightarrow C \models(A \Rightarrow C) \vee(B \Rightarrow C)$.
j. $(C \vee(\neg A \wedge \neg B)) \equiv((A \Rightarrow C) \wedge(B \Rightarrow C))$.
k. $(A \Leftrightarrow B) \wedge(\neg A \vee B)$ is satisfiable.
I. $(A \Leftrightarrow B) \Leftrightarrow C$ has the same number of models as $(A \Leftrightarrow B)$ for any fixed set of proposition symbols that includes $A, B, C$.

Amy Jiang
Amy Jiang
Numerade Educator

Problem 5

Prove each of the following assertions:
a. $\alpha$ is valid if and only if True $\models \alpha$.
b. For any $\alpha$, False $\models \alpha$.
c. $\alpha \models \beta$ if and only if the sentence $(\alpha \Rightarrow \beta)$ is valid.
d. $\alpha \equiv \beta$ if and only if the sentence $(\alpha \Leftrightarrow \beta)$ is valid.
e. $\alpha \models \beta$ if and only if the sentence $(\alpha \wedge \neg \beta)$ is unsatisfiable.

Check back soon!
00:57

Problem 6

Prove, or find a counterexample to, each of the following assertions:
a. If $\alpha \models \gamma$ or $\beta \models \gamma$ (or both) then $(\alpha \wedge \beta) \models \gamma$
b. If $(\alpha \wedge \beta) \models \gamma$ then $\alpha \models \gamma$ or $\beta \models \gamma$ (or both).
c. If $\alpha \models(\beta \vee \gamma)$ then $\alpha \models \beta$ or $\alpha \models \gamma$ (or both).

Maninder Singh
Maninder Singh
Numerade Educator
00:55

Problem 7

Consider a vocabulary with only four propositions, $A, B, C$, and $D$. How many models are there for the following sentences?
a. $B \vee C$.
b. $\neg A \vee \neg B \vee \neg C \vee \neg D$.
c. $(A \Rightarrow B) \wedge A \wedge \neg B \wedge C \wedge D$.

Lily An
Lily An
Numerade Educator
00:42

Problem 8

We have defined four binary logical connectives.
a. Are there any others that might be useful?
b. How many binary connectives can there be?
c. Why are some of them not very useful?

Amy Jiang
Amy Jiang
Numerade Educator

Problem 9

Using a method of your choice, verify each of the equivalences in Figure 7.11 (page 249).

Check back soon!

Problem 10

Decide whether each of the following sentences is valid, unsatisfiable, or neither. Verify your decisions using truth tables or the equivalence rules of Figure 7.11 (page 249).
a. Smoke $\Rightarrow$ Smoke
b. Smoke $\Rightarrow$ Fire
c. $($ Smoke $\Rightarrow$ Fire $) \Rightarrow(\neg$ Smoke $\Rightarrow \neg$ Fire $)$
d. Smoke $\vee$ Fire $\vee \neg$ Fire
e. $(($ Smoke $\wedge$ Heat $) \Rightarrow$ Fire $) \Leftrightarrow(($ Smoke $\Rightarrow$ Fire $) \vee($ Heat $\Rightarrow$ Fire $))$
f. $B i g \vee$ Dumb $\vee(B i g \Rightarrow$ Dumb $)$
g. $($ Big $\wedge$ Dumb $) \vee \neg$ Dumb

Check back soon!
03:02

Problem 11

Any propositional logic sentence is logically equivalent to the assertion that each possible world in which it would be false is not the case. From this observation, prove that any sentence can be written in CNF.

Amy Jiang
Amy Jiang
Numerade Educator

Problem 12

Use resolution to prove the sentence $\neg A \wedge \neg B$ from the clauses in Exercise 7.19.

Check back soon!
00:38

Problem 13

This exercise looks into the relationship between clauses and implication sentences.
a. Show that the clause $\left(\neg P_1 \vee \cdots \vee \neg P_m \vee Q\right)$ is logically equivalent to the implication sentence $\left(P_1 \wedge \cdots \wedge P_m\right) \Rightarrow Q$.
b. Show that every clause (regardless of the number of positive literals) can be written in the form $\left(P_1 \wedge \cdots \wedge P_m\right) \Rightarrow\left(Q_1 \vee \cdots \vee Q_n\right)$, where the $P_{\mathrm{s}}$ and $Q_{\mathrm{s}}$ are proposition symbols. A knowledge base consisting of such sentences is in implicative normal form or Kowalski form (Kowalski, 1979).
c. Write down the full resolution rule for sentences in implicative normal form.

Clarissa Noh
Clarissa Noh
Numerade Educator
06:55

Problem 14

According to some political pundits, a person who is radical $(R)$ is electable $(E)$ if he/she is conservative $(C)$, but otherwise is not electable.
a. Which of the following are correct representations of this assertion?
(i) $(R \wedge E) \Longleftrightarrow C$
(ii) $R \Rightarrow(E \Longleftrightarrow C)$
(iii) $R \Rightarrow((C \Rightarrow E) \vee \neg E)$
b. Which of the sentences in (a) can be expressed in Horn form?

Nicholas Sacco
Nicholas Sacco
Numerade Educator
01:06

Problem 15

This question considers representing satisfiability (SAT) problems as CSPs.
a. Draw the constraint graph corresponding to the SAT problem
$$
\left(\neg X_1 \vee X_2\right) \wedge\left(\neg X_2 \vee X_3\right) \wedge \ldots \wedge\left(\neg X_{n-1} \vee X_n\right)
$$
for the particular case $n=4$.
b. How many solutions are there for this general SAT problem as a function of $n$ ?
c. Suppose we apply BACKTRACKING-SEARCH (page 215) to find all solutions to a SAT CSP of the type given in (a). (To find all solutions to a CSP, we simply modify the basic algorithm so it continues searching after each solution is found.) Assume that variables are ordered $X_1, \ldots, X_n$ and false is ordered before true. How much time will the algorithm take to terminate? (Write an $O(\cdot)$ expression as a function of $n$.)
d. We know that SAT problems in Horn form can be solved in linear time by forward chaining (unit propagation). We also know that every tree-structured binary CSP with discrete, finite domains can be solved in time linear in the number of variables (Section 6.5). Are these two facts connected? Discuss.

Lauren Shelton
Lauren Shelton
Numerade Educator
05:33

Problem 16

Prove each of the following assertions:
a. Every pair of propositional clauses either has no resolvents, or all their resolvents are logically equivalent.
b. There is no clause that, when resolved with itself, yields (after factoring) the clause $(\neg P \vee \neg Q)$.
c. If a propositional clause $C$ can be resolved with a copy of itself, it must be logically equivalent to True.

Rosina Dapaah
Rosina Dapaah
Numerade Educator

Problem 17

Consider the following sentence:
$$
[(\text { Food } \Rightarrow \text { Party }) \vee(\text { Drinks } \Rightarrow \text { Party })] \Rightarrow[(\text { Food } \wedge \text { Drinks }) \Rightarrow \text { Party }]
$$
a. Determine, using enumeration, whether this sentence is valid, satisfiable (but not valid), or unsatisfiable.
b. Convert the left-hand and right-hand sides of the main implication into CNF, showing each step, and explain how the results confirm your answer to (a).
c. Prove your answer to (a) using resolution.

Check back soon!
02:09

Problem 18

A sentence is in disjunctive normal form (DNF) if it is the disjunction of conjunctions of literals. For example, the sentence $(A \wedge B \wedge \neg C) \vee(\neg A \wedge C) \vee(B \wedge \neg C)$ is in DNF.
a. Any propositional logic sentence is logically equivalent to the assertion that some possible world in which it would be true is in fact the case. From this observation, prove that any sentence can be written in DNF.
b. Construct an algorithm that converts any sentence in propositional logic into DNF.
c. Construct a simple algorithm that takes as input a sentence in DNF and returns a satisfying assignment if one exists, or reports that no satisfying assignment exists.
d. Apply the algorithms in (b) and (c) to the following set of sentences:
$$
\begin{aligned}
& A \Rightarrow B \\
& B \Rightarrow C \\
& C \Rightarrow \neg A .
\end{aligned}
$$
e. Since the algorithm in (b) is very similar to the algorithm for conversion to CNF, and since the algorithm in (c) is much simpler than any algorithm for solving a set of sentences in CNF, why is this technique not used in automated reasoning?

Clarissa Noh
Clarissa Noh
Numerade Educator

Problem 19

Convert the following set of sentences to clausal form.
$$
\begin{aligned}
& \text { S1: } A \Leftrightarrow(C \vee E) . \\
& \text { S2: } E \Rightarrow D . \\
& \text { S3: } B \wedge F \Rightarrow \neg C . \\
& \text { S4: } E \Rightarrow C . \\
& \text { S5: } C \Rightarrow F . \\
& \text { S6: } C \Rightarrow B
\end{aligned}
$$

Give a trace of the execution of DPLL on the conjunction of these clauses.

Check back soon!
03:30

Problem 20

Is a randomly generated 4-CNF sentence with $n$ symbols and $m$ clauses more or less likely to be solvable than a randomly generated $3-\mathrm{CNF}$ sentence with $n$ symbols and $m$ clauses? Explain.

Anas Venkitta
Anas Venkitta
Numerade Educator

Problem 21

Minesweeper, the well-known computer game, is closely related to the wumpus world. A minesweeper world is a rectangular grid of $N$ squares with $M$ invisible mines scattered among them. Any square may be probed by the agent; instant death follows if a mine is probed. Minesweeper indicates the presence of mines by revealing, in each probed square, the number of mines that are directly or diagonally adjacent. The goal is to probe every unmined square.
a. Let $X_{i, j}$ be true iff square $[i, j]$ contains a mine. Write down the assertion that exactly two mines are adjacent to $[1,1]$ as a sentence involving some logical combination of $X_{i, j}$ propositions.
b. Generalize your assertion from (a) by explaining how to construct a CNF sentence asserting that $k$ of $n$ neighbors contain mines.
c. Explain precisely how an agent can use DPLL to prove that a given square does (or does not) contain a mine, ignoring the global constraint that there are exactly $M$ mines in all.
d. Suppose that the global constraint is constructed from your method from part (b). How does the number of clauses depend on $M$ and $N$ ? Suggest a way to modify DPLL so that the global constraint does not need to be represented explicitly.
e. Are any conclusions derived by the method in part (c) invalidated when the global constraint is taken into account?
f. Give examples of configurations of probe values that induce long-range dependencies such that the contents of a given unprobed square would give information about the contents of a far-distant square.

Check back soon!

Problem 22

How long does it take to prove $K B \models \alpha$ using DPLL when $\alpha$ is a literal already contained in $K B$ ? Explain.

Check back soon!

Problem 23

Trace the behavior of DPLL on the knowledge base in Figure 7.16 when trying to prove $Q$, and compare this behavior with that of the forward-chaining algorithm.

Check back soon!
02:48

Problem 24

Discuss what is meant by optimal behavior in the wumpus world. Show that the HYBRID-WUMPUS-AGENT is not optimal, and suggest ways to improve it.

Srikar Katta
Srikar Katta
Numerade Educator

Problem 25

Suppose an agent inhabits a world with two states, $S$ and $\neg S$, and can do exactly one of two actions, $a$ and $b$. Action $a$ does nothing and action $b$ flips from one state to the other. Let $S^t$ be the proposition that the agent is in state $S$ at time $t$, and let $a^t$ be the proposition that the agent does action $a$ at time $t$ (similarly for $b^t$ ).
a. Write a successor-state axiom for $S^{t+1}$.
b. Convert the sentence in (a) into CNF.
c. Show a resolution refutation proof that if the agent is in $\neg S$ at time $t$ and does $a$, it will still be in $-S$ at time $t+1$.

Check back soon!

Problem 26

Section 7.7.1 provides some of the successor-state axioms required for the wumpus world. Write down axioms for all remaining fluent symbols.

Check back soon!
04:09

Problem 27

Modify the HYBRID-WUMPUS-AGENT to use the 1-CNF logical state estimation method described on page 271. We noted on that page that such an agent will not be able to acquire, maintain, and use more complex beliefs such as the disjunction $P_{3,1} \vee P_{2,2}$. Suggest a method for overcoming this problem by defining additional proposition symbols, and try it out in the wumpus world. Does it improve the performance of the agent?

Akash M
Akash M
Numerade Educator