Professional Documents
Culture Documents
Notes Updated
Notes Updated
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
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
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
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.
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.
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.
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 :
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.
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.
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.
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.
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.
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
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.
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.
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
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)
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:
Example 2.13. Determine the truth values of each of the following propositional formu-
las.
a) P ∨ (¬Q ∧ P ).
b) ¬(¬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.
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.
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).
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
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
P ¬P P ∨ ¬P
T F T
F T T
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.
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.
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
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.
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).
P →Q
Q→R
∴P ∨Q→R
ii)
19
P ∨Q
P → ¬Q
P →R
∴R
Solution
i) Constructing the truth table, we have:
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:
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.
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.
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.
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
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.
¬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.
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.
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
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
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
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 ∧ ¬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.
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)
d) (P → Q) → (¬R ∧ Q).
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).
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.
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.
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”.
Example 4.3.
Consider a first order logic formula ¬Q(x) over domain D = {◦, ?}. The interpreta-
tion I over domain D is given below
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.
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.
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.
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 .
∀x.Q(x)
is logically equivalent to
Q(2) ∧ Q(4) ∧ Q(6).
∃x.Q(x)
is logically equivalent to
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
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
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))
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.
∃x.(Set&logic(x) ∧ f irstyear(x))
¬(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:
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
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”.
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
∃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,
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.
Solution
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.
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:
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.
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.
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.
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
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,
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.
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.
Remark 5.8. To prove a Bi-conditional statement P ↔ Q, one must prove the two
implications, namely, P → Q and Q → P .
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:
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.
Proof. Let N = 24. Since 24, 25, 26, 27, and 28 are all composite, this complete the proof.
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
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.
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.
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.
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.
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},
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.
54
6.2 Operations on sets
6.2.1 Union and intersection
A ∪ B := {x | (x ∈ A) ∨ (x ∈ B) is true}.
A ∩ B := {x | (x ∈ A) ∧ (x ∈ B) is true}.
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:
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:
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}.
a) A \ (B ∪ C) = (A \ B) ∩ (A \ C).
b) A \ (B ∩ C) = (A \ B) ∪ (A \ C).
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.
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.
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.
[ 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
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.
X × Y := {(x, y) | x ∈ X & y ∈ Y },
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.
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
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}.
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.
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.
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.
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}.
R = {(x, y) | x − y = 0}.
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
63