6.
882 — PS2: Practice problems — Fall 2010 1
PS2: Practice problems
Answer Answers are shown in green. These answers have not been proofread by anyone but
me, so there is substantial chance of error. Please let me know if you have any doubts. -lpk
1 Logic
1.1 Propositional sentences
For each of the sentences below, indicate whether it is valid, unsatisfiable, or neither. If neither,
provide an interpretation that makes it true and one that makes it false.
1. S → F
Answer It is neither valid nor unsatisfiable. The interpretation S = T, F = T makes it true;
the interpretation S = T, F = F makes it false.
2. S → S
Answer This is valid; that is, it is true in all interpretations.
3. B ∨ D ∨ (B → D)
Answer This is equivalent to B ∨ D ∨ (¬B ∨ D), which is valid.
1.2 English to propositional logic
We’d like to formalize the sentence: A person who is radical (R) is electable (E) if he/she is conservative
(C), but is otherwise not electable. For each of the logical sentences below, indicate whether it is a
successful formalization of the English sentence. If it is not, explain why not.
1. (R ∧E) ↔C
Answer This is not equivalent. It says that all (and only) conservatives are radical and
electable.
2. R →(E ↔C)
Answer This one is equivalent.
3. R →((C →E) ∨¬E)
Answer This one is vacuous. It’s equivalent to ¬R ∨ (¬C ∨ E ∨ ¬E), which is true in all
interpretations.
6.882 — PS2: Practice problems — Fall 2010 2
1.3 Quantifiers
Consider a finite domain U = {a, b, c}. For each of the sentences below, provide a sentence
without any quantifiers that is equivalent to it in any interpretation with universe U.
1. ∀x.P(x)
Answer P(a) ∧ P(b) ∧ P(c)
2. ∃x.∀y.Q(x, y)
Answer
(Q(a, a) ∧ Q(a, b) ∧ Q(a, c)) ∨ (Q(b, a) ∧ Q(b, b) ∧ Q(b, c)) ∨ (Q(c, a) ∧ Q(c, b) ∧ Q(c, c))
1.4 English to FOL
Formalize each of these sentences in first-order logic.
1. All countries that border Ecuador are in South America.
Answer ∀c.Borders(c, Ecuador) → In(c, SouthAmerica)
2. No two adjacent countries have the same map color.
Answer ¬∃c1 .∃c2 .Adjacent(c1 , c2 ) ∧ Color(c1 ) = Color(c2 )
3. There is a barber who shaves all men, and only those men, who do not shave themselves.
Answer ∃b.Barber(b) ∧ ∀m.¬Shaves(m, m) ↔ Shaves(b, m)
For extra fun, figure out whether the last one is satisfiable, and provide a proof.
Answer This is unsatisfiable. We’ll prove a contradiction. The barber part is irrelevant. So, the
sentence is: ∃b.∀m.¬Shaves(m, m) ↔ Shaves(b, m)
We haven’t really studied formal proof in this class, so I’ll do it informally. Don’t worry if you
don’t feel like you know how to do proofs in FOL.
1. First, rewrite the equivalence as two implications (always legal):
∃b.∀m.(¬Shaves(m, m) → Shaves(b, m)) ∧ (Shaves(b, m) → ¬Shaves(m, m))
2. Let’s just pick a particular constant name for the b without making any assumptions about
him:
∀m.(¬Shaves(m, m) → Shaves(Figaro, m)) ∧ (Shaves(Figaro, m) → ¬Shaves(m, m))
3. Now, because this has to be true of all m, it has to be true of Figaro:
(¬Shaves(Figaro, Figaro) → Shaves(Figaro, Figaro)) ∧
(Shaves(Figaro, Figaro) → ¬Shaves(Figaro, Figaro))
6.882 — PS2: Practice problems — Fall 2010 3
4. Rewriting the implications as disjunctions:
(Shaves(Figaro, Figaro) ∨ Shaves(Figaro, Figaro)) ∧
(¬Shaves(Figaro, Figaro) ∨ ¬Shaves(Figaro, Figaro))
5. Simplifying:
Shaves(Figaro, Figaro) ∧ ¬Shaves(Figaro, Figaro)
6. This is clearly a contradiction. So, it cannot be that there is a barber who shaves all and only
the men who do not shave themselves. (Unless she is a woman!)
2 Planning
2.1 Monkey and bananas
A monkey wants bananas, but is too short to grab them. Help him make a plan!
There are three locations. The monkey is at L1, a box is at L2 and the bananas are hanging at L3.
The monkey can move to any location if he is not elevated. The monkey can climb up on top
of the box if he is at the same location as the box; if he climbs on the box, he will be elevated.
The monkey can climb down from the box if he is on it, and then he will no longer be elevated.
The monkey can push the box to any location if he and the box are at the same location to start
with and he is not elevated. The monkey can grab the bananas if he is at the same location as the
bananas and is elevated, at which point, he will have the bananas.
Write STRIPS or PDDL-like action schemas (syntax isn’t important) for the monkey’s operations
above.
AnswerMove(start, target):
• Pre: At(Monkey, start), not Elevated(Monkey)
• Result: not At(Monkey, start), At(Monkey, target)
ClimbUp(loc):
• Pre: At(Monkey, loc), At(Box, loc), not Elevated(Monkey)
• Result: Elevated(Monkey)
ClimbDown():
• Pre: Elevated(Monkey)
• Result: not Elevated(Monkey)
PushBox(start, target):
6.882 — PS2: Practice problems — Fall 2010 4
• Pre: At(Monkey, start), At(Box, start), not Elevated(Monkey)
• Result: not At(Monkey, start), not At(Box, start), At(Monkey, target), At(Box, target)
GrabBananas():
• Pre: At(Monkey, L3), At(Bananas, L3), Elevated(Monkey)
• Result: Holding(Monkey, Bananas), not At(Bananas, L3)
2.2 Regression
The monkey has the goal: Holding(Monkey, Bananas) ∧ At(Monkey, L1).
• Which actions are relevant to this goal?
Answer An action is relevant if it can make a fluent in the goal true. So the relevant actions
are GrabBananas(), Move(L2, L1), and Move(L3, L1). (STRIPS usually implicitly assumes
that each of the arguments of an operator has to be different, so we don’t have Move(L1, L1)
as well.)
• Which actions are both relevant and applicable?
AnswerGrabBananas() is not applicable, because it has as a precondition At(Monkey, L3)
which is in contradiction with a fluent in the goal. (Actually detecting that contradiction re-
quires either reasoning outside of STRIPS or putting not At(Monkey, L1) and not At(Monkey,
L2) in the goal. Another strategy is to have a fluent Loc(Monkey) that takes on locations as
values; this also takes us outside of the realm of basic STRIPS.)
Only the move actions are both relevant and applicable.
• For each of the actions that are both relevant and applicable, provide the regression of the goal
under that action.
Answer For Move(L2, L1), the regression of the goal is
Holding(Monkey, Bananas), At(Monkey, L2), not Elevated(Monkey).
It is similar for the other move operation.
2.3 Graphplan
P
If you have a goal G1 ∧ G2 ∧ . . . ∧ Gn , then one heuristic function to use might be i lc(Gi ),
where lc(Gi ) is the level cost of Gi in the plan graph. Is this heuristic admissible? Why or why
not?
Answer It is not admissible, because it might be that the same actions that cause G1 to be true
can cause all of the goal fluents to be true as well.