CS101 - Chapter2 Dicrete Math
CS101 - Chapter2 Dicrete Math
study of reasoning
specifically concerned with whether reasoning is
correct
focuses on the relationship among statements
as opposed to the content of any particular
statement.
example:
All mathematicians wear sandals.
Anyone who wears sandals is an algebraist.
Therefore, all mathematicians are algebraists.
Atomic Propositions
propositions in which each one is an atomic
entity
truth or falsity is independent of any other
propositions.
Representation of proposition
we will use lowercase letters, such as p, q, and
r, so that the notation
p: 1 + 1 = 3
defines p to be the proposition 1 + 1 = 3.
Propositional Logic
there are two possible truth values that can be
associated with atomic propositions
every proposition may be associated with only
one of the truth values of true and false, at any
given time
sometimes determining the truth or falsity of a
given proposition may not be possible but we
know it must be true or false
a proposition can never be both true and false at
the same time although the truth value of a
given proposition may change according to
when it is stated.
Examples of Propositions
p: 1 + 1 = 2
q: Today is Tuesday.
r: Jack likes Jill.
s: Cedric is happy.
Three-valued Logic
a proposition may have a third truth value of
undefined
it is quite difficult to attach a truth value to some
propositions, thus, the undefined truth value for
propositions in this field is accepted
p ~p
T F
F T
Conjunction
Definition. Let p and q be propositions.
The conjunction of p and q, denoted p q,
is the proposition
p and q.
Remark: The proposition p q can also
be read as “p conjoined with q”.
Example:
Given: p: 0 < 1
q: 1 < 2
p q: (0 < 1) (1 < 2).
Truth Table for Conjunction
p q pq
T T T
T F F
F T F
F F F
p q ~q p ~ q
T T F F
T F T T
F T F F
F F T F
Disjunction
Definition. The disjunction of p and q, denoted p
q, is the proposition
p or q
T T T
T F T
F T T
F F F
p: A decade is 10 years
q: A year is always 365 days
p q: A decade is 10 years or a year is always
365 days
p: 23 = 6
q: 4 x 8 = 48
p q: 23 = 6 or 4 x 8 = 48
FF
Symbolic representation: Truth value:
(p (~q)) r ( p q ) r (T T ) F
(T F ) F
FF
F
Properties of Disjunction
For any propositions p, q and r,
p (q r) (p q) (p r)
(p q) r (p r) (q r)
Truth table for p (q r)
p q r q r p (q r) pq pr (p q)
(p r)
T T T T T T T T
T T F F T T T T
T F T F T T T T
T F F F T T T T
F T T T T T T T
F T F F F T F F
F F T F F F T F
F F F F F F F F
Conditional Propositions
Definition. If p and q are propositions,
the compound proposition
if p then q
is called a conditional proposition and is
denoted pq
Remark: The operator is called the
implication operator and the proposition
p is called the hypothesis (or antecedent)
and the proposition q is called the
conclusion (or consequent).
Example of a conditional proposition
If the Mathematics Department gets an
additional budget, then it will hire one new
faculty member.
p: If the Mathematics Department gets an
additional budget
q: It will hire one new faculty member
p q:
If the Mathematics Department gets an
additional budget, then it will hire one new
faculty member.
Other Forms of pq
Mary will be a good student if she studies
hard.
John may take calculus only if he has
sophomore, junior, senior standing.
When you sing, my ears hurt.
A necessary condition for the Cubs to
win the World Series is that they sign a
right-handed relief pitcher.
A sufficient condition for Ralph to visit
California is that he goes to Disneyland.
Other Forms of pq
The hypothesis is the clause following if
The only if clause is the conclusion; that is, if p then
q is considered logically the same as p only if q
The “if p then q” formulation emphasizes the
hypothesis, whereas the “p only if q” formulation
emphasizes the conclusion; the difference is only
the style.
When means the same as if
The conclusion expresses a necessary condition
The hypothesis expresses a sufficient condition
Other Forms of pq
Mary will be a good student if she studies hard.
If Mary studies hard, then she will be a good
student.
John may take calculus only if he has
sophomore, junior, senior standing.
If John takes calculus then he has sophomore,
junior, or senior standing.
T T T
T F F
F T T
F F T
p: 1 > 2
q: 4 < 8
pq is true
q p is false
Example of a conditional proposition
Given: p – true, q – false, r – true
Find the truth values of the following
propositions:
( p q) r
( p q) r
p (q r )
p (q r )
Relationship of propositions
In ordinary language, the hypothesis and
conclusion in a conditional proposition
are normally related, but in logic, the
hypothesis and conclusion in a
conditional proposition are not required
to refer to the same subject matter.
p q pq
T T T
T F F
F T F
F F T
Example of logical equivalence
p: 1 < 5
q: 2 < 6
p q p q,
pq pq
Proof of De Morgan’s Law (i)
p q pq
T T F F
T F F F
F T F F
F F T T
pq pq
pq pq
p q p q pq
pq pq
T T F F
T F T T
F T F F
F F F F
( p q ) ( p q ) (q p )
( p q)
q p
pq pq
p q p q p q
p q p q(q p )
pq pq
pq
q p
pq
T T T T T T
T F F F T F
F T F T F F
F F T T T T
Properties of Equivalence (Law 2.6)
p q p→q ~q → ~p
T T T T
T F F F
F T T T
F F T T
Hierarchy of Logical Operators
p~p
pp
(p q) (p ~q) (~p q)
(~p ~q)
Is (p ~ p) q a tautology?
Answer:
From the previous slide, we
have seen that p ~ p is a
tautology. If q is false, then
(p ~ p) q is false. Hence
(p ~ p) q is not a
tautology.
Contradiction
Definition. A proposition which is
always false is called a contradiction.
Example:
The proposition ~ (p p) is a
contradiction. If p is true, then the
overall proposition is false, whereas if
p is false the overall proposition is also
false.
Contingency
Definition.
If a proposition is neither a
tautology nor a contradiction,
then it is called a contingency.
Contingency
Example:
Consider the proposition p q.
If p is true and q is false, then
the implication is false,
whereas if p and q are both
true the implication is true.
Hence, the implication p q is
a contingency.
Equational Reasoning
Solution:
(p q) (~p ~q)
(p q) ~(p q) [De Morgan’s Law]
false [Law 2.6.4
(No prop. is equiv. to its negation)]