Ch01 1
Ch01 1
Ch01 1
Logic!
“y > 5”
Is this a statement? no
It’s a request.
Is this a proposition? no
• Negation (NOT, ¬)
• Conjunction (AND, ∧)
• Disjunction (OR, ∨)
• Exclusive-or (XOR, ⊕ )
• Implication (if – then, → )
• Biconditional (if and only if, ↔ )
• Truth tables can be used to show how these operators can
combine propositions to compound propositions.
May 2012 Discrete Structures 13
Negation (NOT)
P ¬ P
true (T) false (F)
false (F) true (T)
P Q P∧Q
T T T
T F F
F T F
F F F
P Q P∨ Q
T T T
T F T
F T T
F F F
P Q P⊕Q
T T F
T F T
F T T
F F F
P Q P→Q
T T T
T F F
F T T
F F T
May 2012 Discrete Structures 18
Implication (if - then)
v if p, then q.
v if p, q.
v p is sufficient for q.
v q if p.
v q when p.
v a necessary condition for p is q.
v p implies/causes q.
May 2012 Discrete Structures 19
Implication (if - then)
v p only if q.
v a sufficient condition for q is p.
v q whenever p.
v q is necessary for p.
v q follows from p.
v q unless ¬p
v q when p.
May 2012 Discrete Structures 20
Implication (if - then)
Example: Implication in various forms
v If today is rainy, then the flowers will grow well.
v If the gas pedal is pressed deeper, the car moves fast.
v Ice melted in north and south pole causes the increase
of sea level.
v He is willing to go if he is given travel allowance.
v Ahmad can take Factory Layout only if he already
passed Discrete Mathematics.
v The sufficient condition for a gas station to explode is
small cigarette sparks.
P Q P↔Q
T T T
T F F
F T F
F F T
• P → Q ⊕R
• Why use XOR here? – example of ambiguity of
natural languages
May 2012 Discrete Structures 31
Exercises
• School is closed if more than 2 feet of snow
falls or if the wind chill is below -100.
– P: School is closed
– Q: 2 feet of snow falls
– R: wind chill is below -100
• Q ∨ R → P
• Precedence among operators:
¬, ∧, ∨, →, ↔
• Example
• Do the system specifications in the above example
remain consistent if the specification “The diagnostic
message is not retransmitted” is added?
• NO
T T T F F
T F F T T
F T F T T
F F F T T
May 2012 Discrete Structures 39
Equivalent Statements
P Q ¬(P∧Q) (¬P)∨(¬Q) ¬(P∧Q)↔(¬P)∨(¬Q)
T T F F T
T F T T T
F T T T T
F F T T T
The statements ¬(P∧Q) and (¬P) ∨ (¬Q) are logically
equivalent, since they have the same truth table, or put
it in another way, ¬(P∧Q) ↔(¬P) ∨ (¬Q) is always true.
May 2012 Discrete Structures 40
Tautologies and Contradictions
• A tautology is a statement that is always true.
Examples:
– R∨(¬R)
¬(P∧Q) ↔ (¬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.
• A compound proposition that is neither a tautology
nor a contradiction is called a contingency.
May 2012 Discrete Structures 41
Equivalence
Definition: two propositional statements
S1 and S2 are said to be (logically)
equivalent, denoted S1 ≡ S2 if
– They have the same truth table, or
– S1 ⇔ S2 is a tautology
Equivalence can be established by
– Constructing truth tables
– Using equivalence laws
Is it true? yes
Definition
Two statements S and T involving predicates and
quantifiers are logically equivalent if and only if they
have the same truth value regardless of the
interpretation, i.e. regardless of
the meaning that is attributed to each propositional
function,
the domain of discourse. We denote S ≡ T.
Is ∀x(P (x) ∧ Q(x)) logically equivalent to ∀xP (x) ∧
∀xQ(x) ?
Is ∀x(P (x) ∨ Q(x)) logically equivalent to ∀xP (x) ∨
∀xQ(x) ?
May 2012 Discrete Structures 65
Logical Equivalences Involving Quantifiers
∀x∃y∀z(B(x,y) ∧ ((z≠y)→¬B(x,z))).
v Example:
v Let Q(x,y,z) be the statement “x+y=z.” What are the truth
values of the statements ∀x∀y∃z Q(x,y,z) and ∃z
∀x∀y Q(x,y,z)?
v ∀x∀y∃z Q(x,y,z)
² “For all real numbers x and for all real numbers y there is a
real number z such that x+y=z.” is True
v ∃z∀x∀y Q(x,y,z)
² “There is a real number z such that for all real numbers x and
for all real numbers y it is true that x+y=z.” is False, since
there is no value of z that satisfies the equation x+y=z for all
values of x and y.
v Negation
v “It is not the case that there is a student in this class who
has taken a course in calculus.” This is equivalent to “Every
student in this class has not taken calculus.” This can be
represented as
v ∀x¬ Q(x)
v When the domain has n elements x1, x2, . . . . . . . , xn , it
follows that ¬∀x P(x) is the same as ¬ ( P(x1) ∧ P(x2)
∧. . .∧P(xn )), which is equivalent to ¬P(x1) v ¬P(x2) . . .v
¬P(xn) by De Morgan's laws, and this is the same as
∃x¬P(x).
v Similarly, ¬∃xP(x)is the same as ¬(P(x1) v P(x2) v . . . v
P(xn)), which by De Morgan's laws is equivalent to ¬P(x1) ∧
¬P(x2) ∧ . . . ∧ ¬P(xn )), and this is the same as ∀x¬P(x)
May 2012 Discrete Structures 89
Negating Quantified Expressions: De Morgan Laws
v Practice Exercises
v What are the negations of the following statements:
v “There is an honest politician.”
v “All americans eat cheeseburgers.”
v What are the negations of ∀x(x2 > x) and ∃x(x2 = 2)? Ans:
(∃x( x2 <= x)) and ∀x( x2≠2)
v Show that ¬∀x(P (x) → Q(x)) and ∃x(P (x) ∧ ¬Q(x)) are
logically equivalent.
Nobody is perfect
¬∃x (Person(x) ∧ Perfect(x))
∀x (Person(x) → ¬Perfect(x))
Definition
v An argument in propositional logic is sequence of propositions. All
but the final proposition are called premises and the final
proposition is called the conclusion. An argument is valid if the truth
of all its premises implies that the conclusion is true.
Formal Proofs
+KL+
31&
&
< 7
$
+KL+
34+
+K+L+
#
83
&
L++L
D#<#<C#E5I
G1"3$
&
+
I
$
L++L
D#<#<C#E5I
G1"3$
&
+
I
$
/&"1<1K>1
1<1L81!
$)
%
<
1
& $
$)
%
<
1
v Definition
v The integer n is even if there exists an integer k such that
n = 2k, and n is odd if there exists an integer k such that n
= 2k + 1.