Logic: 1.1 Statements and Compound Statements
Logic: 1.1 Statements and Compound Statements
Logic: 1.1 Statements and Compound Statements
Logic
1.1
2 = ab . (True.)
CHAPTER 1. LOGIC
1.2
Negation of Statements
q p q p q (p q) p q p q (p q) p q
0 1 1
0
1
1
0
1
1
1 1 0
0
1
1
1
0
0
0 0 1
0
1
1
1
0
0
1 0 0
1
0
0
1
0
0
CHAPTER 1. LOGIC
q p q p q (p q) p q
0 1 1
1
0
0
1 1 0
1
0
0
0 0 1
0
1
1
1 0 0
1
0
0
Finally, the statement p q asserts that p and q have the same truth
value. Hence (p q) asserts that p and q have different truth values. This
happens when p is true and q is false, or when p is false and q is true. Thus,
(p q) is the same as (p q) (p q).
p
0
0
1
1
1.3
q p q p q (p q) p q p q (p q) (p q)
0 1 0
0
1
0
0
0
1 1 0
1
0
0
1
1
0 0 1
1
0
1
0
1
1 0 0
0
1
0
0
0
obtain the truth values of p, (p r), r, (q r), and then, finally, the
entire statement we want.
p
0
0
0
0
1
1
1
1
q
0
0
1
1
0
0
1
1
r p p r r q r (p r) (q r)
0 1
0
1
1
1
1 1
1
0
0
0
0 1
0
1
1
1
1 1
1
0
1
1
0 0
1
1
1
1
1 0
1
0
0
0
0 0
1
1
1
1
1 0
1
1
0
0
Sometimes only part of the truth table needs to be made. For example,
suppose it is given a and b are false, and c is true. Then the truth value of
a (b c) can be found by completing the single row of the truth table
where a, b and c have the given truth values.
If we are given that p is false and q is true, then we can find all possible
truth values of (p r) (q s) by completing the four rows of the truth
table where p and q have the truth values given, and all possible truth values
for r and s occur.
Sometimes information about truth values can be given a more indirectly.
Suppose were given that a (b c) is false, and asked to determine
all possible truth values of (a b) (b c). The information that given
implication is false, lets us conclude that its hypothesis, a, is true (so a is
false), and its conclusion, (b c), is false (so b and c have different truth
values, that is, b and c have the same truth value. Hence we need a truth
table with only two rows:
a b c b c a b b c (a b) (b c)
0 0 0 1 1
0
1
0
0 1 1 0 0
1
0
0
Therefore, if a (b c) is false, so is (a b) (b c).
CHAPTER 1. LOGIC
1.4
p
0
0
1
1
q p q
0 1 1
1 1 0
0 0 1
1 0 0
implication
contrapositive converse
pq
p q
q p
qp
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
1
1.5
Quantifiers
1.5. QUANTIFIERS
its truth value until something about the variables is known. There are two
options:
1. If values are given to the variables, then the assertion will be either
true or false for those particular values. Giving different values to the
variables might result in a different truth value for the assertion.
2. Specify the quantity (that is, number) of allowed replacements for each
variable that result in the assertion being true. This specification is an
assertion that is either true or false, that is, it is a statement.
We will pursue the second option.
The universe of a variable is the collection of values it is allowed to take.
The universal quantifier asserts that the given assertion is true for
all allowed replacements for a variable. Think of the upside-down A as
representing All. Synonyms for for all , include all , every and for
each.
An example of using a universal quantifier is: for all integers n, the
integer n(n + 1) is even. We could take a first step towards a symbolic representation of this statement by writing n, n(n+1) is even, and specifying
that the universe of n is the integers. (This statement is true.)
The existential quantifier asserts that there exists at least one allowed
replacement for a variable for which the given assertion is true. Think of the
backwards E as representing exists. Synonyms for there exists include
there is, there are, some, and at least one.
An example of using an existential quantifier is there exists an integer
n such that n2 n + 1 = 0. A symbolic representation of this statement is
obtained by writing n, n2 n + 1 = 0, and specifying that the universe of
n is the integers. (This statement is false.)
We can completely write the statement n, n(n + 1) is even in symbols
by remembering the definition of an even integer. An integer k is even when
there is an integer t such that k = 2t. Symbolically, k is even when t, k = 2t,
where the universe of t is the integers. With this in mind n, n(n + 1) is
even becomes n, t, n(n + 1) = 2t.
Let s(x) denote a statement involving the variable x. Observe that if
x, s(x) is true, then so is x, s(x), provided the universe contains a non-
CHAPTER 1. LOGIC
zero number of elements: if an assertion is true for all x is the universe, then
it is true for at least one x (provided there is one). If the universe contains
no elements, then x, s(x) is always true, and x, s(x) is never true (why?).
Of course, the truth of x, s(x) tells us nothing about the truth of x, s(x).
Both universal and existential quantifiers can be (unintentionally) hidden, as in the example used to begin this section. Another example is the
statement if (a 6= 0) and (ax2 + bx + c = 0) then
b b2 4ac
x=
2a
is meant to apply to all real numbers x. If the universal quantifier were
made explicit, it would read for all real numbers x . . .. Similarly, a real
number can have more than one decimal expansion is intended to assert
the existence of one or more such numbers. If the existential quantifier were
made explicit, it would read there is a real number x such that x has more
than one decimal expansion.
When quantifiers are nested, they are read in order from left to right.
For example, if x and y are understood to be numbers, x, y, x + y = 0
is read as follows: for all x, the statement y, x + y = 0 is true. No
matter the value of x, the number y can be chosen to be its negative. Hence,
y, x + y = 0 is true for any x. Consequently, x, y, x + y = 0 is true.
The order of quantifiers is important. The statement x, y, x + y = 0
says that there is a real number x such that, for every real number y, the
quantity x + y = 0, which is false.
1.6
The negation of a universally quantified statement is an an existentially quantified statement. If it is not the case that a statement is true for all allowed
replacements in the universe, then it is false for at least one allowed replacement.
For example n 0, n2 n + 41 is prime says it is not the case that
for every positive integer n the number n2 n + 41 is prime, or in other
words there exists a positive integer n such that n2 n + 41 is not prime.
1.7
Logical Equivalence
In the process of making the truth table for (p q) (p q), we see that
the two bracketed statements have the same truth values for given truth
value assignments to p and q. Hence the double implication is always true.
A statement which is always true is called a tautology. A statement which
is always false is called a contradiction.
For example, p (p) is a contradiction, while p (p) is a tautology.
Most statements are neither tautologies nor contradictions.
One way to determine if a statement is a tautology is to make its truth
table and see if it (the statement) is always true. Similarly, you can determine
if a statement is a contradiction by making its truth table and seeing if it is
always false.
Informally, two statements s1 and s2 are logically equivalent if they have
the same truth table (up to the order of the rows). This happens exactly
when the statement s1 s2 is a tautology.
10
CHAPTER 1. LOGIC
1.8
ppp
Commutative: p q q p,
pq qp
Associative: (p q) r p (q r),
(p q) r p (q r)
p(qr) (pq)(pr)
(p q) p q
11
Absorbtion: p 1 p,
p00
Dominance: p 1 1,
p0p
pq
(p q) (p q)
Known L.E.
(p (p q)) (q (p q))
Distributive
[(p p) (p q)] [(q p) (q q)]
Distributive (twice)
[0 (p q)] [(q p) 0]
Known contradictions
(p q) (q p)
Dominance
(p q) (p q)
Commutative (3 )
There are two other forms of the Distributive Laws. These can be derived
from the versions given above:
(q r) p
p (q r)
Commutative
(p q) (p r)
Distributive
(q p) (r p) Commutative (twice)
Similarly (q r) p (q p) (r p).
The Laws of Logic can be used in several other ways. One of them is to
prove that a statement is a tautology without resorting to a truth table. This
12
CHAPTER 1. LOGIC
q (p q)
Known L.E.
q (q p)
Commutative
(q q) p
Associative
1 p
Known tautology
1
Dominance
(p q) (p q)
Known L.E.
(p q) (p q)
Double Negation
(p q) (p q)
DeMorgan
0
(p p) q
Dist ve (from right to left)
0 q
Konown contradiction
q
Absorbtion
This section concludes with one last example. Suppose we are asked to
show that (p q) [(q r) (p r)] (p q). Use LHS to denote
the expression on the left hand side. Then
LHS
1.9
13
It turns out that any statement is logically equivalent to one that uses only
the connectives , , and . The logical equivalences above allow statements
involving the logical connectives and to be replaced by equivalent
statements that use only , , and .
It is also possible to do this directly from the truth table, as will now be
demonstrated. Let s be the statement involving p and q for which the truth
table is given below.
p q s
0 0 1
0 1 1
1 0 0
1 1 1
First, for each row of the truth table where the statement s is true, write a
statement thats true only when p and q have the truth values in that row.
This statement will involve the logical connective and. For the truth table
above:
Row 1: p q
Row 2: p q
Row 4: p q
Now, to get an expression thats logically equivalent to s, take the disjunction
of these statements: it will be true exactly when the truth values of p and q
correspond to a row of the truth table where s is true (row 1 or row 2 or row
4). Thus s (p q) (p q) (p q). The process is exactly the same
if there are more than two statements involved.
There is some terminology and an important fact (important in computer
science) associated with what we have done. The expression associated with
each row of the truth table a conjunction of variables or their negations
is called a minterm. The compound statement derived using the process
consists of the disjunction of a collection of minterms (that is, they are all
joined together using or). It is called the disjunctive normal form of the
statement s. Since every statement has a truth table, and every truth table
14
CHAPTER 1. LOGIC
1.10
Logical Implication
It is apparent from examining the truth table for a b that, if this statement
is true, then so is a. Since an implication is true by definition when the
hypothesis is false, this means that the statement (a b) a is a tautology.
If, in the midst of an argument, we were to discover that a b is true, we
would be entitled to conclude (infer, or deduce) that a is true (and the same
for b). In what follows we develop a collection of basic rules for making
inferences.
Informally statement, a statement p logically implies a statement q if the
truth or p guarantees the truth of q This happens exactly when p q is a
15
tautology. Note that we are not concerned about what happens if p is false.
This is because of the truth table for implies: p q is true (by definition)
when p is false.
Formally, we say p logically implies q when p q is a tautology.
We use the notation p q to denote the fact (theorem), that p q is a
tautology, that is, that p logically implies q. Notice that p q is a statement
and can in general be true or false, and p q indicates the (higher level)
fact that it is always true.
Suppose p q. Then p q is a tautology. Since p q (p
q) (q p), the latter statement is also a tautology. Using the reasoning
in the first paragraph of this section, this means that each of (p q) and
(q p) is a tautology. Therefore p q and p q (which has the obvious
intended meaning: q p). In the same way, if both p q and p q, then
p q.
1.11
16
CHAPTER 1. LOGIC
17
We use these inference rules to prove some other rules. The rules above
are worth memorizing. The rules below are easy consequences of them and
need not be remembered.
Modus Tollens: [(p q) q] p.
Proof.
1.
2.
3.
4.
pq
Premise
q p L.E. to 1
q
Premise
p
2, 3, M.P.
pq
Premise
p q L.E. to 1
p
Premise
q
2, 3, M.P.
pr
Premise
p r
L.E. to 1
q r
Premise
r q 3, Commutative
rq
L.E. to 4
p q 2, 5, Chain Rule
pq
L.E. to 6
Here are two more inference rules which are clearly true, and which can
be formally proved with a truth table.
Disjunctive Amplification: p p q
Conjunctive Simplification: p q p
18
CHAPTER 1. LOGIC
p q
Premise
(p q) (q p)
L.E. to 1
q p
2, Conjunctive Simplification
p q
3, Contrapositive
q r
Premise
pr
4, 5, Chain Rule
p
Premise
r
6, 8, M.P.
In the next example, the argument is given in words. We can still check
its validity using inference rules. First, we need to translate the argument
into symbols.
If I run, then my ankle does not hurt
If I am not injured, then I run
My ankle hurts
I am injured
19
p q
Premise
r p
Premise
r q 2, 1, Chain Rule
qr
3, Contrapositive
q
Premise
r
4, 5, M.P.
We conclude this section with two more inference rules that can be proved
with a truth table, and then some discussion about them.
Proof by Contradiction: (p 0) p
Proof by Cases: (p r) (q r) (p q) r
The rule Proof by Contradiction is best illustrated by a proof in words.
An example will be given in the next section. The idea behind the rule is that
one should only be able to obtain true statements when starting with true
statements, and using logical equivalences and logical implications. Hence, if
falsity of the desired conclusion leads to a statement that is never true (that
is, a contradiction), then the conclusion can not be false. Here, we illustrate
the use of this rule in a proof of the type above by giving a second proof of
the rule Resolution.
Alternate proof of the rule Resolution.
1.
2.
3.
4.
5.
6.
7.
8.
9
10.
11.
12.
(p q)
Negation of conclusion, for proof by contradiction
p q
1, DeMorgan
p
2, Conjunctive Simplification
q
2, Conjunctive Simplification
pr
Premise
p r
L.E. to 5
r
3, 6, M.P.
q r
Premise
q r
L.E. to 8
r
4, 9, M.P.
r r ( 0)
Known contradiction from 7, 10
pq
1, 11, Proof by Contradiction
20
CHAPTER 1. LOGIC
1.12
Proofs in Words
Suppose you want to write a proof in words for a statement of the form
if p then q. That is, you wish to establish the theorem p q. There
are many techniques (methods) that can be tried. There is no guarantee of
which method will work best in any given situation. Experience is a good
guide, however. Once a person has written a few proofs, s/he gets a sense of
the best thing to try first in any given situation.
To use the method of direct proof to show p logically implies q, assume p
is true and then argue using definitons, known implications and equivalences
that q must be true. The reason for assuming p is true comes from the
definition of logical implication. In this case the first line of the proof is
Assume p. and the last says, essentially, q is true. What comes in
between depends on p and q.
In the following example of a direct proof, we use the definition of an
even integer: An integer n is even if there exists an integer k so that n = 2k.
Proposition 1.12.1 If the integer n is even, then n2 is even.
Proof. Suppose that the integer n is even. Hence, there exists an an integer
k so that n = 2k. Then, n2 = (2k)2 = 4k 2 = 2(2k 2 ). Since 2k 2 is an integer,
n2 is even.
It is customary in mathematics to use a box to indicate the end (or
absence) or an argument.
21
2 is not irrational.
Proof.
Suppose
2 is rational. Then there exist integers a and b so that
2 = a/b. The integers a and b can be chosen so that the fraction a/b is
22
CHAPTER 1. LOGIC
23
Both cases have now been considered. In each of them, we have shown that
n2 is not a multiple of 3. It now follows that if n is not a multiple of 3, then
n2 is not a multiple of 3. This completes the proof.