Examples of Fol
Examples of Fol
This exercise is not graded and you will not turn it in. These are practice questions (done and discussed in-class)
to get you used to writing in first order logic.
Convert to English
1. x IsABunny(x) IsCute(x)
All bunnies are cute
2. x IsAStudent(x) IsTakingAI(x) IsCool(x)
Everyone student who is taking AI is cool
3. x IsABunny(x) IsAStudent(x) IsTakingAI(x) IsCute(x) IsCool(x)
Every bunny who is a student taking AI is cute and cool
4. x EatsRamen(x) IsHomeless(x) IsAGradStudent(x)
Everyone who eats ramen is either homeless or a graduate student
5. s h IsAStudent(s) IsTaking(s,AI) HomeworkFor(h,AI) Hates(s,h)
There is at least one student who doesnt hate (any of) the AI homework
6. a (IsACat(a) Rules(a)) (IsADog(a) Drools(a))
Cats rule and dogs drool
7. p time base isACaptain(captain) isABase(base) <(time, Now)
Owns(captain, base, time) Owns(CATS, base, Now)
All the bases that belonged to Captain now belong to CATS
8. =(2,2)
2=2
9. +(2, 2) 4
2+2=4
10.
2+2=4
2 + 2 4
18. Some students took AI1 in Spring 2008 (using Take(person, course, semester))
x Student(x) Takes(x, AI1, Spring2008)
19. Every student who takes AI1 passes it
x,y Student(x) Semester(y) Takes(x, AI1, y) Passes(x, AI1, y)
The y in the above sentence (the semester the course was taken) is used because we defined our predicate to
take a time parameter in question 18. Including it with Passes wasnt necessary but was done the same way for
consistency.
The general rule is, goes with , goes with . The questions in the next section show why.
21.
x Something(x)
???
SomethingElse(x)
The general rule is, goes with , goes with . Questions 24-27 show why.
Convert to English
24. x At(x, Berkeley) isSmart(x)
Everyone at Berkeley is smart.
If youre wondering why i used Berkeley its because this is one of the rare occasions that i used someone elses
example, in this case Russel and Norvig. You can guess what school one of the authors is from.
25.
Contrary to what many people think, this statement does not say that there is a person at Stanford who is smart.
It says that if there is at least one person who, if he is at Stanford, is also smart. And if he isnt, who knows.
While its possible the author meant this, in most cases this is an error. Remember use with , not .
Applying implication elimination, you could also write:
x At(x, Stanford) isSmart(x)
which means there exists at least one person who either doesnt go to Stanford or who is smart (whether hes at
Stanford or not).
If you build a truth table for this statement youll find that it is false when someone attends Stanford and none
of them are smart and is true all other times - if there is someone at Stanford who is smart and if nobody attends
Stanford. Implicative rules are always true if the antecedent the if part is false, with the reasoning that you
cant test the rule and as a result cant violate it.
27.
x,y Loves(x, y)
x y Loves(x, y)
30.
x y Loves(x, y)
This question is asking, is everyone loves Snoopy the same as there is not a single person who doesnt love
Snoopy. These are exactly the same thing.
In general, x P(x) and x P(x) are equivalent. But one is shorter to write.
33.
This question is asking, is there is at least one person who loves American Idol the same as not everybody
hates American Idol (assuming you consider not loves and hate to be the same thing; it sounds better than not
everyone doesnt love American Idol). These are exactly the same thing.
In general, x P(x) and x P(x) are equivalent. But one is shorter to write.
34.
This question is asking, are all predicates P(x,y) the same as P(y,x) (the same statement with arguments
reversed). This is not valid (i.e., always true). For example, reversing the arguments isnt important in
Sibling(Meg, Chris) and Sibling(Meg, Chris) but is it for Parent(Peter, Meg) and
Parent(Meg, Peter).
35.
x,y x=y
x,y x=y
Is every single object the exact same as every other object? Normally, no. If you have only one object in the
world, this would be true but otherwise this is unsatisfiable.
Person(y) Fools(x,y,t))
Person(y) Fools(x,y,t))
Person(y) Fools(x,y,t))