Extra FOL practice

Here are some extra sentences to help you practice your FOL skills. The answers are in a white font - highlight to reveal them.

Encode each of the Following sentences as first-order logic. Use the following predicates: neighborhood(x), in(x,y), foggy(x), sunny(x), livesIn(x,y), drivesToWork(x), ownsCar(x).

Note: A= Forall, E=ThereExists, v = OR, ^ = AND, ! = NOT, -> = implies, <-> = equivalence

• All neighborhoods in San Francisco are foggy.
Forall x neighborhood(x) ^ in(x,SF) -> foggy(x)
• All neighborhoods in Oakland are sunny.
Forall x neighborhood(x) ^ in(x,Oakland) -> sunny(x)
• Susan owns a car.
ownsCar(Susan)
• Bob either lives in San Francisco or he lives in Oakland.
livesIn(Bob, SF) v livesIn(Bob, Oakland)
• If Bob lives in San Francisco, then Susan lives in Oakland, and if Bob lives in Oakland, then Susan lives in San Francisco.
(livesIn(Bob, SF) -> livesIn(Susan, Oakland)) ^ (livesIn(Bib, Oakland) -> livesIn(Susan,SF))
• If a person drives to work, then they live in Oakland.
Forall x drivesToWork(x) -> livesIn(x, Oakland)
• If a person owns a car, then they drive to work.
Forall x ownsCar(x) -> drivesToWork(x)
• Exeryone lives in either San Francisco or Oakland.
Forall x livesIn(x,SF) v livesIn(x, Oakland)
• No one lives in both SF and Oakland.
(there's several ways to do this) Forall x !livesIn (x,SF) v !livesIn(x, Oakland)

Convert each of the sentences above to CNF.
• All neighborhoods in San Francisco are foggy.
S1: ! neighborhood(x1) v ! in(x1,SF) v foggy(x1)
• All neighborhoods in Oakland are sunny.
S2: neighborhood(x2) v ! in(x2,Oakland) v sunny(x2)
• Susan owns a car.
S3: ownsCar(Susan)
• Bob either lives in San Francisco or he lives in Oakland.
S4: livesIn(Bob, SF) v livesIn(Bob, Oakland)
• If Bob lives in San Francisco, then Susan lives in Oakland, and if Bob lives in Oakland, then Susan lives in San Francisco.
S5a: ! livesIn(Bob, SF) v livesIn(Susan, Oakland)
S5b: ! livesIn(Bob, Oakland) v livesIn(Susan, SF)
• If a person drives to work, then they live in Oakland.
S6: ! drivesToWork(x3) v livesIn(x3, Oakland)
• If a person owns a car, then they drive to work.
S7: ! ownsCar(x4) v drivesToWork(x4)
• Exeryone lives in either San Francisco or Oakland.
S8: livesIn(x8,SF) v livesIn(x8, Oakland)
• No one lives in both SF and Oakland.
S9:! livesIn (x9,SF) v ! livesIn(x9, Oakland)

Use resolution with refutation to prove that Bob lives in San Francisco.
• Insert S10: ! livesIn(Bob, SF) into the KB
• Resolve S10 and S4 to conclude S11: livesIn(Bob, Oakland)
• Resolve S11 with S5b (unifying Bob/x9) to conclude S12: livesIn(Susan, SF)
• resolve S12 with S9 (unifying x9/Susan) to conclude S13: ! livesIn(Susan, Oakland)
• resolve S13 with S6 (unifying x3/Susan) to conclude S14: ! drivesToWork(Susan)
• resolve S14 with S7 (unifying (x4/Susan) to conclude S15: ! ownsCar(Susan)
• Resolve S15 with S3: Contradiction!