Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Bayero University, Kano

CSC 4331, First Semester, 2020/2021

CSC 4331 Propositional Logic Excersises

Habeebah Adamu Kakudi (PhD)

Date Submitted

Date Performed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .February 8, 2021

1 EXERCISES ON PROPOSITIONAL LOGIC


Rules for constructing Wffs A predicate name followed by a list of variables such as
P (x, y), where P is a predicate name, and x and y are variables, is called an atomic formula.
Wffs are constructed using the following rules:
1. True and False are wffs.
2. Each propositional constant (i.e. specific proposition), and each propositional variable
(i.e. a variable representing propositions) are wffs.
3. Each atomic formula (i.e. a specific predicate with variables) is a wff.
4. If A, B, and C are wffs, then so are ¬A, (A ∧ B), (A ∨ B), (A =⇒ B), and (A ⇐⇒
B).
5. If x is a variable (representing objects of the universe of discourse), and A is a wff,
then so are ∀xA and ∃xA .
For example,
ˆ ”The capital of Virginia is Richmond.” is a specific proposition. Hence it is a wff by
2.
ˆ Let B be a predicate name representing ”being blue” and let x be a variable. Then
B(x)is an atomic formula meaning ”x is blue”. Thus it is a wff by 3. above. By
applying 5. to B(x), ∀xB(x) is a wff and so is ∃xB(x). Then by applying 4. to them
∀xB(x) ∧ ∃xB(x) is seen to be a wff.

1
ˆ Similarly if R is a predicate name representing ”being round”. Then R(x) is an atomic
formula. Hence it is a wff. By applying 4 to B(x) and R(x), B(x) ∧ R(x) is seen to be
a wff. In this manner, larger and more complex wffs can be constructed following the
rules given above.
ˆ Note, however, that strings that can not be constructed by using those rules are not
wffs. For example, ∀xB(x)R(x), and B(∃x) are NOT wffs, NOR are B(R(x)), and
B(∃xR(x)).
One way to check whether or not an expression is a wff is to try to state it in English.
If you can translate it into a correct English sentence, then it is a wff.
The following examples are a little closer to English. To express the fact that Tom is
taller than John, we can use the atomic formula taller(T om, John), which is a wff. This
wff can also be part of some compound statement such as

taller(T om, John) ∧ ¬taller(John, T om)

, which is also a wff.


If x is a variable representing people in the world, then

taller(x, T om), ∀xtaller(x, T om), ∃xtaller(x, T om), ∃x∀ytaller(x, y)

are all wffs among others.


However,
taller(∃x, John) and taller(T om ∧ M ary, Jim)
, for example, are NOT wffs.

Example 1. Which of the following are well formed propositional formulas?]


1. ∨pq
2. (¬(p → (q ∧ p)))
3. (¬(p → (q = p)))
4. (p ∧ ¬Q) ∨ (q =⇒ r)
5. (p¬r)

Solution Well formed formulas: 2. and 4.

Example 2. Compute the truth table of(F ∨ G) ∧ ¬(F ∧ G).

Solution
F G F ∨G F ∧G ¬(F ∧ G) (F ∨ G) ∧ ¬(F ∧ G)
T T T T F F
T F T F T T
F T T F T T
F F F F T F

2
The formula models an exclusive or!

Example 3. Use the truth tables method to determine whether (p =⇒ q) ∨ (p =⇒ ¬q)


is valid.

Solution
p q p =⇒ q ¬q p =⇒ ¬q (p =⇒ q) ∨ ¬(p =⇒ ¬q)
T T T F F T
T F F T T T
F T T F T T
F F T T T T
The formula is valid since it is satisfied by every interpretation.

Example 4. Compute the truth tables for the following propositional formulas:
1. (p =⇒ p) =⇒ p
2. p =⇒ (p =⇒ p)
3. p ∨ q =⇒ p ∧ q

Example 5. Use the truth table method to verify whether the following formulas are
valid, satisfiable or unsatisfiable:
1. (p =⇒ q) ∧ ¬q =⇒ ¬p
2. (p =⇒ q) =⇒ (p =⇒ ¬q)
3. (p ∨ q =⇒ r) ∨ p ∨ q
4. (p ∨ q) ∧ (p =⇒ r ∧ q) ∧ (q =⇒ ¬r ∧ p)

Example 6. Use the truth table method to verify whether the following logical conse-
quences and equivalences are correct:
1. (p ∧ q) ∨ r ≡ (p =⇒ ¬q) =⇒ r
2. (p ∨ q) ∧ (¬p =⇒ ¬q) ≡ p
3. ((p =⇒ q =⇒ q)) =⇒ q ≡ p =⇒ q

1.1 Propositional Formalization

Example 7. Let’s consider a propositional language where


ˆ p means “Paola is happy”,
ˆ q means “Paola paints a picture”,
ˆ r means “Renzo is happy”.
Formalize the following sentences:

3
1. “if Paola is happy and paints a picture then Renzo isn’t happy”
2. “if Paola is happy, then she paints a picture”
3. “Paola is happy only if she paints a picture”

Solution
1. p ∧ q =⇒ ¬r
2. p =⇒ q
3. ¬(p ∧ ¬q) which is equivalent to p =⇒ q
The precision of formal languages avoid the ambiguities of natural languages.

Example 8. Let’s consider a propositional language where


ˆ p means “x is a prime number”,
ˆ q means “x is odd”.
Formalize the following sentences:
1. “x being prime is a sufficient condition for x being odd”
2. “x being odd is a necessary condition for x being prime”

Solution 1. and 2. p =⇒ q .

Example 9. Let’s consider a propositional language where


ˆ A =“Amaka comes to the party”,
ˆ B =“Binta comes to the party”,
ˆ C =“Chidi comes to the party”,
ˆ D =“Dotun comes to the party”.
Formalize the following sentences:
1. “If Dotun comes to the party then Binta and Chidi come too”
2. “Chidi comes to the party only if Amaka and Binta do not come”
3. “Dotun comes to the party if and only if Chidi comes and Amaka doesn’t come”
4. “If Dotun comes to the party, then, if Chidi doesn’t come then Amaka comes”
5. “Chidi comes to the party provided that Dotun doesn’t come, but, if Dotun comes,
then Binta doesn’t come”
6. “A necessary condition for Amaka coming to the party, is that, if Bruno and Chidi
aren’t coming, Dotun comes”
7. “Amaka, Binta and Chidi come to the party if and only if Dotun doesn’t come, but,
if neither Amaka nor Binta come, then Dotun comes only if Chidi comes”

4
Solution
1. D =⇒ B ∧ C
2. C =⇒ ¬A ∧ ¬B
3. D ↔ (C ∧ ¬A)
4. D =⇒ (¬C =⇒ A)
5. (¬D =⇒ C) ∧ (D =⇒ ¬B)
6. A =⇒ (¬B ∧ ¬C =⇒ D)
7. (A ∧ B ∧ C ↔ ¬D) ∧ (¬A ∧ ¬B =⇒ (D ↔ C))

Example 10. Socrate says:


”If I’m guilty, I must be punished;
I’m guilty. Thus I must be punished.”
Is the argument logically correct?

Solution The argument is logically correct: if p means “I’m guilty” and q means “I must
be punished”, then:
(p =⇒ q) ∧ p |= q (modus ponens)

Example 11. Three boxes are presented to you. One contains gold, the other two are
empty. Each box has imprinted on it a clue as to its contents; the clues are:
ˆ Box 1 “The gold is not here”
ˆ Box 2 “The gold is not here”
ˆ Box 3 “The gold is in Box 2”
Only one message is true; the other two are false. Which box has the gold? Formalize the
puzzle in Propositional Logic and find the solution using a truth table.

solution Let Bi with i ∈ 1, 2, 3 stand for “gold is in the i-th box”. We can formalize the
statements of the problem as follows:
1. One box contains gold, the other two are empty.
(B1 ∧ ¬B2 ∧ ¬B3 ) ∨ (¬B1 ∧ B2 ∧ ¬B3 ) ∨ (¬B1 ∧ ¬B2 ∧ B3 ) (1)

2. Only one message is true; the other two are false.


(¬B1 ∧ ¬¬B2 ∧ ¬B2 ) ∨ (¬¬B1 ∧ ¬B2 ∧ ¬B2 ) ∨ (¬¬B1 ∧ ¬¬B2 ∧ B2 ) (2)

Equation 2 is equivalent to
(B1 ∧ ¬B2 ) ∨ (B1 ∧ B2 ) (3)

Let us compute the truth table for (1) and (3)

5
Solution
B1 B2 B3 (1) (3)
T T T F T
T T F F T
T F T F T
T F F T T
F T T F F
F T F T F
F F T T F
F F F F F
The only assignment I that verifies both (1) and (3 is the one with I(B1 ) = T and
I(B2 ) = I(B3 ) = F , which implies that the gold is in the first box.

2 First Order Logic


Example 1. Non Logical symbols:

constants a,b; functions f ,g ; predicates p ,r ,q .


Say whether the following strings of symbols are well formed FOL formulas or terms:
1. q(a)
2. p(y)
3. p(g(b))
4. ¬r(x, a)

solution Well formed formulas: 2., 4. All other strings are NOT well formed FOL formulas
nor terms.

Example 2. Non Logical symbols:

constants a,b; functions f1 , g2 ; predicates p1 , r2 , q3 .


Say whether the following strings of symbols are well formed FOL formulas or terms:
1. r(a, g(a, a))
2. g(a, g(a, a))
3. ∀x.¬p(x)
4. ∀r(x, a)

You might also like