Download as pdf or txt
Download as pdf or txt
You are on page 1of 63

Sets and Logic, SM3512MS

UNIVERSITY OF NAMIBIA, SCHOOL OF SCIENCE


Department of Computing, Statistical and Mathematical Sciences
Study GUIDE

Contents
1 Introduction 4

2 Propositional logic 4
2.1 Propositions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.1 Syntax and semantic . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Logical connectives and truth tables . . . . . . . . . . . . . . . . . . . . . . 5
2.2.1 Propositional formulas . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.2 Logical equivalence . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.3 Conditional and biconditional logical operators . . . . . . . . . . . . 12
2.2.4 Converse and Contrapositive . . . . . . . . . . . . . . . . . . . . . . 13
2.2.5 Tautologies, Contradiction & Contigences . . . . . . . . . . . . . . 14
2.3 Laws of Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.4 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3 Deductions and normal forms 18


3.1 Logical implication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2 Valid and invalid arguments . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.3 Rules of inferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.4 Exercise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.5 Simplification and transformation of Propositional formulas . . . . . . . . . 26
3.6 Conjunctive and disjunctive normal forms . . . . . . . . . . . . . . . . . . 27
3.7 The Hilbert system for propositional logic . . . . . . . . . . . . . . . . . . 32
3.7.1 Introduction to formal proof systems . . . . . . . . . . . . . . . . . 32
3.7.2 The axiomatic approach to propositional logic . . . . . . . . . . . . 32
3.7.3 Derivation rules and inference rules . . . . . . . . . . . . . . . . . . 32

1
4 First-order predicate logic 32
4.1 Propositional vs. predicate logic . . . . . . . . . . . . . . . . . . . . . . . . 32
4.2 Syntax of first order logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.3 Formulas in First order predicate logic . . . . . . . . . . . . . . . . . . . . 34
4.4 Semantics of first-order predicate logic . . . . . . . . . . . . . . . . . . . . 35
4.5 Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
4.5.1 Universal quantification . . . . . . . . . . . . . . . . . . . . . . . . 37
4.5.2 Existential quantification . . . . . . . . . . . . . . . . . . . . . . . 38
4.5.3 Quantification and logical connectives . . . . . . . . . . . . . . . . . 39
4.5.4 Quantified Formulas of first-order predicate logic . . . . . . . . . . 40
4.5.5 De Morgan’s Laws for Quantifiers . . . . . . . . . . . . . . . . . . . 41
4.5.6 Nested Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

5 Proofs of mathematical theorems 45


5.1 Methods of proving mathematical statements . . . . . . . . . . . . . . . . . 45
5.1.1 Direct method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.1.2 Proof by contrapositive . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.1.3 Proof by contradiction . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.1.4 Proof by cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
5.2 Proving quantified statements . . . . . . . . . . . . . . . . . . . . . . . . . 50
5.2.1 Universally quantified statements . . . . . . . . . . . . . . . . . . . 50
5.2.2 Existentially quantified statements . . . . . . . . . . . . . . . . . . 50
5.2.3 Counterexamples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

6 Sets and relations 51


6.1 Basic concepts of set theory:Sets; Elements; Union and intersection . . . . 51
6.1.1 Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.1.2 Subsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.1.3 Universal set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.1.4 Equality of sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.1.5 The powerset of a set . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.2 Operations on sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

2
6.2.1 Union and intersection . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.2.2 Complements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
6.2.3 Families of sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
6.3 Cartesian products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
6.4 Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
6.4.1 Definition of relations . . . . . . . . . . . . . . . . . . . . . . . . . . 60
6.4.2 Order relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.4.3 Equivalence relations . . . . . . . . . . . . . . . . . . . . . . . . . . 62
6.4.4 Partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
6.4.5 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
6.5 Cardinality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
6.6 Cantor-Schroeder-Bernstein theorem . . . . . . . . . . . . . . . . . . . . . 63

7 Theory of natural numbers 63


7.1 Peano axioms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
7.1.1 Successor function . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
7.1.2 Inductive property . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
7.2 Basic properties of natural numbers: Addition; Multiplication; Division . . 63
7.3 Principle of mathematical induction . . . . . . . . . . . . . . . . . . . . . . 63

3
1 Introduction

2 Propositional logic

2.1 Propositions
Propositional logic is a type of mathematical logic that deals with statements that are
either true or false. In propositional logic, these statements are called propositions, and
they are represented by letters or symbols.
Propositional logic allows us to combine propositions using logical operators (logical
connectives) such as ”and”, ”or”, and ”not”. For example, we can create a new proposition
by joining two propositions with the ”and” connective.
Propositional logic is useful for analyzing arguments and reasoning in a formal way.
It provides a systematic method for determining whether an argument is valid or not by
breaking down complex statements into simpler propositions and analyzing how they are
related to each other.

2.1.1 Syntax and semantic

Definition 2.1. A proposition is an assertion or statement that is either true or false


but not both.

A truth value is a label true or false associated with a given statement, usually
denoted by T and F respectively.

Definition 2.2. A Predicate is a statement that contains one or more variables and
becomes a proposition when specific values are substituted for the variables.

The truth value of a predicate can only be determined if further clarification or


precision is given. For example, consider the statement

x is an even number.

Out of context, with no understanding of the variable x, we cannot assign this statement
a truth value, so by itself, it doesn’t seem to qualify to be a proposition. If, however,
it existed in a context where x had meaning, it could be a proposition. This stress,

4
especially, the importance of definitions in mathematics. Without precise definitions, we
end up with the kind of unverifiable statements like the one above.
Here are some examples

a) There are no integers a and b so that 2 = ab . This is a true proposition.

b) x+5 = 3. This statement is true if x = −2 and false if x represents another numerical


value. It is a predicate if no value of x is assigned.

c) 3 is an even number. This is false proposition.

(Give examples and mention how statements will be represented.

2.2 Logical connectives and truth tables


In first year mathematics, you may have encountered set operations such as union, inter-
section, and complement. These operations involve combining, comparing, and negating
sets. Similarly, in logic, we use logical operators (logical connectives) to combine and
relate propositions. Some logical operators we will look at such as “AND”, “OR”, and
“NOT” can be thought of as analogous to set operations, and are essential building blocks
for writing logical expressions. In this way, understanding logical operators can be seen
as a natural extension of the set operations studied in first year mathematics.
We will represent propositions using letters such as P, Q, R. These letter called
propositional variables. A good way to think of these letters is as variables that can
take the values “True” and “False”.

Definition 2.3 (Negation ). Let P be a proposition. The negation of P , denoted ¬P , is


a proposition that is true when P is false, and false when P is true.

The negation reverses the truth value of a proposition. In other words, if a statement
is true, its negation is false, and if a statement is false, its negation is true. The negation
of a proposition is typically indicated by placing the word “not” in a grammatically
appropriate way to the main verb or adjective.

5
Example 2.4. In each case below the negation of statement P :

a) P=The sky is blue; ¬P =The sky is not blue.

b) P=Paulina is smiling; ¬P =Paulina is not smiling.

c) P= No student fails the first test; ¬P =There is at least one student that fails the
first test.

d) P= 3 − 4 = 0; ¬P = 3 − 4 6= 0.

e) P=2 is an even number; ¬P =2 is not an even number.

f ) P=Every student obtained a C− symbol in their grade 12 Mathematics; ¬P =Some


students did not obtain a C− symbol in their grade 12 Mathematics (or Not every
student obtained a C− symbol in their grade 12 Mathematics).

Remark 2.5. The negation of a statement that has “every” in its language involves
replacing “every” with “not every” or “some not” and making any necessary adjustments
in the statement to preserve its meaning. For example, consider the statement: “Every
cat has fur.” The negation of this statement would be “Not every cat has fur” or “Some
cats do not have fur.” This means that there are some cats that do not have fur, which is
the opposite of the original statement that claims that all cats have fur.

The effect of negation on the truth values of a proposition is summarised in the


following table, called the truth table for ¬. Here the letter T in a column indicates
that the proposition named at the top of the column is true , and F indicates that it is
false. For example, the first row of the table tells us that when P is true, ¬ P is false:

P ¬P
T F
F T

Remark 2.6. We shall use, frequently, the fact that for any proposition P, we have
¬¬P is the same as P; that is, applying the negation operator twice does nothing to a
proposition.

6
Definition 2.7 (Conjunction). Let P and Q be propositions. The conjunction of P and
Q, denoted by P ∧ Q is a proposition that is true when both P and Q are true, and false
in any other condition.

Let us understand the definition above in the following non-mathematical example.

Example 2.8. Consider the proposition “John is a plumber and a footballer”. In order
for this proposition to be true, two things need to BOTH be true. Namely, we need that
John is a plumber AND that John is a footballer. If we take P to be the proposition
“John is a plumber” and take Q to be the proposition “John is a footballer” then the above
proposition can be represented as P ∧ Q. Clearly, it is true only when both P and Q are
true; if either of them is false then P ∧ Q is certainly false as well.

The truth value of P ∧ Q is given in the table below.

P Q P ∧Q
T T T
T F F
F T F
F F F
Note that the truth value of P ∧ Q depends only on the truth values of P and Q,
and there need be no connection between the subject matter of P and Q. For example,
the conjunction
2 is an even number and 5 + 2 = 7

is a true proposition.

Definition 2.9 (Disjunction). Let P and Q be propositions. The disjunction of P and Q,


denoted by P ∨ Q, is a proposition that is true when at least one of P or Q is true, and
false if both P and Q are false.

The word “or” has two usage in standard English, namely, exclusive Or and in-
clusive Or. Exclusive Or returns true only when one of the propositions is true and the
other is false (this does not include when both propositions are true). Inclusive Or on the
other hand returns true when at least one of the propositions is true (this includes when
both propositions are true).

7
For example, consider the propositions: (1) “Lunch is served with rice or veggies”. It
is clear that one is entitled to exactly one of the two choices, that is, either have their lunch
served with rice or with veggies but not both. Thus the “or” in this case is exclusive. (2)
“Students who have passed Mathematical support I with distinction or have an average
above 70% in first year will receive awards”. In this proposition it is understood that if
a student satisfies at least one of the specified conditions, then will receive an award; in
particular, if a student passed Mathematical support I with distinction and also has an
average of 70% in first year, then will still qualify for an award. This “or” is inclusive
since the fulfilment of one requirement includes the possibility that a student may also
fulfill the other.
In much of mathematical work, “or” is used in the inclusive sense (definition of
disjunction above) unless explicitly stated otherwise. Hence we will generally not use
exclusive Or much in developing our understanding of propositional logic. Therefore our
convention going forward is “P or Q” is true when P is true, Q is true, or both P and Q
are true, and false only when both P and Q are false

P Q P ∨Q
T T T
T F T
F T T
F F F
In propositional logic, a truth function is a function that assigns a truth value (either
“true” or “false”) to a proposition or a compound proposition (also known as a logical
expression), based on the truth values of its component propositions and the logical
connectives that link them

2.2.1 Propositional formulas

Armed with the three basic logic operators, that is negation, conjuction and disjunction,
one can now determined the truth value of more complex propositions. At the core of
this process is the notion of atomic proposition defined below.

Definition 2.10. An atomic proposition is a proposition that cannot be broken further

8
into smaller propositions.

The truth value of a complex proposition depends on the truth values of its atomic
propositions, and the logical operators used to combine them.
Let us consider the following example.

Example 2.11. Let x be an integer. Consider the following proposition about x :

“x is positive and odd, or x is negative and odd.”

Let’s consider how we can represent this as a combination of atomic propositions and
logical operators. Firstly, the atomic propositions have to be identified in the statement
and assign them proprositional variables:

P: x is positive

Q: x is negative

R: x is odd

Then we can read our proposition as

P and R, or Q and R.

Replacing words “and ” and “or” with the symbols ∧ and ∨ respectively, we can rewrite
the proposition as
(P ∧ Q) ∨ (Q ∧ R)

and determine its truth value.

Remark 2.12. In the previous example, parentheses () are introduced to avoid ambiguity
and ensure that the proposition is evaluated correctly. Therefore, parentheses are used to
clarify the order of operations when evaluating a complex proposition. They indicate which
logical operations should be performed first, similar to the use of parentheses in arithmetic
expressions.

For example, using the propositional variables P, Q, and R in Example 2.11, in the
statement P ∧ R ∨ Q it is not clear if one must first compute R ∨ Q and then P ∧ (R ∨ Q)

9
or one must first work out P ∧ R and then (P ∧ R) ∨ Q, and both (P ∧ R) ∨ Q and
P ∧ (R ∨ Q) have different sentential forms ( that is when propositional variables are
replaced by explicit words); “ x is positive and odd, or x is negative” and “ x is positive,
and x is negative or odd”, respectively. So if we take, for example, x = −2 then (P ∧R)∨Q
is true and P ∧ (R ∨ Q) is false.
When a much more complex proposition is represented using propositional variables,
parentheses and logical operators it is called a propositional formulae.
Some example of propositional formulas constructed using propositional variables
and the logical operators studied so far, are such as:

¬(P ∧ Q), ¬P ∨ Q, (¬P ∨ Q) ∧ R, ¬((P ∧ Q) ∨ (Q ∧ R)), (¬P ∨ Q) ∧ ¬(¬R), ¬(¬(¬P )).

Example 2.13. Determine the truth values of each of the following propositional formu-
las.

a) P ∨ (¬Q ∧ P ).

b) ¬(¬P ∧ Q) ∨ (P ∨ Q).

c) P ∨ (¬Q ∧ (¬P ∨ Q)).

Solution
a)
P Q ¬Q ¬Q ∧ P P ∨ (¬Q ∧ P )
T T F F T
T F T T T
F T F F F
F F T F F
b)
P Q ¬P ¬P ∧ Q ¬(¬P ∧ Q) P ∨ Q ¬(¬P ∧ Q) ∨ (P ∨ Q)
T T F F T T T
T F F F T T T
F T T T F T T
F F T F T F T

10
c)
P Q ¬P ¬Q ¬P ∨ Q ¬Q ∧ (¬P ∨ Q) P ∨ (¬Q ∧ (¬P ∨ Q))
T T F F T F T
T F F T F F T
F T T F T F F
F F T T T T T

Remark 2.14. In Example 2.13 notice that there are 2 columns to the left in every truth
table, enumerating the various possibilities for the propositional variables P and Q. To the
right, the column we care about is the last. The intermediary columns are included simply
to help us do the calculation; these columns are not necessary at all, and the truth table
would be equally correct without them.

2.2.2 Logical equivalence

Next we explain what it means for two propositional formulas to be “equivalent”.

Definition 2.15. Two propositional formulae are called logically equivalent if the two
propositions give the same truth value, regardless of the truth values of the propositional
variables from which they are constructed.

For example, the propositional formulas R ∧ (P ∨ Q) and (R ∧ P ) ∨ (R ∧ Q) are


logically equivalent. Note that in set-theoretical language when ∧ and ∨ are replaced by
∩ and ∪ respectively, the two formulae become set-theoretically equal.

R P Q R ∧ P R ∧ Q R ∧ (P ∨ Q) P ∨ Q (R ∧ P ) ∨ (R ∧ Q)
T T T T T T T T
T T F T F T T T
T F T F T T T T
F T T F F F T F
T F F F F F F F
F T F F F F T F
F F T F F F T F
F F F F F F T F

11
Notice that the two columns of R ∧ (P ∨ Q) and (R ∧ P ) ∨ (R ∧ Q) have the same
truth values, and hence, as expected, the two are propositional formulae are logically
equivalent. The notation ⇔ (or ≡) is used to denote logical equivalence, so we can write
R ∧ (P ∨ Q) ⇔ (R ∧ P ) ∨ (R ∧ Q).

2.2.3 Conditional and biconditional logical operators

The final logical operators we shall consider are conditional and biconditional operators,
also called impli cation operators.
Definition 2.16. Let P and Q be propositions. The proposition P → Q is false if P ∧ ¬Q
is true, and is true otherwise. The operator → is called the conditional operator or
implicative operator, and the proposition P → Q is called conditional proposition
or implication. The statement P is called the hypothesis of the implication and the
statement Q is called the conclusion of the implication.
Note that we read or speak the proposition P → Q as “P implies Q” or “if P then
Q.” In plain English, the proposition should be true if, whenever P is true, we must have
that Q is also true. This means that it is not true that P is true and Q is false. Therefore,
P → Q is logical equivalent to ¬(P ∧ ¬Q). Thus, P → Q is true when ¬(P ∧ ¬Q) is true,
and false when ¬(¬(P ∧ ¬Q)) ⇔ P ∧ ¬Q is true, i.e. the only way for the proposition
P → Q to fail to be true is when P is true and Q is not. In summary, we have

P → Q ⇔ ¬(P ∧ ¬Q) ⇔ ¬P ∨ Q.

An important note from the equivalence above is that the truth value of P → Q is
true in the case that P is false, regardless of what Q does.
Remark 2.17. The statement P → Q may also read as “P is sufficient for Q” and “Q
is necessary for P”. Other phrasings are “P only if Q,” and “Q if P”.
Below is the truth table of P → Q.
P Q P →Q
T T T
T F F
F T T
F F T

12
2.2.4 Converse and Contrapositive

The implication P ← Q is called the converse of P → Q. As shown in the example


below, an implication and its converse can have different truth values, and therefore can
not be regarded as the same.
For example, the converse of the implication “ if n is a prime number then n ≥ 2”
is the statement “if n ≥ 2 then n is a prime number”. Clearly, the implication “if n is
a prime number then n ≥ 2” is true, however its converse statement is not true, as for
example, 4 ≥ 2 but 4 is not a prime number.
The contrapositive of the implication P → Q is ¬Q → ¬P . We will notice that
the implication P → Q and its contrapositive ¬Q → ¬P have exactly the same truth
table, that is, they are each true for exactly the same truth values of P and Q. Hence
they are logically equivalent. For example, the contrapositive of the implication “ if n is
a prime number then n ≥ 2” is “ if n is not greater than or equal 2 then n is not a prime
number”, or equivalently, “if n < 2 then n is not a prime number”.

Converse Implication Contrapositive


P Q P ←Q P →Q ¬Q ¬P ¬Q → ¬P
T T T T F F T
T F T F T F F
F T F T F T T
F F T T T T T

Definition 2.18. Let P and Q be propositions. The proposition P ↔ Q is true if P


and Q always have the same truth value. The operator ↔ is called the biconditional
operator, or bi-implicative operator.

The proposition P ↔ Q is called biconditional proposition or double implica-


tion, and it reads as “P if and only if Q”.
Note that P ↔ Q is logical equivalent to (P → Q) ∧ (P ← Q) as seen in truth table
below:

13
P Q P ↔ Q P → Q P ← Q (P → Q) ∧ (P ← Q)
T T T T T T
T F F F T F
F T F T F F
F F T T T T

2.2.5 Tautologies, Contradiction & Contigences

Definition 2.19. A propositional formula is called a tautology if the formula is true,


regardless of the truth values of the propositional variables from which it is constructed.
Such a formula may be referred to as tautologically true.

Consider the formula (P ∨ ¬P ). As seen in the truth table below

P ¬P P ∨ ¬P
T F T
F T T

the propositional formula (P ∨¬P ) is a tautology because it is always true, no matter


what truth values are assigned to the proposition P.
Another example of a tautology is the logical expression ¬(P ∧ ¬P ), which is equiv-
alent to the earlier example. This expression asserts that it is not the case that both P
and “not P” are true simultaneously, which is always true, because it is impossible for
both “P” and ”not P” to be true at the same time.
From the truth table below, it can also be seen that the formula (P → (Q → P )) is
a tautology.

P Q Q → P P → (Q → P )
T T T T
T F T T
F T F T
F F T T
Tautologies are important in propositional logic because they serve as the basis for
many logical deductions and proofs. Any proposition that can be derived from a set of

14
tautologies must itself be true, since it follows logically from premises that are always
true.

Definition 2.20. A contradiction is a proposition formula (or a logical expression) that


is always false, regardless of the truth values of its propositions. Put another way, a
contradiction is a statement that is false under all possible interpretations of its constituent
propositions.

For example, the logical expression “(P ∧ ¬P )” is a contradiction because it is always


false, no matter what truth values are assigned to the proposition “P”. This is because the
expression asserts that both “P” and “not P” are true simultaneously, which is impossible,
since “P” and “not P” are mutually exclusive.

P ¬P P ∧ ¬P
T F F
F T F
As seen below, the proposition ¬((P ∨ Q) ↔ (Q ∨ P )) is a contradiction.

P Q (P ∨ Q) ((P ∨ Q) ↔ (Q ∨ P )) ¬((P ∨ Q) ↔ (Q ∨ P ))
T T T T F
T F T T F
F T T T F
F F F T F

Remark 2.21. It is a common practice to denote a statement that is always false (i.e. a
contradiction) by 0 and denote a statement that is always true (i.e. a tautology) by 1.

Definition 2.22. A formula is contigent if the final column in its truth table has both
T 0 s and F 0 s.

15
The following examples of contingencies can be verified with truth tables

i) P

ii) (P ∨ P )

iii) (P ∨ Q) → Q

iv) (P → Q) → P.

2.3 Laws of Logic


We now set out to develop an algebra of propositions. To do so, we need some basic
operations (logical equivalences) that can be used. Each of the following can be verified
(proved) with a truth table.

Equivalence
Idempotent Laws P ∨P ⇔P
P ∧P ⇔P
Commutative Laws P ∨Q⇔Q∨P
P ∧Q⇔Q∧P
Associative Laws (P ∨ Q) ∨ R ⇔ P ∨ (Q ∨ R)
(P ∧ Q) ∧ R ⇔ P ∧ (Q ∧ R)
Distributive Laws P ∨ (Q ∧ R) ⇔ (P ∨ Q) ∧ (P ∨ R)
P ∧ (Q ∨ R) ⇔ (P ∧ Q) ∨ (P ∧ R)
De Morgan’s Laws ¬(P ∨ Q) ⇔ ¬P ∧ ¬Q
¬(P ∧ Q) ⇔ ¬P ∨ ¬Q
Double Negation Law ¬(¬P ) ⇔ P
Contrapositive Law P → Q ⇔ ¬Q → ¬P
Law of Implication P → Q ⇔ ¬P ∨ Q
Identity Laws P ∧1⇔P
P ∨0⇔P
Dominance Laws P ∧0⇔0
P ∨1⇔1

16
2.4 Exercise

17
3 Deductions and normal forms

3.1 Logical implication


A statement P logically implies a statement Q if the truth of P guarantees the truth of
Q. This happens exactly 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, i.e. if
P is true then Q is also true (so P → Q is a tautology).
Note that P ⇔ Q means P ⇒ Q and P ⇐ Q.
Example, (give an example of no logical implication due to implication not being a
tautology).

3.2 Valid and invalid arguments


An argument is an implication (P1 ∧ P2 ∧ ... ∧ Pn ) → Q. The statements P1 , P2 , ..., Pn
are called premises (or assumptions), and the statement Q is called the conclusion.
Since the truth table for implies (→) says that an implication is true when its hypothesis
is false, and since the hypothesis is the conjunction of all of the premises, when any one of
the premises is false, the argument is automatically true. Thus, the truth of an argument
is determined by whether when all premises are true implies the conclusion is true or not.
Therefore, an argument is a tautology when all premises are true implies the conclusion
is true.
An argument is called valid if whenever true propositions are substituted in for the
propositional variables the conclusion is always true, i.e. the conclusion is guaranteed to
be true when all of the hypotheses are true), otherwise it is invalid. When a conclusion
is reached using a valid argument, we say the conclusion is inferred or deduced from
the premises.
To show that an argument is invalid, it needs to be demonstrated that the implication
is not a tautology. From the truth table for implies, this amounts to describing a single row
of a truth table where each premise is true and the conclusion is false. Such a collection
of truth values is called a counterexample to the argument.

18
Arguments are usually presented in the tabular format shown below; for example,
(P1 ∧ P2 ∧ ... ∧ Pn ) → Q is represented as

P1
P2
P3
..
.
Pn
∴Q

The premises are listed first and then the conclusion is listed below a separating line.
We write (P1 ∧P2 ∧...∧Pn ) ⇒ Q to indicate that the argument (P1 ∧P2 ∧...∧Pn ) → Q
is valid.

Remark 3.1. To test whether or not an argument is valid, we do the following:

i) Identify the premises and the conclusion

ii) Construct a truth table showing the truth values of the premises and the conclusion

iii) Look for all the rows where the premises are all true - we call such rows critical
rows. If the conclusion is false in a critical row, then the argument is invalid. Oth-
erwise, the argument is valid (since the conclusion is always true when the premises
are true).

Example 3.2. Determine whether the following arguments are valid.


i)

P →Q
Q→R
∴P ∨Q→R

ii)

19
P ∨Q
P → ¬Q
P →R
∴R

Solution
i) Constructing the truth table, we have:

premises premises conclusion


P Q R P →Q Q→R P ∨Q P ∨Q→R
→ T T T T T T T
T T F T F T F
→ F T T T T T T
T F T F T T T
T F F F T T F
F T F T F T F
→ F F T T T F T
→ F F F T T F T

The critical rows (i.e. where the premises are all true) are marked with arrows →. Notice
that all critical rows have a true conclusion and thus the argument is valid. ii) Construct-
ing the truth table, we have:

premises premises premises conclusion


P Q R P → ¬Q P →R P ∨Q R
T T T F T T T
T T F F F T F
→ F T T T T T T
→ T F T T T T T
T F F T F T F
→ F T F T T T F
F F T T T F T
F F F T T F F

20
Notice that the 6th row is a critical row with a false conclusion, so it follows that the the
argument is invalid.

Remark 3.3. In logic, the words “true” and “valid” have very different meanings - truth
is talking about the statements making up an argument and validity is talking about whether
the conclusion follows from the premises. Note that a perfectly valid argument may have
a false conclusion depending upon the truth value of the premises. Likewise, an invalid
argument may have a true conclusion depending upon the truth value of the premises.

3.3 Rules of inferences


The method of using truth tables to prove facts about propositional formulas can be a
very tedious procedure, especially if the formulas contain many propositional variables.
Truth tables become impractical and inefficient when dealing with complex propositions
or arguments that involve many variables. As the number of variables increases, the
number of rows in the truth table grows exponentially, making it difficult to manage and
analyse.
We shall now consider some standard valid argument forms. A valid argument is
sometimes called a rule of inference since the conclusion can always be inferred from
the hypothesis. We shall list the valid arguments and once they have all been stated,
we shall consider some examples of how to use these arguments in proofs: A chain of
logical equivalences and implications involving the premises (which are assumed to be
true because an implication is true when its hypothesis is false).
The idea of writing a mathematical proof is that every statement you write down
is true, and is either a premise, or an allowed additional hypothesis, or is derived from
statements known to be true via logical equivalences and implications.
Our ultimate goal is to write mathematical proofs in words. Proving logical implica-
tions using inference rules and logical equivalences is a step towards that goal.
The two following inference rules are logical implications (i.e. valid arguments).

21
Rule 1. Modus Ponens (or Law of detachment) :P ∧ (P → Q) ⇒ Q. Written in tabular
form
P
P →Q
∴Q
In words, Modus Ponens means: if P is true and it is also true that P implies Q,
then Q is also true.

Rule 2. Chain rule( or Law of Syllogism): (P → Q) ∧ (Q → R) ⇒ (P → R). Written in


tabular form

P →Q
Q→R
∴P →R
In words: If it is true that P implies Q and it is true that Q implies R, then it is
also true that P implies R.
To prove, using truth tables, that Rule 1 and Rule 2 are valid, it is left as an exercise.
We will use Rule 1 and Rule 2 to prove other rules without truth tables.

Rule 3. Modus Tollens: (P → Q) ∧ ¬Q) ⇒ ¬P In words: If it is true that P implies Q, then


P is false whenever Q is false.

Proof. In the proof, every numbered statement is true and the reason why it is true
is explained on the right. The proof ends when we obtain that the conclusion is
true.

1. P →Q Given as a premises
2. ¬Q → ¬P Logically equivalent to 1 (or contrapositive of 1)
3. ¬Q Given as a premises
4. ¬P Follows by applying Modus Ponens to 2 & 3

22
Rule 4. Simplification: P ∧ Q ⇒ P and P ∧ Q ⇒ Q. Note that some valid arguments are
presented more conveniently in tabular form. For example, Rule 4 can be presented
as
P ∧Q
∴ P, Q
This rule is obviously true from the truth table.

Rule 5. Consolidation
P
Q
∴P ∧Q
This rule is obviously true from the truth table.

Rule 6. Addition

P
∴P ∨Q
This rule follows from the simple fact that once we know that one part of an ∨ is
true then the truth of the ∨ automatically follows.

Rule 7. Elimination (P ∨ Q) ∧ ¬Q ⇒ P .

P ∨Q
¬Q
∴P
This rule just describes the fact that if one of the statements in an ∨ is false then
the other must be true in order for the disjunction ∨ to be true.

Proof.
1. P ∨Q Given as a premises
2. ¬Q → P Logically equivalent to 1
3. ¬Q Given as a premises
4. P Follows by applying Modus Ponens to 2 & 3

23
Rule 8. Proof by cases: (P → R) ∧ (Q → R) ⇒ (P ∨ Q) → R

P →R
Q→R
∴P ∨Q→R

Proof.

1. P →R Premises
2. Q→R Premises
3. P ∨Q Assumption
4. ¬P → Q L.E 3
5. ¬P → R Chain rule to 4 & 2
6. ¬R → P Contapositive of 5
7. ¬R Assumption; R is equivalent to ¬R → R.
8. ¬R → ¬P Contrapostive of 1
9. ¬P Modun Ponens to 7& 8
10. Q Modus Ponens to 9& 4
11. R Modus Ponens to 10 & 2

Rule 9. Direct proof


P ⇒Q
∴P →Q

The direct proof method is a common method of proof in mathematics that aims to
establish the truth of a statement by directly demonstrating that it follows logically
from certain assumptions or previously proven statements.
To use the direct proof method to prove the implication P → Q, you start with a
special line on your proof to assume P is true, you then use logical reasoning and
deductive arguments to come up with a line that says Q is true. In other words,
you assume the premise to be true, apply some logical reasoning, and then conclude
with the statement you want to prove. If the conclusion follows logically from the

24
premises, then the proof is considered valid. Notice that the entire portion of the
proof between when we assumed P and when we derived Q may depend on the
assumption that P is true. When Q is shown to be true we can conclude, using the
direct proof rule, that P → Q follows.

Rule 10. Proof by contradiction (¬P → 0) ⇒ P

¬P → 0
∴P
If you can show that the hypothesis that P is false leads to a contradiction, then P
has to be true. To prove that a statement P is true using Proof by contradiction,
you assume that P is not true, i.e. ¬P is true. Then use logical equivalences and
logical implications to obtain a contradiction, that is, a statement known to be
always false.
The proof can be seen from the truth table below.

P 0 ¬P → 0
→ T F T
F F F

3.4 Exercise
The ultimate goal is to write mathematical proofs in words. Most of mathematical state-
ments can be expressed as a logical implication P ⇒ Q. According to the inference rules
discussed above, one may prove an implication is by 1). Direct method; 2.) Direct method
on the contrapositive; 3.) Proof by contradiction. Using direct method, one starts by as-
suming that P is true and then show that Q is true. Similarly, using the Direct method on
contrapositive, one assumes P is false and then shows that Q is also false. Using Proof by
contradiction, one assumes P is true and shows that this leads to a false known statement.
Here are some general steps to follow when writing a mathematical proof in words:

1. Begin by stating the statement or theorem that you are trying to prove. This will
help you to stay focused on the goal of the proof.

25
2. Clearly state any assumptions that you are making in the proof. These should be
based on the definitions and logical relationships that are relevant to the statement.

3. Use logical inference rules to show how each step in the proof follows logically from
the previous one. This involves identifying the logical relationship between each
step and the assumptions that were made.

4. Use logical equivalences to simplify the proof and make it easier to follow. This
involves identifying logical relationships between different elements of the statement
and using these relationships to rewrite the proof in a more concise and clear way.

5. Be sure to use precise and concise language when writing the proof. This will help
to make the proof more understandable and easier to follow.

6. Finally, review the proof to ensure that it is complete and accurate. This involves
checking that all of the assumptions have been used correctly and that the logical
relationships between each step are sound.

3.5 Simplification and transformation of Propositional formulas


Definition 3.4. A mathematical proof is a rigorous and logical argument that demon-
strates the truth of a mathematical statement. It is a process of reasoning that shows
why a particular statement is true based on a set of axioms, definitions, and previously
established results or theorems.

A mathematical proof typically involves a series of logical steps, starting from a set
of assumptions or premises, and leading to a conclusion that follows logically from those
assumptions. The process of proving a statement or theorem can involve a variety of
techniques and strategies, that will be discussed in this section.
The goal of a mathematical proof is to provide a convincing and rigorous argument
that the statement or theorem being proved is true, and to eliminate any possibility of
doubt or ambiguity. A well-written mathematical proof is clear, concise, and easy to
follow, and it provides a complete and convincing explanation of why the statement or
theorem being proved is true.
For example, prove that the sum of two odd numbers is an even number.

26
Proof. Let n and m be two odd numbers. Then n and m are of the form n = 2k + 1 and
m = 2p + 1, for some k, p ∈ Z. Thus, n + m = 2k + 1 + 2p + 1 = 2(k + p + 2) = 2q, where
q = k + p + 2. Hence, n + m is an even number since it is a multiple of 2.

The underlying logic of the proof is choosing n and m to be the odd integers and use
definition of an odd integer to express n = 2k + 1 and m = 2p + 1, and then proving the
implication P ⇒ Q, where

P = “n = 2k + 1 and m = 2p + 100 ⇒ Q = “n + m = 2q 00 ,

is true.
Note that the statement “the sum of two odd numbers is an even number” can be
rephrased into an equivalent implication: “if n and m are odd numbers then n + m is
even”. In order to show P ⇒ Q is true, where P=“n and m are odd” and Q=“ n + m is
even”, we add a special line to our proof in which we assume P to be true. We then use
all the laws of inference and all the propositions that we have on previous lines in order
to come up with a line that says that Q must be true. Put in words:

Proof. Assume n and m are odd numbers. Then n = 2k + 1 and m = 2p + 1, for some
k, p ∈ Z. Now n + m = 2k + 1 + 2p + 1 = 2(k + p + 2) = 2q, which shows that n + m is
an even number.

3.6 Conjunctive and disjunctive normal forms


From the laws of logic, it can be noticed that any statement is logically equivalent to
one that uses only the connectives ∧, ¬ and ∨. The logical equivalences allow statements
involving, for instance, the logical connectives → and ↔ to be replaced by equivalent
statements that use only ∧, ¬ and ∨.
Given a statement S derived from sub formulas involving P and Q in a truth table, it
is possible to find a statement with variables P and Q that uses only the connectives ∧, ¬
and ∨, that is logically equivalent to S. For example, let S be the statement involving P
and Q for which the truth table is given below.

27
P Q S
Row 1 T T T
T F F
Row 3 F T T
Row 4 F F T
First, for each row of the truth table where the statement S is true, write a statement
that’s true only when P and Q have the truth values in that row. This statement will
involve the logical connective ∧ and ¬. We obtain

Row 1: P ∧ Q

Row 3: ¬P ∧ Q

Row 4: ¬P ∧ ¬Q

Now, to get an expression that is 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 (that is, Row 1 or Row 3 or Row 4). Thus, S is
logically equivalent to (P ∧ Q) ∨ (¬P ∧ Q) ∨ (¬P ∧ ¬Q) as seen in the truth table below

P Q S P ∧ Q ¬P ∧ Q ¬P ∧ ¬Q) (P ∧ Q) ∨ (¬P ∧ Q) ∨ (¬P ∧ ¬Q)


Row 1 T T T T F F T
T F F F F F F
Row 3 F T T F T F T
Row 4 F F T F F T T

The process is exactly the same if there are more than two statements P, Q, R, T involved.
There is some terminology and an important fact associated with what we have done.
The expressions (P ∧ Q), (¬P ∧ Q), and (¬P ∧ ¬Q) associated with each row of the truth
table is called a minterm. The compound statement (P ∧ Q) ∨ (¬P ∧ Q) ∨ (¬P ∧ ¬Q)
derived using the process consists of the disjunction of a collection of minterms, where
each minters is conjuctive of variables, is called the disjunctive normal form (DNF) of
the statement S.

28
Example 3.5. The following formulas are written in disjunctive normal form

a) (P ∧ ¬Q) ∨ (¬P ∧ ¬Q) ∨ (P ∧ Q)

b) (P ∧ Q ∧ R) ∨ (P ∧ Q ∧ ¬R) ∨ (¬P ∧ Q ∧ R) ∨ (¬P ∧ ¬Q ∧ R)

c) P ∧ Q

d) (P ∧ ¬Q ∧ R) ∨ (¬Q ∧ ¬R)

e) (P ∧ Q ∧ ¬R ∧ S) ∨ (¬Q ∧ S) ∨ (P ∧ S).

Since every statement has a truth table, and every truth table leads to a statement
constructed as above, a consequence of the procedure just described is the theorem that
every statement is logically equivalent to one that is in disjunctive normal form.
It can be observed directly from the truth table that

S ⇔ P →Q
⇔ ¬P ∨ Q.
The principle that things that are logically equivalent to the same statement are
logically equivalent to each other now implies it should be true that

¬P ∨ Q ⇔ (P ∧ Q) ∨ (¬P ∧ Q) ∨ (¬P ∧ ¬Q).

This can be even shown with the Laws of logic as follows:

(P ∧ Q) ∨ (¬P ∧ Q) ∨ (¬P ∧ ¬Q) ⇔ (P ∧ Q) ∨ (¬P ∧ (Q ∨ ¬Q)) Distributive laws


⇔ (P ∧ Q) ∨ (¬P ∧ 1) Identity laws
⇔ (P ∧ Q) ∨ ¬P Dominance law
⇔ (¬P ∨ P ) ∧ (¬P ∨ Q) Commutative and Distributive
⇔ 1 ∧ (¬P ∨ Q) Identity laws
⇔ ¬P ∨ Q Dominance law.

Remark 3.6. The DNF of a given formula is not unique, that is, for a given propositional
formula, there can be more than one logically equivalent disjunctive normal forms.

29
There is another method to obtain a DNF of a given formula without using the
truth table method described above. This method mostly applies to formulas involving
implications → and biconditionals ↔. The idea is that if a given formula contains → and
↔, then (1)replace it with an equivalent formula that contains ∨, ∧, ¬. (2) Use the laws
of logic to obtain a logically equivalent formula in DNF. We illustrate this method in the
example below.

Example 3.7. For each of the following formulas, find the logically equivalent disjunctive
normal form

a) P ∧ (P → Q)

b) ¬(P → (Q ∧ R))

Solution

a)
P ∧ (P → Q) ⇔ P ∧ (¬P ∨ Q)
⇔ (P ∧ ¬P ) ∨ (P ∧ Q) Distributive law
⇔ 0 ∨ (P ∧ Q) P ∧ ¬P ⇔ 0
⇔ (P ∧ Q) Identity laws
Thus, (P ∧ Q) is an logically equivalent DNF of P ∧ (P → Q).

b)

¬(P → (Q ∧ R)) ⇔ ¬(¬P ∨ (Q ∧ R))


⇔ ¬((¬P ∨ Q) ∧ (¬P ∨ R)) Distributive law
⇔ (P ∧ ¬Q) ∨ (P ∧ ¬R) De Morgan’s laws
⇔ (P ∧ ¬Q ∧ 1) ∨ (P ∧ ¬R ∧ 1) Dominance laws
⇔ ((P ∧ ¬Q) ∧ (R ∨ ¬R)) ∨ ((P ∧ ¬R) ∧ (Q ∨ ¬Q)) Introducing missing terms
⇔ (P ∧ ¬Q ∧ R) ∨ (P ∧ ¬Q ∧ ¬R) ∨ (P ∧ ¬R ∧ Q) ∨ (P ∧ ¬R ∧ ¬Q) Distributive law.

So, the DNF equivalence of the formula ¬(P → (Q ∧ R)) is

(P ∧ ¬Q ∧ R) ∨ (P ∧ ¬Q ∧ ¬R) ∨ (P ∧ ¬R ∧ Q) ∨ (P ∧ ¬R ∧ ¬Q).

30
In a similar way, a logical expression is in Conjunctive normal form (CNF) if it
is a conjunction of minterms, where each minterm is a disjunction of variables.

Example 3.8. The following formulas are in CNF.

a) P ∨ Q

b) (P ∨ Q) ∧ (¬P ∨ Q) ∧ (P ∨ ¬Q)

c) (P ∨ Q ∨ R) ∧ (¬P ∨ Q ∨ ¬R) ∧ (P ∨ ¬Q ∨ R)

d) (P ∨ R) ∧ (¬Q ∨ ¬R) ∧ Q

e) (P ∨ Q ∨ ¬R ∨ S) ∧ (¬Q ∨ S) ∧ ¬S.

Like with DNF, a truth table can be used to obtain a CNF of a given formula. However, for
CNF the rows of interest are those where the formula is false. If S is a formula consisting
of variables P and Q, for each row where S is false, write a minterm that is false only
when P and Q have the truth values in that row, and each minterm is a disjunction of
variables. A CNF is then obtained by taking conjunction of minterms.
For example, consider the statement P ↔ Q. Its truth table is given below

P Q P ↔Q
T T T
Row 2 T F F
Row 3 F T F
F F T

The rows of interest are Row 2 and Row 3. For Row 2, the minterm is ¬P ∨ Q and for
Row 3, the minterm is P ∨ ¬Q. Therefore, the CNF equivalence of P ↔ Q is

(¬P ∨ Q) ∧ (P ∨ ¬Q).

It is left as an exercise to check via the truth table that (¬P ∨ Q) ∧ (P ∨ ¬Q) is indeed
logically equivalent to P ↔ Q.

31
Another method to obtain a CNF of given formula is by replacing statements con-
taining → and ↔ with equivalent statements involving ∨, ∧, ¬ and then use the laws of
logic (mostly distributive laws).
For example, lets obtain the CNF of the previous formula P ↔ Q without using the
truth table.

P ↔Q ⇔ (P → Q) ∧ (Q → P )
⇔ (¬P ∨ Q) ∧ (¬Q ∨ P )
Hence the desired format.

Example 3.9. Find a CNF of each of the following formulas with or without using truth
table.

a) ¬(P ↔ Q)

b) (P → Q) → (¬R → Q)

c) ¬((¬P → ¬Q) ∧ ¬R)

d) (P → Q) → (¬R ∧ Q).

3.7 The Hilbert system for propositional logic


3.7.1 Introduction to formal proof systems

3.7.2 The axiomatic approach to propositional logic

3.7.3 Derivation rules and inference rules

4 First-order predicate logic

4.1 Propositional vs. predicate logic


So far, we studied the simplest form of logic called propositional logic. However as widely
known, for some applications, propositional logic is not expressive enough. On the other
hand, first-order logic is more expressive: allows representing more complex facts and
making more sophisticated inferences.

32
For instance, consider the statement “Anyone who is registered for the course Set &
Logic in 2023 is a first year student”. From this, we should be able to conclude “If Joe
is registered for the course Set & Logic in 2023, he is a first year student”. Similarly, we
should be able to conclude “If Rachel is registered for the course Set & Logic in 2023,
she is a first year student” and “ Mia is not a first year student, therefore Mia is not
registered for Set & Logic” . But propositional logic can’t handle such kind of inferences
because we cannot talk about concepts like “anyone” , “everyone”, “someone” etc.
Our target is to be able to make such inferences as well as determining the truth
value of statement such as “Anyone who is registered for the course Set & Logic in 2023
is a first year student”. For this, we should understand First-order logic ( also known
as predicate logic).

4.2 Syntax of first order logic


In propositional logic we take propositions P, Q, R and build sentences using logical
connectives, namely, AND, OR, NOT, (BI)-IMPLICATION. So the building blocks of
propositional logic are propositions.
In first-order logic, there are three kinds of basic building blocks: constants, vari-
ables, and predicates.

Constants: refer to specific objects (in a universe of discourse). For example, Set & Logic,
UNAM, 5, Maria, Windhoek,..

Variables: range over objects (in a universe of discourse) and is usually denoted using variables
like x, y, z etc. For example, if the universe of discourse is Towns in Namibia, x
can represent Windhoek, Walvis bay, Swakopmund, Oshakati, Opuwo, Mariental,
Keetmanshop, Rundu etc.

Predicates: describe properties of objects or relationships between objects. For example, isfunny,
betterthan, loves, >. Predicates can be applied to both constants and variables: for
example, isfunny(Paulina), betterthan(x,y), loves(Paulus, Rachel), x > 2 . In the
statement “isfunny(Paulina)” , Paulina is a constant and isfunny is the predicate.
So here the predicate isfunny describes a property of a constant Paulina. In bet-
terthan(x,y), the predicate betterthan expresses a relationship between variables x

33
and y. In x > 2 the predicate > expresses relationship between variables x and
constant 2.

It is a common practise to denote predicates with P, Q, R, F and when it is applied


to a constant a or variables x, y, one writes P (a), P (x, y), Q(y) etc. For example, if
P=betterthan, and x, y are variables, in english the statement P(x,y) reads as “ x is
better than y”. If Q=isfunny and a=Paulina, then Q(a) reads as “ Paulina is funny”. A
statement Q(x) means “someone is funny” , here we use “someone” since x is a variable
or simply put “x is funny”.
In the statement P(x,y), the subject x is related to y by the predicate P . While in
the statement Q(x) the subject x is described by the predicate Q.
Truth values of predicates A predicate P(a) is true or false depending on whether
property P holds for a constant a. For example, isfunny(Paulina) is true if Paulina is
happy but false otherwise.
Note that the truth value of a statement Q(x) cannot be determined unless a variable
x is specified. In fact, when a predicate is applied to a constant it becomes a proposition,
while when it is applied to a variable it remains a predicate in the sense of propositional
logic. However, we will discuss below that in first order logic, the truth value of Q(x) can
be determined under certain “interpretations”.

Example 4.1. a) Consider the predicate Q=isodd which represents if a number is


odd. Determine the truth value of Q(2), Q(1), and Q(x).

b) Let Q(x, y) represents x > y. What is the truth value of Q(2, 1), Q(1, 2), Q(3, 0)?

Solution:
a) The truth value of Q(2) is false since 2 is not odd; Q(1) is true; and Q(x) has no truth
value since x is a variable.
b) The truth value of Q(2, 1) is true; Q(1, 2) is false; Q(3, 0) is true.

4.3 Formulas in First order predicate logic


Recall that in propositional logic, formulas are formed using atomic propositions and
logical connectives. In first-order logic, formulas are formed using predicates and logical

34
connectives.
The following are formulas in first order logic.
a) Q(2)
b) Q(x)
c) P(x) ∨ Q(x)
d) (Q(x) → ¬ P(x)) ∧ F(x)
e) ¬Q(x, y) ∨ P (y).

Remark 4.2. A formula of first order logic Q(x, y) is called a relation; it relates x to y
by Q. Such formulas are said to have arity of 2. Example, if Q represents “greaterthan”,
then Q(x, y) represents “x is greater than y”.
A formula Q(x) applied to one variable is said to have rarity of 1. It represents a
property. Example, if Q represents “iseven”, then Q(x) represents “ x is an even number”.

4.4 Semantics of first-order predicate logic


In propositonal logic, the truth value of formula depends on a truth assignment to the
propositional variables. In first order logic, truth value of a formula depends on inter-
pretation I of predicate symbols and variables over some domain D. That is, given a
formula Q(x) in first order logic, its truth valued is determined by giving the domain (set
of entities ) to which variables and constants belong and are specified, and predicate Q is
interpreted as true or false over the domain.

Example 4.3.

Consider a first order logic formula ¬Q(x) over domain D = {◦, ?}. The interpreta-
tion I over domain D is given below

a) Q(◦) =true, Q(?) =false.

b) x = ?.

The truth value of ¬Q(x) is true when Q(x) is false, and is false when Q(x) is true.
Now since x = ? and Q(?) is interpreted as false, it follows that ¬Q(x) is a true formula
of first order logic. Note that if x was interpreted x = ◦, then Q(x) would be a false
formula of first order logic.

35
Example 4.4.

Consider interpretation I over domain D = {1, 2}

i) P (1, 1) = P (1, 2) = true, P (2, 1) = P (2, 2) =false.

ii) Q(1) = false, Q(2) = true

iii) x = 1, y = 2.

Under the interpretation I over domain D above, what is the truth value of:
a) P (x, y) ∧ Q(y);
b) P (y, x) → Q(y);
c) P (x, y) → Q(x) ?

a) As in propositional logic, the conjuction P (x, y) ∧ Q(y) is true if P (x, y) and Q(y)
are both true, and false otherwise. From the interpretation, P (1, 2) = true, Q(2) = true,
and therefore, P (x, y) ∧ Q(y) is true.

b) The implication P (y, x) → Q(y) is only false when P (y, x) is true and Q(y) is
false, otherwise it is true. But since P (2, 1) =false, irregardless of the interpretation of
Q(y), the formula P (y, x) → Q(y) is true.

c) Since P (1, 2) = true and Q(1) = false, the formula P (x, y) → Q(x) is false.

4.5 Quantifiers
So far we have established the basic language of first order logic, which comprises of
constants, variables, logical connectives and predicates. However, a powerful component
of first order logic over propositional logic is the concept of quantifiers. Quantifiers
provide mean of quantification of variable(s), i.e. they allow us to talk about all variables
or the existence of some variables.
There are two kinds of quantifiers in first order logic, namely, universal quantifiers
and existential quantifiers.

36
4.5.1 Universal quantification

Definition 4.5. A universal quantifier indicates that the predicate is true for all instances
of the variable in the given universe. It is typically indicated by using the phrase “for
every” or “for all”, and can be denoted symbolically by ∀ in symbolic statements.

Universal quantification of predicate P(x), is ∀xP (x), which represents the state-
ment “ P (x) holds for all objects x in the universe of discourse”.
A universally quantified predicate ∀x.P (x) is true if predicate P is true for all ob-
ject in the universe of discourse, and false otherwise,.i.e. ∀x.P (x) is false if there is an
object o in the universe of discourse for which P (o) is false. Such object o is called a
counterexample of ∀xP (x).

Example 4.6.

Consider domain D = {◦, ?}, such that P (◦) = true, P (?) = f alse.
To determine truth value of ∀x.P (x), we observe that for the object ? in the universe of
discourse, P (?) is false.Hence, ∀x.P (x) is false and object ? is a counterexample.

Example 4.7.

Consider the domain D of real numbers and predicate P (x) with interpretation
x2 ≥ x.
a) What is the truth value of ∀x.P (x)? If false, what is a counterexample?
b) What is the truth value of ∀x.P (x) if the domain is integers?
Solution
a) Over the domain R of real numbers, ∀x.P (x) is false: Take x = 0.5 for example. P (0.5)
is false as (0.5)2 > (0.5) is false. So a counterexample can be any real number strictly
between 0 and 1. b) Over the domain Z of integers, ∀xP (x) is true. To see this, we
observe that x2 ≥ x is only false if and only if 0 < x < 1, and true otherwise. How-
ever, since the universe of discourse is Z, and there is no integer in the interval (0, 1),
it follows that the formula ∀x.P (x) is true,.i.e. there is no integer x such that P (x) is false.

Observation: Truth value of a formula in first order logic depends on a universe of


discourse! In the previous example, the formula ∀x.P (x) is false in R but true in Z.

37
4.5.2 Existential quantification

Definition 4.8. An existential quantifier indicates that the predicate is true for at least
one instance of the variable in the given universe. It is typically indicate by the phrase
“for some” or “there exists”, and can be denoted by ∃ in symbolic statements.

Existential quantification of predicate P (x), is written ∃x.P (x), and it represents


the statement “There exists an element x in the domain such that P (x) holds”.
An existentially quantified predicate ∃x.P (x) is true if there is at least one element
in the domain such that P (x) is true, and it is false otherwise.
Note that In first-order logic, domain is required to be non-empty.

Example 4.9.

Consider domain D = {◦, ?}, P (?) = true, P (◦) = f alse. To determine the truth
value of ∃x.P (x), we need to check whether there is an object o in the domain such that
P (o) is true. Indeed, P (?) is true for an object ? in the domain, and hence the formula
∃x.P (x) is true.

Example 4.10.

Consider the domain of real numbers and predicate P (x) with interpretation x < 0.
a) What is the truth value of ∃x.P (x)?
b) What if domain is positive integers?
c) Let Q(y) be the statement y > y 2
i) What’s truth value of ∃y.Q(y) if domain is real numbers?
ii) What about if domain is integers?

Solution
a) The formula ∃x.P (x) is true since we can find a real number, for example x = −1, for
which x < 0 is true.
b) If the domain is positive integers, the formula ∃x.P (x) is false since there is no a
positive integer x such that x < 0 is true.
c) For the predicate Q(y) with interpretation y > y 2 ,
i) the formula ∃y.Q(y) is true, since we can find a real number , for example y = 0.5, for

38
which y > y 2 is true;
ii) the formula ∃y.Q(y) is false since there is no integer y such that y > y 2 .

4.5.3 Quantification and logical connectives

Note that universal quantification is similar to conjunction. For example, suppose Q is


predicate over domain {2, 4, 6}. Then the formula

∀x.Q(x)

is logically equivalent to
Q(2) ∧ Q(4) ∧ Q(6).

If Q represents “iseven”, then “∀x.Q(x)” is logically equivalent to “iseven(2)∧iseven(4)∧


iseven(6)”, which is a true formula.
Dually, existential quantification is similar to disjunction. Thus, if Q represents
“iseven” over domain D = {1, 2, 3}. Then

∃x.Q(x)

is logically equivalent to

isven(1) ∨ iseven(2) ∨ iseven(3).

And so “∃x.Q(x)” is a true formula since “isven(1) ∨ iseven(2) ∨ iseven(3)” is a true


formula.
The universal and existential quantifiers are in fact duals (opposite) of each other;
that is,
∀x.Q(x) ⇔ ¬∃x.¬P (x).

Therefore, to say that everything has some property is the same as saying that there is
nothing that does not have the property.
Similarly,
∃x.P (x) ⇔ ¬∀x.¬P (x),

Which means that to say there is something that has the property is the same as
saying that it is not the case that everything doesn’t have the property.

39
4.5.4 Quantified Formulas of first-order predicate logic

So far, we only discussed how to quantify individual predicates. However, one can also
quantify entire formulas containing multiple predicates and logical connectives.
Note that a quantified formula of first order logic still remains a formula of first order
logic.
How do we determine the truth value of a quantified formula P containing multiple
predicates and logical connectives? For example, consider the formula

∃x.(iseven(x) ∧ grt(x, 100)),

where “grt” and “iseven” represent “greater than” and “is even” respectively. If we
assume the domain is all integers, then formula is true if there is an integer x such that
“iseven(x) ∧ grt(x, 100) is true; that is, if there is an integer x such that x is an even
number and x is greater than 100. Thus, the truth value is true since once can take, for
example, x = 102.
In a similar way, the formula

∀x.(iseven(x) ∧ grt(x, 100))

over integers is true if for every integer x, iseven(x) ∧ grt(x, 100) is true. However, this
is clearly false, since not every even integer is greater than 100: take for example x = 2.

Example 4.11.

Consider the domain of integers and the predicates iseven(x) and div4(x) which
represent “is even” and “if x is divisible by 4” respectively. Determine the truth value of
each of the following quantified formulas.

i) ∀x.(div4(x) → iseven(x))

ii) ∀x.(iseven(x) → div4(x))

iii) ∃x.(¬div4(x) ∧ iseven(x))

iv) ∃x.(¬div4(x) → iseven(x))

v) ∀x.(¬div4(x) → iseven(x))

40
Solution
i) The formula ∀x.(div4(x) → iseven(x)) is true if for every integer x, the implication
(div4(x) → iseven(x) is true. But recall that the implication is only false when the
hypothesis is true and the conclusion is false. So, (div4(x) → iseven(x) is only false if
there is an integer x such that x is divisible by 4 but x is not even. But there is no such
x since if x is divisible by 4 then x is also divisible by 2, and hence x is even. Therefore,
the formula is true. The rest are left as reader’s exercises.
One of our goals in first order logic is to express English statements into (quantified)
formula of first order logic and vice-versa.

Example 4.12.

Assuming f irstyear(x) means “x is a first year student” and Set&logic(x) means “x


is taking Set & Logic”, express the following in first order logic:

i) Someone in Set & Logic is a first year student:

∃x.(Set&logic(x) ∧ f irstyear(x))

ii) No one in Set & Logic is a first year student:

∀x.(Set&Logic(x) → ¬f irstyear(x)) ≡ ∀x.¬(Set&Logic(x) ∧ f irstyear(x))

iii) Everyone taking Set & Logic is a first year:

∀x.(Set&Logic(x) → f irstyear(x)) ≡ ∀x.¬(Set&Logic(x) ∧ ¬f irstyear(x))

iv) Every first year is taking Set & Logic:

∀x.(f irstyear(x) → Set&Logic(x)) ≡ ∀x.¬(f irstyear(x) ∧ ¬Set&Logic(x))

4.5.5 De Morgan’s Laws for Quantifiers

Recall that in earlier unit we discussed DeMorgan’s laws of propositional logic:

¬(P ∨ Q) ≡ ¬P ∧ ¬Q

41
¬(P ∧ Q) ≡ ¬P ∨ ¬Q,

which basically explain how negation engage with conjunction and disjunction.
Since existential and universal quantifier can be thought of as disjunction and con-
juction respectively, over domain, this allows De Morgan’s laws to extend to first order
logic.
The new De Morgan’s laws for quantifiers are:

¬∀x.P (x) ≡ ∃x.¬P (x)

¬∃x.P (x) ≡ ∀x.¬P (x)

To see this more explicitly, suppose P is a predicate over a finite domain {x1 , x2 , ..., xn }.
Then
¬∀x.P (x) ≡ ¬(P (x1 ) ∧ P (x2 ) ∧ ... ∧ P (xn ))
≡ ¬P (x1 ) ∨ ¬P (x2 ) ∨ ... ∨ ¬P (xn )
≡ ∃x.¬P (x).
Similarly,
¬∃x.P (x) ≡ ¬(P (x1 ) ∨ P (x2 ) ∨ ... ∨ P (xn ))
≡ ¬P (x1 ) ∧ ¬P (x2 ) ∧ ... ∧ ¬P (xn )
≡ ∀x.¬P (x).

Remark 4.13. Observe that when you push negation in,∀ flips to ∃ and vice versa

Example 4.14.

Use De Morgan’s laws to find an equivalence of the formula: “No one in Set & Logic
is a first year student”, which is expressed in first order logic as

¬∃x.(Set&Logic(x) ∧ f irstyear(x)).

Using deMorgan laws, both versions of quantifiers and propositional logic, and the fact
that P → Q is equivalent to ¬P ∨ Q, we have

¬∃x.(Set&Logic(x) ∧ f irstyear(x)) ≡ ∀x.¬(Set&Logic(x) ∧ f irstyear(x))


≡ ∀x.(¬Set&Logic(x) ∨ ¬f irstyear(x))
≡ ∀x.(Set&Logic(x) → ¬f irstyear(x)).

42
Hence the equivalence the formula “No one in Set & Logic is a first year student” is

∀x.(Set&Logic(x) → ¬f irstyear(x)),

which translates to “Every student in Set & Logic is not a first year” or “ For all students,
if a student is in Set & Logic then is not a first year”.

4.5.6 Nested Quantifiers

Nested quantifiers are expressions used to express statements involving multiple quanti-
fiers. For example:
∀x.∃x.P (x, y).

This statement can be read as “For all x, there exists a y such that P (x, y) is true”. Here,
the universal quantifier ∀ applies to the whole expression ∃x.P (x, y), indicating that for
every x, there exists a y that satisfies the condition P (x, y).
There are instances when it is necessary to use multiple quantifiers: For example,
the statement “Everybody loves someone” cannot be expressed using a single quantifier.
The statement “Everybody loves someone” indicates that “for every person x, there is a
person y such that x loves y”. To express this statement in first order logic, if P (x, y)
represents “ x loves y”, then we have

∀x.∃y.P (x, y).

Note that the order of quantifiers is very important: For example,

∃y.∀x.P (x, y)

translates to “There is a person y such that for every person x, x loves y”. This sim-
ply means “There is someone loved by everybody”. And this is clearly different from
“Everybody loves someone”. Hence,

∀x.∃y.P (x, y) 6≡ ∃y.∀x.P (x, y).

Here are all the possible combinations of Nested quantifiers:

1) ∀x.∃y.P (x, y) reads as “For all x there is a y such that P (x, y)”.

43
2) ∃y.∀x.P (x, y) reads as “There is a y such that for every x, P (x, y)”.

3) ∃y.∃x.P (x, y) reads as “For some y and for some x, P (x, y)”.

4) ∀y.∀x.P (x, y) reads as “For all y and for all x, P (x, y)”.

Remark 4.15. Note that for ∃y.∃x.P (x, y) and ∀y.∀x.P (x, y), the order of quantifiers do
not matter. Thus,
∃y.∃x.P (x, y) ≡ ∃x.∃y.P (x, y)

and
∀y.∀x.P (x, y) ≡ ∀x.∀y.P (x, y).

Example 4.16. Given that P (x, y) represents “Person x likes person y”. Express each
of the following as formula in first order logic.

a) “Someone likes everyone”

b) “There is someone who doesn’t like anyone”

c) “There is someone who is not liked by anyone”

d) “Everyone likes everyone”

e) “There is someone who doesn’t like herself/himself.”

Solution

a) ∃x.∀y.P (x, y).

b) ∃x.∀y.¬P (x, y).

c) ∀x.∃y.¬P (x, y).

d) ∀x.∀y.P (x, y).

e) ∃x.¬P (x, x).

44
5 Proofs of mathematical theorems
Most mathematical statements are implications of the form P → Q, where P or Q might
be compound propositions. In this section we will look at some methods for proving
implications. Note that we are using some definitions and results from other areas of
mathematics that we have not explicitly stated. We will not allow ourselves to make
those kinds of assumptions once we begin our study of set theory.

5.1 Methods of proving mathematical statements


5.1.1 Direct method

A direct proof of the implication P → Q assumes that the hypothesis P is true, then
uses definitions, previously proved theorems, and the rules of inference to deduce that the
conclusion Q must also be true.
Let us demonstrate the direct method in the example below:

Theorem 5.1. If n is an even integer, then n2 is even.

Clearly, this theorem is of the form P → Q, with P=n is an even integer and Q=n2
is even. The first step in trying to prove any theorem is to make sure you know what
it means. In this case, we need to know the definition of an even integer and of the
square of an integer. An integer n is even if it can be written as n = 2k for some integer
k. The square of n is the product n2 = n × n. Note that one does not give a proof by
demonstrating that the statement is true for a certain example, for instance, taking n = 2.
We give an outline of the proof below, by first assuming that n is even and use various
definitions and algebraic manipulation to deduce that n2 is even.

Proof.

(1) n is an even integer given in the hypothesis


(2) n = 2k for some integer k definition of an even number, (1)
(3) n2 = (2k)2 definition, (2)
2 2
(4) n = 4k algebraic manipulation of (3)
2 2
(5) n = 2(2k ) algebraic manipulation of (4)
(4) n2 is even definition, (5)

45
Although the two-column proof above is valid, it is not written in a format that
mathematicians usually find acceptable. We prefer proofs that are written using com-
plete sentences, paragraphs, and correct grammar and punctuation. Here is a better
presentation for the previous proof.

Proof. (Proof of Theorem 5.1). Let n be an even integer, then by definition n = 2k for
some integer k. Squaring both sides yields n2 = 4k 2 = 2(2k 2 ). Since 2k 2 is an integer,
n2 = 2(2k 2 ) is even as desired.

For the remainder of this unit, all proofs will be presented in paragraph format.

Theorem 5.2. If n is an odd integer then its square has the form 8k + 1 for some integer
k.

Proof. If n is an odd integer ,then by definition it is of the form n = 2q + 1. Squaring on


both side,
n2 = (2q + 1)2 = 4q 2 + 4q + 1 = 4q(q + 1) + 1.

Note that for the integer q(q + 1), if q is even then q + 1 is odd, and so q(q + 1) is even.
If q is odd, then q + 1 is even and so q(q + 1) is even. Hence, q(q + 1) is even and is of
the form 2k. Substituting into n2 = 4q(q + 1) + 1, we have n2 = 4(2k) + 1 = 8k + 1 as
desired.

Theorem 5.3. Let x, y, z be real numbers. Prove that if x < y and y < z, then x < z.

Proof. Let x, y, z be real numbers and assume that x < y and y < z. Then this means
that x − y < 0 and y − z < 0. Now,

x−z = x−y+y−z
= (x − y) + (y − z)
< 0 + 0 = 0.

That is, x − z < 0, and this means that x < z.

46
5.1.2 Proof by contrapositive

It has been shown already through the truth table that the contrapositive of an implication
is logically equivalent to the implication. Sometimes it is easier to prove the contrapositive
of the implication we are interested in. Consider the following example

Theorem 5.4. Let n be an integer. If n2 is even, then n is even.

We might try to begin this proof as we did the proof of Theorem 5.1. First assume
that n2 is even. By definition we know that n2 = 2k for some integer k. Now what? In
the previous example we were able to square 2k and see that the result was even, but
taking the square root doesn’t tell us anything useful. Instead we prove the contrapositive
of the theorem: If n is not even, then n2 is not even. We use the fact that every integer
is either even or odd, but never both; so if n is not even then it is odd.

Proof. Let us assume n is odd. Then n is of the form n = 2k + 1 for some integer k. Now

n2 = (2k + 1)2 = 4k 2 + 4k + 1 = 2q + 1,

where q = 2k 2 + 2k. Thus, n2 = 2q + 1 is odd as desired.

5.1.3 Proof by contradiction

A proof by contradiction, or reductio ad absurdum begins by assuming that the result we


are trying to prove is false, then deriving a contradiction from that assumption. It is easy
to confuse this with a direct proof of the contrapositive, which makes different beginning
assumptions. To prove the implication P → Q by proving the contrapositive, you assume
¬Q and use that to prove ¬P . A proof by contradiction assumes P ∧ ¬Q, (that is, P is
true and Q is false) and derives a contradiction R ∧ ¬R. Here is a classic example of a
proof by contradiction.

Theorem 5.5. If x is a rational number, then x2 6= 2.

Proof. The theorem can be equivalently phrased as follow: There is no rational number
x such that x2 = 2. By contradiction, assume that there is a rational number x with
p
x2 = 2.Since x is rational, we may express x as a fraction q
in lowest terms, in other

47
p
words p and qare integers and no common factor except ±1. Since x = q
and x2 = 2, we
p2
have q2
= 2 or p2 = 2q 2 . Since q 2 is an integer, p2 = 2q 2 is even. So p is an integer and p2
is even, so Theorem 5.4 implies that p is even. This allows us to write p = 2k for some
integer k. Substituting into p2 = 2q 2 , we see that 4k 2 = 2q 2 , so q 2 = 2k 2 . Now q is an
integer and q 2 is even, so another application of Theorem 5.4 implies that q is even. We
now know that both p and q are even, so they have 2 as a common factor. This contradicts
our choice of p and q, so our assumption that x is rational must be incorrect.

Theorem 5.6. Prove that the interval (0, 1) has no least element.

Proof. Suppose that the interval (0, 1) has a least element, say l. Then we have that
l ≤ x for every x ∈ (0, 1). Now, consider 2l , l
2
∈ (0, 1) and l
2
< l, which contradicts the
assumption that l is the least element of (0, 1). Thus, the assumption that the interval
(0, 1) has a least element is false, and we conclude that the interval (0, 1) has no least
element.

5.1.4 Proof by cases

To prove the implication P → Q by cases, we make use of the following argument:

P → (R ∨ S)
R→Q
S→Q
∴P →Q
This means that to prove P → Q, it is enough to show that if P → (R ∨ S) is true
and both R → Q and S → Q are true, then P → Q is true.
It can be easily shown through rules of inference that the argument

(P → (R ∨ S)) ∧ (R → Q) ∧ (S → Q) ⇒ P → Q

is valid.
Here is a simple illustration of a proof by cases. We make use of some of the order
properties of the real numbers. In particular, we know that multiplying both sides of an
inequality by a positive number preserves the inequality, and multiplying both sides of an
inequality by a negative number reverses the inequality.

48
Theorem 5.7. If x is a real number, then x2 ≥ 0.

If x is a real number, then either x ≥ 0 or x < 0. Now let P = “x is a real number,”


R = “x ≥ 0”, S = “x < 0”, and Q = “x2 > 0”. Clearly, it is true that P → (R ∨ S). So
to proof that P → Q, we only need to show: case 1. R → Q and case 2. S → Q, that is,
if x ≥ 0 then x2 ≥ 0, and if x < 0 then x2 ≥ 0.

Proof. (P → (R ∨ S)) If x is a real number, then either x ≥ 0 or x < 0.


Case 1(R → Q) . If x ≥ 0, then by multiplying both sides of this inequality by x, we
see that x2 ≥ x0 = 0.
Case 2 (S → Q). If x < 0, then multiplying both sides of the inequality by x reverses
the inequality, yielding x2 > x0 = 0. Since x2 > 0 we have x2 ≥ 0.
In either case we have x2 ≥ 0, so the result is true.

Remark 5.8. To prove a Bi-conditional statement P ↔ Q, one must prove the two
implications, namely, P → Q and Q → P .

Theorem 5.9. An integer n is even if and only if n2 is even.

Note that this is a bi-conditional statement, which is a conjunction of two implica-


tions. Thus, we need to prove that both implications are true. That is, we prove that:
(→). “If n is even then n2 is even”
and
(←). “If n2 is even then n is even”.
Note that (→) denotes “forward” implication, that is , “if n is even then n2 is even”,
while (←) denotes the “backward” implication, that is, “if n2 is even then n is even”.

Proof. (→) The proof that, if n is even then n2 is even, is given in Theorem 5.1.
(←) The proof that, if n2 is even then n, is even is given in Theorem 5.4.

49
5.2 Proving quantified statements
5.2.1 Universally quantified statements

On the simplest level, a universally quantified statement has the form ∀x.P (x). To prove
such a proposition, we assume that x is in the required domain and show that P (x) must
be true. It is frequently helpful to think of such a statement as an implication where the
hypothesis is that x is in the required domain, and the conclusion is P (x). In fact, we
have already seen such an example when we proved Theorem 5.7. We could restate this
theorem as follows:

Theorem 5.10. (alternate Theorem 5.7) For every real number x, x2 ≥ 0.

Since universally quantified statements can be thought of as implications, we can use


the same proof technique.

5.2.2 Existentially quantified statements

Existentially quantified statements are significantly different than implications and uni-
versally quantified statements. To prove the statement ∃x.P (x) we must show that there
is at least one x in the domain that satisfies P (x). One way to do this is simply to find a
single particular example. The following theorem can be proved in this way.

Theorem 5.11. There is a positive integer N such that N, N + 1, N + 2, N + 3, and N + 4


are all composite (not prime).

Proof. Let N = 24. Since 24, 25, 26, 27, and 28 are all composite, this complete the proof.

Theorem 5.12. There exists an even prime number x.

Proof. Take x = 2. It is even and a prime number.

Theorem 5.13. There exist irrational numbers a and b so that ab is rational.



Proof. First note that 2 is irrational, but
 √ √2
√ 2 √ √√ √
2 = ( 2) 2 2 = ( 2)2 = 2

50
√ √2
which is a rational number. Now it is certainly true that 2 is either a rational number
√ √2 √ √
or an irrational. If 2 √ is rational, then we can take a√ = 2 and b = 2, which are both
b
√ 2 √ 2 √ √2
irrational but a = 2 is rational as assumed. If 2 is irrational, then take a = 2

and b = 2, which are both irrational, but as shown above, ab = 2 is rational.

5.2.3 Counterexamples

Consider the following proposition:


Conjecture. Every integer is even.
It probably seems clear to you that this statement is false, but how could you prove
that? To prove that a proposition is false we must show that it’s negation is true, so we
first find the negation of the original statement:
“Some integer is not even.”
We have transformed our original problem (proving that a statement is false) into
something more familiar (proving that a statement is true): How do we prove the second
statement is true? As noted above, one way to prove an existentially quantified statement
is simply to find the object it says exists. In this case, we must find an integer that is
not even. Of course, we know many such integers. Any odd integer will do. So our proof
that the original statement is false consists of finding an example that makes it false: the
integer x = 1 is not even. Note that you shouldn’t just say that there are such examples,
you should give a particular one that your reader can check. An example showing that a
universally quantified statement is false is called a counterexample to that statement.

6 Sets and relations

6.1 Basic concepts of set theory:Sets; Elements; Union and in-


tersection
6.1.1 Elements

We will think of a set as a collection of objects, called it’s elements. These objects
might be points, numbers, people, kitchen appliances, other sets, or any other objects
we are interested in talking about. For a set to be well-defined, we must have a way

51
to determine whether or not a given object is in the set. We consider two sets to be
equal if they contain exactly the same elements. Note that an object is either an element
of a set or not, the elements of a set do not occur in a particular order and the same
object cannot be an element of the set more than once. One way to indicate a set is
to simply list all of the elements between set braces { and }. For example, the sets
A = {1, 2, 4, 8}, B = {8, 2, 1, 4}, C = {1, 2, 1, 4, 8} are all equal because they each contain
the same elements. The set D = {1, 2, 3, 4, 8} is different from the others since it contains
the element 3 and the other sets do not.
Let X = {1, 3, {3}}. Note that this set contains some elements that are numbers and
some elements that are sets of numbers. We consider those different objects. For example
1 is an element of X, but {1} is not an element of X. On the other hand, both 3 and {3}
are elements of X.
We will find it useful to have a special notation for the set which has no elements.
To this end, let ∅ = { }. This set is called the empty set.
We indicate that the object x is an element of the set A by writing x ∈ A. We write
x 6∈ A if x is not an element of A. Listing all of the elements of a set works well when
the set contains only a few elements, but what about sets with many elements? In this
case, we use set builder notation to denote the set. An important part of this notation
is the use of the vertical bar | (some texts use a colon in place of the vertical bar), read
“such that.” So the set
A = {x| x2 − 2 = 0}

is read “the set of all elements x such that x2 − 2 = 0.” An object will be an element of
this set if and only if it satisfies the equation x2 − 2 = 0. There are also a few sets that
are useful enough to deserve their ownspecial notation. In particular, N denotes the set
of natural numbers, Z the set of integers, Q the set of rational numbers, R the set of real
numbers, and C the set of complex numbers.

6.1.2 Subsets

Definition 6.1. Given two sets A and B we say that A is a subset of B, or that A is
contained in B, if every element of A is also an element of B. In this case we write A ⊂ B
( or sometimes A ⊆ B).

52
Since every natural number is also an integer and every integer is a real number, we
have N ⊂ Z and Z ⊂ R. For sets A = {1, 2, 3}, B = {1, 2, {3}, 4}, and C = {1, 2, 3, {4}},
A is a subset of C because each element of A is also an element of C. Note that A is not
a subset of B because 3 is an element of A, but not an element of B -remember that 3
and {3} are different objects.

Remark 6.2. Note also that the empty set is a subset of every set A since there are no
elements of the empty set which are not in A. If there is a set A for which the empty set
is not a subset of, it would mean there is an element in the empty set which is not in A,
which contradict that the empty set is a set with no elements.

Definition 6.3. A subset B of A is said to be a proper subset of A if B 6= ∅ and A 6= B.

Theorem 6.4. If A ⊂ B and B ⊂ C, then A ⊂ C.

Proof. Suppose that a ∈ A. Since A ⊂ B it follows that a ∈ B. Now B ⊂ C, so we may


say that a ∈ C as desired.

In the proof of the above theorem, we first noted that the statement is a universally
quantified statement about elements of A; every element of A is also an element of C. We
began by considering an arbitrary element of A, which we have named a. The goal is to
use our hypotheses , A ⊂ B and B ⊂ C, to arrive at the conclusion that a ∈ C. First we
note that every element of A is also an element of B since A ⊂ B. This allows us to state
that a ∈ B. Once we have a ∈ B we may use the second hypothesis to see that a ∈ C.
So starting with any element at all of the set A we have shown that it must also be an
element of C, which is the definition of A ⊂ C. We conclude that A ⊂ C as desired.

6.1.3 Universal set

In many instances, all of the sets we may be interested in are subsets of some particular
set U. In this case we say that U is a universal set, or that U is the universe.

6.1.4 Equality of sets

We say that two sets are equal if they contain exactly the same elements. In other words,
A = B means that every element of A is an element of B and every element of B is an
element of A. In other words, we have the following:

53
Theorem 6.5. Given any two sets A and B, A = B if and only if A ⊂ B and B ⊂ A.

Therefore to show that two sets A and B are equal, one only needs to show that the
statements (x ∈ A) and (x ∈ B) are equivalent, that is,

x ∈ A ⇔ x ∈ B.

Note that it is wrong to write A ⇔ B since equivalence only makes sense for statements,
so for sets we use equality A = B. Similarly, is wrong to write (x ∈ A) = (x ∈ B) equality
does not make sense for statements, so for statements we use equivalence x ∈ A ⇔ x ∈ B.

6.1.5 The powerset of a set

Definition 6.6. Let A be any set. The powerset of A is the set

P(A) := {B | B ⊂ A}.

In other words, the powerset of A is the set whose elements are the subsets of A.
Note that for any set A, ∅ ∈ P(A) and A ∈ P(A). So P(A) is a nonempty for every set
A.The powers is frequently denoted by 2A .
Example: Let A = {1, 2, 3}. Then

P(A) = {∅, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, A},

consisting of all subsets of A.

Theorem 6.7. For sets A and B, A ⊂ B if and only if P(A) ⊂ P(B).

Proof. ⇒) First we prove the forward implication, that is, if A ⊂ B then P(A) ⊂ P(B).
Let us suppose A ⊂ B, and take X ∈ P(A). Then X ⊂ A, but since A ⊂ B, X ⊂ B.
Hence X ∈ P(B) and this shows that P(A) ⊂ P(B).
⇐) For the converse, we need to prove that if P(A) ⊂ P(B) then A ⊂ B. Let us
suppose P(A) ⊂ P(B) and take a ∈ A. Then {a} ∈ P(A), but since P(A) ⊂ P(B), it
follows that {a} ∈ P(B). Hence a ∈ B and this shows that A ⊂ B.

Theorem 6.8. Let A and B be sets. Then P(A ∩ B) = P(A) ∩ P(B).

Proof. The proof is left as an exercise.

54
6.2 Operations on sets
6.2.1 Union and intersection

Definition 6.9. a) The union of two sets A and B is the set

A ∪ B := {x | (x ∈ A) ∨ (x ∈ B) is true}.

b) The intersection of two sets A and B is the set

A ∩ B := {x | (x ∈ A) ∧ (x ∈ B) is true}.

Example: Let A = {2, 3, 4, 5, 6} and B = {3, 2, 8, 1, 4}. Then A∪B = {1, 2, 3, 4, 5, 6, 8}


and A ∩ B = {2, 3, 4}.

Remark 6.10. The union of A and B consists of elements that either belong to A or B
or both A and B. While the intersection of A and B consists of elements that belong both
to A and B. Therefore, A ∩ B can be thought of as the set of all elements x that make
the conjunction (x ∈ A) ∧ (x ∈ B) true. Similarly, the union is a set of all elements x
that make the disjunction (x ∈ A) ∨ (x ∈ B) true. We will observe below that similar
properties of ∨ and ∧ hold for ∪ and ∩.

Theorem 6.11. Let A, B, and C be any sets in the universal set U. Then the following
properties holds:

Idempotent Laws A∩A=A


A∪A=A
Commutative Laws A∪B =B∪A
A∩B =B∩A
Associative Laws (A ∪ B) ∪ C = A ∪ (B ∪ C)
(A ∩ B) ∩ C = A ∩ (B ∩ C)
Distributive Laws A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
Identity Laws A∩U=A
A∪∅=A
Dominance Laws A∩∅=∅
A∪U=U

55
Proof. Let us, for instance, prove one of the distributive laws. We show that union
distributes over intersection (I.e. A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)) using the fact that
disjunction distributes over conjunction (i.e. P ∨ (Q ∧ R) ⇔ (P ∨ Q) ∧ (P ∨ R)) in the
third line.

x ∈ A ∪ (B ∩ C) ⇔ (x ∈ A) ∨ (x ∈ B ∩ C)
⇔ (x ∈ A) ∨ ((x ∈ B) ∧ (x ∈ C))
⇔ ((x ∈ A) ∨ ((x ∈ B)) ∧ ((x ∈ A) ∨ (x ∈ C))
⇔ (x ∈ A ∪ B) ∧ (x ∈ A ∪ C)
⇔ x ∈ (A ∪ B) ∩ (A ∪ C).
Therefore, A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C).

6.2.2 Complements

Definition 6.12. The relative complement of B in A (also called the set difference)
is the set:

A \ B := {a | a ∈ A and a 6∈ B} = {a | (a ∈ A) ∧ ¬(a ∈ B) is true}.

In a given universe U, we may also define the complement of a set A, sometimes denoted
by Ac , is the set
U \ A = {x | x 6∈ A} = {x | ¬(x ∈ A) is true}.

Theorem 6.13 (DeMorgan’s laws). Let A, B and C be sets. Then

a) A \ (B ∪ C) = (A \ B) ∩ (A \ C).

b) A \ (B ∩ C) = (A \ B) ∪ (A \ C).

Proof. a) We prove that A \ (B ∪ C) = (A \ B) ∩ (A \ C) by showing that

x ∈ A \ (B ∪ C) ⇔ x ∈ (A \ B) ∩ (A \ C).

56
x ∈ A \ (B ∪ C) ⇔ (x ∈ A) ∧ ¬(x ∈ (B ∪ C))
⇔ (x ∈ A) ∧ ¬((x ∈ B) ∨ (x ∈ C))
⇔ (x ∈ A) ∧ (¬(x ∈ B)) ∧ ¬(x ∈ C))
⇔ ((x ∈ A) ∧ ¬(x ∈ B)) ∧ ((x ∈ A) ∧ ¬(x ∈ C))
⇔ (x ∈ A \ B) ∧ (x ∈ A \ C)
⇔ x ∈ (A \ B) ∩ (A \ C).
Note that we obtained line 4 by applying the fact: P ∧ (Q ∧ R) ⇔ (P ∧ Q) ∧ (P ∧ R)
to line 3.

6.2.3 Families of sets

We can define unions and intersections for more than two sets or possibly infinite number
of sets. For now we will restrict to finitely many sets.

Definition 6.14. Let X be a set and X1 , X2 , ..., Xn be subsets of of X. Then we define

a) X1 ∪ X2 ∪ ... ∪ Xn to be the set of all elements that belong to at least one of the Xi0 s
and,

b) X1 ∩ X2 ∩ ... ∩ Xn to be the set of all elements that belong to all of the Xi0 s , where
1 ≤ i ≤ n.

It is a common practice to write the collection of sets X1 , X2 , ..., Xn as the set

{Xi | 1 ≤ i ≤ n} = {Xi | i ∈ I},

with I := {1, 2, 3, ..., n}. To be more compact, one writes X1 ∪ X2 ∪ ... ∪ Xn as

[ n
[
{Xi | 1 ≤ i ≤ n} = Xi ,
i=1

and X1 ∩ X2 ∩ ... ∩ Xn as
\ n
\
{Xi | 1 ≤ i ≤ n} = Xi .
i=1

57
Definition 6.15. Let X = {Xi | i ∈ I} be a collection of sets Xi with i ∈ I. Note that
I is just an arbitrary set that could be finite or infinite. Then X is called an indexed
family and I the index set of a family. The notation (Xi )i∈I is frequently used to denote
an indexed family.
The arbitrary union of a family (Xi )i∈I is the set
[
Xi
i∈I

of all elements that belong to at least of the Xi0 s i.e.


[
Xi = {x | (∃i ∈ I)(x ∈ Xi )}.
i∈I

The arbitrary intersection of a family (Xi )i∈I is the set


\
Xi
i∈I

of all elements that belong to all of the Xi0 s i.e.


\
Xi = {x | (∀i ∈ I)(x ∈ Xi )}.
i∈I

Example 6.16. Let A1 = {20, 11, 13, 19}, A2 = {20, 15, 11, 19}, A3 = {11, 15, 19, 22}.
Then the indexed family of sets is {Ai | i ∈ {1, 2, 3}} with the index set I = {1, 2, 3}.
Moreover,
[
Ai = {20, 11, 13, 15, 19, 22},
i∈I

and
\
Ai = {11, 19}.
i∈I

Proposition 6.17. Let (Xi )i be a family of sets and k ∈ I (i.e. k is a particular element
of the index set I). Then
S
a) Xk ⊆ i∈I Xi .
T
b) i∈I Xi ⊆ X k .

58
Proof. a) Let x ∈ Xk . Then there exists i ∈ I ( that is k) such that x ∈ Xi . So by
S S S
definition of i∈I Xi , x ∈ i∈I Xi . Hence, Xk ⊆ i∈I Xi
The proof of b) is left as an exercise.

Next we state De Morgan law’s version for a family of sets.

Theorem 6.18. Let (Xi )i∈I be a family of subsets of X. Then


T S
a) X \ ( i∈I Xi ) = i∈I (X \ Xi ).
S T
b) X \ ( i∈I Xi ) = i∈I (X \ Xi ).

Proof. The proof is left as an exercise.

6.3 Cartesian products


Definition 6.19. The (Cartesian) product of two sets X and Y is the set:

X × Y := {(x, y) | x ∈ X & y ∈ Y },

where (x, y) is called an ordered pair (is not an interval).

Note that X × Y is simply the set of all ordered pairs with first coordinates in X
and second coordinates in Y . For example, the Cartesian plane used in Calculus is the
set R × R.

Axiom 6.20 (Ordered pair axiom). Two ordered pairs are equal if and only if the corre-
sponding components are equal, i.e. (x, y) = (a, b) if and only if a = x and b = y.

Example 6.21. a) Let X = {1, 2} and Y = {4, 5}. Then

X × Y = {(1, 4), (1, 5), (2, 4), (2, 5)}.

b) For sets A and B, A × B = ∅ if and only if A = ∅ or B = ∅.

Theorem 6.22. For sets X, Y and Z, the following hold:

59
a) (X ∪ Y ) × Z = (X × Z) ∪ (Y × Z).

b) (X ∩ Y ) × Z = (X × Z) ∩ (Y × Z).

c) (X \ Y ) × Z = (X × Z) \ (Y × Z).

Proof. The proofs of a) and b) are left as exercise. We prove c). Let (a, b) ∈ X \ Y ) × Z.
Then a ∈ X \ Y and b ∈ Z. This means (a, b) ∈ X × Z and (a, b) 6∈ (Y × Z) since a 6∈ Y .
Therefore, (a, b) ∈ (X ×Z)\(Y ×Z), and this shows that (X \Y )×Z ⊆ (X ×Z)\(Y ×Z).
Now we must show that (X ×Z)\(Y ×Z) ⊆ (X \Y )×Z. Let (a, b) ∈ (X ×Z)\(Y ×Z).
Then (a, b) ∈ (X × Z) and (a, b) 6∈ (Y × Z). But since b ∈ Z, then the only reason
(a, b) 6∈ (Y × Z) is because a 6∈ Y . Thus a ∈ X \ Y and consequently, (a, b) ∈ (X \ Y ) × Z,
and this shows that (X × Z) \ (Y × Z) ⊆ (X \ Y ) × Z.
Hence (X \ Y ) × Z = (X × Z) \ (Y × Z).

6.4 Relations
6.4.1 Definition of relations

Definition 6.23. For two sets A and B, a relation from A to B is a subset of A × B.


The relations we will be most interested in are usually from a set A to itself, in which
case we say that the relation is a relation on A. If R is a relation, we frequently use the
notation xRy to indicate that the ordered pair (x, y) is in R.

Example 6.24. a) The usual less than or equal ordering ≤ is a relation on R. This
relation can be written as

L := {(a, b) | a − b ≤ 0}.

In other words, a pair (a, b) is in the relation if a ≤ b.

b) The set of points on the unit circle is a relation on R defined by

C = {(a, b) | a2 + b2 = 1}.

c) For X = {1, 2, 3, 4, 5}, the sets {(1, 2), (3, 4)}, {(3, 5), (5, 1), (3, 4)} and all other
subsets of X × X are relations on X.

60
d) The empty set ∅ is a relation on any set X since ∅ ⊆ X × X.

e) For any set X, subset ⊆ is a relation on P(X), with A, B ∈ P(X) related if A ⊆ B.

Definition 6.25. Let R be a relation on a set X. We say that R

a) is reflexive if (x, x) ∈ R for every x ∈ X.

b) is symmetric if (a, b) ∈ R implies (b, a) ∈ R for every a, b ∈ X.

c) is antisymmetric if (a, b) ∈ R and (b, a) ∈ R implies a = b for every a, b ∈ X

d) is transitive if (a, b), (b, c) ∈ R implies (a, c) ∈ R for every a, b, c ∈ X.

Example 6.26. The relation less than or equal to ≤ on R is reflexive since x ≤ x for
every x ∈ R. It is not symmetric since 2 ≤ 3 but 3 6≤ 2. It is transitive since x ≤ y and
y ≤ z implies x ≤ z. It is antisymmetric since for every x, y ∈ R such that x ≤ y and
y ≤ x implies x = y.

6.4.2 Order relations

Many of our comparisons involve describing some objects as being “less than”, “equal
to”, or “greater than” other objects, in a certain respect. These involve order relations

Definition 6.27. a) A relation which is both reflexive and transitive is called a pre-
order.

b) A preorder which is also antisymmetric is called a partial order. In other words,


a partial order is a relation which is reflexive, antisymmetric, and transitive.

Remark 6.28. Every partial order is a preorder.

Example 6.29. a) The less than or equal relation ≤ on R is a partial order.

b) For a set X, the subset relation ⊆ on P(X) is a partial order.

c) The relation R = {(1, 2), (2, 1), (1, 1), (2, 2)} on X = {1, 2} is a preorder but not a
partial order since (1, 2), (2, 1) ∈ R but 2 6= 1.

61
Definition 6.30. A partial order R on X is called a total order orlinear order if any
x, y ∈ X, either (x, y) ∈ R or (y, x) ∈ R.

Example 6.31. a) The less than or equal to relation ≤ on R is linear, since for any
two real numbersx, y ∈ R is either x ≤ y or y ≤ x.

b) Consider the relation ⊆ on P(X), where X = {1, 2}. This relation is not linear
since, for example, {1} 6⊆ {2} and {2} 6⊆ {1}.

6.4.3 Equivalence relations

Definition 6.32. A relation R on a set X that is reflexive, symmetric, and transitive is


said to be an equivalence relation on X.

Example 6.33. a) The relation less than or equal to ≤ on R is not an equivalence


relation since it is not symmetric. Same also with the relation subset ⊆ on a pow-
erset.

b) Consider the relation R on R defined by

R = {(x, y) | x − y = 0}.

This is an equivalence relation on R, and it is left as an exercise to verify it.

b) For the set X = {1, 2, 3}, the relation

R = {(1, 1), (2, 2), (3, 3), (1, 2), (3, 2), (2, 1), (2, 3), (1, 3), (3, 1)}

is an equivalence relation on X.

6.4.4 Partitions

Definition 6.34.

62
6.4.5 Functions

6.5 Cardinality

6.6 Cantor-Schroeder-Bernstein theorem

7 Theory of natural numbers

7.1 Peano axioms


7.1.1 Successor function

7.1.2 Inductive property

7.2 Basic properties of natural numbers: Addition; Multiplica-


tion; Division

7.3 Principle of mathematical induction

63

You might also like