0% found this document useful (0 votes)
23 views124 pages

Merged Presentation Choladeck

Uploaded by

Hussain Khan
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)
23 views124 pages

Merged Presentation Choladeck

Uploaded by

Hussain Khan
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/ 124

Discrete Structure

CS-1203
Syed Ijaz Hussain Bukhari
Discrete Structure
Course Objective
1.Express statements with the precision of formal logic
2.Analyze arguments to test their validity
3.Apply the basic properties and operations related to sets
4.Apply to sets the basic properties and operations related to relations and
function
5.Define terms recursively
6.Prove a formula using mathematical induction
7.Prove statements using direct and indirect methods
8.Compute probability of simple and conditional events
9.Identify and use the formulas of combinatorics in different problems
10.Illustrate the basic definitions of graph theory and properties of graphs
11.Relate each major topic in Discrete Mathematics to an application area in
computing
Discrete Structure
• Recommended Books:
1. Discrete Mathematics and Its Applications
(7th edition) by Kenneth H. Rosen

2. Discrete Mathematics with Applications


(second edition) by Susanna S. Epp
Discrete Structure
MAIN TOPICS

1. Logic
2. Sets & Operations on sets
3. Relations & Their Properties
4. Functions
5. Sequences & Series
6. Recurrence Relations
7. Mathematical Induction
8. Loop Invariants
9. Combinatorics
10. Probability
11. Graphs and Trees
What is Discrete Math?
Discrete Mathematics concerns processes that
consist of a sequence of individual steps.
The Foundations: Logic and Proofs
The rules of logic specify the meaning of mathematical statements. For instance, these rules help us
understand and reason with statements such as “There exists an integer that is not the sum of two
squares” and “For every positive integer n, the sum of the positive integers not exceeding n is
n(n+1)/2.” Logic is the basis of all mathematical reasoning, and of all automated reasoning. It has
practical applications to the design of computing machines, to the specification of systems, to
artificial intelligence, to computer programming, to programming languages, and to other areas of
computer science, as well as to many other fields of study.

To understand mathematics, we must understand what makes up a correct mathematical argument,


that is, a proof. Once we prove a mathematical statement is true, we call it a theorem. A collection
of theorems on a topic organize what we know about this topic. To learn a mathematical topic, a
person needs to actively construct mathematical arguments on this topic, and not just read
exposition. Moreover, knowing the proof of a theorem often makes it possible to modify the result
to fit new situations.
The Foundations: Logic and Proofs
Everyone knows that proofs are important
throughout mathematics, but many people find it
surprising how important proofs are in computer
science. In fact, proofs are used to verify that
computer programs produce the correct output
for all possible input values, to show that
algorithms always produce the correct result, to
establish the security of a system, and to create
artificial intelligence. Furthermore, automated
reasoning systems have been created to allow
computers to construct their own proofs.
Logic and Proposition
What is Logic?
Logic is the study of the principles and
methods that distinguishes between a valid
and an invalid argument.

Propositions
A proposition is a declarative sentence (that
is, a sentence that declares a fact) that is
either true or false, but not both.
Logic and Proposition
SIMPLE STATEMENT:
• A statement is a declarative sentence that is
either true or false but not both.
• A statement is also referred to as a proposition
Example: 2+2 = 4, It is Sunday today
• If a proposition is true, we say that it has a truth
value of "true”.
• If a proposition is false, its truth value is "false".
• The truth values “true” and “false” are,
respectively, denoted by the letters T and F.
Logic and Proposition
• EXAMPLES:
1. Grass is green.
2. 4 + 2 = 6
3. 4 + 2 = 7
4. There are four fingers in a hand.
5. Washington, D.C., is the capital of the United
States of America.
6. Toronto is the capital of Canada.
7. 1+1=2
8. 2+2=3 are propositions
Logic and Proposition
Not Propositions
• Close the door.
• x is greater than 2.
• He is very rich.
are not propositions.
Logic and Proposition
Rule:
• If the sentence is preceded by other sentences that make the
pronoun or variable reference clear, then the sentence is a
statement.
Example:
• x=1
• x>2
• x > 2 is a statement with truth-value FALSE.

Example
• Bill Gates is an American
• He is very rich
• He is very rich is a statement with truth-value TRUE.
Logic and Proposition
• UNDERSTANDING STATEMENTS:
1. x + 2 is positive. Not a statement
2. May I come in? Not a statement
3. Logic is interesting. A statement
4. It is hot today. A statement
5. -1 > 0 A statement
6. x + y = 12 Not a statement
Logic and Proposition
Consider the following sentences.
1. What time is it?
2. Read this carefully.
3. x+1=2.
4. x+y=z.
Sentences 1 and 2 are not propositions because they
are not declarative sentences. Sentences 3 and 4 are
not propositions because they are neither true nor
false. Note that each of sentences 3 and 4 can be
turned into a proposition if we assign values to the
variables.
COMPOUND STATEMENT:
Simple statements could be used to build a
compound statement.
LOGICAL CONNECTIVES
EXAMPLES:
1. “3 + 2 = 5” and “Lahore is a city in Pakistan”
2. “The grass is green” or “ It is hot today”
3. “Discrete Mathematics is not difficult to me”
AND, OR, NOT are called LOGICAL CONNECTIVES.
Logic and Proposition
• SYMBOLIC REPRESENTATION:
• We use letters to denote propositional variables
(or statement variables), that is, variables that
represent propositions, just as letters are used to
denote numerical variables. The conventional
letters used for propositional variables are p, q, r,
s, ... . The truth value of a proposition is true,
denoted by T, if it is a true proposition, and the
truth value of a proposition is false, denoted by F,
if it is a false proposition.
SYMBOLIC REPRESENTATION

CONNECTIVE MEANINGS SYMBOL CALLED

Negation not ~ Tilde

Conjunction and  Hat

Disjunction or  Vel

Conditional if…then…  Arrow

Biconditional if and only if  Double arrow


Logic and Proposition
EXAMPLES:
p = “Islamabad is the capital of Pakistan”
q = “17 is divisible by 3”

p  q = “Islamabad is the capital of Pakistan and 17 is


divisible by 3”
p  q = “Islamabad is the capital of Pakistan or 17 is
divisible by 3”
~p = “It is not the case that Islamabad is the capital of
Pakistan” or simply
“Islamabad is not the capital of Pakistan”
TRANSLATING FROM ENGLISH TO SYMBOLS:
Let p = “It is hot”, and q = “It is sunny”
SENTENCE SYMBOLIC FORM
1. It is not hot. ~p
2. It is hot and sunny. p q
3. It is hot or sunny. pq
4. It is not hot but sunny. ~ p q
5. It is neither hot nor sunny. ~p~q
EXAMPLE:
• Let h = “Zia is healthy”

w = “Zia is wealthy”
s = “Zia is wise”
Translate the compound statements to symbolic form:
1. Zia is healthy and wealthy but not wise. (h  w)  (~s)

2. Zia is not wealthy but he is healthy and wise. ~w  (h  s)

3. Zia is neither healthy, wealthy nor wise. ~h  ~w  ~s


TRANSLATING FROM SYMBOLS TO ENGLISH:
Let m = “Ali is good in Mathematics”
c = “Ali is a Computer Science student”
Translate the following statement forms into plain English:

1. ~ c Ali is not a Computer Science student

2. c  m Ali is a Computer Science student or good in Maths.

3. m  ~c Ali is good in Maths but not a Computer Science student


A convenient method for analyzing a compound statement is to make a truth
table for it.
A truth table specifies the truth value of a compound proposition for all
possible truth values of its constituent propositions.
• NEGATION (~):
• If p is a statement variable, then negation of p,
“not p”, is denoted as “~p”
• It has opposite truth value from p i.e.,
• if p is true, ~p is false; if p is false, ~p is true.
TRUTH TABLE FOR ~ p
P ~P
T F
F T
CONJUNCTION ():
• If p and q are statements, then the conjunction of
p and q is “p and q”, denoted as “p  q”.
• It is true when, and only when, both p and q are
true. If either p or q is false, or
• if both are false, pq is false.
• TRUTH TABLE FOR
p q P^q

• pq T
T
T
F
T
F
F T F
F F F
• DISJUNCTION () or INCLUSIVE OR
If p & q are statements, then the disjunction of
p and q is “p or q”, denoted as “p  q”. It is
true when at least one of p or q is true and is
false only when both p and q are false.
TRUTH TABLE FOR p  q
p q pq
T T T
T F T
F T T
F F F
Applications of Propositional Logic
• Logic has many important applications to mathematics,
computer science, and numerous other disciplines.
Statements in mathematics and the sciences and in
natural language often are imprecise or ambiguous. To
make such statements precise, they can be translated
into the language of logic. For example, logic is used in
the specification of software and hardware, because
these specifications need to be precise before
development begins. Furthermore, propositional logic
and its rules can be used to design computer circuits, to
construct computer programs, to verify the correctness
of programs, and to build expert systems.
Applications of Propositional Logic
• Translating English Sentences
• There are many reasons to translate English sentences into
expressions involving propositional variables and logical
connectives. In particular, English (and every other human
language) is often ambiguous. Translating sentences into compound
statements (and other types of logical expressions, which we will
introduce later in this chapter) removes the ambiguity. Note that
this may involve making a set of reasonable assumptions based on
the intended meaning of the sentence. Moreover, once we have
translated sentences from English into logical expressions we can
analyze these logical expressions to determine their truth values,
we can manipulate them, and we can use rules of inference (which
are discussed in Section 1.6) to reason about them.
• Example
How can this English sentence be translated into a logical expression?
“You can access the Internet from campus only if you are a computer science
major or you are not a freshman.”
Discrete Structure

Lecture 2
Syed Ijaz Hussain Bukhari
Truth Tables
Truth Tables for:
1. ~pq
2. ~ p  (q  ~ r)
3. (pq)  ~ (pq)
Truth table for the statement form ~ p  q
Truth Table
p q ~p ~p ^ q

T T F F

T F F F

F T T T

F F T F
Truth Table
Truth table for ~ p  (q  ~ r)
p q r ~r Q v ~r ~p ~p ^ (q v ~r)

T T T F T F F

T T F T T F F

T F T F F F F

T F F T T F F

F T T F T T T

F T F T T T T

F F T F F T F

F F F T T T T
Truth Table
Truth table for (pq)  ~ (pq)

p q Pvq P^q ~(p ^ q) (p v q) ^ ~(p ^ q)

T T T T F F

T F T F T T

F T T F T T

F F F F T F
Truth Table
Double Negative Property ~(~p)  p

P ~p ~ ( ~p )

T F T

F T F
Truth Table
• Example
• “It is not true that I am not happy”
• Solution:
• Let p = “I am happy”
• then ~ p = “I am not happy”
• and ~(~ p) = “It is not true that I am not happy”
• Since ~ (~p)  p
• Hence the given statement is equivalent to:
• “I am happy”
Truth Table
~ (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
Truth Table
• DE MORGAN’S LAWS:
• 1) The negation of an and statement is logically
equivalent to the or statement in which each
component is negated.
Symbolically ~(p  q)  ~p  ~q.
• 2) The negation of an or statement is logically
equivalent to the and statement in which each
component is negated.
Symbolically: ~(p  q)  ~p  ~q.
Truth Table
~(p  q)  ~p  ~q
p q ~p ~q Pvq ~ (p v 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
Truth Table
• Application:
• Give negations for each of the following
statements:
• a. The fan is slow or it is very hot.
• b. Akram is unfit and Saleem is injured.
• Solution
• a. The fan is not slow and it is not very hot.
• b. Akram is not unfit or Saleem is not injured.
Truth Table
• INEQUALITIES AND DEMORGAN’S LAWS:
Use DeMorgan’s Laws to write the negation of
-1 < x  4
for some particular real no. x
-1 < x  4 means x > –1 and x  4
By DeMorgan’s Law, the negation is:
x > –1 or x  4
Which is equivalent to: x  –1 or x > 4
• EXERCISE:
1. (p  q)  r  p (q  r)
2. Are the statements (pq)r and p(q  r) logically
equivalent?
Truth Table
• TAUTOLOGY:
A tautology is a statement form that is always
true regardless of the truth values of the
statement variables.
• A tautology is represented by the symbol “T”..
EXAMPLE: The statement form p  ~ p is
tautology p ~p p~p

• p  ~p  t T F T
F T T
Truth Table
• CONTRADICTION:
• A contradiction is a statement form that is always
false regardless of the truth values of the
statement variables.
• A contradiction is represented by the symbol “c”.
• So if we have to prove that a given statement
form is CONTRADICTION we will make the truth
table for the statement form and if in the column
of the given statement form all the entries are F,
then we say that statement form is contradiction.
Truth Table
• EXAMPLE:
• The statement form p  ~ p is a contradiction.
p ~p p~p
T F F
F T F

• Since in the last column in the truth table we


have F in all the entries so is a contradiction
p  ~p c
Tautology
• LOGICAL EQUIVALENCE INVOLVING TAUTOLOGY
1. Show that p  t  p
p t pt
T T T
F T F
• Since in the above table the entries in the first
and last columns are identical so we have the
corresponding statement forms are Logically
Equivalent that is
ptp
Contradiction
• LOGICAL EQUIVALENCE INVOLVING CONTRADICTION
• Show that pc  c
p c pc
T F F
F F F

Same truth values in the indicated columns so pc  c


• EXERCISE:
• Use truth table to show that (p  q) (~p (p  ~q)) is a
tautology
EXERCISE:

• Use truth table to show that


(p  q) (~p (p  ~q)) is a tautology

• Use truth table to show that (p  ~q) (~pq)


is a contradiction
Inclusive OR
• USAGE OF “OR” IN ENGLISH
In English language the word or is sometimes
used in an inclusive sense (p or q or both).
• Example: I shall buy a pen or a book.
In the above statement, if you buy a pen or a
book in both cases the statement is true and if
you buy (both) pen and book then statement
is again true. Thus we say in the above
statement we use or in inclusive sense.
Exclusive OR
The word or is sometimes used in an exclusive sense (p or q but not
both). As in the below statement
• Example: Tomorrow at 9, I’ll be in Lahore or Islamabad.
Now in above statement we are using or in exclusive sense because
both the statements are true then we have F for the statement.
While defining a disjunction the word or is used in its inclusive
sense. Thus the symbol  means the “inclusive or”
• EXCLUSIVE OR:
When or is used in its exclusive sense, the statement “p or q”
means “p or q but not both” or “p or q and not p and q” which
translates into symbols as:
(p  q)  ~ (p  q)
Which is abbreviated as:
p  q or p XOR q
TRUTH TABLE FOR EXCLUSIVE OR:

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

T T T T F F

T F T F T T

F T T F T T

F F F F T F
Discrete Structure

Lecture No 3
Syed Ijaz Hussain Bukhari
Logical Equivalences
Name Equivalences
Identity Law pT=p
pvF=p
Domination Law pvT=T
pF=F
Indempotent Law pvp=p
pp=p
Double Negation Law ~(~p) = p
Commutative Law pvq=qvp
pq=qp
Associative Law (p v q) v r = p v (q v r)
(p  q)  r = p  (q  r)
Distributive Law p v (q  r) = (p v q)  ( p v r)
p  (q v r) = (p  q) v (p  r )
Absorption Law p v (p  q ) = p
p  (p v q) = p
APPLYING LAWS OF LOGIC
• Using law of logic, simplify the statement form
p  [~(~p  q)]
• Solution:

p  [~(~p  q)]  p  [~(~p)  (~q)] DeMorgan’s Law


p  [p(~q)] Double Negative Law
 [p  p](~q) Associative Law for 

p  (~q) Indempotent Law


This is the simplified statement form.
• EXAMPLE Using Laws of Logic, verify the logical
equivalence
~ (~ p  q)  (p  q) p

~(~p  q)  (pq)  (~(~p)  ~q) (p  q) DeMorgan’s Law


 (p  ~q)  (p  q) Double Negative Law
 p  (~q  q) Distributive Law
pc Negation Law
p Identity Law
SIMPLIFYING A STATEMENT:

“You will get an A if you are hardworking and the sun shines, or you are hardworking and it rains.”
Rephrase the condition more simply.
Solution:
Let p = “You are hardworking’
q = “The sun shines”
r = “It rains” .

The condition is then (p  q)  (p  r) And using distributive law in reverse,


(p  q)  (p  r)  p  (q  r)
Putting p  (q  r) back into English, we can rephrase the given sentence as
“You will get an A if you are hardworking and the sun shines or it rains.
EXERCISE:
Use Logical Equivalence to rewrite each of the following sentences more
simply.
1. It is not true that I am tired and you are smart.
{I am not tired or you are not smart.}
2. It is not true that I am tired or you are smart.
{I am not tired and you are not smart.}

3. I forgot my pen or my bag and I forgot my pen or my glasses.


I forgot my pen or I forgot my bag and glasses.
4. It is raining and I have forgotten my umbrella, or it is raining and I have
forgotten my hat.
It is raining and I have forgotten my umbrella or my hat.
CONDITIONAL STATEMENTS

Introduction
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."
The original statement is then saying:
if p is true, then q is true, or, more simply, if p, then q.
We can also phrase this as p implies q, and we write
p  q.
CONDITIONAL STATEMENTS OR
IMPLICATIONS
• If p and q are statement variables, the
conditional of q by p is “If p then q” or “p
implies q” and is denoted p  q.
• It is false when p is true and q is false;
otherwise it is true.
• The arrow " " is the conditional operator,
and in p  q the statement p is called the
hypothesis and q is called the conclusion.
TRUTH TABLE

p q pq

T T T

T F F

F T T

F F T
PRACTICE WITH CONDITIONAL
STATEMENTS:
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 = 2, then 2 = 3.” TRUE
5. “If 1 = 1, then 1 = 2 and 2 = 3.” FALSE
6. “If 1 = 3 or 1 = 2 then 3 = 3.” TRUE
• 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”


• EXERCISE:

Write the following statements in the form “if p, then q” in English.


a) Your guarantee is good only if you bought your CD player less than 90 days ago.
If your guarantee is good, then you must have bought your CD player less
than 90 days ago.
b) To get tenure as a professor, it is sufficient to be world-famous.

If you get tenure as a professor then you will be world-famous.


c) That you get the job implies that you have the best credentials.

If you get the job, then you have the best credentials.
d) It is necessary to walk 8 miles to get to the top of the Peak.
If you get to the top of the peak, then you must have walked 8 miles.
TRANSLATING ENGLISH SENTENCES
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.
• SOLUTION pr

• 2. You do every exercise in this book; You get an A
on the final, implies, you get an A in the class.
• SOLUTION pqr

• 3. Getting an A on the final and doing every
exercise in this book is sufficient for getting an A
in this class.
• SOLUTION pqr
TRANSLATING SYMBOLIC
PROPOSITIONS TO 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
If you have flu, then you will miss the final exam.
2.~q  r
If you don’t miss the final exam, you will pass the course.
3.~p  ~q r
If you neither have flu nor miss the final exam, then you will
pass the course.
HIERARCHY OF OPERATIONS
FOR LOGICAL CONNECTIVES
• ~ (negation)
•  (conjunction),  (disjunction)
•  (conditional)
Logical Equivalences
Involving Conditional Statements
Construct a truth table for the statement form
p~q~p
p q ~q ~p p  ~q p~q~p

T T F F T F

T F T F T F

F T F T F T

F F T T T T
Construct a truth table for the statement form
(p q)(~ p  r)
p q r pq ~p ~pr (pq)(~ p r)

T T T T F T T
T T F T F T T
T F T F F T F
T F F F F T F
F T T T T T T
F T F T T F F
F F T T T T T
F F F T T F F
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

Hence the given two expressions are equivalent.


IMPLICATION LAW
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


NEGATION OF A CONDITIONAL
STATEMENT
Since pq  ~pq therefore
~ (p  q)  ~ (~ p  q)
 ~ (~ p)  (~ q) by De Morgan’s law
 p  ~ q by the Double Negative law

Thus the negation of “if p then q” is logically equivalent to “p and not q”.
Accordingly, the negation of an if-then statement does not start with the
word if.
EXAMPLES
Write negations of each of the following conditional statements:
1. If Ali lives in Pakistan then he lives in Lahore.
2. If my car is in the repair shop, then I cannot get to class.
3. If x is prime then x is odd or x is 2.
4. If n is divisible by 6, then n is divisible by 2 and n is divisible by 3.
SOLUTIONS:

1. Ali lives in Pakistan and he does not live in Lahore.


2. My car is in the repair shop and I can get to class.
3. x is prime but x is not odd and x is not 2.
4. n is divisible by 6 but n is not divisible by 2 or by 3.
INVERSE OF A CONDITIONAL
STATEMENT
The inverse of the conditional statement p q
is ~p  ~q
A conditional and its inverse are not equivalent
as could be seen from the truth table.
p q pq ~p ~q ~p ~q

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

different truth values in rows 2 and 3


WRITING INVERSE:
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.
CONVERSE OF A CONDITIONAL
STATEMENT
The converse of the conditional statement p  q
is q p
A conditional and its converse are not equivalent.
i.e.,  is not a commutative operator.

p q pq qp
T T T T
T F F T
F T T F
F F T T
• WRITING CONVERSE:
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 cannot get to the class, then my car is in the repair shop.
CONTRAPOSITIVE OF A CONDITIONAL
STATEMENT:
The contrapositive of the conditional statement p  q is~ q  ~ p

A conditional and its contrapositive are equivalent. Symbolically pq


 ~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.
Discrete Structure
Lecture
By
Syed Ijaz Hussain Bukhari
BICONDITIONAL
• 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. if and only if abbreviated
iff. The double headed arrow " " is the
biconditional operator.
TRUTH TABLE FOR pq.
p q p q
T T T
T F F
F T F
F F T
• EXAMPLES:
True or false?
1. “1+1 = 3 if and only if earth is flat” TRUE
2. “Sky is blue iff 1 = 0” FALSE
3. “Milk is white iff birds lay eggs” TRUE
4. “33 is divisible by 4 if and only if horse has four
legs” FALSE
5. “x > 5 iff x2 > 25” FALSE
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


REPHRASING BICONDITIONAL:
pq is also expressed as:
• “p is necessary and sufficient for q”
• “if p then q, and conversely”
• “p is equivalent to q”
• EXERCISE:
Rephrase the following propositions in the form “p if and only if q” in English.
1. If it is hot outside you buy an ice cream cone, and if you buy an ice cream cone it is
hot outside.
Sol You buy an ice cream cone if and only if it is hot outside.
2. For you to win the contest it is necessary and sufficient that you have the only
winning ticket.
Sol You win the contest if and only if you hold the only winning ticket.
3. If you read the news paper every day, you will be informed and conversely.
Sol You will be informed if and only if you read the news paper every day.
4.It rains if it is a weekend day, and it is a weekend day if it rains.
Sol It rains if and only if it is a weekend day.
5. The train runs late on exactly those days when I take it.
Sol The train runs late if and only if it is a day I take the train.
6. This number is divisible by 6 precisely when it is divisible by both 2 and 3.
Sol This number is divisible by 6 if and only if it is divisible by both 2 and 3.
• TRUTH TABLE FOR (pq)  (~ q ~ p)
p q pq ~q ~p ~ q ~ p (pq)  (~ q ~ p)

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

• TRUTH TABLE FOR(pq)(rq)


p q r pq rq (pq)(rq)

T T T T T T
T T F T F F
T F T F F T
T F F F T F
F T T F T F
F T F F F T
F F T T F F
F F F T T T
TRUTH TABLE FOR
p  ~r qr
Here p  ~ r q  r means (p  (~ r)) (q  r)
p q r ~r p~r qr p  ~r qr

T T T F F T F
T T F T T T T
T F T F F T F
T F F T T F F
F T T F F T F
F T F T F T F
F F T F F T F
F F F T F F T
• LOGICAL EQUIVALENCE INVOLVING
BICONDITIONAL
• 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
EXERCISE:
• 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
• LAWS OF LOGIC:
• 1. Commutative Law: pqqp
• 2. Implication Laws: p q  ~p  q
 ~(p  ~q)
• 3. Exportation Law: (p  q)r  p (q r)
• 4. Equivalence: p  q  (p q)(q p)
• 5. Reduction and absurdum p q  (p  ~q) c
• APPLICATION:
• Rewrite the statement forms without using the symbols  or 

• 1. p~qr 2. (pr)(q r)


SOLUTION
• 1. p~qr  (p~q)r order of operations
• ~(p~q)  r implication law

• 2. (pr)(q r)  (~p  r)(~q  r) implication law


•  [(~p  r) (~q  r)]  [(~q  r) (~p  r)]
• equivalence of biconditional
•  [~(~p  r)  (~q  r)]  [~(~q  r)  (~p  r)]
• implication law
• Rewrite the statement form ~p  q  r  ~q to a
logically equivalent form that uses only ~ and 

SOLUTION
STATEMENT REASON

• ~p  q  r  ~q Given statement form


•  (~p  q)  (r  ~q) Order of operations
•  ~[(~p  q)  ~ (r  ~q)] Implication law pq 
~(p~ q)
•  ~[ (p  ~q)  (~r  q)] De Morgan’s law
• Show that ~(pq)  p is a tautology without using truth tables.
SOLUTION
STATEMENT REASON

• ~(pq)  p Given statement form


•  ~[~(p  ~q)]  p Implication law pq  ~(p  ~q)
• (p  ~q)  p Double negation law
•  ~(p  ~q)  p Implication law pq  ~p  q
• (~p  q)  p De Morgan’s law
• (q  ~p)  p Commutative law of 
•  q  (~p  p) Associative law of 
• qt Negation law
• t Universal bound law
• EXERCISE:
Suppose that p and q are statements so that
pq is false. Find the truth values of each of
the following:
• 1. ~ p  q
• 2. p  q
• 3. q  p
Discrete Structure

Lecture 5
By
Syed Ijaz Hussain Bukhari
Argument
• ARGUMENT:
An argument is a list of statements called premises (or assumptions or
hypotheses) followed by a statement called the conclusion.
P1 Premise
P2 Premise
P3 Premise
. . . . .. . . . .
Pn Premise
______________
C Conclusion

• EXAMPLE
An interesting teacher keeps me awake. I stay awake in Discrete Mathematics
class. Therefore, my Discrete Mathematics teacher is interesting.
Is the above argument valid?
• VALID AND INVALID ARGUMENT:
• An argument is valid if the conclusion is true
when all the premises are true.
• Alternatively, an argument is valid if conjunction
of its premises imply conclusion. That is (P1 P2
 P3  . . .  Pn)  C is a tautology.
• An argument is invalid if the conclusion is false
when all the premises are true.
• Alternatively, an argument is invalid if
conjunction of its premises does not imply
conclusion.
Critical Row
• The critical rows are those rows where the
premises have truth value T. (Also remember
that we say an argument is valid if in all critical
rows and conclusion has truth value T)
• EXAMPLE:
• Show that the following argument form is valid:
pq
p
 q

SOLUTION premises conclusion

p q pq p q
T T T T T Critical Row

T F F T F
F T T F T
F F T F F
EXAMPLE Show that the following argument form is
invalid:
pq
q
 p
Premisis Conclusion

p q pq q p
T T T T T
T F F F T Critical
F T T T F
F F T F F
• EXERCISE:
Use truth table to determine the argument
form
pq
p  ~q
pr
 r
is valid or invalid.
premises conclusion

P q r ~q pq p~q pr r


T T T F T F T T
T T F F T F F F
T F T T T T T T
T F F T T T F F Critical rows

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

The argument form is invalid


WORD PROBLEM
• If Tariq is not on team A, then Hameed is on
team B.
• If Hameed is not on team B, then Tariq is on
team A.
 Tariq is not on team A or Hameed is not on team B.
• SOLUTION
Let
t = Tariq is on team A
h = Hameed is on team B
Then the argument is
h ~t ~h ~t  h ~h  t ~t ~h
~th t
T T F F T T F
~ht T F F T T T T
F T T F T T T
~t~h F F T T F F T
Argument is invalid. Because there are three
critical rows ( Remember that the critical rows
are those rows where the premises have truth
value T) and in the first critical row conclusion
has truth value F. (Also remember that we say
an argument is valid if in all critical rows and
conclusion has truth value T)
EXERCISE
If at least one of these two numbers is divisible
by 6, then the product of these two numbers is
divisible by 6.
Neither of these two numbers is divisible by 6.
 The product of these two numbers is not divisible
by 6.
SOLUTION
Let d = at least one of these two numbers is
divisible by 6.
p = product of these two numbers is divisible
by 6.
Then the argument become in these symbols
dp
~d
 ~p
We will made the truth table for premises and conclusion
as given below

d p dp ~d ~p
T T T F F
T F F F T
F T T T F
F F T T T

The Argument is invalid.


EXERCISE
If I got an Eid bonus, I’ll buy a stereo.
If I sell my motorcycle, I’ll buy a stereo.
 If I get an Eid bonus or I sell my motorcycle, then
I’ll buy a stereo.
SOLUTION:
Let
e = I got an Eid bonus
s = I’ll buy a stereo
m = I sell my motorcycle
The argument is
es
ms
e  m  s
e s m e s m s em em s
T T T T T T T
T T F T T T T
T F T F F T F
T F F F T T F
F T T T T T T
F T F T T F T
F F T T F T F
F F F T T F T

The argument is valid. Because there are five critical rows


• EXERCISE
• An interesting teacher keeps me awake. I stay awake in
Discrete Mathematics class. Therefore, my Discrete
Mathematics teacher is interesting.
• Solution: t: my teacher is interesting a: I stay awake

• m: I am in Discrete Mathematics class the argument to be


tested is
t  a,
am

Therefore mt
t a m ta am mt
T T T T T T
T T F T F F
T F T F F T
T F F F F F
F T T T T F
F T F T F F
F F T T F F
F F F T F F

Argument is not valid


Application of Logic
SWITCHES IN SERIES
SWITCHES IN SERIES

Switches Light Bulb

P Q State

Closed Closed On

Closed Open On

Open Closed On

Open Open Off


SWITCHES IN SERIES

Switches Light Bulb


P Q P Q
P Q State
Closed Closed On T T T

Closed Open Off T F F

Open Closed Off F T F

Open Open Off F F F


SWITCHES IN PARALLEL

Switches Light Bulb P Q PQ


P Q State T T T
Closed Closed On T F T
Closed Open On F T T
Open Closed On F F F
Open Open Off
1.NOT-gate
A NOT-gate (or inverter) is a circuit with one
input and one output signal. If the input signal
is 1, the output signal is 0. Conversely, if the
input signal is 0, then the output signal is 1.
P R Input Output
NOT
P R
1 0
0 1
2.AND-gate
An AND-gate is a circuit with two input signals and
one output signal. If both input signals are 1, the
output signal is 1. Otherwise the output signal is 0.
Symbolic representation & Input/Output Table
Input Output
P Q R
P R 1 1 1
AND 1 0 0
Q 0 1 0
0 0 0
3.OR-gate
An OR-gate is a circuit with two input signals and one
output signal.If both input signals are 0, then the
output signal is 0. Otherwise, the output signal is 1.
Symbolic representation & Input/Output Table
Input Output
P P Q R
R
Q OR 1 1 1
1 0 1
0 1 1
0 0 0
COMBINATIONAL CIRCUIT:
A Combinational Circuit is a compound
circuit consisting of the basic logic gates
such as NOT, AND, OR.
DETERMINING OUTPUT FOR A GIVEN INPUT:
Indicate the output of the circuit below when
the input signals are P = 1, Q = 0 and R = 0
SOLUTION:

Output S = 1
CONSTRUCTING THE INPUT/OUTPUT TABLE FOR A CIRCUIT
Construct the input/output table for the following circuit.
LABELING INTERMEDIATE OUTPUTS:
P Q R X Y S
1 1 1 1 0 1
1 1 0 1 0 0
1 0 1 0 1 1
1 0 0 0 1 1
0 1 1 0 1 1
0 1 0 0 1 1
0 0 1 0 1 1
0 0 0 0 1 1
FINDING A BOOLEAN EXPRESSION FOR A CIRCUIT

P
OR
Q
AND

R OR
• SOLUTION:
Trace through the circuit from left to right, writing
down the output of each logic gate.
P PQ
OR
Q (PQ)  (PR)
PR AND

R OR

Hence (PQ) (PR) is the Boolean expression for this


circuit.
CIRCUIT CORRESPONDING TO A BOOLEAN EXPRESSION

You might also like