Mathematical Foundations of Computer Science Lecture Outline
Mathematical Foundations of Computer Science Lecture Outline
Lecture Outline
August 28, 2018
Introduction to Logic
A proposition is a statement that is either true or false. For example, “2 + 2 = 4” and
“Donald Knuth is a faculty at Rutgers-Camden” are propositions, whereas “What time is
it?”, x2 < x + 40 are not propositions.
We can construct compound propositions from simpler propositions by using some of the
following connectives. Let p and q be arbitrary propositions.
Negation: p̃ (read as “not p”) is the proposition that is true when p is false and vice-versa.
Conjunction: p ∧ q (read as “p and q”) is the proposition that is true when both p and q
are true.
Disjunction: p ∨ q (read as “p or q”) is the proposition that is true when at least one of
p or q is true.
Exclusive Or: p ⊕ q (read as “p exclusive-or q”) is the proposition that is true when
exactly one of p and q is true is false otherwise.
Implication: p → q (read as “p implies q”) is the proposition that is false when p is true
and q is false and is true otherwise.
Biconditional: p ↔ q (read as “p if, and only if, q”) is the proposition that is true if p and q
have the same truth values and is false otherwise. “If and only if” is often abbreviated as iff.
Logical Equivalence
Two compound propositions are logically equivalent if they always have the same truth
value. Two statement p and q can be proved to be logically equivalent either with the aid
of truth tables or using a sequence of previously derived logically equivalent statements.
p q ¬p ¬q p→q ¬p ∨ q ¬q → ¬p
T T F F T T T
T F F T F F F
F T T F T T T
F F T T T T T
p q ¬p ¬q p→q p ∧ ¬q C ¬p → C (p ∧ ¬q) → C
T T F F T F F T T
T F F T F T F T F
F T T F T F F F T
F F T T T F F F T
x0 ∈ D for which P (x0 ) is false. Using existential quantifier ∃ (“there exists”) alongside
P (x) means that there exists an element in the domain of x for which P (x) is true. Thus
the proposition ∃x ∈ D, P (x) is true if there is an x0 ∈ D for which P (x0 ) is true and is
false if P (x) is false for all x ∈ D.
Examples of propositions using quatifiers are as follows.
1. ∀x ∈ Z, x3 + 1 is composite.
2. ∀x ∈ Z, x is even → x + 1 is odd.
3. ∃x ∈ N, x2 6> x.
4. ∃x ∈ Z, 2|x and 2|x + 1.
5. ∀x ∈ Z ∃y ∈ Z, x + y = 0.
6. ∃x ∈ Z ∀y ∈ Z, x > y.
Sometimes it helps (in proofs) to consider the negation of a proposition. Verify the following
equivalence.
Proofs
We will illustrate some proof techniques by proving some properties about numbers. Before
we do that let’s go through some basic definitions given below.
An integer n is even iff n = 2k for some integer k. An integer is odd iff n = 2k + 1 for some
integer k. Symbolically,
An integer n is prime iff n > 1 and for all positive integers r and s, if n = r · s, then r = 1
or s = 1. Otherwise n is composite.
Given any real number x, the floor of x, denoted by bxc, is defined as follows
Given any real number x, the ceiling of x, denoted by dxe, is defined as follows
A real number is rational iff it can be expressed as a ratio of two integers with a non-zero
denominator. A real number that is not rational is irrational. More formally,
Example. Prove the following: If the sum of two integers is even then so is their difference.
Solution. Let m and n be particular but arbitrarily chosen integers such that m + n is
even. By definition of even, we have m + n = 2k, for some integer k. Then
m = 2k − n
m − n = 2k − n − n
= 2(k − n)
Since k and n are integers, k − n is an integer, 2(k − n) is even and hence m − n is even.
n2 + n + 1 = (2k + 1)2 + 2k + 1 + 1
= 4k 2 + 4k + 1 + 2k + 2
= 4k 2 + 6k + 2 + 1
= 2(2k 2 + 3k + 1) + 1
Since k is an integer, p = 2k 2 +3k+1 is an integer and n2 +n+1 is odd, since n2 +n+1 = 2p+1
where p is an integer.
Solution. Let x be an arbitrary but specific integer such that x > 1. We can rewrite
x3 + 1 as (x + 1)(x2 − x + 1). Note that since x is an integer both (x + 1) and (x2 − x + 1)
are integers. Hence (x + 1)|x3 + 1 and (x2 − x + 1)|x3 + 1. We now need to show that
x + 1 > 1 and x2 − x + 1 > 1. Since x > 1, clearly, x + 1 > 1. x2 − x + 1 > 1 by the
following reasoning.
x > 1
x2 > x (Multiplying both sides by x.)
2
x −x > 0 (Subtracting both sides by x.)
2
x −x+1 > 1 (Adding 1 to both sides.)
We can also argue that x2 − x + 1 > 1 by showing that x + 1 < x3 + 1. Since x > 1 we have
x2 > x and hence x2 > 1. Multiplying both sides by x again we get x3 > x. This means
that x + 1 < x3 + 1 and since (x + 1)|x3 + 1, we conclude that x3 + 1 is composite.
Note: One student asked the question that why can’t we write x3 + 1 as x3 (1 + x13 ). The
reason is that for an integer x > 1, (1 + x13 ) is not an integer and the proof breaks down.