0% found this document useful (0 votes)
22 views

sol_asmt3bcs303_2024[1]

Uploaded by

rohangrover0610
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

sol_asmt3bcs303_2024[1]

Uploaded by

rohangrover0610
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Solutions : Assignment – 3 1

INDERPRASTHA ENGINEERING COLLEGE


63 Site IV, Sahibabad Industrial Area, Surya Nagar Flyover Road, Ghaziabad

SOLUTIONS (ASSIGNMENT – 3)

Subject Name:Discrete Structures & Theory of Logic Subject Code: BCS-303

NOTE : The solutions given below may prove beneficial for upcoimg examinations.

Q 1 Write the following in symbolic form: (i) the crop will be destroyed if there is a flood; (ii) if it rains, then
I will not go to market; (iii) I am in trouble if the work is not finished on time; and, (iv) the home team wins
whenever it is raining.

Solution. The proposition in (i) can be expressed as p → q, where

p : there is a flood and q : the crop will be destroyed.

The proposition in (ii) can be expressed as p → ¬ q, where

p : it rains and q : I will go to market.

The proposition in (iii) can be expressed as ¬ p → q, where

p : the work is finished on time and q : I am in trouble.

The proposition in (iv) can be expressed as p → q, where

p : it is raining and q : the home team wins.

This completes the solution. †



Q 2 Suppose the proposition p ∨ q is false. Find the truth values of the following: (i) ¬ p ∧ q → q; (ii) ¬q →
p ∧ q; and, (iii) ¬p → q ↔ p → ¬q.

Solution. We know the truth value of p ∨ q is F if and only if both p and q have the truth value F. We thus have
 
¬ p ∧ q → q = ¬ ¬F ∧ F → F = F;

¬q → p ∧ q = ¬ F → F ∧ F = F;
 
¬p → q ↔ p → ¬q = ¬ F → F ↔ F → ¬F = T ↔ T = T.

Notice that in the second and thid equality we have used standard “order of precedence” for logic connectives. †

We apply the following order of precedence to avoid “ambiguity” in evaluation of formulas:

(a) The negation (¬) takes precedence over all other connectives.
(b) The conjunction (∧) takes precedence over the disjunction (∨).
Solutions : Assignment – 3 2

(c) Within parenthesis, one-sided conditional connective → takes precedence over bi-conditional
connective ↔ . In general, both → and ↔ have lower order of precedence over all other
connectives.

Q 3 Define tautology, contradiction, contingency, and satisfiability? Justify that each one of the following state-

ment formulas is a tautology: (i) (p ∨ q) ∧ (¬p ∨ r) → (q ∨ r); and, (ii) (p ∨ q) ∧ ¬(¬p ∧ (¬q ∨ ¬r) ∨ (¬p ∧
¬q) ∨ (¬p ∨ r).

Solution. A proposition is called a tautology if it is universally true. It is denoted by T (or simply T). A
proposition is called a contradiction if it is universally false. It is denoted by F (or simply F). A proposition is
called a contingency if it is neither a tautology nor a contradiction. A proposition is called satisfiable if it is true
for at least for one substitution instance. For (i), we have
     
p ∨ q ∧ ¬p ∨ r → q ∨ r ≡ (p ∨ q) ∧ ¬ p ∨ (p ∨ q) ∧ r → q ∨ r (distributivity)
 
≡ q ∧ ¬ p ∨ (p ∧ r) ∨ (q ∧ r) → q ∨ r (distributivity & identity)
  
≡ ¬ q ∧ ¬ p ∨ (p ∧ r) ∨ (q ∧ r) ∨ (q ∨ r) (implication as disjunction)
 
≡ (¬ q ∨ p) ∧ (¬ p ∨ ¬ r) ∧ (¬ q ∨ ¬ r) ∨ (q ∨ r) (DeMorgan)
 
≡ A ∧ (¬ q ∨ ¬ r) ∨ (q ∨ r) (distributivity)
≡ A∧T (associativity, commutativity, & complementation)
 
≡ (¬ q ∨ p) ∧ (¬ p ∨ ¬ r) ∨ (q ∨ r) (identity)
   
≡ (¬ q ∨ p) ∨ (q ∨ r) ∧ (¬ p ∨ ¬ r) ∨ (q ∨ r) (distributivity)
≡ p∨T ∨r ∧ ¬ p∨q∨T
   
(commutativity & complementation)
≡ T ∧T = T (dominance),
 
where A = (¬ q ∨ p) ∧ (¬ p ∨ ¬ r) ∨ (q ∨ r). For (ii), we have
  
(p ∨ q) ∧ ¬(¬p ∧ (¬q ∨ ¬r) ∨ ¬p ∧ ¬q ∨ ¬p ∨ r
  
≡ (p ∨ q) ∧ (p ∨ (q ∧ r) ∨ ¬ p ∨ q ∨ ¬p ∨ r (DeMorgan)
     
≡ (p ∨ q) ∧ p ∨ (p ∨ q) ∧ (q ∧ r) ∨ ¬ p ∨ q ∨ ¬p ∨ r (distributivity)
 
≡ p ∨ (q ∧ r) ∨ ¬ p ∨ q ∨ ¬p ∨ r (absorption)
≡ T ∨ (q ∧ r) ∨ ¬ p ∨ q

(commutativity & dominance)
≡T (dominance)

This completes the solution. †

Q 4 Write the converse, contrapositive, and inverse of the following: (i) If she has the courage, then she will
win; (ii) if I wake up early in the morning, then I will be healthy; and, (iii) the home team wins whenever it is
raining.

Solution. With p : she has the courage and q : she will win, the statement in (i) can be expressed as p → q.
Solutions : Assignment – 3 3

Therefore, the converse, contrapositive, and inverse are respectively given by

If she wins, then she has the courage (q → p);


If she doesn’t win, then she doesn’t has the courage (¬ q → ¬ p);
If she doesn’t has the courage, then she cannot win (¬ p → ¬ q).

With p : I wake up early in the morning and q : I will be healthy, the statement in (ii) can be expressed as p → q.
Therefore, the converse, contrapositive, and inverse are respectively given by

If I am healthy, then I wake up early in the morning (q → p);


If I am not be healthy, then I haven’t woke up early in the morning (¬ q → ¬ p);
If I don’t wake up early in the morning, then I will not be healthy (¬ p → ¬ q).

With p : it is raining and q : the home team wins, the statement in (iii) can be expressed as p → q. Therefore,
the converse, contrapositive, and inverse are respectively given by

If the home team wins, then it is raining (q → p);


If the home team doesn’t win, then it is not raining (¬ q → ¬ p);
If it is not raining, then the home team cannot win (¬ p → ¬ q).

This completes the solution. †

Q 5 Use truth tables to justify the following equivalences: (i) p → q ≡ ¬p ∨ q ≡ ¬q → ¬ p; and,


   
(ii) p ↔ q ≡ p → q ∧ q → p ≡ p ∨ q ∨ ¬p ∧ ¬q .

Solution. The truth tables for the three statement formulas p → q, ¬p ∨ q, and ¬q → ¬ p in (i) are as given in
Table 1. The third and fifth columns shows that the equivalence p → q ≡ ¬p ∨ q holds, and the fifth and seventh
columns shows that the equivalence ¬p ∨ q ≡ ¬q → ¬p holds. For (ii), we may recall that the truth value of
r ↔ s is T if and only if r and s are both true or both are false. The truth tables for the three statement formulas
   
p ↔ q, p → q ∧ q → p , and p ∨ q ∨ ¬p ∧ ¬q are as given in Table 2. The seventh and tenth columns of
the table proves the first equivalence, and the tenth and eleventh columns proves the second equivalence. †

Table 1: Truth Table for Q. 5(i).

p q p→q ¬p ¬p ∨ q ¬q ¬q → ¬p
T T T F T F T
T F F F F T F
F T T T T F T
F F T T T T T

  
Q 6 Use algebraic laws to justify the following equivalences: (i) p → q ∧ q → r ≡ p ∨ q → r; and,
  
(ii) (p ∧ q ∧ a) → r ∧ a → (p ∨ q ∨ r) ≡ a ∧ (p ↔ q) → r.
Solutions : Assignment – 3 4

Table 2: Truth Table for Q. 5(ii).


 
p q ¬p ¬q p∧q ¬p ∧ ¬q p↔q p→q q→ p (p → q) ∧ (q → p) p ∧ q ∨ ¬p ∧ ¬q
T T F F T F T T T T T
T F F T F F F F T F F
F T T F F F F T F F F
F F T T F T T T T T T

Solution. For (i), we have

   
p → r ∧ q → r ≡ ¬p ∨ r ∧ ¬q ∨ r (implication as disjunction)

≡ ¬p ∧ ¬q ∨ r (distributivity)
≡ ¬(p ∨ q) ∨ r (DeMorgan)

≡ p∨q → r (implication as disjunction)

For (ii), we start by using implication as disjunction so that we have

   
(p ∧ q ∧ a) → r ∧ a → (p ∨ q ∨ r) ≡ ¬(p ∧ q ∧ a) ∨ r ∧ ¬a ∨ (p ∨ q ∨ r)
 
≡ (¬p ∨ ¬q ∨ ¬a) ∨ r) ∧ (¬a ∨ p ∨ q) ∨ r (DeMorgan)
 
≡ (¬p ∨ ¬q ∨ ¬a) ∨ r ∧ (p ∨ q ∨ ¬a) ∨ r) (commutative)

≡ (¬p ∨ ¬q ∨ ¬a) ∧ (p ∨ q ∨ ¬a) ∨ r (distributivity)

≡ ((¬p ∨ ¬q) ∧ (p ∨ q)) ∨ ¬a ∨ r (distributivity)
  
≡ ¬ (p ∧ q) ∨ (¬p ∧ ¬q) ∨ ¬a ∨ r (DeMorgan)
  
≡ ¬ (p ∧ q) ∨ (¬p ∧ ¬q) ∧ a ∨ r (DeMorgan)

≡ ¬ (p ↔ q) ∧ a ∨ r (equivalence in Q. 5(ii))

≡ (p ↔ q) ∧ a → r (implication as disjunction)

This completes the solution. †

Q 7 State and prove the modus ponens, modus tollens, and the disjunctive syllogism.

 
Solution. The modus ponens states that p → q ∧ p ⇒ q; the modus tollens states that (p → q ∧ ¬q ⇒ ¬p;
 
and, the disjunctive syllogism states that p ∨ q ∧ ¬p ⇒ q. We first prove that p → q ∧ p → q is a tautology.
Solutions : Assignment – 3 5

For, we have
 
p → q ∧ p → q ≡ ¬p ∨ q ∧ p → q (implication as disjunction)

≡ (¬p ∧ p) ∨ (q ∧ p) → q (distributivity)
≡ F ∨ (q ∧ p) → q

(complementation)
≡ (q ∧ p) → q (identity law)
≡ ¬(q ∧ p) ∨ q (implication as disjunction)

≡ ¬q ∨ ¬p ∨ q (DeMorgan)

≡ ¬q ∨ q ∨ ¬p (commutativity)
≡ T ∨ ¬p (identity law)
≡T (dominance)

We next prove that (p → q ∧ ¬q → ¬p is a tautology. For, we have
 
p → q ∧ ¬q → ¬p ≡ ¬p ∨ q ∧ ¬q → ¬p (implication as disjunction)

≡ (¬p ∧ ¬q) ∨ (q ∧ ¬q) → ¬p (distributivity)
≡ ¬(p ∨ q) ∨ F → ¬p

(DeMorgan & complementation)
≡ ¬(p ∨ q) → ¬p (identity law)
≡ p ∨ q ∨ ¬p (implication as disjunction)

≡ p ∨ ¬p ∨ q (commutativity)
≡ T ∨q (complementation)
≡T (dominance)

Finally, we prove that p ∨ q ∧ ¬p → q is a tautology. For, we have
 
p ∨ q ∧ ¬p → q ≡ (p ∧ ¬p) ∨ (q ∧ ¬p) → q (distributivity)
≡ F ∨ (q ∧ ¬p) → q

(complementation)
≡ (q ∧ ¬p) → q (identity)
≡ ¬(q ∧ ¬p) ∨ q (implication as disjunction)
≡ (¬q ∨ p) ∨ q (DeMorgan)
≡ (¬q ∨ q) ∨ p (commutativity)
≡T ∨p (complementation)
≡T (dominance)

This completes the solution. †

Q 8 Show that the premises r → ¬q, r ∨ s, s → ¬q, p → q, ¬p are consistent.

Solution. The following is a step-by-step argument to show that the given premises are consistent:

(1) p→q Rule - P


Solutions : Assignment – 3 6

(2) r → ¬q Rule - P
(3) q → ¬r (2), Rule - T (contrapositive)
(4) p → ¬r (1), (3), hypothetical syllogism
(5) s → ¬q Rule - P
(6) q → ¬s (5), Rule - T (contrapositive)
(7) p → ¬s (1),(6), hypothetical syllogism
(8) r → ¬p (4), Rule - T (contrapositive)
(9) s → ¬p (7), Rule - T (contrapositive)
(10) r ∨ s → ¬p (8), (9), Rule - T (equivalence)
(11) r∨s Rule - P
(12) ¬p (10), (11), modus ponens
(9) p ∨ ¬p ≡ T (1), (12)

This completes the solution. †

Q 9 Justify that the following premises are inconsistent: (i) If Nirmala misses many classes due to illness, then
she fails high school; (ii) if Nirmala fails high school, then she would be uneducated; (iii) if Nirmala reads a
lot of books, then she is not uneducated; and, (iv) Nirmala misses many classes due to illness and reads a lot of
books.

Solution. To write the given premises symbolically, we take

p : Nirmala misses many classes due to illness; q : she fails high school;
r : she would be uneducated; s : Nirmala reads a lot of books

Therefore, we need to verify p → q, q → r, s → ¬ q, p ∧ s are inconsistent. For, we have

(1) p→q Rule - P


(2) q→r Rule - P
(3) p→r (1), (2), hypothetical syllogism
(4) s → ¬q Rule - P
(5) q → ¬s (4), Rule - T (contrapositive and involution)
(6) p → ¬s (1), (5), hypothetical syllogism
(7) p∧s Rule - P
(8) p (7), simplification
(9) ¬s (6), (8), modus ponens
(10) s (7), simplification
(9) s∧¬s = F (9), (10), conjunction

This completes the solution. †

Q 10 Use rules of inference to justify that the three hypothesis (i) if it doesn’t rain or it is not foggy, then the
sailing race will be held, and the lifesaving demonstration will go on; (ii) if the sailing race is held, then the
trophy will be awarded; and (iii) the trophy was not awarded, imply the conclusion “it rained”.
Solutions : Assignment – 3 7

Solution. To write the given premises symbolically, we take

p : It rained; q : It is foggy;
r : The sailing race will be held; s : The life saving demonstration will go on;
t : The trophy will be awarded

Therefore, we need to verify (¬ p ∨ ¬ q) → (r ∧ s), r → t, ¬t ⇒ p. For, we have

(1) ¬r → s Rule - P
(2) s→t Rule - P
(3) ¬r → t (1), (2), hypothetical syllogism
(4) r→p Rule - P
(5) ¬p → ¬r (4), Rule - T (contrapositive)
(6) ¬p → t (5), (3), hypothetical syllogism
(7) ¬p ∧ q Rule - P
(8) ¬p (7), simplification
(9) t (6), (8), modus ponens

Therefore, the conclusion “we will be home by sunset” is valid. †

Q 11 Use variables, logical operations, and quantifiers, to express the following as predicates:

(i) Not all birds can fly;

(ii) Everybody likes somebody;

(iii) All integers are either even or odd;

(iv) If a person is female, and is a parent, then this person is someone’s mother;

(v) There is a barber in the town who shaves all men who do not shave themselves.

Solution. The statement in (i) is the negation of the statement “all birds can fly”, which can be expressed as
 
¬ ∀ x Bird(x) → Fly(x) ≡ ∃ x Bird(x) ∧ ¬ Fly(x).

The statement in (ii) can be expressed as ∀ x ∃ y Like(x, y), where universe for x and y is the set of people (may
also include some pets). The statement in (iii) can be expressed as
   
∀ x Int x → Even x ∨ Odd x .

For (iv), the given statement can be expressed as


   
∀ x Female x ∧ Parent x → ∃ y Mother x, y ,

where universe for x is the set of females and y is the set of all humans. For (v), the given statement can be
expressed as
 
∃ y Barber(y) ∧ ∀ ¬ Shaves(x, x) → Shaves(y, x) ,
Solutions : Assignment – 3 8

where universe for x and y is the set of all men in the town. Alternatively, taking y = b (barber), the above
statement may also be expressed as
 
∃ b ∀ x ¬ S(x, x) → S(b, x)

This completes the solution. †

Q 12 Use variables, logical operations, and quantifiers, to express the following as predicates:

(i) For every number there is a number greater than that number;

(ii) Sum of every two integer is an integer;

(iii) Not every man is perfect;

(iv) There is no student in the class who knows both Python and R programming.

Solution. Taking G(x, y) : y > x, the statement in (i) can be expressed as ∀ x ∃ y G(x, y), where universe for x and
y is the set of real numbers R. For (ii), let S(x, y) : x + y is an integer. Then the given statement can be expressed
as ∀ x ∀ y S(x, y), where universe for x and y is the set of integers Z. For (iii), we may take the predicates

M(x) : x is a man P(x) : x is perfect,

so that the statement in (iii) is the negation of the statement “every man is perfect”, which can be expressed as
    
¬ ∀ x M(x) → P(x) ≡ ∃ x M(x) ∧ ¬ P(x) .

Finally, for (iv), let

C(x) : x is a student; P(x) : x knows Python programming; R(x) : x knows R programming

so that the given statement can be expressed as


 
∀ x C(x) → ¬ P(x) ∧ R(x) ,

where universe of x is the set of students in the class. †

You might also like