Lecture Week1
Lecture Week1
DISCRETE MATHEMATICS
Week 1
Introduction
Logic
09/17/2023 2
Logic
Crucial for mathematical reasoning
Important for program design
Used for designing electronic circuitry
Logic is a system based on propositions.
A proposition is a (declarative) statement that
is either true or false (not both).
We say that the truth value of a proposition is
either true (T) or false (F).
Corresponds to 1 and 0 in digital circuits
09/17/2023 3
The Statement/Proposition Game
“Elephants are bigger than mice.”
09/17/2023 4
The Statement/Proposition Game
“520 < 111”
09/17/2023 5
The Statement/Proposition Game
“y > 5”
09/17/2023 6
The Statement/Proposition Game
“Today is January 27 and 99 < 5.”
09/17/2023 7
The Statement/Proposition Game
“Please do not fall asleep.”
Is this a statement? no
It’s a request.
Is this a proposition? no
09/17/2023 8
The Statement/Proposition Game
“If the moon is made of cheese,
then I will be rich.”
09/17/2023 9
The Statement/Proposition Game
“x < y if and only if y > x.”
Is this a statement? yes
Is this a proposition? yes
… because its truth value
does not depend on
specific values of x and y.
What is the truth value
of the proposition? true
09/17/2023 10
Combining Propositions
Disjunction (OR, )
Exclusive-or (XOR, )
09/17/2023 12
Negation (NOT)
P P
true (T) false (F)
false (F) true (T)
09/17/2023 13
Conjunction (AND)
Binary Operator, Symbol:
P Q P Q
T T T
T F F
F T F
F F F
09/17/2023 14
Disjunction (OR)
Binary Operator, Symbol:
P Q P Q
T T T
T F T
F T T
F F F
09/17/2023 15
Exclusive Or (XOR)
Binary Operator, Symbol:
P Q P Q
T T F
T F T
F T T
F F F
09/17/2023 16
Implication (if - then)
Binary Operator, Symbol:
P Q P Q
T T T
T F F
F T T
F F T
09/17/2023 17
Biconditional (if and only if)
Binary Operator, Symbol:
P Q P Q
T T T
T F F
F T F
F F T
09/17/2023 18
Statements and Operators
Statements and operators can be combined in any
way to form new statements.
(P)(
P Q P Q
Q)
T T F F F
T F F T T
F T T F T
F F T T T
09/17/2023 19
Statements and Operations
Statements and operators can be combined in any
way to form new statements.
(P)(
P Q PQ
(PQ) Q)
T T T F F
T F F T T
F T F T T
F F F T T
09/17/2023 20
Equivalent Statements
(P)(Q (PQ) ( P)(
P Q
(PQ) ) Q)
T T F F T
T F T T T
F T T T T
F F T T T
The statements (PQ) and ( P) ( Q) are logically equivalent, since they have the
same truth table, or put it in another way, (PQ) ( P) ( Q) is always true.
09/17/2023 21
Example
Ellen reached an island where knight and knaves reside. A
knight always speaks the truth. A knave always speaks lie.
Ellen meet A and B in two roads intersection. She asked the
way to go to the capital
A says to her: “The capital is in mountains, or the road on
the right goes to the capital”
B says to her: The capital is in mountains, and the road on
the right goes to the capital”
A shouted,” The person is liar”
B then added, “If the capital is in the mountains, the road to
the right goes to the capital”
Ellen computed and took the left road. Did she reached the
capital?
09/17/2023 22
Example (contd.)
c : the capital is in the mountains
r : the road on the right goes to the capital
A: c.or. B:
c r B:c->r
r c .and.r
F F F F T
F T T F T
T F T F F
T T T T T
09/17/2023 23
Computation
Truth Tables for Ellen’s Computation
A is a Knight and telling the truth
A: c.or. B:
c r B:c->r
r c .and.r
F F F F T
F T T F T
T F T F F
T T T T T
09/17/2023 24
Example 2
Ellen met 3 people C, D, E on the way. A knight always speaks the
truth. A knave always speaks lie. She asked, whether the road went
to the capital and where
Ellen meet A and B in two roads intersection. She asked the way to
go to the capital and whether the location is bus stop.
C says to her: “The road goes to the capital and the bus stop is not
here”
D says to her: “The road does not go to the capital and the bus stop is
here”
E says to her: “The road does not go to the capital and the bus stop is
not here”
Ellen asked whether they are knights or knaves, three gave same
answers, “2 of us are knights, 1 is knave”
Does the road go to the capital? How many were knights? Was the
location near bus stop?
09/17/2023 25
Example (contd.)
g : the road goes to the capital
b : the bus stop is here
D:~g.and. E:~g.and
g b C: g.and. ~r
b . ~r
F F F F F
F T F F F
T F T T F
T T F F T
09/17/2023 CSE 103 - Discrete Mathematics 26
Example (contd.)
g : the road goes to the capital
b : the bus stop is here
D:~g.and. E:~g.and
g b C: g.and. ~r
b . ~r
F F F F T
F T F T F
T F T F F
T T F F F
09/17/2023 27
Tautologies and Contradictions
A tautology is a statement that is always true.
Examples:
R (R)
(PQ) (P)( Q)
A contradiction is a statement that is always false.
Examples:
R(R)
( (P Q) ( P) ( Q))
The negation of any tautology is a contradiction, and
the negation of any contradiction is a tautology.
09/17/2023 29
Logical Equivalence
Equivalence laws
Identitylaws, P T P, P F P,
Domination laws, P F F, P T T,
Idempotent laws, P P P, P P P,
Double negation law, ( P) P
Commutative laws, P Q Q P, same for
Associative laws, P (Q R) (P Q) R, same for
Distributive laws, P (Q R) (P Q) (P R),
09/17/2023 30
Summary So Far
Proposition
Truth value
Truth table
Definition
Proving equivalence (by truth table or equivalence
laws)