0% found this document useful (0 votes)
17 views57 pages

Lecture # 03 - New

The document summarizes key points from three lectures on discrete structures taught by instructor Khurram Iqbal at COMSATS University in Islamabad, Pakistan. The first lecture covers compound statements formed using logical connectives like NOT, AND, OR. The second lecture defines conditional statements and discusses determining the truth value of implications using truth tables. The third lecture covers alternative ways to express conditional statements, and the inverse, converse, and contrapositive of conditional statements. Logical equivalence and tautologies are also introduced.

Uploaded by

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

Lecture # 03 - New

The document summarizes key points from three lectures on discrete structures taught by instructor Khurram Iqbal at COMSATS University in Islamabad, Pakistan. The first lecture covers compound statements formed using logical connectives like NOT, AND, OR. The second lecture defines conditional statements and discusses determining the truth value of implications using truth tables. The third lecture covers alternative ways to express conditional statements, and the inverse, converse, and contrapositive of conditional statements. Logical equivalence and tautologies are also introduced.

Uploaded by

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

CSC102:Discrete Structure

Instructor Khurram Iqbal

Department of Computer Science


COMSATS University, Islamabad
Recap

Lecture No 2

Department of Computer Science 2


Compound Statement

 A statement that is formed using logical


connectives is called compound statement.
 Examples:
1. “Discrete Mathematics is not difficult to me”

2. “3 + 2 = 5” and “Lahore is a city in Pakistan”

3. “The grass is green” or “ It is hot today”

 NOT, AND, OR are called LOGICAL CONNECTIVES.

Department of Computer Science 3


Logical connectives

CONNECTIVE MEANINGS SYMBOL CALLED

Negation NOT ~ Tilde

Conjunction AND  Hat

Disjunction OR  Vel

Exclusive OR XOR  pq


(p q)  ~(p  q)

Department of Computer Science 4


Compound Statement

 The truth value of a compound statement is


determined by using Truth Table. (p q)  ~(p  q)

Department of Computer Science 5


Lecture No 3

Department of Computer Science 6


Today Covered
1. Conditional Statement
• Alternative ways for expressing
conditional statement
2. Inverse, converse, and contrapositive of
conditional statement
3. What is LOGICAL EQUIVALENCE and how
to prove it using Truth Table?
4. What is TAUTOLOGY?
5. What is CONTRADICTION?
Department of Computer Science 7
Conditional Statement /Implication

 Consider the statement:


 "If you earn an A in Math, then I'll buy you a computer."

 This statement is made up of two simpler


statements:
 p: "You earn an A in Math," and
 q: "I will buy you a computer."
 If p and q are statement variables, the
conditional of q by p is
 “If p then q” or “p implies q”
 It is denoted as p  q

Department of Computer Science 8


Conditional Statement /Implication

 pq
 The statement p is called the hypothesis (or
antecedent)
 The arrow " " is the conditional operator
 The statement q is called the conclusion (or
consequent).

Department of Computer Science 9


Alternative ways of p  q

ALTERNATIVE WAYS OF EXPRESSING IMPLICATIONS


The implication p  q could be expressed in many alternative ways as:

 “if p then q”  “not p unless q”


 “p implies q”  “q follows from p”
 “if p, q”  “q if p”
 “p only if q”  “q whenever p”
 “p is sufficient for q”  “q is necessary for p”
 a sufficient condition  a s necessary
for q is p condition for p is q

Department of Computer Science 10


Alternative ways of p  q

"If you earn an A in Math, then I'll buy you a computer."


 “if p then q”
 "If you earn an A in Math, then I'll buy you a computer."
 “p implies q”
 “Earning an A in Math implies buying you a
computer."
 “if p, q”
 “If you earn an A in Math, I'll buy you a computer."
 “p only if q”
 “Getting an A in Math only if I’ll buy you a computer”

Department of Computer Science 11


Alternative ways of p  q

"If you earn an A in Math, then I'll buy you a computer."


 “p is sufficient for q”
 Getting an A in Math is sufficient for buying you a
computer
 “a sufficient condition for q is p”
 A sufficient condition for buying you a computer is to
earn an A in Math

Department of Computer Science 12


Alternative ways of p  q

"If you earn an A in Math, then I'll buy you a computer."


 “not p unless q”
 You did not earn an A in Math unless I'll buy you a
computer
 “q follows from p”
 Buying a computer follows from earning an A in Math
 “q if p”
 I'll buy you a computer if you earn an A in Math
 “q whenever p”
 I'll buy you a computer whenever you earn an A in
Math

Department of Computer Science 13


Alternative ways of p  q

"If you earn an A in Math, then I'll buy you a computer."


 “q is necessary for p”
 Buying a computer is necessary for earning an A in
Math
 “a necessary condition for p is q”
 A necessary condition for earning an A in Math is to
buy a computer

Department of Computer Science 14


How to determine truth value of implication

 Consider the statement:


 "If you earn an A in Math, then I'll buy you
a computer."
 Under what circumstances are you justified in
saying that I spoke falsely?
 That is, under what circumstances is the above
sentence false?

Department of Computer Science 15


How to determine truth value of implication

 The hypothesis is the statement:


 “you earn an A in Math”
 and the conclusion is the statement
 “I'll buy you a computer."
 Thinking of this as a promise
 What is the truth value of given statement?
 First, suppose that the you earn an A in Math
 i.e. p is TRUE
 Now if I fulfill my promise(i.e. q is TRUE),
surely given statement is true.
Department of Computer Science 16
How to determine truth value of implication

 if p and q are both true, then p → q is true

p q pq

T T T

 On the other hand, if you earn an A in Math and


I do not buy you a computer, I broke my
promise
 i.e. given statement is false

Department of Computer Science 17


How to determine truth value of implication

 the only way that promise can be broken is if


you do earn an A and I do not buy you a
computer.
 That is if you earn an A in Math and I do not buy you a
computer, surely given statement is false.
 If p is true and q is false, then p → q is false.

p q pq

T F F

Department of Computer Science 18


How to determine truth value of implication

 Now, suppose that you do not earn an A.


 i.e. p is FALSE
 In this case, I may or may not buy you a
computer.
 Surely we would not consider that the given
statement to be false.
 Case 1: If p is false and q is true, then p → q is
True
p q pq
F T T
Department of Computer Science 19
How to determine truth value of implication

 Case 2:If p is false and q is false, then p → q is True.

p q pq
F F T

Department of Computer Science 20


How to determine truth value of implication

 In general, we use this idea to define the


statement p  q.  

 It is false when p is true and q is false;


otherwise it is true.
p q pq
T T T
T F F
F T T
F F T

Department of Computer Science 21


Practice with conditional statement

Determine the truth value of each of the following


conditional statements:
1.“If 1 = 1, then 3 = 3.” TRUE
2.“If 1 = 1, then 2 = 3.” FALSE

3.“If 1 = 0, then 3 = 3.” TRUE

4.“If 1 = 0, then 2 = 3.” TRUE

5. “If 1 = 1 and 1 = 2, then 2 = 3.” TRUE

6. “If 1 = 3 or 1 = 2 then 3 = 3.” TRUE

Department of Computer Science 22


Inverse, converse and contrapositive of implication

 The inverse of the conditional statement:


 p  q is ~p  ~q
 The converse of the conditional statement:
 p  q is q  p
 The contrapositive of the conditional statement:
 ~q  ~p

Department of Computer Science 23


Writing inverse
p  q is ~p  ~q

1. If today is Friday, then 2 + 3 = 5.


If today is not Friday, then 2 + 3  5.
2. If it snows today, I will ski tomorrow.
If it does not snow today I will not ski tomorrow.
3. If P is a square, then P is a rectangle.
If P is not a square then P is not a rectangle.
4. If my car is in the repair shop, then I cannot get to class.
If my car is not in the repair shop, then I shall get to the class.

Department of Computer Science 24


Writing converse
p  q is q  p

1. If today is Friday, then 2 + 3 = 5.


If 2 + 3 = 5, then today is Friday.
2. If it snows today, I will ski tomorrow.
I will ski tomorrow only if it snows today.
3. If P is a square, then P is a rectangle.
If P is a rectangle then P is a square.
4. If my car is in the repair shop, then I cannot get to class.
If I can’t get to the class, then my car is in the repair shop.

Department of Computer Science 25


Writing contrapositive
p  q is ~q  ~p
1. If today is Friday, then 2 + 3 = 5.
If 2 + 3  5, then today is not Friday.
2. If it snows today, I will ski tomorrow.
I will not ski tomorrow only if it does not snow today.
3. If P is a square, then P is a rectangle.
If P is not a rectangle then P is not a square.
4. If my car is in the repair shop, then I cannot get to class.
If I get to the class, then my car is not in the repair shop.

Department of Computer Science 26


Application of Propositional
Logic
Translating English Sentences

Department of Computer Science


Translating English sentence to Symbols

Let p and q be propositions:


p = “you get an A on the final exam”
q = “you do every exercise in this book”
r = “you get an A in this class”
Write the following propositions using p, q, and r and logical
connectives.
1. To get an A in this class it is necessary for you to get an A on the
final.
2. You do every exercise in this book; You get an A on the final,
implies, you get an A in the class.
3. Getting an A on the final and doing every exercise in this book is
sufficient
Department of Computer getting an A in this class.
forScience 28
Solutions

1. To get an A in this class it is necessary for you to get an A in the


final.
SOLUTION rp

2. You do every exercise in this book; You get an A in the final,


implies, you get an A in the class.
SOLUTION pqr

3. Getting an A in the final and doing every exercise in this book is


sufficient for getting an A in this class.
SOLUTION pqr
Department of Computer Science 29
Translating Symbolic Proposition into English

Let p, q, and r be the propositions:


p = “you have the flu”
q = “you miss the final exam”
r = “you pass the course”
Express the following propositions as an English sentence.
1. p  q
2. ~q  r
3. ~p  ~q r

Department of Computer Science 30


Solution

1. p  q
If you have flu, then you will miss the final examination.
2. ~q  r
If you don’t miss the final examination, you will pass the
course.
3. ~p  ~q r
If you neither have flu nor miss the final examination, then
you will pass the course.

Department of Computer Science 31


Exercise

Construct truth table for (pq)(qp)

p q pq qp (pq)(qp)


T T T T T
T F F T F
F T T F F
F F T T T

Department of Computer Science 32


Bi-conditional Statement

 From previous exercise, we see that pq is not


the same as q p.
 It may happen, however, that both
p q and q p are true.
 For example, if p= “1+1= 2" and q=“2+2 = 4," then
p q and q p are both true because p and q are
both true.
 Similarly, if p= “1+1= 3" and q=“2+2 = 5,"
then p q and q p are both true because

p and q are both false.


Department of Computer Science 33
Bi-conditional Statement

 If p and q are statement variables, the


biconditional of p and q is “p if, and only if, q”
and is denoted pq.
 It is true if both p and q have the same truth
values and false if p and q have opposite truth
values.
 The words if and only if are sometimes
abbreviated iff.
 The double headed arrow " " is the
biconditional operator.
Department of Computer Science 34
Truth Table of Bi-conditional Statement

p q p q

T T T

T F F

F T F

F F T

Department of Computer Science 35


Logical Equivalence

 Two statement forms are called logically


equivalent if, and only if, they have identical
truth values for all possible truth values for their
statement variables.
 The logical equivalence of statement forms P
and Q is denoted by writing P  Q.

Department of Computer Science 36


Example-1

Double Negative Property ~(~p)  p

p ~p ~(~p)

T F T

F T F

Same Truth Values


Department of Computer Science 37
Example-2

~(pq) and ~p  ~q are not logically equivalent

p q ~p ~q pq ~(pq) ~p  ~q
T T F F T F F
T F F T F T F
F T T F F T F
F F T T F T T

Different truth values in row 2 and row 3


Department of Computer Science 38
Your Turn
Are the statements (p  q)  r and (p  q)  r logically equivalent?

p q r pq q  r (p  q)  r p (q  r)
T T T T T T T
T T F T F F F
T F T F F F F
T F F F F F F
F T T F T F F
F T F F F F F
F F T F F F F
F F F F F F F

Same truth values

Department of Computer Science 39


Logical Equivalence involving implication

Use truth table to show pq  ~q  ~p

p q ~q ~p pq ~q  ~p
T T F F T T
T F T F F F
F T F T T T
F F T T T T

same truth values


Department of Computer Science 40
Logical Equivalence involving implication

Use truth table to show pq  ~pq

p q pq ~p ~pq
T T T F T
T F F F F
F T T T T
F F T T T

same truth values


Result: pq  ~pq Implications Law
Department of Computer Science 41
Logical Equivalence involving Bi-conditional

pq  (pq)(qp)

p q pq pq qp (pq)(qp)


T T T T T T
T F F F T F
F T F T F F
F F T T T T

same truth values

Department of Computer Science 42


Logical Equivalence involving Bi-conditional

Show that ~pq and p~q are logically equivalent

p q ~p ~q ~pq p~q
T T F F F F
T F F T T T
F T T F T T
F F T T F F

same truth values

Department of Computer Science 43


Your Turn

Show that ~(pq) and pq are logically equivalent

p q pq ~(pq) pq


T T F T T
T F T F F
F T T F F
F F F T T

same truth values

Department of Computer Science 44


Negation of AND, OR, and
implication

Department of Computer Science


Negation of AND, OR and Implication

 The negation of compound statement involving AND


 ~(p  q)  ~p  ~q.
 The negation of compound statement involving OR

~(p  q)  ~p  ~q.
 The negation of the conditional statement:
 ~ (p  q)  p  ~ q

Department of Computer Science 46


Negation of AND

~(p  q)  ~p  ~q

p q ~p ~q pq ~(p  q) ~p  ~q
T T F F T F F
T F F T F T F
F T T F F T F
F F T T F T T

Same truth values


Result: ~(p  q)  ~p  ~q De- Morgan’s Law
Department of Computer Science 47
Negation of OR

~(p  q)  ~p  ~q

p q ~p ~q pq ~(p  q) ~p  ~q
T T F F T F F
T F F T T F F
F T T F T F F
F F T T F T T

Same truth values


Result: ~(p  q)  ~p  ~q De- Morgan’s Law
Department of Computer Science 48
Negation of implication

~ (p  q)  p  ~ q

p q pq ~(pq) ~q p ~q


T T T F F F
T F F T T T
F T T F F F
F F T F T F

same truth values

Department of Computer Science 49


Exercise

 How do the converse, contrapositive, and inverse relate


to p →q?
 converse  contrapositive ?
 converse  inverse ?
 contrapositive  inverse ?
 Is p →q logically equivalent to ∼q →∼p?
 Is p →q logically equivalent to ∼p ∨ q?

Department of Computer Science 50


Answer

p q pq ~p ~q~p
T T T F T
T F F F F
F T T T T
F F T T T

same truth values

Department of Computer Science 51


Answer

p q pq ~p ~pq
T T T F T
T F F F F
F T T T T
F F T T T

same truth values


Department of Computer Science 52
Exercise -1

Construct the truth table of (p  q) (~p (p  ~q))

p q p  q ~ p ~ q p  ~ q ~ p (p  ~q) (p  q) 
(~p  (p  ~q))
T T T F F F F T

T F F F T T T T

F T F T F F T T

F F F T T F T T

Department of Computer Science 53


Tautology

A statement form that is always true regardless of the truth values of


the statement variables is called tautology .
A tautology is represented by the symbol “t”.
EXAMPLE: The statement form (p  q) (~p (p  ~q))
is tautology.

(p  q) (~p (p  ~q)) t

Department of Computer Science 54


Exercise -2

Construct the truth table of (p  ~q) (~pq)

p q ~q p~q ~p ~pq (p  ~q) (~pq)


T T F F F T F
T F T T F F F
F T F F T T F
F F T F T T F

Department of Computer Science 55


Contradiction

A statement form that is always false regardless of the truth values of


the statement variables is called contradiction.
A contradiction is represented by the symbol “c”.
EXAMPLE:The statement form (p  ~q) (~pq) is a contradiction.

(p  ~q) (~pq)c

Department of Computer Science 56


Conclusion

Implication: pq
Inverse: ~p  ~q
Converse: qp
Contrapositive: ~q  ~p
NOTE
1. An implication is logically equivalent to it’s contrapositive.
2. The converse and inverse of an implication are logically
equivalent.
3. An implication is not equivalent to it’s converse.

Department of Computer Science 57

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy