08 Exercise Solution
08 Exercise Solution
md 12/14/2021
Exercise assignment for the course Introduction to AI (Part I) in the Bachelor of AAI at Rosenheim University of
Applied Sciences
Solution
In propositional logic, each variable (and formula) stands for a proposition, something that's either true or
false. In a first-order logic formula, each variable stands for an object.
Solution
Task 2
Define an appropriate language and formalize the following sentences using FOL formulas:
Solution
1. ∀x.(Student(x) → Smart(x))
2. ∃x.Student(x)
3. ∃x.(Student(x) ∧ Smart(x))
4. ∀x.(Student(x) → ∃y.(Student(y) ∧ Loves(x, y)))
5. ∀x.(Student(x) → ∃y.(Student(y) ∧ ¬(x = y) ∧ Loves(x, y)))
6. ∃x.(Student(x) ∧ ∀y.(Student(y) ∧ ¬(x = y) → Loves(y, x)))
7. Student(Bill)
8. Takes(Bill, Analysis) ↔ ¬Takes(Bill, Geometry)
9. Takes(Bill, Analysis) ∧ Takes(Bill, Geometry)
10. ¬Takes(Bill, Analysis)
1/3
exercise_solution.md 12/14/2021
Task 3
Define an appropriate language and formalize the following sentences in FOL:
Solution
Constants: A, B, C, D, E, F
Predicates: On2, Above2, F ree1, Red1, Green1.
Axioms
1. "A is above C, D is above F and on E." φ1 : Above(A, C) ∧ Above(E, F ) ∧ On(D, E)
2. "A is green while C is not." φ2 : Green(A) ∧ ¬Green(C)
3. "Everything is on something." φ3 : ∀x∃y.On(x, y)
4. "Everything that is free has nothing on it." φ4 : ∀x.(F ree(x) → ¬∃y.On(y, x))
5. "Everything that is green is free." φ5 : ∀x.(Green(x) → F ree(x))
6. "There is something that is red and is not free." φ6 : ∃x.(Red(x) ∧ ¬F ree(x))
7. "Everything that is not green and is above B, is red." φ7 : ∀x.(¬Green(x) ∧ Above(x, B) →
Red(x))
Task 4
The following diagram represents a set of people named A, B, C, and D. If there's an arrow from a person x
to a person y, then person x loves person y. We'll denote this by writing Loves(x, y). Below is a list of
formulas in first-order logic about the picture. In those formulas, the letter P represents the set of all the
people. For each formula, determine whether that formula is true or false.
2/3
exercise_solution.md 12/14/2021
This statement is false. Pick x and y to be A. Then Loves(x, y) is false and Loves(y, x) is false.
Remember that quantifiers can range over the same objects at the same time!
This statement is true – given any pair of two people in this diagram, one of them loves the other.
This statement is true. Given any pair of two people, exactly one of them loves the other, so either
Loves(x, y) will be true, or Loves(y, x) will be true, but not both. The biconditional in this case will
therefore always evaluate to true.
d) ∃x ∈ P. ∀y ∈ P. (Loves(x, y))
This statement is false – no one loves everyone, because no one loves themselves.
e) ∃x ∈ P. ∀y ∈ P. (x ≠ y → Loves(x, y))
f) ∀y ∈ P. ∃x ∈ P. (Loves(x, y))
g) ∀y ∈ P. ∃x ∈ P. (x ≠ y ∧ Loves(x, y))
h) ∃x ∈ P. ∀y ∈ P. (¬Loves(x, y))
3/3