Professional Documents
Culture Documents
CS 343 Homework 7 Solutions: A Representing Knowledge in Logical Formalisms
CS 343 Homework 7 Solutions: A Representing Knowledge in Logical Formalisms
Nick Jong
Technically, we would also need to axiomatize certain basic properties of the less-than relation, such
as its transitivity.
3. What problems would be encountered in attempting to represent the following statements in FOPC?
It should be possible to deduce the final statement from the others.
Without going into detail, some of these sentences contain concepts that are awkward to express
properly in FOPC, such as defaults and frequency. Others are ambiguous or have literal translations
that depart from the likely intended meaning.
1
B Inference methods and algorithms for reasoning with knowl-
edge that is represented in logical formalisms
Propositional logical
1. Decide whether each of the following sentences is valid, unsatisfiable, or neither. You may use truth
tables or any of the standard sound rules for propositional inference. Show your argument.
2. Given the following, can you prove that the unicorn is mythical? Magical? Horned? Show your work.
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 horned. The unicorn is magical if it is horned.
Since the unicorn must be either mythical or not mythical, the unicorn must be either immortal or
a mammal, according to the first sentence above. Then by the second sentence, the unicorn must be
horned. By the third sentence, it is also magical. However, we have no way of proving whether or
not the unicorn is mythical. We reasoned over two cases to show that the unicorn is immortal or a
mammal, but we don’t know which case actually holds.
3. Show that every propositional logic clause with at least one positive literal and one negative literal can
be written in the form (P1 ∧ · · · ∧ Pm ) → (Q1 ∨ · · · ∨ Qn ), where the P s and Qs are proposition symbols.
A knowledge base consisting of such sentences is in implicatie normal form or Kowalski form.
Let (L1 ∨ · · · ∨ Lk ) be an arbitrary clause, where each L is a literal (a propositional symbol that
may or may not be negated). Since ∨ is cumutative and associative, we may assume without loss of
generality that for some m between 1 and k (inclusive), L1 through Lm are negated and Lm+1 through
Lk are positive. Then we may write the clause as (L1 ∨ · · · ∨ Lm ) ∨ (Lm+1 ∨ · · · ∨ Lk ). From the
definition of →, we have ¬(L1 ∨ · · · ∨ Lm ) → (Lm+1 ∨ · · · ∨ Lk ). Applying de Morgan’s Law, we obtain
(¬L1 ∧ · · · ∧ ¬Lm ) → (Lm+1 ∨ · · · ∨ Lk ). Since the first m literals are negated propositional symbols
and the remaining n = k − m literals are unnegated propositional symbols, we can now express the
clause as (P1 ∧ · · · ∧ Pm ) → (Q1 ∨ · · · ∨ Qn ), as desired.
4. Consider the following KB:
• winter ∨ hot
• winter → ¬summer ∧ ¬spring ∧ ¬f all
• rainy → spring ∨ winter
• pollen → winter
• rivers → rainy
• spring → bluebonnets
• ¬bluebonnets
• rivers
FOPC
5. Write down a logical sentence such that every world in which it is true contains exactly one object.
∃x∀y x = y
This sentences says that some individual is the same as any given individual. This is only true if only
one individual exists (for appropriate meanings of “same”).
6. Show the result of applying the unification algorithm given in class to each of the following pairs of
clauses.
(a) P (A, B, B) P (x, y, z) A/x, B/y, B/z
(b) Q(y, G(A, B)) Q(G(x, x), y) failure: can’t unify A and B
(c) Older(F ather(y), y) Older(F ather(x), John) Joh(n/x, John/y
(d) Knows(F ather(y), y) Knows(x, x) failure: can’t unify y and F ather(y)
(e) F (M arcus) F (Caesar) failure: can’t unify M arcus and Caesar
(f) F (x) F (G(y)) G(y)/x
(g) F (M arcus, G(x, y)) F (x, G(Caesar, M arcus)) failure: can’t unify M arcus and Caesar
7. Consider the following KB:
• ∀x M arried(x) → ∃y Spouse(x, y)
• ∀x∃y Spouse(x, y) → M arried(x)
• ∀x∀y Spouse(x, y) → Spouse(y, x)
• ∀x∀y JointT axF ilers(x, y) → Spouse(x, y)
• JointT axF ilers(John, M ary)
• ¬∃y Spouse(Sue, y)
(a) Convert each of these formulas to clause form.
1. ¬M arried(x) ∨ Spouse(x, S1 (x))
2. ¬Spouse(x, y) ∨ M arried(x)
3. ¬Spouse(x, y) ∨ Spouse(y, x)
4. ¬JointT axF ilers(x, y) ∨ Spouse(x, y)
5. JointT axF ilers(John, M ary)
6. ¬Spouse(Sue, y)
(b) Use resolution and this KB to prove M arried(M ary).
7. ¬M arried(M ary) negated conclusion
8. ¬Spouse(M ary, y) 2 and 7
9. ¬Spouse(y, M ary) 3 and 8
10. ¬JointT axF ilers(y, M ary) 4 and 9
11. ⊥ 5 and 10
(c) Use resolution and this KB to prove ¬M arried(Sue).
12. M arried(Sue) negated conclusion
13. Spouse(Sue, S1 (Sue)) 1 and 12
14. ⊥ 6 and 13
8. Suppose you are given the following facts:
(α) ∀x, y, z gt(x, y) ∧ gt(y, z) → gt(x, z)
(β) ∀a, b succ(a, b) → gt(a, b)
(γ) ∀x ¬gt(x, x)
Using these facts, we want to prove gt(5, 2), which we should be able to do with resolution. Consider
the following attempt at a resolution proof:
The first statement gives a property of the set of men (taken collectively), not a property that applies
to each individual member of the set.