• Home
  • Textbooks
  • Artificial Intelligence. A Modern Approach [Global Edition]
  • Inference in 1st-Order Logic

Artificial Intelligence. A Modern Approach [Global Edition]

Stuart Russell, Peter Norvig

Chapter 9

Inference in 1st-Order Logic - all with Video Answers

Educators


Chapter Questions

01:35

Problem 1

Prove that Universal Instantiation is sound and that Existential Instantiation produces an inferentially equivalent knowledge base.

WM
William Mead
Numerade Educator
01:52

Problem 2

From Likes(Jerry, IceCream) it seems reasonable to infer $\exists x$ Likes( $x$, IceCream). Write down a general inference rule, Existential Introduction, that sanctions this inference. State carefully the conditions that must be satisfied by the variables and terms involved.

Adriano Chikande
Adriano Chikande
Numerade Educator
02:51

Problem 3

Which of the following are legitimate results of applying Existential Instantiation?
a. AsHighAs(Everest, Everest).
b. AsHighAs(Kilimanjaro, Everest).
c. AsHighAs $($ Kilimanjaro, Everest $) \wedge A s H i g h A s($ BenNevis, Everest $)$ (after two applications).

Teresa Fuston
Teresa Fuston
Numerade Educator

Problem 4

For each pair of atomic sentences, give the most general unifier if it exists:
a. $P(A, A, B), P(x, y, z)$.
b. $Q(y, G(A, B)), Q(G(x, x), y)$.
c. Older $($ Father $(y), y)$, Older (Father $(x)$, Jerry).
d. Knows (Father $(y), y)$, Knows $(x, x)$.

Check back soon!
00:37

Problem 5

Consider the subsumption lattices shown in Figure 9.2 (page 329).
a. Construct the lattice for the sentence Employs(Mother(John), Father(Richard)).
b. Construct the lattice for the sentence Employs $(I B M, y)$ ("Everyone works for IBM"). Remember to include every kind of query that unifies with the sentence.
c. Assume that STORE indexes each sentence under every node in its subsumption lattice. Explain how FETCH should work when some of these sentences contain variables; use as examples the sentences in (a) and (b) and the query Employs (x, Father (x)).

Mohamed Mohamed
Mohamed Mohamed
Numerade Educator
02:18

Problem 6

Write down logical representations for the following sentences, suitable for use with Generalized Modus Ponens:
a. Horses, cows, and pigs are mammals.
b. An offspring of a horse is a horse.
c. Bluebeard is a horse.
d. Bluebeard is Charlie's parent.
e. Offspring and parent are inverse relations.
f. Every mammal has a parent.

Christopher Stanley
Christopher Stanley
Numerade Educator
02:29

Problem 7

These questions concern concern issues with substitution and Skolemization.
a. Given the premise $\forall x \exists \exists P(x, y)$, it is not valid to conclude that $\exists q P(q, q)$. Give an example of a predicate $P$ where the first is true but the second is false.
b. Suppose that an inference engine is incorrectly written with the occurs check omitted, so that it allows a literal like $P(x, F(x))$ to be unified with $P(q, q)$. (As mentioned, most standard implementations of Prolog actually do allow this.) Show that such an inference engine will allow the conclusion $\exists y P(q, q)$ to be inferred from the premise $\forall x \exists y P(x, y)$.
c. Suppose that a procedure that converts first-order logic to clausal form incorrectly Skolemizes $\forall x \quad \exists y \quad P(x, y)$ to $P(x, S k 0)$-that is, it replaces $y$ by a Skolem constant rather than by a Skolem function of $x$. Show that an inference engine that uses such a procedure will likewise allow $\exists q \quad P(q, q)$ to be inferred from the premise $\forall x \exists y P(x, y)$.
d. A common error among students is to suppose that, in unification, one is allowed to substitute a term for a Skolem constant instead of for a variable. For instance, they will say that the formulas $P(S k 1)$ and $P(A)$ can be unified under the substitution $\{S k 1 / A\}$. Give an example where this leads to an invalid inference.

Amy Jiang
Amy Jiang
Numerade Educator

Problem 8

This question considers Horn KBs, such as the following:
$$
\begin{aligned}
& P(F(x)) \Rightarrow P(x) \\
& Q(x) \Rightarrow P(F(x)) \\
& P(A) \\
& Q(B)
\end{aligned}
$$

Let $\mathrm{FC}$ be a breadth-first forward-chaining algorithm that repeatedly adds all consequences of currently satisfied rules; let $\mathrm{BC}$ be a depth-first left-to-right backward-chaining algorithm that tries clauses in the order given in the KB. Which of the following are true?
a. FC will infer the literal $Q(A)$.
b. FC will infer the literal $P(B)$.
c. If FC has failed to infer a given literal, then it is not entailed by the KB.
d. $\mathrm{BC}$ will return true given the query $P(B)$.
e. If BC does not return true given a query literal, then it is not entailed by the KB.

Check back soon!
View

Problem 9

Explain how to write any given 3-SAT problem of arbitrary size using a single first-order definite clause and no more than 30 ground facts.

Victor Salazar
Victor Salazar
Numerade Educator

Problem 10

Suppose you are given the following axioms:
$1.0 \leq 4$.
2. $5 \leq 9$.
3. $\forall x \quad x \leq x$.
4. $\forall x \quad x \leq x+0$.
5. $\forall x \quad x+0 \leq x$.
6. $\forall x, y \quad x+y \leq y+x$.
7. $\forall w, x, y, z \quad w \leq y \wedge x \leq z \Rightarrow w+x \leq y+z$.
8. $\forall x, y, z \quad x \leq y \wedge y \leq z \Rightarrow x \leq z$
a. Give a backward-chaining proof of the sentence $5 \leq 4+9$. (Be sure, of course, to use only the axioms given here, not anything else you may know about arithmetic.) Show only the steps that leads to success, not the irrelevant steps.
b. Give a forward-chaining proof of the sentence $5 \leq 4+9$. Again, show only the steps that lead to success.

Check back soon!
01:19

Problem 11

A popular children's riddle is "Brothers and sisters have I none, but that man's father is my father's son." Use the rules of the family domain (Section 8.3.2 on page 301) to show who that man is. You may apply any of the inference methods described in this chapter. Why do you think that this riddle is difficult?

Manik Pulyani
Manik Pulyani
Numerade Educator

Problem 12

Suppose we put into a logical knowledge base a segment of the U.S. census data listing the age, city of residence, date of birth, and mother of every person, using social security numbers as identifying constants for each person. Thus, George's age is given by Age(443-65-1282, 56). Which of the following indexing schemes S1-S5 enable an efficient solution for which of the queries Q1-Q4 (assuming normal backward chaining)?
$\bullet$ S1: an index for each atom in each position.
$\bullet$ S2: an index for each first argument.
$\bullet$ S3: an index for each predicate atom.
$\bullet$S4: an index for each combination of predicate and first argument.
$\bullet$ S5: an index for each combination of predicate and second argument and an index for each first argument.
$\bullet$Q1: Age(443-44-4321, x)
$\bullet$ Q2: ResidesIn( $x$, Houston)
$\bullet$ Q3: $\operatorname{Mother}(x, y)$
$\bullet$ Q4: $\operatorname{Age}(x, 34) \wedge$ ResidesIn $(x$, TinyTownUSA $)$

Check back soon!

Problem 13

One might suppose that we can avoid the problem of variable conflict in unification during backward chaining by standardizing apart all of the sentences in the knowledge base once and for all. Show that, for some sentences, this approach cannot work.

Check back soon!

Problem 14

In this exercise, use the sentences you wrote in Exercise 9.6 to answer a question by using a backward-chaining algorithm.
a. Draw the proof tree generated by an exhaustive backward-chaining algorithm for the query $\exists h \operatorname{Horse}(h)$, where clauses are matched in the order given.
b. What do you notice about this domain?
c. How many solutions for $h$ actually follow from your sentences?
d. Can you think of a way to find all of them?

Check back soon!

Problem 15

Trace the execution of the backward-chaining algorithm in Figure 9.6 (page 338) when it is applied to solve the crime problem (page 330). Show the sequence of values taken on by the goals variable, and arrange them into a tree.

Check back soon!
01:18

Problem 16

The following Prolog code defines a predicate P. (Remember that uppercase terms are variables, not constants, in Prolog.)
$$
\begin{aligned}
& P(X,[X \mid Y]) . \\
& P(X,[Y \mid Z]):-P(X, Z) .
\end{aligned}
$$
a. Show proof trees and solutions for the queries $\mathrm{P}(\mathrm{A},[1,2,3])$ and $\mathrm{P}(2,[1, \mathrm{~A}, 3])$.
b. What standard list operation does $P$ represent?

Clarissa Noh
Clarissa Noh
Numerade Educator

Problem 17

This exercise looks at sorting in Prolog.
a. Write Prolog clauses that define the predicate sorted (L), which is true if and only if list $\mathrm{L}$ is sorted in ascending order.
b. Write a Prolog definition for the predicate perm $(L, M)$, which is true if and only if $L$ is a permutation of $\mathrm{M}$.
c. Define sort (L,M) (M is a sorted version of L) using perm and sorted.
d. Run sort on longer and longer lists until you lose patience. What is the time complexity of your program?
e. Write a faster sorting algorithm, such as insertion sort or quicksort, in Prolog.

Check back soon!

Problem 18

This exercise looks at the recursive application of rewrite rules, using logic programming. A rewrite rule (or demodulator in OTTER terminology) is an equation with a specified direction. For example, the rewrite rule $x+0 \rightarrow x$ suggests replacing any expression that matches $x+0$ with the expression $x$. Rewrite rules are a key component of equational reasoning systems. Use the predicate rewrite $(\mathrm{X}, \mathrm{Y})$ to represent rewrite rules. For example, the earlier rewrite rule is written as rewrite $(\mathrm{X}+0, \mathrm{X})$. Some terms are primitive and cannot be further simplified; thus, we write primitive $(0)$ to say that 0 is a primitive term.
a. Write a definition of a predicate $\operatorname{simplify}(\mathrm{X}, \mathrm{Y})$, that is true when $\mathrm{Y}$ is a simplified version of $\mathrm{X}$ - that is, when no further rewrite rules apply to any subexpression of $\mathrm{Y}$.
b. Write a collection of rules for the simplification of expressions involving arithmetic operators, and apply your simplification algorithm to some sample expressions.
c. Write a collection of rewrite rules for symbolic differentiation, and use them along with your simplification rules to differentiate and simplify expressions involving arithmetic expressions, including exponentiation.

Check back soon!

Problem 19

This exercise considers the implementation of search algorithms in Prolog. Suppose that successor $(X, Y)$ is true when state $Y$ is a successor of state $X$; and that goal (X) is true when $\mathrm{X}$ is a goal state. Write a definition for solve (X, P), which means that $\mathrm{P}$ is a path (list of states) beginning with $\mathrm{X}$, ending in a goal state, and consisting of a sequence of legal steps as defined by successor. You will find that depth-first search is the easiest way to do this. How easy would it be to add heuristic search control?

Check back soon!
04:43

Problem 20

Let $\mathcal{L}$ be the first-order language with a single predicate $S(p, q)$, meaning " $p$ shaves $q . "$ Assume a domain of people.
a. Consider the sentence "There exists a person $P$ who shaves every one who does not shave themselves, and only people that do not shave themselves." Express this in $\mathcal{L}$.
b. Convert the sentence in (a) to clausal form.
c. Construct a resolution proof to show that the clauses in (b) are inherently inconsistent. (Note: you do not need any additional axioms.)

Rosina Dapaah
Rosina Dapaah
Numerade Educator

Problem 21

How can resolution be used to show that a sentence is valid? Unsatisfiable?

Check back soon!

Problem 22

Construct an example of two clauses that can be resolved together in two different ways giving two different outcomes.

Check back soon!

Problem 23

From "Sheep are animals," it follows that "The head of a sheep is the head of an animal." Demonstrate that this inference is valid by carrying out the following steps:
a. Translate the premise and the conclusion into the language of first-order logic. Use three predicates: HeadOf $(h, x)$ (meaning " $h$ is the head of $x "$ ), Sheep $(x)$, and Animal $(x)$.
b. Negate the conclusion, and convert the premise and the negated conclusion into conjunctive normal form.
c. Use resolution to show that the conclusion follows from the premise.

Check back soon!

Problem 24

Here are two sentences in the language of first-order logic:
(A) $\forall x \exists y(x \geq y)$
(B) $\exists y \forall x \quad(x \geq y)$
a. Assume that the variables range over all the natural numbers $0,1,2, \ldots, \infty$ and that the " $\geq$ " predicate means "is greater than or equal to." Under this interpretation, translate (A) and (B) into English.
b. Is (A) true under this interpretation?
c. Is (B) true under this interpretation?
d. Does (A) logically entail (B)?
e. Does (B) logically entail (A)?
f. Using resolution, try to prove that (A) follows from (B). Do this even if you think that (B) does not logically entail (A); continue until the proof breaks down and you cannot proceed (if it does break down). Show the unifying substitution for each resolution step. If the proof fails, explain exactly where, how, and why it breaks down.
g. Now try to prove that (B) follows from (A).

Check back soon!

Problem 25

Resolution can produce nonconstructive proofs for queries with variables, so we had to introduce special mechanisms to extract definite answers. Explain why this issue does not arise with knowledge bases containing only definite clauses.

Check back soon!
06:50

Problem 26

We said in this chapter that resolution cannot be used to generate all logical consequences of a set of sentences. Can any algorithm do this?

Bryan Lynn
Bryan Lynn
Numerade Educator