Lecture Notes: Discrete Mathematics For Computer Science: Part 1. Logical Notation
Lecture Notes: Discrete Mathematics For Computer Science: Part 1. Logical Notation
Lecture Notes: Discrete Mathematics For Computer Science: Part 1. Logical Notation
(or),
(not),
and quantifiers
(for all),
(there exists).
The symbol , called conjunction, and the symbol , called disjunction, are binary
connectives, because each of them is used to form a compound proposition from two
propositions. The negation symbol is a unary connective.
The symbol is called the universal quantifier; the symbol is the existential quantifier.
5 < x < 6;
2x 6= 1;
x 1.
Truth Tables
The truth tables for propositional connectives show how we can determine whether a
compound proposition is true if we know which of its component propositions are true.
Here is the truth table for conjunction and disjunction:
p
F
F
T
T
pq
F
F
F
T
q
F
T
F
T
pq
F
T
T
T
The symbols T and F here stand for true and false. They are called truth values.
The truth table for negation looks like this:
p
T
F
p
F
T
(1)
and x
2
Implication
The binary propositional connective is called implication. It represents the combination if . . . then. For instance, the logical formula
n(4 | n 2 | n)
(3)
says: for all n, if n is a multiple of 4 then n is even. The assertion the cube of any
positive number is positive also can be written as
x(x > 0 x3 > 0).
(4)
(Do not write x > 0(x3 > 0); this is not considered a valid logical formula.) The
formula to the left of (in this example, x > 0) is called the antecedent. The formula
to the right of (in this example, x3 > 0) is called the consequent.
In the truth table below, the column for implication is added to the columns for
conjunction and disjunction:
p
F
F
T
T
q
F
T
F
T
pq
F
F
F
T
pq
F
T
T
T
pq
T
T
F
T
You see that an implication is false in only one case: when its antecedent is true but its
consequent is false.
For example, consider the formula
x(x > 5 2x > 20).
This formula is false, because we can find a number x such that the antecedent x > 5
is true but the consequent 2x > 20 is false. For instance, x = 6 can be used as a
counterexample.
Consider the formula
xy(x > 0 y < 0 x + y = 0).
(5)
This formula is false, because we can find a pair of numbers x, y such that the antecedent
x > 0 y < 0 is true but the consequent x + y = 0 is false. According to the truth
table for conjunction, to make the antecedent true we should make each of the formulas
x > 0, y < 0 true. In other words, to give a counterexample we need to find a pair of
numbers x, y such that x is positive, y is negative, and x + y is different from 0. For
instance, the pair x = 1, y = 2 is a counterexample.
The converse of an implication is obtained by swapping its antecedent with its consequent. The converse of a true implication may be true or may be false. For instance,
the converse of (3) is
n(2 | n 4 | n);
this formula is false. (The value n = 2 can be used as a counterexample.) The converse
of (4) is
x(x3 > 0 x > 0);
this formula is true.
Equivalence
The binary propositional connective is called equivalence. It represents the combination if and only if (sometimes abbreviated as iff). For instance, the logical
formula
n(6 | n 2 | n 3 | n)
(6)
expresses that an integer is a multiple of 6 iff it is both a multiple of 2 and a multiple
of 3.
The last column in the truth table below shows that an equivalence is true whenever
its left-hand side and its right-hand side have the same truth value.
p
F
F
T
T
q
F
T
F
T
pq
F
F
F
T
pq
F
T
T
T
4
pq
T
T
F
T
pq
T
F
F
T
The equivalence p q has the same meaning as the conjunction of two implications
(p q) (q p).
For instance, the assertion x3 is positive iff x is positive can be written either as an
equivalence
x(x3 > 0 x > 0)
or as the conjunction of two implications:
x((x3 > 0 x > 0) (x > 0 x3 > 0)).
To provide a counterexample for an equivalence, we need to make one of its two sides
true while the other is false. For instance, the formula
x(x2 > 0 x > 0)
is false, and x = 1 can be used as a counterexample: for this value of x, the left-hand
side is true, and the right-hand side is false.
Proofs by Exhaustion
The implication
n(1 n 1 n3 = n)
is easy to prove, because only three values of n satisfy its antecedent 1 n 1,
and we can check for each of them individually that it satisfies the consequent n3 = n
as well. This kind of reasoning is called proof by exhaustion. It is not applicable
if the antecedent is satisfied for infinitely many values of variables. For instance, the
implication
x(1 x 1 1 x3 1)
cannot be proved by exhaustion, because there are infinitely many real numbers between
1 and 1.
(7)
(8)
The difference between free and bound variables is important because the truth
value of a formula depends on the values of its free variables, but does not depend on
the values of its bound variables. For instance, formula (7) expresses that j is a complete
square; whether or not it is true depends on the value of its free variable j. Formula (8)
expresses that 29 can be represented as the sum of two squares; we dont need to specify
the values of any variables before we ask whether this formula is true.
Replacing a bound variable by a new variable does not change the meaning of a
formula. For instance, the formula k(j = k 2 ) has the same meaning as (7): it says
that j is a complete square.
n2 .
n=1
Here n is a bound variable. The value of this expression is 30; it does not depend on n.
Replacing n by a different variable does not change the meaning of the expression. For
instance, the value of the expression
4
X
i2
i=1
is 30 as well.
The expression
n
X
i2
i=1
denotes the sum of the squares of the numbers from 1 to n. In this expression, n is free,
and i is bound. The value of this expression depends on n, but not on i.
In the expression
2n + 1
lim
n n + 1
the variable n is bound. The value of the limit is 2; it does not depend on n.
In the definite integral
Z
1
x2 dx
the variable x is bound. The value of the integral is 13 ; it does not depend on x. In the
expression
Z x
t2 dt
0
x3
3 ;
Nested Quantifiers
Some logical formulas include nested quantifiers, where one quantifier is within the
scope of another:
mn(m2 + n2 = 10),
(9)
xy(x > 0 y < 0 x + y = 0),
(10)
(11)
If both quantifiers are existential, as in (9), or both are universal, as in (10), then the
second quantifier can be dropped, and the formula will not change its meaning. For
instance, formula (9) has the same meaning as (2), and (10) has the same meaning
as (5). But using a combination of a universal quantifier with an existential quantifier,
as in (11), we can express more complex ideas than with just one quantifier. For instance,
formula (11) says that for every real number x we can find a real number y that is greater
than x. This formula is true: we can take y = x + 1 as a witness. This equality shows
how to calculate a witness y for any given value of x.
Note that the order of quantifiers in (11) is essential. The formula
yx(y > x),
which differs from (11) by the order of quantifiers, says that there exists a single value
of y that is greater than all real numbers. This formula is false.
On the other hand, the formula
yx(y > sin x)
is true. Indeed, y = 2 can be taken as a witness.