Practice Questions Logic
Practice Questions Logic
1. Translate each of the following sentences into First Order Logic (FOL).
(k) There is a barber who shaves all men in the town who do not shave themselves
∃x [Barber(x) ∧ ∀y [man(y) ∧ ¬shaves(y, y)] → shaves(x, y)]
1
(l) There is no business like show business
∀x [(business(x) ∧ (x 6= show business)) → ¬like(x, show business)]
2. Rewrite each proposition symbolically, given that the universe of discourse is a set of real numbers
∀x (stud(x) → mathcount(x) = 2)
(b) Someone has visited every country in the world except Libya
∃x [person(x) ∧ ∀y (country(y) ∧ y 6= Libya → visited(x, y))]
Some text books use iff for ’except’. Then,
∃x [person(x) ∧ ∀y (country(y) ∧ y 6= Libya ↔ visited(x, y))]
4. Check the validity: Every computer science student takes discrete mathematics. Neetha is taking
discrete mathematics. Therefore, Neetha is a computer science student.
The given conclusion is false. The following Venn diagram is a counter example for the given conclu-
sion.
5. Check the validity: If it does not rain or it is not foggy then the sailing race will be held and life saving
demonstrations will go on. If the sailing race is held, then the trophy will be awarded. The trophy was
not awarded. Therefore, it rained.
The conclusion is TRUE by the following argument.
2
DM
Comp.
Sci Neetha
6. Prove or Disprove: All doctors are college graduates. Some doctors are not golfers. Hence, some golfers
are not college graduates.
The given conclusion is false. The following Venn diagram is a counter example for the given conclu-
sion.
Graduates
Doctor Golfers
(b) In the array A with 100 integer elements, the first fifty numbers are in increasing order and the
last fifty are in decreasing order.
(∀i(1 ≤ i ≤ 49) → [A[i] ≤ A[i + 1]]) ∧ (∀i(51 ≤ i ≤ 99) → [A[i] ≥ A[i + 1]])
(c) It is not the case that all blueline buses are bad. Some persons who drive blueline buses are not
certified drivers.
¬∀x (Bluelinebus(x)).
3
∃x (Person(x)∧ Drives(x, bluelinebus) ∧¬ Certified(x))
8. The attack will succeed only if the enemy is taken by surprise or the position is weakly defended. The
enemy will not be taken by surprise unless he is overconfident. The enemy will not be overconfident if
the position is weakly defended. Therefore, the attack will not succeed.
premise : A→E∨W
premise : ¬O → ¬E
premise : W → ¬O
Conclusion : ¬A
Using Truth Table, we can check whether the given conclusion follows from the premises.
a b c
A E W ¬A E∨W W ∧E ¬(W ∧ E) A → (E ∨ W ) a∧b c → ¬A
T T T F T T F T F T
T T F F T F T T T F
T F T F T F T T T F
T F F F F F T F F T
F T T T T T F T F T
F T F T T F T T T T
F F T T T F T T T T
F F F T F F T T T T
The last column says that the given argument is contingency. i.e., the given argument is invalid.
Thus, the conclusion does not follow from the premises.
P Q R Q→R (P → Q) (P → R) (P → Q) → (P → R) P → (Q → R)
T T T T T T T T
T T F F T F F F
T F T T F T T T
T F F T F F T T
F T T T T T T T
F T F F T T T T
F F T T T T T T
F F F T T T T T
4
Refer to the truth table. Hence, P → (Q → R) is equivalent to (P → Q) → (P → R).
(P → Q) (P ∨ R) [(P → Q) ∨ (R → S)]
P Q R S P →Q R→S (P ∨ R) (Q ∨ S) ∨ → →
(R → S) (Q ∨ S) [(P ∨ R) → (Q ∨ S)]
T T T T T T T T T T T
T T T F T F T T T T T
T T F T T T T T T T T
T F T T F T T T T T T
T T F F T T T T T T T
T F T F F F T F F F T
T F F T F T T T T T T
T F F F F T T F T F F
F T T T T T T T T T T
F T T F T F T T T T T
F T F T T T F T T T T
F F T T T T T T T T T
F T F F T T F T T T T
F F T F T F T F T F F
F F F T T T F T T T T
F F F F T T F F T T T
∀xP (x) and ∃xP (x) are atomic predicates. Therefore, we can check the validity of the given
proposition using truth table.
From the last two columns we can conclude that given propositions are not equivalent. NOTE:
in the above table, ’NA’ is mentioned in some places which means ’not applicable’. That is, when
∀xP (x) is TRUE, ∃xP (x) cannot be FALSE.
∀x[P → Q(x)]
↔ ∀x[¬P ∨ Q(x)]
5
↔ [¬P ∨ Q(0)] ∧ [¬P ∨ Q(1)] ∧ [¬P ∨ Q(0)] ∧ . . .
↔ [¬P ∨ (Q(0) ∧ Q(1) ∧ Q(2) ∧ . . .)]
↔ [¬P ∨ (∀xQ(x))]
Hence, the given propositions are equivalent.
11. Everyone who gets admitted into an IIT gets a job. Therefore, if there are no jobs, then nobody gets
admitted into any IIT.
12. All horses are animals. Therefore, heads of horses are heads of animals. NOTE: ’head’ refers to the
’leader’ of the group.
¬∀x(Boy(x) → Intelligent(x))
or ∃x(Boy(x) ∧ ¬Intelligent(x))
(c) Some students of DM course has cleared JEE main and the rest cleared SAT.
U OD(x): all persons.
ClearJEE(x): x clears JEE main.
ClearSAT (x): x clears SAT.
(d) Some thing that is white is not always milk, whereas the milk is always white.
U OD(x): things.
W hite(x): x is white.
M ilk(x): x is milk.
(e) Unless you report to the exam cell before 9 am, you will not be permitted to write quizzes. - Also,
write inverse, converse and contrapositive.
Let P : You report to the exam cell before 9am.
6
Q : You will be permitted to write quizzes.
Therefore the statement is ¬P → ¬Q
Converse: ¬Q → ¬P
If you are not permitted to write quizzes, then you have not reported to the exam cell before 9am.
Inverse: P → Q
If you report to the exam cell before 9am, then you will be permitted to write quizzes.
Contrapositive: Q → P
If you are permitted to write quizzes, then you reported to the exam cell before 9am.
(f) Breakfast is served in mess on all days between 7am and 9am except Sunday. And, on Sundays
it is served till 9.15 am.
U OD(x): days.
Day(x): x is a day of the week.
Breakfast-time-non-sunday(x): Breakfast is served in mess on x between 7am and 9am.
Breakfast-time-sunday(x): Breakfast is served in mess on x till 9.15am.
(g) The speed of light is not same in all mediums. The speed of light in fiber is 2×108 m/s. Therefore,
there exists at least two mediums having different speed of light.
U OD(x): mediums.
M edium(x): Light travels in medium x.
Speed(x): Speed of light in medium x.
P : Speed of light in fiber is 2 × 108 m/s.
(h) Some students have joined IIITDM. There exists a student who has not joined any IIITDM. Not
all students have cleared JEE advanced. Therefore, some students have joined deemed universi-
ties.
U OD(x) : people.
U OD(y) : Educational institutes.
Stud(x): x is a student.
IIIT DM (y) : y is a IIITDM.
JoinIIIT DM (x, y) : x joins IIITDM y.
ClearJEE(x) : x cleared JEE advanced.
JoinDeemed(x) : x joins a deemed university.
7
(i) Each student of IIITDM likes either carnatic music or Hindustani music. Further, some students
are athletes, however, they have not represented the institute in inter sports meet. Carnatic music
is a form of meditation. Music club at IIITDM is not that active. Therefore, students of IIITDM
are neither good in sports nor in music.
uod(x) : people
Stud(x) : x is a student.
C(x) : x likes carnatic music.
H(x) : x likes Hindustani music.
Athlete(x) : x is an athlete.
notrep(x) : x has not represented the institute in inter sports meet.
CM : Carnatic music is a form of meditation
M A : Music club at IIITDM is active
S(x) : x is good in sports.
M (x) : x is good in music.
Conclusion:
∀x(Stud(x) → ¬S(x) ∧ ¬M (x)).
(j) In any group of five people, there are not necessarily three mutual friends or three mutual enemies.
NOTE: any two people are either friends or enemies
P eople(x) : x is a person.
M utualF riends(x, y, z) : x, y, z are mutual friends.
M utualEnemies(x, y, z) : x, y, z are mutual enemies.
(k) In a group of 10 people, there are either three mutual friends or four mutual enemies, and there
are either three mutual enemies or four mutual friends.
P eople(x) : x is a person.
M utual3F riends(x, y, z) : x, y, z are mutual friends.
M utual3Enemies(x, y, z) : x, y, z are mutual enemies.
M utual4F riends(w, x, y, z) : w, x, y, z are mutual friends.
M utual4Enemies(w, x, y, z) : w, x, y, z are mutual enemies.
14. Are there statements in English that can not be expressed using FOL. Mention at least one, if it exists.
Less formal example: statements that are not propositions
Did you send me an email? (interrogative), Aha! a beautiful course indeed (Exclamatory), Get me a
soft copy of Disc Math text book (Imperative)
8
Formal and rich example: statements that are propositions but still FOL does not exist
If one attempts FOL for the above statement, then the expression goes like this;
∃S(S ⊂ U OD ∧ ∀x(S(x) ∧ stud(x) → iphone(x))
However, FOL does not allow quantification with respect to subsets, it only allows quantification with
respect to elements in UOD (atomic variables). The above expression comes under the next level logic,
namely, second order logic.
15. Puzzle to assess Logical Reasoning ability: Five persons A, B, C, D, E are in a compartment
in a train. A, C, E are men and B, D are women. The train passes through a tunnel and when it
emerges, it is found that E is murdered. An inquiry is held, A, B, C, D make the following statements.
Each makes two statements.
A says: I am innocent. B was talking to E when the train was passing through the tunnel.
B says: I am innocent. I was not talking to E when the train was passing through the tunnel.
C says: I am innocent. D committed the murder.
D says: I am innocent. One of the men committed the murder.
Out of 8 statements given above, 4 are true and 4 are false. Who is the murderer. Support your
answer with a precise and concise justification. Note: Each person is making exactly two statements.
Solution: Let the statements given by A be A1 , A2 in order. Similarly, let us denote Bi , Ci , Di , i ∈ {1, 2}
for other statements. Since one of A, B, C, D did the murder, three among A1 , B1 , C1 , D1 are true.
Observe that the statements A2 , B2 are inverse to each other. Therefore one of them is true. It follows
that the four true statements are from A1 , B1 , C1 , D1 , A2 , B2 . Hence, we could conclude that C2 , D2
are false. This implies, D did not commit the murder and none of the men committed the murder.
Further, out of the two women B, D; since D has not committed the murder, we conclude that B is
the murderer.
16. Write the definition of ’row-major’ order in FOL. Note that ’two dimensional arrays’ are stored in
either row major order or column major order. The ’row-major’ order refers to
(i) sorting within the row
(ii) the last element of the first row is smaller than the first element of the second row. In general, the
last element of the ith row is smaller than the first element of the (i + 1)th row.
We shall write the above two statements in FOL as follows; assume 20 rows and 30 columns.
{∀i ∀j [1 ≤ i ≤ 20, 1 ≤ j ≤ 29 → A[i][j] ≤ A[i][j + 1]] ∧ [∀i 1 ≤ i ≤ 19 → A[i][30] ≤ A[i + 1][1]]}
17. Express the following in FOL. Use predicate when necessary. Avoid using predicate when simple
proposition would suffice.
(a) If tomorrow is a holiday, then some students of IIITDM will go home and the rest solve DM
assignment.
P → ∃x(student(x) ∧ gohome(x) ∧ ∀y(y 6= x → solvedm(y)))
9
(b) All students who study at IIITDM are resident of some hostel. However, some students are day
scholars. Although, some students are day scholars, some hostel room is alloted by the hostel office.
∀x(residenthostel(x))∧∃x(dayscholars(x))∧ ∃x(dayscholar(x)∧∃y(hostelroom(y)∧allotment(x, y)))
(c) Unless students sleep at 10 pm, they cannot get up early in the morning. There are students who
sleep at 10 pm but still get up late. In each hostel, there is a student who either sleeps at 10 pm
or does not sleep at all.
∀x(¬sleepat10(x) → ¬getup(x)) ∧ ∃x(sleepat10(x) ∧ getup(x)) ∧ ∀x(hostel(x) → ∃y(student(y) ∧
(sleepat10(y) ⊕ ¬sleep(y))))
P Q P →Q ¬P ¬P ∨ Q P →Q↔P ∨Q
T T T F T T
T F F F F T
F T T T T T
F F T T T T
(b) ¬(P ↔ Q) ↔ (P ↔ ¬Q)
P Q P ↔Q ¬P ↔ Q ¬Q P ↔ ¬Q ¬(P ↔ Q) ↔ (P ↔ ¬Q)
T T T F F F T
T F F T T T T
F T F T F T T
F F T F T F T
(c) (P → Q) → R 6↔ (P → (Q → R))
P Q R P →Q (P → Q) → R Q→R P → (Q → R) P→Q
(P) (Q)
T T T T T T T T
T T F T F F F T
T F T F T T T T
T F F F T T T T
F T T T T T T T
F T F T F F T F
F F T T T T T T
F F F T F T T F
(d) ((P → Q) ∧ ¬Q) → (¬P )
P Q P → Q ¬Q (P → Q) ∧ ¬Q ¬P ((P → Q) ∧ ¬Q) → (¬P )
T T T F F F T
T F F T F F T
F T T F F T T
F F T T T T T
19. Identify propositions from the following. If not a proposition, justify, why it is not.
10
Ans: It is not a proposition. The truth value varies depending on the time of the day. During morning,
I shall study is true and sleep is false, together the truth value is true. During evening, I shall
study is false and sleep is also false. Since truth value takes both true and false, it is not a
proposition.
(b) x2 + 5x + 6 = 0 such that x ∈ integers
Ans: The given equation is true for x = −3, −2, and false otherwise. Thus it is not a proposition.
20. Express the following in first order logic (identify the right universe of discourse, predicates before
attempting each question. Think twice and do not oversimplify the problem)
(a) The fundamental law of nature is change.
Ans: The given statement is a simple proposition. P . Note that a proposition is also a predicate. A
predicate without quantification is a proposition. However, one can also write using the following
predicates
UOD(x): {laws of nature}. ∀x(f undamental(x) → change(x))
(b) We cannot help everyone, but everyone can help some one.
Ans: UOD(x,y): {people}
Let help(x, y): x can help y.
We cannot help everyone = There exists a person who helps everyone is false.
We cannot help everyone: ¬∃x ∀y (help(x, y)) ≡ ∀x ∃y ¬ help(x, y)
Everyone can help some one: ∀x ∃y (help(x, y))
∀x ∃y ¬ help(x, y) ∧ ∀x ∃y (help(x, y))
(c) Power does not corrupt people, people corrupt power.
Ans: P: Power does not corrupt people. Q: People corrupt power. P∧Q
Simple proposition would suffice. However, the following predicate also captures the above ex-
pression.
Let corrupt(x, y): x corrupts y.
UOD(x): {people}
∀x (¬ corrupt(power, x) ∧ corrupt(x, power)).
(d) It is nice of somebody to do something.
Ans: UOD(x,y): {people,actions}.
∃x (people(x) ∧ ∃y (thing(y) ∧ Does(x, y) ∧ N ice(x)))
(e) No one who has no complete knowledge of himself will ever have a true understanding of another.
Ans: UOD(x,y): {people}
¬∃x (¬know(x) ∧ ∃y (understand(x, y)))
≡ ∀x (¬know(x) → ¬∃y (understand(x, y)))
≡ ∀x (¬know(x) → ∀y ¬(understand(x, y)))
(f) Thought or thinking is what set human beings apart from other living things.
Ans: UOD(x): set of living beings.
∀x (T hought(x) ∨ T hink(x) → Human(x) ∧ ∀y (¬Human(y) → Distinct(x, y)))
11
(or)
∀x[((1 < x) ∧ ∀y((y|x) → ((y = 1) ∨ (y = x)))) → P rime(x)] ∧ ∀x[((1 < x) ∧ ∃y((y|x) ∧ ((y 6= 1) ∧ (y 6=
x)))) → ¬P rime(x)]
∀x[((1 < x) ∧ ∀y((y|x) → ((y = 1) ∨ (y = x)))) ↔ P rime(x)]
NOTE: any mathematical definition is always written using iff
22. Negate the following: ∀x∃((x > 0 ∧ > 0) ∧ ∀y(y > 0 → x − y ≥ )).
Solution:
∃x∀((x ≤ 0 ∨ ≤ 0) ∨ ∃y(y > 0 ∧ (x − y) < ))
(or)
Solution:
The above implication is false. Counter Example: UOD: N. P (x) : x = 2 and Q(x) : x = 3. The
premise is true and the conclusion is false. Therefore the above statement is false.
24. Prove or Disprove:
12
25. Check the validity of the argument.
Some trigonometric functions are periodic. Some periodic functions are continuous. Therefore, some
trigonometric functions are continuous.
Solution:
The given conclusion is false. The following Venn diagram is a counter example for the given conclusion.
27. Let the universe of discourse be the set of integers. For each of the following assertions, find a predicate
P which makes the implication false.
13
Proof by contradiction: Assume on the contrary that the conclusion is False. i.e., include ¬ Conclusion
as part of premise.
Therefore our assumption is wrong/False and conclusion is True. Therefore ∀x P (x) ∨ ∃x Q(x) follows
from ∀x (P (x) ∨ Q(x)).
(or)
∀xP (x), ∀xQ(x) and ∃xQ(x) are atomic predicates. Therefore, we can check the validity of the above
proposition using truth table.
A B C D E
∀xP (x) ∀xQ(x) ∃xQ(x) ¬A ¬B ¬A ∧ ¬B A∨C D∨E
1 1 1 0 0 0 1 1
1 1 0 (NA) (NA) (NA) (NA) (NA) (NA)
1 0 1 0 1 0 1 1
1 0 0 0 1 0 1 1
0 1 1 1 0 0 1 1
0 1 0 (NA) (NA) (NA) (NA) (NA) (NA)
0 0 1 1 1 1 1 1
0 0 0 1 1 1 0 1
Since, the last column forms a tautology, the given proposition is true.
29. All lions are animals. Therefore, all heads of lions are heads of animals.
We shall present FOL followed by a proof to establish this claim.
L(x) : x is a lion. A(x) : x is an animal H(x, y) : x is a head of y (head means the leader of the group)
14
Given: [∀x(L(x) → A(x))] →
[∀x(L(x) ∧ ∃y(L(y) ∧ H(x, y)) → ∃y(A(y) ∧ H(x, y)))]
To prove, we shall follow a proof by contradiction. We shall include the negation of the conclusion for
arguments. Since with just premise, deriving the conclusion is not possible, we have chosen this proof
technique.
Consider ∀x(L(x) → A(x)) ∧ ¬[∀x(L(x) ∧ ∃y(L(y) ∧ H(x, y)) → ∃y(A(y) ∧ H(x, y)))]
We need to show that the above expression is unsatisfiable (False).
Apply distribution
This shows that our assumption that the conclusion is false is wrong. Therefore, the conclusion follows
from the premise.
15