CS 540-1: Introduction to Artificial Intelligence
Exam 2: 7:15-9:15pm, November 20, 1995
CLOSED BOOK
(one page of notes allowed)
Write your answers on these pages and show your work. If you feel that a question is not fully
specified, state any assumptions you need to make in order to solve the problem. You may use
the backs of these sheets for scratch work.
Write your name on this and all other pages of this exam. Make sure your exam contains seven
(7) problems on eight (8) pages.
Name ________________________________________________
Student ID ________________________________________________
Problem Score Max Score
1 _____ 18
2 _____ 15
3 _____ 10
4 _____ 15
5 _____ 14
6 _____ 14
7 _____ 14
Total _____ 100
(over)
CS 540-1 2 Name ____________________
PROBLEM 1 - First-Order Predicate Calculus (18 points)
Give one (1) predicate calculus representation for each of these English sentences. If you feel a
sentence is ambiguous, provide a more detailed sentence that better captures the version
represented by your FOPC. Choose reasonable constants, predicates. and functions - the
predicate John’s-car-is-red is not an acceptable answer to the first question.
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
i) John’s car is red.
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
ii) All of Wendt’s books are cataloged.
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
iii) Every player on [the sports teams] the Packers and the Brewers is rich.
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
iv) Every living thing likes Thanksgiving, except for the turkeys.
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
v) Unless it is a blizzard, Mary has some mode of transportation for getting to school.
[note: use situation calculus to represent this sentence]
(over)
CS 540-1 3 Name ____________________
PROBLEM 2 - FOPC Interpretations (15 points)
For the English-FOPC pairs below, provide a formal interpretation that shows that the FOPC on
the right does not represent the English on the left. Justify your answers by computing the truth
value of the wff, given your interpretation, and compare to the ‘obvious’ meaning of the English.
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
i) Some horses do not like hay. ∃ x [ horse(x) ⇒ ¬likes(x, Hay) ]
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
ii) Bridge players who know all ∀ x,r [ { plays(x, Bridge) ∧ ruleOfBridge(r)
the rules are successful. ∧ knows(x, r) } ⇒ successful(x) ]
(over)
CS 540-1 4 Name ____________________
PROBLEM 3 - Clausal Form (10 points)
Convert (separately) the following FOPC wff’s to clausal form.
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
¬ [ ∀ x,y { P(x,y) ∧ ¬ Q(F(x), G(x, y)) } ]
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
∃ x ∀ y ∃ z [ P(x,y,z) ⇔ P(z,y,x) ]
(over)
CS 540-1 5 Name ____________________
PROBLEM 4 - Pattern Matching (15 points)
i) What is the most general unifier of the following pairs of wff’s? (If none exists, report
‘‘fail.’’) Assume that capital letters are constants and lowercase letters are variables.
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
P(x, y, x, z) P(F(w), A, F(B), w)
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Q(x, F(x), G(F(x))) Q(1, y, G(F(y)))
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
ii) Given the following Working Memory (WM), what are the valid variable-binding sets for the
production rule listed below?
WM: { P(0,0), P(1,2), P(2,1), Q(0,0), Q(0,1), Q(1,2), R(0,0,0), R(0,0,1), R(0,1,2), R(1,2,2) }
Rule: ∀ x,y,z [ P(x,y) ∧ Q(x,z) ∧ R(x, y, z) ] ⇒ Action(x, y, z)
If negation by failure were used, would the above rule match the above WM more, fewer, or
the same number of times? Explain your answer.
(over)
CS 540-1 6 Name ____________________
PROBLEM 5 - ‘Natural Deduction’ Theorem Proving (14 points)
Using the inference rules for logic, complete the natural deduction proof below, whose task is to
show that ∃ x Z(x) follows from the givens. Be sure to justify your steps by stating the inference
rule used, along with the previous line(s) to which it was applied.
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
# WFF Justification
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
1 P(1) given
2 W(1) ∧ W(2) ∧ W(3) given
3 ∀ x [P(x) ⇒ ¬R(x)] given
4 ∀ x [Q(x) ∨ R(x)] given
5 ∀ x [ {Q(x) ∧ W(x)} ⇒ Z(x)] given
6
(over)
CS 540-1 7 Name ____________________
PROBLEM 6 - Resolution Theorem Proving (14 points)
Consider the following formalization of a recent news story.
(1) Student 1 said that the University should construct more on-campus parking.
Student(S1) ∧ [ BuildsParkingLots(Univ) ⇒ ListenedTo(Univ, S1) ]
(2) Student 2 said that the University should not build more parking lots.
Student(S2) ∧ [ ¬BuildsParkingLots(Univ) ⇒ ListenedTo(Univ, S2) ]
(3) Student 3 said the University never listens to students.
∀ x [ Student(x) ⇒ ¬ListenedTo(Univ, x) ]
Use resolution theorem proving to show that Student 3’s statement is false.
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
First, prepare and number your clauses.
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Next, repeatedly apply the resolution inference rule.
(over)
CS 540-1 8 Name ____________________
PROBLEM 7 - Production Systems (14 points)
Consider the following set of production rules. Assume that the conflict resolution strategy is to
pick the rule with the most preconditions that (a) matches working memory (WM) and (b) has
not already been used. Break ties by choosing the lowest numbered rule. Also assume that the
production system terminates when either (a) no unused rules match WM or (b) the system
executes a PRINT action.
ASSERT’ing X means that ¬X is removed from WM and X is added, while RETRACT’ing X
means that X is removed from WM and ¬X is added.
(1) Q ∧ ¬S ⇒ ASSERT(R)
(2) P ∧ Q ∧ ¬R ⇒ RETRACT(Q), ASSERT(S)
(3) R ⇒ PRINT("Eureka!")
(4) S ⇒ PRINT("Eureka!")
(5) P∧S ⇒ RETRACT(P), RETRACT(S), ASSERT(Q)
(6) ¬P ∧ ¬Q ∧ ¬R ∧ ¬S ⇒ PRINT("I’m Stuck!")
Illustrate the operation of this production system by filling out the table below.
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Time Working Matching Chosen
Step Memory Unused Rules Rule
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
0 {P, Q, ¬R, ¬S}
(The End!)