Professional Documents
Culture Documents
Chapter1 RemovePdfPages RemovePdfPages
Chapter1 RemovePdfPages RemovePdfPages
Spring, 2013/2014
1 Propositional Logic
2 Propositional Equivalences
4 Nested Quantifiers
5 Rules of Inference
6 Introduction to Proofs
For every positive integer n, the sum of the positive integers not
exceeding n is n(n + 1)/2.
Mathematical Statement + Proof = Theorem
Proofs are important throughout mathematics, but how important
proofs are in computer science?.
Verify that computer programs produce the correct output for all
possible input values.
Show that algorithms always produce the correct result.
Establish the security of a system.
What we are going to learn in this chapter?
Introduce tools to construct a correct mathematical arguments.
Develop different proof methods that will enable us to prove many
different types of results.
Introduce several strategies for constructing proofs.
Is it a proposition?
Hello, How are you?.
NO
We can eat rocks.
YES
Ahmad taller than Ali.
YES
He is a good student.
NO
Please wakeup.
NO
15 * Z >= 30.
NO
DEFINITION
Let p be a proposition. The negation of p, denoted by + p (also
denoted by p̄), is the statement
”It is not the case that p.”
The proposition + p is read ”not p.” The truth value of the negation of
p, + p, is the opposite of the truth value of p.
Connectives
The logical operators that are used to form new propositions from two or
more existing propositions.
Discrete Mathematics - Ch.1 Dr. Musbah Shaat 8 / 85
Propositional Logic
Compound Propositions
Conjunction
Let p and q be propositions. The conjunction of p and q, denoted by
p ∧ q, is the proposition of ”p and q”. The conjunction p ∧ q is true
when both p and q are true and is false otherwise.
Disjunction
Let p and q be propositions. The disjunction of p and q, denoted by
p ∨ q, is the proposition of ”p or q”. The disjunction p ∨ q is false when
both p and q are false and is true otherwise.
Exclusive or
Let p and q be propositions. The exclusive or of p and q, denoted by
p ⊕ q, is the proposition that is true when exactly one of p and q is true
and is false otherwise.
There are three related conditional statements that occur so often that
they have special names:
The converse of p → q is the preposition q → p.
The contrapositive of p → q is the preposition + q →+ p.
The inverse of p → q is the preposition + p →+ q.
Biconditional Statement
Let p and q be propositions. The biconditional statement p ↔ q is the
proposition ”p if and only if q.” The biconditional statement p ↔ q is
true when p and q have the same truth values, and is false otherwise.
Biconditional statements are also called bi-implications.
Example: Let p be the statement ”You can take the flight” and let
q be the statement ”You buy a ticket.” Then p ↔ q is the
statement ”You can take the flight if and only if you buy a ticket.”
This statement is true if p and q are either both true or both false, that
is, if you buy a ticket and can take the flight or if you do not buy a ticket
and you cannot take the flight. It is false when p and q have opposite
truth values.
Discrete Mathematics - Ch.1 Dr. Musbah Shaat 20 / 85
Propositional Logic
Precedence of Logical Operators
(p∨ + q) → (p ∧ q)
Compound propositions that have the same truth values in all possible
cases are called logically equivalent.
Another Definition
The compound propositions p and q are called logically equivalent if
p ↔ q is a tautology. The notation p ≡ q denotes that p and q are
logically equivalent.
General Remarks:
The symbol ≡ is not a logical connective, and p ≡ q is not a
compound proposition but rather is the statement that p ↔ q is a
tautology.
The symbol ⇔ is sometimes used instead of ≡ to denote logical
equivalence.
The compound propositions p and q are equivalent if and only if the
columns giving their truth values agree.
Example: Let P(x) denote the statement ”x > 3.” What are the
truth values of P(4) and P(2)?
P(4), ”4 > 3”, True.
P(2), ”2 > 3”, False.
What are the truth values of the quantification ∀xP(x) for the following
statements:
P(x) is ”x + 1 > x”, D : Real No.’s.
True for all real numbers ⇒ True.
P(x) is ”x < 2”, D : Real No.’s.
P(3) is false. That is, x = 3 is a counterexample for the statement
”∀xP(x)” ⇒ False.
P(x) is ”x 2 > 0”, D : All integers.
We see that x = 0 is a counterexample because x 2 = 0 when x = 0,
so that x 2 is not greater than 0 when x = 0. ⇒ False.
P(x) is ”x 2 < 10”, D : +ve integers not exceeding 4.
∀xP(x) = P(1) ∧ P(2) ∧ P(3) ∧ P(4). Because P(4), which is the
statement ”42 < 10,” is false ⇒ ∀xP(x) is False.
P(x) is ”x 2 ≥ x”, D : Real No.’s
∀x(x 2 ≥ x) is false if the domain consists of all real numbers.
However, its True if the domain consists of the integers No’s only.
Discrete Mathematics - Ch.1 Dr. Musbah Shaat 38 / 85
Predicates and Quantifiers
Quantifiers
What are the truth values of the quantification ∃xP(x) for the following
statements:
P(x) is ”x > 3”, D : Real No.’s.
Because ”x > 3” is sometimes true, for instance, when x = 4 ⇒ the
existential quantification of P(x) is True.
P(x) is ”x = x + 1”, D : Real No.’s.
Because P(x) is false for every real number x ⇒ the existential
quantification of P(x) is False.
P(x) is ”x 2 > 10”, D : +ve integers not exceeding 4.
What are the truth values of the quantification ∃xP(x) for the following
statements:
P(x) is ”x > 3”, D : Real No.’s.
Because ”x > 3” is sometimes true, for instance, when x = 4 ⇒ the
existential quantification of P(x) is True.
P(x) is ”x = x + 1”, D : Real No.’s.
Because P(x) is false for every real number x ⇒ the existential
quantification of P(x) is False.
P(x) is ”x 2 > 10”, D : +ve integers not exceeding 4.
∃xP(x) = P(1) ∨ P(2) ∨ P(3) ∨ P(4). Because P(4), which is the
statement ”42 > 10,” is True ⇒ ∃xP(x) is True.
+ ∀xP(x) ≡ ∃x + P(x)
+ ∃xP(x) ≡ ∀x + P(x)
+ ∃xP(x) ≡ ∀x + P(x)
Nested Quantifiers
Its the statements that have one Quantifier within the scope of another.
Examples:
∀x∃y P(x, y )
”For all x, there exists a y such that P(x, y ).”
Example: ∀x∃y (x + y = 0).
∃x∀y P(x, y )
”There exists an x, such that for all y P(x, y ) is true.”
Example: ∃x∀y (x ∗ y = 0).
Exercise:
∀x∀y (((x 6= 0) ∧ (y 6= 0)) ↔ (xy 6= 0))
Example: Translate the following English statement into logical
expression:
”The sum of two positive integers is always positive”.
We first rewrite the sentence ”For every two integers, if these integers
are both positive, then the sum of these integers is positive.”
Next, we introduce the variables x and y to obtain ”For all positive
integers x and y , x + y is positive.”
Consequently, we can express this statement as:
∀x∀y ((x > 0) ∧ (y > 0) → (x + y > 0)), where the domain consists
of all integers.
If the domain is all positive integers, then the statement can be
written as ”For every two positive integers, the sum of these integers
is positive”, and can be expressed mathematically as:
∀x∀y (x + y > 0).
Argument
An argument in propositional logic is a sequence of propositions. All but
the final proposition in the argument 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.
Argument form
An argument form in propositional logic is a sequence of compound
propositions involving propositional variables. The conclusion is true if
the premises are all true.
[hypothetical syllogism].
Example: Show that the premises ”It is not sunny this afternoon and it
is colder than yesterday,” ”We will go swimming only if it is sunny,” ”If
we do not go swimming, then we will take a canoe trip,” and ”If we take
a canoe trip, then we will be home by sunset” lead to the conclusion
”We will be home by sunset.”
Example: Show that the premises ”If you send me an e-mail message,
then I will finish writing the program,” ”If you do not send me an e-mail
message, then I will go to sleep early,” and ”If I go to sleep early, then I
will wake up feeling refreshed,” lead to the conclusion ”If I do not finish
writing the program, then I will wake up feeling refreshed.”
Example: Show that the premises ”A student in this class has not read
the book,” and ”Everyone in this class passed the first exam,” lead to the
conclusion ”Someone who passed the first exam has not read the book.”
Proof
is a valid argument that establishes the truth of a mathematical
statement.
A proof can use the hypotheses of the theorem, if any, axioms assumed
to be true, and previously proven theorems.
Types of Proofs:
Formal proofs [Used by computer programs]: show that
statements involving propositions and quantified statements are true
by supplying all the steps and giving the rules for each step in the
argument.
Informal proofs [Used by humans]: more than one rule of inference
may be used in each step, where steps may be skipped, where the
axioms being assumed and the rules of inference used are not
explicitly stated.
Direct proof
showing that a conditional statement p → q is true by showing that if p
is true, then q must also be true, so that the combination p true and q
false never occurs.
Give a direct proof of the following theorems:
”If n is an odd integer, then n2 is odd”.
Assume n is odd ⇔ n = 2k + 1, where k is an integer.
n2 = (2k + 1)2
= (4k 2 + 4k + 1) = 2(2k 2 + 2k) + 1 = 2k̀ + 1
Since n2 can be written in this form, it is odd.
Proof by Contraposition
make use of the fact that the conditional statement p → q is equivalent
to its contrapositive, + q →+ p.
Give an indirect proof of the following:
”if n is an integer and 3n + 2 is odd, then n is odd.”.
Assume that the conclusion q of this implication is false (n is even).
Then use rules of inference and known theorems to show that the
hypothesis p must also be false (3n + 2 is even).
n is even ⇔ n = 2k where k is an integer.
⇒ 3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1) = 2k̀
Therefore 3n + 2 is even.
We have shown that the contrapositive of the implication is true, so
the implication itself is also true (If 3n + 2 is odd, then n is odd).
Exercise show that ”if m + n > 50 then m > 25 or n > 25” where m
and n are integers.
Discrete Mathematics - Ch.1 Dr. Musbah Shaat 73 / 85
Introduction to Proofs
Methods of Proving Theorems / Indirect proof
Proof by Contradiction
reveal that p is true if we can show that + p → (r ∧ + r ) is true for
some proposition r .
Way: assume + q and p and then deduce any contradiction.
Give an indirect proof of the following:
”if the square of an integer number is odd, then the integer is odd.”
Assume that the hypothesis p of this implication is true and the
conclusion q is false (n is even). Then use rules of inference and
known theorems to deduce contradiction.
Assume n2 is odd and n is not odd (even).
⇒ n = 2k
⇒ n2 = 4k 2 = 2(2k 2 )
Therefore n2 is even and is also odd by the assumption.
We have a contradiction.
Exercise show that ”if 3n + 2 is odd, then n is odd”.
Discrete Mathematics - Ch.1 Dr. Musbah Shaat 74 / 85
Introduction to Proofs
Proofs of Equivalence
Every step is valid except for one, step 5 where we divided both sides by
a − b. The error is that a − b equals zero; division of both sides of an
equation by the same quantity is valid as long as this quantity is not zero.
Proof by cases
The original conditional statement with a hypothesis made up of a
disjunction of the propositions p1 , p2 , · · · , pn can be proved by proving
each of the n conditional statements pi → q, i = 1, 2, · · · , n, individually.
Exhaustive proof
Proving by exhausting all possibilities [normally applicable when there is
small number of possibilities].
EX. Show that if x and y are integers and both xy and x + y are even,
then both x and y are even.
We can proof using the proof by contraposition and the notion of
(without loss of generality (WLOG)) and by proof by cases.
First, suppose that x and y are not both even, that is x is odd or y is
odd or both are odd.
WLOG, assume that x is odd, ⇒ x = 2m + 1 for some integer m.
To complete the proof we need to show that xy or x + y is odd. We have
two cases:
Case(i): y is even ⇒ y = 2n ⇒ x + y = (2m + 1) + 2n = 2(m + n) + 1
is odd.
Case(ii): y is odd
⇒ y = 2n + 1 ⇒ xy = (2m + 1) ∗ (2n + 1) = 2(2mn + m + n) + 1 is odd.
which completes the proof.
Note: WLOG means the inclusion of the case when y is assumed to be
odd and then consider the two cases of x.
Discrete Mathematics - Ch.1 Dr. Musbah Shaat 81 / 85
Proof Methods and Strategy
Existence Proofs
Existence Proofs
A proof of a proposition of the form ∃xP(x).
Uniqueness Proofs
Show that an element with a given property exists and that no other
element has this property.
Existence: We show that an element x with the desired property exists.
Uniqueness: We show that if y 6= x, then y does not have the desired
property.
Equivalently, we can show that if x and y both have the desired
property, then x = y .
EX. Show that if a and b are real numbers and a 6= 0, then there is a
unique real number r such that ar + b = 0.
EX. Show that for any two distinct real numbers x and y , the arithmetic
√
mean (x + y )/2 is always greater than the geometric mean xy .