Predicate Calculus- Exercises - Computer Science - University of ...
Predicate Calculus- Exercises - Computer Science - University of ...
Predicate Calculus- Exercises - Computer Science - University of ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Predicate</strong> <strong>Calculus</strong>- <strong>Exercises</strong><br />
Lila Kari<br />
The <strong>University</strong> <strong>of</strong> Western Ontario<br />
<strong>Predicate</strong> <strong>Calculus</strong>- <strong>Exercises</strong> CS2209, Applied Logic for <strong>Computer</strong> <strong>Science</strong> 1 / 11
<strong>Exercises</strong><br />
1. Translate the following propositions into formulas <strong>of</strong> L pred (select<br />
suitable symbols). The universe <strong>of</strong> discourse is the set <strong>of</strong> all complex<br />
numbers:<br />
• All rational numbers are real numbers.<br />
• Not all real numbers are rational numbers.<br />
• Some real numbers are not rational numbers.<br />
• Every natural number is either odd or even.<br />
• No natural number is both odd and even.<br />
<strong>Predicate</strong> <strong>Calculus</strong>- <strong>Exercises</strong> CS2209, Applied Logic for <strong>Computer</strong> <strong>Science</strong> 2 / 11
<strong>Exercises</strong> from Lewis Carroll<br />
Lewis Carroll, (really Charles Dodgson writing under a pseudonym),<br />
the author <strong>of</strong> Alice in Wonderland is also author <strong>of</strong> several works in<br />
symbolic logic. The next exercises come from his book Symbolic<br />
Logic.<br />
<strong>Predicate</strong> <strong>Calculus</strong>- <strong>Exercises</strong> CS2209, Applied Logic for <strong>Computer</strong> <strong>Science</strong> 3 / 11
Exercise 1<br />
Consider the following statement. argument.<br />
All lions are fierce.<br />
Some lions do not drink c<strong>of</strong>fee.<br />
Some fierce creatures do not drink c<strong>of</strong>fee.<br />
Express the argument in the language <strong>of</strong> predicate calculus, where<br />
P(x), Q(x) and R(x) are the statements “x is a lion”, “x is fierce”<br />
and “x drinks c<strong>of</strong>fee” respectively. The universe <strong>of</strong> discourse is the<br />
set <strong>of</strong> all creatures.<br />
<strong>Predicate</strong> <strong>Calculus</strong>- <strong>Exercises</strong> CS2209, Applied Logic for <strong>Computer</strong> <strong>Science</strong> 4 / 11
Exercise from Lewis Carroll<br />
Let P(x), Q(x) and R(x) be the statements “x is a pr<strong>of</strong>essor”, “x is<br />
ignorant”, and “x is vain”. Express each <strong>of</strong> the following statements<br />
in L pred where the universe <strong>of</strong> discourse is the set <strong>of</strong> all people.<br />
a) No pr<strong>of</strong>essors are ignorant.<br />
b) All ignorant people are vain.<br />
c) No pr<strong>of</strong>essors are vain.<br />
Does c) follow from a) and b)<br />
<strong>Predicate</strong> <strong>Calculus</strong>- <strong>Exercises</strong> CS2209, Applied Logic for <strong>Computer</strong> <strong>Science</strong> 5 / 11
Exercise from Lewis Caroll<br />
Let P(x), Q(x), R(x) and S(x) be the statements “x is a baby”, “x<br />
is logical”, “x is able to manage crocodiles” and “x is despised”.<br />
Express each <strong>of</strong> the following statements in L pred if the universe <strong>of</strong><br />
discourse is the set <strong>of</strong> all people:<br />
a) Babies are illogical.<br />
b) Nobody is despised who can manage a crocodile.<br />
c) Illogical persons are despised.<br />
d) Babies cannot manage crocodiles.<br />
Does d) follow from a), b) and c)<br />
<strong>Predicate</strong> <strong>Calculus</strong>- <strong>Exercises</strong> CS2209, Applied Logic for <strong>Computer</strong> <strong>Science</strong> 6 / 11
<strong>Exercises</strong><br />
Let P(x) be the statement “x = x 2 ”. If the universe <strong>of</strong> discourse is<br />
the set <strong>of</strong> integers, what are the truth values <strong>of</strong> the following<br />
(a) P(0)<br />
(b) P(1)<br />
(c) P(2).<br />
<strong>Predicate</strong> <strong>Calculus</strong>- <strong>Exercises</strong> CS2209, Applied Logic for <strong>Computer</strong> <strong>Science</strong> 7 / 11
Let Q(x, y) be the statement “x + y = x − y”. If the universe <strong>of</strong><br />
discourse for both variables is the set <strong>of</strong> integers, what are the truth<br />
values <strong>of</strong> the following<br />
a) Q(1, 1) b) Q(2, 0)<br />
c) ∀yQ(1, y) d) ∃xQ(x, 2)<br />
e) ∃x∃yQ(x, y) f ) ∀x∃yQ(x, y)<br />
g) ∃y∀xQ(x, y) h) ∀y∃xQ(x, y)<br />
i) ∀x∀yQ(x, y)<br />
<strong>Predicate</strong> <strong>Calculus</strong>- <strong>Exercises</strong> CS2209, Applied Logic for <strong>Computer</strong> <strong>Science</strong> 8 / 11
<strong>Exercises</strong><br />
Let L(x, y) be the predicate x loves y, where the domain for both x<br />
and y is the set <strong>of</strong> all people in the world. Express the following in<br />
predicate calculus.<br />
a) Everybody loves Jerry.<br />
b) Everybody loves somebody.<br />
c) There is somebody whom everybody loves.<br />
d) Nobody loves everybody.<br />
e) There is somebody whom Lydia does not love.<br />
f) There is somebody whom no one loves.<br />
g) There is exactly one person whom everybody loves.<br />
h) There are exactly two people whom Lynn loves.<br />
i) Everyone loves himself or herself.<br />
j) There is somebody who loves no one besides himself or herself.<br />
<strong>Predicate</strong> <strong>Calculus</strong>- <strong>Exercises</strong> CS2209, Applied Logic for <strong>Computer</strong> <strong>Science</strong> 9 / 11
<strong>Exercises</strong><br />
Express the negation <strong>of</strong> the following propositions using quantifiers.<br />
Also, express these negations in English. The universe <strong>of</strong> discourse is<br />
the set <strong>of</strong> students in this class.<br />
a) Every student in this class likes mathematics.<br />
b) There is a student in this class who has never seen a computer.<br />
c) There is a student in this class who has taken every mathematics<br />
course <strong>of</strong>fered at this school.<br />
d) There is a student in this class who has been in at least one room<br />
<strong>of</strong> every building on campus.<br />
<strong>Predicate</strong> <strong>Calculus</strong>- <strong>Exercises</strong> CS2209, Applied Logic for <strong>Computer</strong> <strong>Science</strong> 10 / 11
<strong>Exercises</strong><br />
Express the following statements in predicate calculus. State the<br />
universe <strong>of</strong> discourse.<br />
a) Every computer science student needs a course in discrete<br />
mathematics.<br />
b) There is a student in this class who owns a personal computer.<br />
c) Every student in this class has taken at least one computer science<br />
course.<br />
d) There is a student in this class who has taken at least one course<br />
in computer science.<br />
e) Every student in this class has been in every building on campus.<br />
f) There is a student in this class who has been in every room <strong>of</strong> at<br />
least one building on campus.<br />
g) Every student in this class has been in at least one room <strong>of</strong> every<br />
building on campus.<br />
<strong>Predicate</strong> <strong>Calculus</strong>- <strong>Exercises</strong> CS2209, Applied Logic for <strong>Computer</strong> <strong>Science</strong> 11 / 11