Sei sulla pagina 1di 3

Homework 4

Dana Asbury
November 12, 2015
Problem 1.a. B551 is a course at IU.
C(x, y) = x is a course at y
C(B551, IU ) = B551 is a course at IU
Problem 1.b. Mary likes all pastries except donuts.
Likes(x, y) = x likes y
P astry(x) = x is a pastry
Donut(x) = x is a donut
xP astry(x) Donut(x) Likes(M ary, x)
Problem 1.c. If a printer doesnt print its broken, unless its unplugged.
P rinter(x) = x is a printer
P rints(x) = x prints
Broken(x) = x is broken
U nplugged(x) = x is unplugged
xP rinter(x) P rints(x) Broken(x) U nplugged(x)
Problem 1.d. No student likes expensive textbooks.
Student(x) = x is a student
Expensive(x) = x is expensive
Book(x) = x is a book
Likes(x, y) = x likes y
xy(Student(x) Book(y) Expensive(y) Likes(x, y))
Problem 1.e. Teach someone to fish and she/he will have fish forever.
T each(x, y, z) = x teaches y to z
Has(x, y) = x has y forever
F ish(x) = x is fish
xyz(T each(x, y, z) F ish(z) Has(y, z))
Problem 2. From Horses are animals, it follows that The head of a horse is the head
of an animal. Demonstrate that this inference is valid by carrying out the following steps:

Problem a. Translate the premise and the conclusion into the language of first-order logic.
Use three predicates:
Head(h, x) = h is the head of x
Horse(x) = x is a horse
Animal(x) = x is an animal
Premise: x(Horse(x) Animal(x))
Conclusion: xy(Head(x, y) Horse(x) z(Head(x, z) Animal(z)))
Problem b. Negate the conclusion, and convert the premise and the negated conclusion
into conjunctive normal form.
Conclusion: xy((Head(x, y) Horse(x) z(Head(x, z) Animal(z)))) =
= xyz(((Head(x, y) Horse(x)) z(Head(x, z) Animal(z)))) =
= xyz(((Head(x, y) Horse(x)) (Head(x, z) Animal(z)))) =
= Head(X, Y ) Horse(X) (Head(X, z) Animal(z))
Premise: x(Horse(x) Animal(x)) =
= x(Horse(x) Animal(x)) = Horse(x) Animal(x)
Note that X and Y are Skolem constants.
So we have the four premises:
1. Head(X, Y )
2. Horse(X)
3. Head(X, z) Animal(z)
4. Horse(x) Animal(x)

Problem c. Use resolution to show that the conclusion follows from the premise.
Resolving 1. and 3. results in 5. Animal(z)
Resolving 5. and 4. results in 6. Horse(x)
Resolving 6. and 2. results in a contradiction, and thus we have proved our conclusion.

Problem 3. Sketch how a forward chaining process could be implemented by breadth-first


search. Assume that the system begins with a set of rules and a set of facts in working
memory.
Problem a. Each rule is represented as a pair of the antecedent and the consequent of the
implication. So P Q would be the pair (P, Q). The state will be represented as the set of
all logical expressions currently in memory, meaning our known facts (either atomic or more
complex logical expressions), and our implication rules represented as pairs. So our initial
state will be the set of known premises at the beginning of the forward chaining process.
Our goal state is a set of one (or possibly many) logical expressions. So for instance our goal
state will be a set containing Q, and our initial state is {P, (P, Q)}, so we can apply our
rule (P,Q) to P, and derive the state {P, (P, Q), Q}, Since this successor contains Q, then we
know we can reach our goal.

Problem b. To generate a successor to the current state we will try to apply a rule to a
logical expression (possibly another rule) in our state. So if the antecedent of a rule matches
an expression in memory, then we can add the consequent of the rule to our state and that
becomes our new successor state. So to generate all successor states we must try to apply
each rule to every expression in our state, and for each successful application of the rule to
the current set of expressions, we have generated a new state with one additional expression
(namely the consequent of the successful rule application).

Potrebbero piacerti anche