0% found this document useful (0 votes)
16 views24 pages

DiscMaths Summary

This document contains summaries of key concepts in discrete mathematics, including logic, proofs, Boolean identities, algebra, order theory, number theory, set theory, and formal languages. It is intended as a study guide for students by providing definitions, theorems, and examples for important topics, but also warns that an intuitive understanding is needed rather than just memorization. Students should use this document to study but not rely on it exclusively for exams.

Uploaded by

Steve Rixel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views24 pages

DiscMaths Summary

This document contains summaries of key concepts in discrete mathematics, including logic, proofs, Boolean identities, algebra, order theory, number theory, set theory, and formal languages. It is intended as a study guide for students by providing definitions, theorems, and examples for important topics, but also warns that an intuitive understanding is needed rather than just memorization. Students should use this document to study but not rely on it exclusively for exams.

Uploaded by

Steve Rixel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Discrete Mathematics

Summary

This document contains most of the definitions, identities and theorems introduced in the course. It
is intended to be a helpful reference for study and revision – however, it is important that you get
a good intuitive understanding for the topics, rather than just memorise everything. Intuition will
come with time and practice; until then, you can use this sheet, remembering not to rely on it too
much because you won’t have it in the exam!

Logic and proof theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2


Boolean identities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Proof patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Algebra and order theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Algebraic structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Order theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Number theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Theorems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Set theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Foundations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Relations, matrices and graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Isomorphisms and equivalence relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Indexing and enumerability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Regular languages and finite automata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Formal languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Inductive definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Regular expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Finite automata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Regular languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
D I S C R E T E M AT H E M AT I C S SUMMARY

Logic and proof theory


Boolean identities
Proof goals can often be simplified using logical identities. Before starting a formal proof, it is always
useful to check if the statement can be simplified or rewritten in a way that will ease reasoning. Some
of these equivalences form the basis of proof patterns discussed below.

This table exemplifies an important concept in logic and many other fields of mathematics: duality.
Most of the properties below come in two ‘flavours’, corresponding to dual operations such as
conjunction and disjunction, or universal and existential quantification. Remember that duality is
different from negation: ‘there do not exist negative primes’ (¬∃x. P(x)) is definitely not the same as
‘all primes are negative’ (∀x. P(x)), but it is the same as ‘all primes are not negative’ (∀x. ¬P(x)).
The precise connection between dual operators and negation is given by the de Morgan laws.

In this table, P ∼
= Q means that the logical statement P is equivalent to Q – that is, P ⇐⇒ Q holds.

Identity P ∧> ∼
= P P ∨⊥ ∼
= P

Annihilation P ∧⊥ ∼
= ⊥ P ∨> ∼
= >

Idempotence P∧P ∼
= P P∨P ∼
= P

Commutativity P ∧Q ∼
= Q∧P P ∨Q ∼
= Q∨P

Associativity (P ∧ Q) ∧ R ∼
= P ∧ (Q ∧ R) (P ∨ Q) ∨ R ∼
= P ∨ (Q ∨ R)

Distributivity (P ∨ Q) ∧ R ∼
= (P ∧ R) ∨ (Q ∧ R) (P ∧ Q) ∨ R ∼
= (P ∨ R) ∧ (Q ∨ R)

Absorption P ∧ (P ∨ Q) ∼
= P P ∨ (P ∧ Q) ∼
= P

Double negation ¬¬P ∼


= P

Complement P ∧ ¬P ∼
= ⊥ P ∨ ¬P ∼
= >

de Morgan ¬(P ∧ Q) ∼
= ¬P ∨ ¬Q ¬(P ∨ Q) ∼
= ¬P ∧ ¬Q

Material implication P =⇒ Q ∼
= ¬P ∨ Q ¬(P =⇒ Q) ∼
= P ∧ ¬Q

Contrapositive P =⇒ Q ∼
= ¬Q =⇒ ¬P

Boolean assumption > =⇒ P ∼


= P ⊥ =⇒ P ∼
= >

Boolean goal P =⇒ > ∼


= > P =⇒ ⊥ ∼
= ¬P

Compound assumption (P ∧ Q) ⇒ R ∼
= P ⇒ (Q ⇒ R) (P ∨ Q) ⇒ R ∼
= (P ⇒ Q) ∧ (Q ⇒ R)

Compound goal P ⇒ (Q ∧ R) ∼
= (P ⇒ Q) ∧ (P ⇒ R) P ⇒ (Q ∨ R) ∼
= (P ⇒ Q) ∨ (P ⇒ R)

Bi-implication (P ⇔ Q) ∼
= (P ⇒ Q) ∧ (Q ⇒ P) = (¬P) ⇔ Q
¬(P ⇔ Q) ∼

Quantifier distrib. = (∀x. P(x))∧(∀x. Q(x))


∀x. P(x) ∧ Q(x) ∼ = (∃x. P(x))∨(∃x. Q(x))
∃x. P(x) ∨ Q(x) ∼
Univ. scope extension (∀x. P(x)) ∧ Q ∼
= ∀x. P(x) ∧ Q (∀x. P(x)) ∨ Q ∼
= ∀x. P(x) ∨ Q

Exis. scope extension (∃x. P(x)) ∧ Q ∼


= ∃x. P(x) ∧ Q (∃x. P(x)) ∨ Q ∼
= ∃x. P(x) ∨ Q

Quantified assumption (∀x. P(x)) ⇒ Q ∼


= ∃x. P(x) ⇒ Q (∃x. P(x)) ⇒ Q ∼
= ∀x. P(x) ⇒ Q

Extraction = (∀x. P(x)) ∧ P(a)


∀x. P(x) ∼ = (∃x. P(x)) ∨ P(a)
∃x. P(x) ∼
Generalised de Morgan ¬(∀x. P(x)) ∼
= ∃x. ¬P(x) ¬(∃x. P(x)) ∼
= ∀x. ¬P(x)
D I S C R E T E M AT H E M AT I C S SUMMARY

Proof patterns
The standard proof techniques used in logic – you can use them systematically to prove most of the
logical propositions you encounter.

Proposition: P

• To assume: Assume P holds.


• To prove:
– Direct proof : Prove the statement directly.
– Proof by contradiction: Assume ¬P and derive a contradiction.

Negation: ¬P

• To assume: Assume ¬P . If P is also an assumption, we have a contradiction.


• To prove
– Reexpress as positive statement: Use logical identities (such as the de Morgan laws) to
‘push the negation in’ and proceed with the proof from there.
– Proof by negation: Assume P and derive a contradiction.

Implication: P =⇒ Q

• To assume
– Modus ponens: Assume P =⇒ Q. If P is also an assumption, we can assume Q.
• To prove
– Deduction: Assume P and prove Q.
– Proof by contrapositive: Prove ¬Q =⇒ ¬P .

Conjunction: P ∧ Q

• To assume:
– Direct proof : Assume P and Q independently.
– Partial assumption: Assume P and prove that Q implies the conclusion. Alternatively,
assume Q and prove that P implies the conclusion.
• To prove: Prove P and Q independently.

Disjunction: P ∨ Q

• To assume
– Proof by cases: In the first case, assume P is true and prove the conclusion. In the second
case, assume Q is true and prove the conclusion
– Disjunctive syllogism: Assume P ∨ Q. If ¬P is also an assumption, we can assume Q.
Similarly, if ¬Q is also an assumption, we can assume P .
• To prove
– Direct proof : Prove P or Q independently.
– Proof by cases: Find a way to split the proof in two cases, proving, in each case, either P
or Q.
D I S C R E T E M AT H E M AT I C S SUMMARY

– Disjunctive syllogism: Assume ¬P and prove Q. Alternatively, assume ¬Q and prove P .


(This follows from a case split on the truth of P : if P is true then P ∨ Q is true, so only
need to provide a proof for ¬P =⇒ Q.)

Bi-implication: P ⇐⇒ Q

Bi-implication equivalent to (P =⇒ Q) ∧ (Q =⇒ P). Correspondingly:

• To assume: Assume P =⇒ Q and Q =⇒ P .


• To prove: Prove P =⇒ Q and Q =⇒ P .

Multiple equivalence: P1 ⇐⇒ P2 ⇐⇒ · · · ⇐⇒ Pn

• To assume: Assume either Pi and freely convert to a different P j as needed.


• To prove: Prove P1 =⇒ P2 , P2 =⇒ P3 , . . . , Pn−1 =⇒ Pn and finally Pn =⇒ P1 .

Universal quantification: ∀x. P(x)

• To assume: Assume ∀x. P(x). If we also have a value a in our assumptions, we can instantiate
the the universal quantification to deduce P(a).
• To prove: Assume x is an arbitrary value and prove P(x). Ensure that x is a new variable name,
i.e. it isn’t already used somewhere in the proof.

Existential quantification: ∃x. P(x)

• To assume: Assume there is a witness a for which P(a) holds, where a is a new variable name.
• To prove: Find a value a for which we can prove that P(a) holds.

Unique existential quantification: ∃!x. P(x)

Unique existence defined as ∃x. P(x) ∧ (∀ y. P( y) =⇒ y = x). Correspondingly:

• To assume: Assume there is a witness a for which P(a) holds; in addition, assume that this a is
unique, i.e. if there is any other b for which P(b) holds, a must equal b.
• To prove: Prove existence and uniqueness: find a value a for which P(a) holds, and establish
that any other b for which P(b) holds must equal a.

Induction
Proof by induction is a powerful, general proof technique for proving properties about elements of
possibly infinite sets. Depending on how the set is defined, the induction principle can be presented in
different ways, but the basic principle is always the same: prove the property for some base elements
of the set, then prove it for the general elements, having assumed it for the ‘smaller’ elements (this
can be made more formal with the notion of a well-founded relation). Below are the three most
common induction principles used in computer science.

Structural induction

We can use structural induction to prove properties about recursively defined structures that can
be represented as trees: lists, binary trees, expressions, etc. These are usually defined with some
recursive grammar (e.g. BNF notation) or an algebraic data type.
D I S C R E T E M AT H E M AT I C S SUMMARY

To prove a property P(t) for every tree t of some grammar or ADT, it is enough to:

1. prove P(l) for every non-recursive leaf node l ;


2. for every branch node b with subtrees t i , assuming P(t i ) for subtrees t i , prove P(b(t 1 , . . . , t n )).

[∀l. P(l)] ∧ [∀b(t 1 , . . . , t n ). P(t 1 ) ∧ · · · ∧ P(t n ) ⇒ P(b(t 1 , . . . , t n ))] =⇒ ∀t. P(t)

Rule induction

We can use rule induction to prove properties about subsets inductively defined by a collection of
axioms and rules:
h1 h2 ··· hn
a c

To prove a property P(e) for every element e of an inductively defined set, it is enough to:

1. prove P(a) for every axiom a;


h1 ··· hi
2. for every rule c , assuming P(hi ) for every hypothesis hi , prove P(c) for the conclusion c .

h1 · · · h i
• ˜
[∀a. P(a)] ∧ ∀ . P(h1 ) ∧ · · · ∧ P(hn ) ⇒ P(c) =⇒ ∀e. P(e)
c

Mathematical induction

We can use mathematical induction to prove properties about natural numbers.

To prove a property P(n) for all n ∈ N, it is enough to:

1. prove P(0);
2. for every k ∈ N, assuming P(k), prove P(k + 1).

P(0) ∧ [∀k ∈ N. P(k) ⇒ P(k + 1)] =⇒ ∀n ∈ N. P(n)

It is worth noting that mathematical induction is just a special case of structural induction on the
data type type nat = zero | succ of nat, or rule induction on the set inductively defined by:
n
zero succ(n)

Strong induction from a basis

Induction hypotheses may be strengthened by assuming the property for every element ‘smaller’
than the general case, not just the immediate predecessor. In addition, we can explicitly specify the
base case if the property only holds for elements above a certain size. Specialised to mathematical
induction, we get the following strong induction principle:

To prove a property P(n) for n ∈ N with ` ≤ n for some basis ` ∈ N, it is enough to:

1. prove P(`);
2. for every k ∈ N, assuming P(m) for all ` ≤ m ≤ k, prove P(k + 1).
D I S C R E T E M AT H E M AT I C S SUMMARY

Algebra and order theory


Abstract algebra is a branch of mathematics that aims to systematise and abstractly analyse the
various structures that are encountered in mathematics. The idea is that by recognising common op-
erations, definitions and properties in different mathematical fields, new theorems and constructions
based on the common properties can be applied uniformly to the distinct fields. A good analogy is
polymorphism encountered in functional and object-oriented programming: an abstract polymorphic
function (e.g. sorting) can be applied at any type that supports some property (e.g. that the elements
can be compared). While this field is not explicitly covered in the course, you are introduced to
many of its underlying concepts, and several ideas in the course can be reinterpreted in an abstract
algebraic framework. Once you understand how these concepts fit together, there is immediately
a lot less to memorise: instead of independently remembering one set of laws for set theory and
another for logic, you can memorise the common structure and apply it to the two fields.

Algebraic structures
Abstract algebra focuses on the analysis of algebraic structures. An algebraic structure consists of
an underlying set (carrier) with a collection of operators and distinguished elements which obey a
collection of laws. An algebraic structure can be built on top of another one by adding new operations,
elements or laws, thereby constructing a hierarchy of algebraic structures. Some examples that appear
in the course:

Monoid A set A with a binary operator •: A × A → A (monoidal multiplication) and element " ∈ A
(unit or neutral element) that obey the following laws:

• Left and right unit: ∀a ∈ A. a • " = a = " • a


• Associativity: ∀a, b, c ∈ A. a • (b • c) = (a • b) • c

Commutative monoid A monoid (A, •, ") with the additional law of commutativity for the multiplica-
tion •: ∀a, b ∈ A. a • b = b • a. For example, (N, +, 0) and (N, ·, 1) are commutative monoids.

Group A monoid (A, •, ") with an additional unary operation (·)−1 : A → A such that for any a ∈ A,
a−1 is the inverse element of a obeying the laws:
a • a−1 = " = a−1 • a

Commutative (or abelian) group A group (A, •, ", (·)−1 ) where the binary operation is commutative.
For example, (Z, +, 0, −) and (Q, ×, 1, 1/(·)) are commutative groups.

Semiring A set A with an additive commutative monoidal structure (A, ⊕, 0) and a multiplicative
monoidal structure (A, ⊗, 1) where ⊗ distributes over ⊕ on both sides:

∀a, b, c ∈ A. a ⊗ (b ⊕ c) = (a ⊗ b) ⊕ (a ⊗ c) (b ⊕ c) ⊗ a = (b ⊗ a) ⊕ (c ⊗ a)
and the additive unit serves as an annihilator for the multiplicative identity:

∀a ∈ A. a ⊗ 0 = 0 = 0 ⊗ a
If the multiplicative operation is commutative, we have a commutative semiring. Examples are
(N, +, 0, ×, 1) and (B, ∨, ⊥, ∧, >).
D I S C R E T E M AT H E M AT I C S SUMMARY

Ring A semiring whose additive commutative monoid is a commutative group. That is, we have an
additive inverse for every element of A. Again, we have a commutative ring if the multiplicative
operation is commutative. An example is (Z, +, 0, −, ×, 1).

Field A commutative ring which has multiplicative inverse for every non-0 element of A. That is, a
field (A, ⊕, 0, , ⊗, 1, (·)−1 ) is a structure where (A, ⊕, 0, ) is an abelian (additive) group and
(A \ {0}, ⊗, 1, (·)−1 ) is an abelian (multiplicative) group. Examples are (Q, +, 0, −, ×, 1, (·)−1 )
or (R, +, 0, −, ×, 1, (·)−1 ). Fields are sets for which addition, multiplication, subtraction and
division are defined, so a field resembles (and generalises) rational or real numbers – many
operations and theorems defined for real numbers can be interpreted more abstractly for fields,
and therefore applied to any particular instance of a field (such as polynomials or integers
modulo a prime number).

Category An algebraic characterisation of structures that have an ‘source’ and ‘target’. Instead of a
single carrier set, a category is defined on a collection of sets (or, more generally, objects) and a
collection of arrows or morphisms between the objects. A typical example is the category Set of
all sets and all functions between them: the set of morphisms between two sets A and B is the
set A ⇒ B . A category also requires an operation of composition of f : A → B and g : B → C to
get g ◦ f : A → C , and an identity morphism idA : A → A for every object A, satisfying:

• Left and right unit: ∀ f : A → B. f ◦ idA = f = idB ◦ f


• Associativity: ∀ f : A → B, g : B → C, h: C → D. h ◦ (g ◦ f ) = (h ◦ g) ◦ f

From the similarity of the laws, we can see that categories are a generalisation of monoids:
indeed, a one-object category (where there is no distinction between the source and target) is a
monoid (cf. Corollary 110, stating that (Rel(A), ◦, idA) is a monoid for any set A). Any time you are
asked to prove that some relational structure (partial functions, surjections, etc.) has a unital
identity and an associative composition operation, you prove that it is a category. The field of
category theory builds some very complex results from this simple idea, establishing surprising
formal connections between seemingly disparate mathematical concepts and deriving powerful,
abstract results that can be applied to a range of mathematical domains.

Order theory
A branch of mathematics which investigates the notion of ordering and comparison using homogen-
eous binary relations. Like with algebraic structures, we start with a carrier set P and some binary
relation v ∈ Rel(P) satisfying some laws.

Preorder A preorder (P, v) consists of a carrier set P and a relation v: P → P satisfying:

• Reflexivity: ∀a ∈ P. a v a
• Transitivity: ∀a, b, c ∈ P. (a v b ∧ b v c) =⇒ a v c

Partial order A partially ordered set or poset is a preorder (P, v) which further satisfies antisymmetry:
∀a, b ∈ P. (a v b ∧ b v a) =⇒ a = b.
Total order A totally ordered set is a poset (P, v) which further satisfies totality (or linearity):
∀a, b ∈ P. a v b ∨ b v a.
D I S C R E T E M AT H E M AT I C S SUMMARY

Strict order A strict order (P, À) can be constructed from any partial order (P, v) by defining À as
a À b ¬ a v b ∧ a 6= b.
The the following definitions are concerned with special constructions within a fixed poset (P, v).

Least and greatest element An element ⊥ ∈ P is the least (or bottom) element of the poset P if it is
below every element in P : ∀a ∈ P. ⊥ v a. An element > ∈ P is the greatest (or top) element if
it is above every element in P : ∀a ∈ P. a v >. Top and bottom elements are unique, if they
exist.

Minimal and maximal element An element m ∈ P is minimal if it has no elements below it:
∀a ∈ P. a v m =⇒ a = m. An element n ∈ P is maximal if it has no elements above it:
∀a ∈ P. n v a =⇒ n = a. If a preorder has no least element, it may still have several minimal
elements which are lower than any other non-minimal element but not related to each other
(and similarly for maximal elements).

Lower and upper bound Given a subset S ⊆ P , an element l ∈ P is a lower bound for S if it is below
every element of S : ∀a ∈ S. l v a. An element u ∈ P is an upper bound for S if it is above every
element of S : ∀a ∈ S. a v u. Bounds do have to exist for every subset, and if they do, they
might not be unique.

Least upper bounds and greatest lower bound Given a subset S ⊆ P , the least upper bound (also
W
called join or supremum), denoted S , is the least element of the set of upper bounds of S ;
that is, the element uniquely determined (if it exists) by the properties:
W
• An upper bound: ∀a ∈ S. a v S
• Below any upper bound: ∀u ∈ P. (∀a ∈ S. a v u) =⇒ S v u
W
V
Dually, the greatest lower bound (also called meet or infimum), denoted S , is the greatest
element of the set of lower bounds of S :
V
• A lower bound: ∀a ∈ S. Sva
• Above any lower bound: ∀l ∈ P. (∀a ∈ S. l v a) =⇒ l v S .
V

These conditions can be equivalently presented with single bi-implications which follow from
W W
combining a v S and S v u via transitivity (and similarly for meets):
_ ^
∀u ∈ P. S v u ⇐⇒ (∀a ∈ S. a v u) ∀l ∈ P. l v S ⇐⇒ (∀a ∈ S. l v a)

Binary joins and meets Meets and joins of two-element sets S = { a, b } are often written as binary
W V
operators: a ∨ b ¬ S and a ∧ b ¬ S . Given a, b ∈ P , the join a ∨ b has the properties:
ava∨b bva∨b ∀u ∈ P. (a v u and b v u) =⇒ a ∨ b v u
and the meet a ∧ b has the properties:

a∧bva a∧bv b ∀l ∈ P. (l v a and l v b) =⇒ l v a ∧ b


Equivalently, we have the bi-implications:

∀u ∈ P. a ∨ b v u ⇐⇒ (a v u and b v u) ∀l ∈ P. l v a ∧ b ⇐⇒ (l v a and l v b)
D I S C R E T E M AT H E M AT I C S SUMMARY

Using these notions, we can describe some order-theoretic structures algebraically.

Join- and meet-semilattice A poset (P, v) is a join-semilattice if every pair of elements has a join
(and, by induction, this implies that every finite subset of P has a join). This lets us treat joins as
an abstract algebraic operator ∨: P × P → P whose laws follow from the structure of subsets
in P : they contain unique elements and are unordered, and nested sets can be collapsed into a
single set. The corresponding laws are:

• Idempotence: ∀a ∈ P. a ∨ a = a
• Commutativity: ∀a, b ∈ P. a ∨ b = b ∨ a
• Associativity: ∀a, b, c ∈ P. a ∨ (b ∨ c) = (a ∨ b) ∨ c .

Dually, P is a meet-semilattice if every pair of elements has a meet, making ∧: P × P → P into


an idempotent, commutative and associative operator on P .

Lattice A poset (P, v) is a lattice if it is both a join- and a meet-semilattice, and in addition, the
following absorption laws hold: ∀a, b ∈ P. a ∧ (a ∨ b) = a and a ∨ (a ∧ b) = a.

Bounded lattice A lattice (P, ∨, ∧) is bounded if it has both a least and greatest element ⊥ and >
which are the units for join and meet, respectively: ∀a ∈ P. a ∨ ⊥ = a = a ∧ >.

Distributive lattice A lattice (P, ∨, ∧) is distributive if meets distribute over joins (and vice versa):
∀a, b, c ∈ P. a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c). Any distributive lattice is a semiring under join
and meet.

Complemented lattice A bounded lattice (P, ∨, ∧, ⊥, >) is complemented if every element a ∈ P has
a complement aû satisfying the complement laws a ∨ aû = > and a ∧ aû = ⊥.

Boolean algebra A Boolean algebra (P, ∨, ∧, >, ⊥, (·) ) is a bounded distributive lattice. Complements
û

in distributive lattices are always unique. We can interpret the classic de Morgan laws in any
Boolean algebra: ∀a, b ∈ P. (a ∧ b)û = aû ∨ bû and (a ∨ b)û = aû ∧ bû .

The prototypical example of a Boolean algebra (which gives it its name and syntax) is the structure
associated with Boolean propositional logic: (B, ∧, ∨, ⊥, >, ¬). Explicitly: B is the set of truth values
{ >, ⊥ } with the order ⊥ v > (and reflexivity); ∧ and ∨ is Boolean conjunction and disjunction,
respectively; ⊥ (false) and > (true) are the least and greatest elements for the order; ¬ is Boolean neg-
ation. The associated Boolean algebra laws (idempotence, associativity, commutativity, distributivity,
annihilation, complement) and the derived identities are exactly the ones shown in Section 1.1. The
rules associated with implication follow from all these laws if we define P =⇒ Q as ¬P ∨ Q (which is
= P =⇒ ⊥ follows from P =⇒ ⊥ = ¬P ∨ ⊥ = ¬P , where we
one of the identities): for example, ¬P ∼
used the unit law for joins and bottom elements. In addition, it is also the case that P v Q if and only
if P =⇒ Q (since the only ordering that doesn’t hold is > v ⊥, which corresponds to the only false
line in the truth table for =⇒), so =⇒ acts as a so-called internalisation of the ordering relation.
D I S C R E T E M AT H E M AT I C S SUMMARY

Number theory
Definitions
Divisibility For all integers d and n, d divides n if:

d | n ⇐⇒ ∃k ∈ Z. n = k · d
Congruence For all m ∈ Z+ and a, b ∈ Z, a and b are congruent modulo m if:

a ≡ b (mod m) ⇐⇒ m | (a − b)
Quotient and remainder The unique pair of natural numbers quo(m, n) and rem(m, n) associated
to a given m ∈ N and n ∈ Z+ by the Division Theorem, with the defining properties:

rem(m, n) < n ∧ m = quo(m, n) · n + rem(m, n)


Modulus For every m ∈ Z+ and k ∈ Z, the unique natural number k modulo m is defined as
[k]m ¬ rem(k + |k| · m, m) ∈ N with the defining properties:
[k]m < m ∧ k ≡ [k]m (mod m)
Modular arithmetic For every m ∈ Z+ , the set of integers modulo m is the set Zm ¬ {0, 1, . . . , m −
2, m − 1} of nonnegative integers strictly less than m. Modular addition and multiplication of
integers k, l ∈ Zm is defined as:

k +m l ¬ [k + l]m ∧ k ·m l ¬ [k · l]m
Common divisors Given an n ∈ N, the set of its divisors is defined as

D(n) ¬ { d ∈ N | (d | n) }
The set of common divisors of n, m ∈ N is the set

CD(m, n) ¬ D(m) ∩ D(n) = { d ∈ N | (d | m ∧ d | n) }


Greatest common divisor The greatest common divisor of m, n ∈ N is the the maximum element of
CD(m, n), the set of their common divisors.
Linear combination An integer r is said to be a linear combination of a pair m, n ∈ Z when there
exist a pair of coefficients s and t such that

s·m+ t ·n= r

Theorems
Fermat’s Little Theorem For all naturals i and primes p,

i p ≡ i (mod p) p - i =⇒ i p−1 ≡ 1 (mod p)

Division Theorem For all m ∈ N and n ∈ Z+ ,

∃!q, r ∈ N. r < n ∧ m = q · n + r

Modulus and remainder For all m ∈ Z+ and naturals k, l, n ∈ N,

k ≡ l (mod m) ⇐⇒ rem(k, m) = rem(l, m) n ≡ rem(n, m) (mod m)


D I S C R E T E M AT H E M AT I C S SUMMARY

Common divisor properties For all n ∈ Z+ and naturals m, m0 ∈ N,


m ≡ m0 (mod n) =⇒ CD(m, n) = CD(m0 , n)
CD(m, n) = CD(rem(m, n), n)
CD(m, n) = CD(max(m, n) − min(m, n), min(m, n))

Euclid’s Algorithm For all m, n ∈ Z+ ,


(
n if n | m
gcd(m, n) ¬
gcd(n, rem(m, n)) otherwise
This algorithm terminates on all pairs m, n ∈ Z+ and gcd(m, n) is the greatest common divisor
of m and n, satisfying the properties:

• A common divisor: gcd(m, n) | m ∧ gcd(m, n) | n


• Greatest of all common divisors: ∀d ∈ Z+ . d | m ∧ d | n =⇒ d | gcd(m, n)

The latter condition is known as the universal property of GCDs: a property which uniquely
characterises the greatest common divisor of two numbers without explicitly defining it.

Linear combinations and GCDs For all m, n ∈ Z+ , gcd(m, n) is the least positive linear combination
of m and n. That is:

1. It is a linear combination: ∃k0 , l0 ∈ Z. gcd(m, n) = k0 · m + l0 · n (where the coefficients


k0 = lc1 (m, n) and l0 = lc2 (m, n) can be efficiently computed using the Extended Euclidean
Algorithm)
2. It is the least of all linear combinations: ∀k, l ∈ Z. gcd(m, n) | k · m + l · n

It follows that m and n are coprime if and only if there is a way to express 1 as their linear
combination: (∃k, l ∈ Z. k · m + l · n = 1) ⇐⇒ gcd(m, n) = 1

Euclid’s Theorem For all m, n ∈ Z+ and primes p, p | (m · n) =⇒ p | m ∨ p | n.

Multiplicative inverses in modular arithmetic For all m, n ∈ Z+ ,

1. n · lc2 (m, n) ≡ gcd(m, n) (mod m)


2. If gcd(m, n) = 1, [lc2 (m, n)]m is the multiplicative inverse of [n]m in Zm
3. For a prime p, every non-zero element of Z p has [i p−2 ] p as a multiplicative inverse. Hence,
the algebraic structure (Z p , + p , 0, − p , × p , 1, [(·) p−2 ] p ) is a field.

The divisibility lattice The structure (N, lcm, gcd, 1, 0), is a bounded lattice, where:

• (N, |) is a partial order: m ∈ N is below n ∈ N if m divides n (m | n)


• 1 is the bottom element: ∀n ∈ N. 1 | n
• 0 is the top element: ∀n ∈ N. n | 0
• The common divisors of two numbers m, n ∈ N is the set of lower bounds:
∀d ∈ CD(m, n). d | m ∧ d | n
• The greatest common divisor is the meet: the characteristic property of meets

∀d ∈ N. (d | m ∧ d | n) ⇐⇒ d | gcd(m, n)
D I S C R E T E M AT H E M AT I C S SUMMARY

is exactly the universal property associated with GCDs.


• The top element is the unit for the meet: ∀n ∈ N. gcd(0, n) = n.
• Dually, the join of this preorder is the least common multiple, the bottom element of the
set of common multiples of two numbers. The bottom of the preorder is the unit for the
join: ∀n ∈ N. lcm(1, n) = n.

Set theory
Foundations
Definitions

Subset A ⊆ B ⇐⇒ ∀x. x ∈ A =⇒ x ∈ B
Proper subset A ⊂ B ⇐⇒ A ⊆ B ∧ A 6= B
Empty set ∀x. x 6∈ ;
Finite set [n] ¬ { 0, . . . , n − 1 }
Cardinality The size #A or | A| associated with a set A. If it is a natural number, the set is finite.
In general, the numbers used to describe the cardinality of (finite or infinite) sets are called
cardinal numbers.
Universe The ‘domain of discourse’ in set theory often denoted as U – the collection of elements
that we are concerned with, the superset of all the sets that we are investigating. When we
say ‘A is a set’, we usually mean it is a subset of the universe U . We need this subtlety to
avoid set-theoretic paradoxes such as Russell’s paradox. However, we often leave the universe
implicit: writing x for an element implicitly assumes that x ∈ U .
Set comprehension A notation for defining a set by specifying the property that its elements must
satisfy. Abstractly, we write
A ¬ { x ∈ B | P(x) }

to state that A consists of elements (of B ) for which P(x) holds. Thus, saying that x ∈ A is
equivalent to saying that x ∈ B and furthermore P(x) holds.
Powerset P (A) ¬ { X ⊆ U | X ⊆ A}
Intersection A∩ B ¬ { x ∈ U | x ∈ A∧ x ∈ B }
Union A∪ B ¬ { x ∈ U | x ∈ A∨ x ∈ B }
Complement Aû ¬ { x ∈ U | x 6∈ A}
Set difference A \ B ¬ { x ∈ A | x 6∈ B }
Big union For all families of sets F ⊆ P (U )
[
F ¬ { x ∈ U | ∃A ∈ F . x ∈ A}
Big intersection For all families of sets F ⊆ P (U )
\
F ¬ { x ∈ U | ∀A ∈ F . x ∈ A}
Ordered pair (a, b) ¬ { a, { a, b } }
Cartesian product A × B ¬ { (a, b) | a ∈ A ∧ b ∈ B }
D I S C R E T E M AT H E M AT I C S SUMMARY

Finitary product
n
Y
Ai ¬ A1 × · · · × An
i=1
n
Qn
Set exponent A ¬ i=1 A
Tagging { ` } × A ¬ { (`, a) | a ∈ A}
Disjoint union A ] B ¬ ({ 1 } × A) ∪ ({ 2 } × B)
Finitary disjoint union
n
]
Ai ¬ A1 ] · · · ] An
i=1
Un
Set multiplication n · A ¬ i=1
A

Theorems

Algebraic and order-theoretic properties Let A be a carrier set. A can also taken to be the universe
U so these apply to ‘arbitrary sets’ as well.
• (P (A), ⊆) forms a partial order under subset inclusion.
• (P (A), ∪, ∩, ;, A, (·)û ) forms a Boolean algebra. This means that all the algebraic laws in
the first part of the table in Section 1.1 apply to set theory when we replace the join of logic
S
(disjunction) with the join of set theory (union), etc. The big union F and intersection
F are the generalised joins and meets of the subset F ⊆ P (A). The characteristic
T

properties of big unions and intersections follow directly from the definitions of joins
and meets: for all families of sets F , we have
[ \
∀U. F ⊆ U ⇐⇒ (∀X ∈ F . X ⊆ U) ∀L. L ⊆ F ⇐⇒ (∀X ∈ F . L ⊆ X )
• (P (A), ], ×, ;, [1]) forms a commutative semiring up to isomorphism: for example, A×[1]
is not equal to A (as one consists of tuples (a, 0) while the other is simply elements a),
but there is a bijective correspondence between them.

Cardinality Let A, B be finite sets.

#; = 0 #[n] = n #P (A) = 2#A #(A × B) = #A · #B #(A ] B) = #A + #B

Relations, matrices and graphs


Definitions

Binary relation A relation R between sets A and B (denoted R: A → B ) is a subset R ⊆ A × B . The set
of all relations between A and B is denoted Rel(A, B). An element (a, b) ∈ R is usually written
a R b (as an operator) or R(a, b) (as a predicate). A relation R ∈ Rel(A) on a set A is R: A → A.
Identity relation and relational composition The identity relation idA is { (a, a) | a ∈ A}, so
idA(a, a0 ) ⇐⇒ a = a0 .
Relational composition Composition of relations R: A → B and S : B → C is a new relation
S ◦ R: A → C defined as { (a, c) | ∃b ∈ B. a R b ∧ b S c }.
D I S C R E T E M AT H E M AT I C S SUMMARY

Iterated composition For a relation R: A → A on a set A, the n-fold composition R◦n : A → A is

R◦n ¬ R ◦ · · · ◦ R
| {z }
n times
◦∗
The iterated composition R : A → A is then
[ [
R◦∗ ¬ { R◦n : A → A | n ∈ N } = R◦n
n∈N

Closure Given a relation R ∈ Rel(A) and property P (such as reflexivity), the closure of R under
property P is a relation R
b P ∈ Rel(A) which is the smallest superset of R which satisfies P :

1. R ⊆ R
bP
2. R
b P satisfies P
3. For any other T ∈ Rel(A) which is a superset of R and satisfies P , R
bP ⊆ T .

More generally, we call an arbitrary set A closed under some operation if applying the
operation to elements of A yields an element of A. The closure of a set under an operation
is the smallest superset of A which is closed under the operation. For instance, natural
numbers are closed under addition but not under subtraction; the closure of natural
numbers under subtraction is the set of integers.

Matrices For positive integers m and n, an (m × n)-matrix M over a semiring (S, ⊕, 1, ⊗, 0) is given
by entries Mi, j ∈ S for all 0 ≤ i < m and 0 ≤ j < n. The set of all (m × n)-matrices is denoted
Mat(m, n). An (n×n)-matrix is called a square matrix of order n, and the set of all such matrices
is denoted SqMat(n).

Identity matrix The identity (n × n)-matrix I − n has entries


(
1 if i = j
(I n )i, j ¬
0 if i 6= j
Matrix multiplication The multiplication of an (` × m)-matrix L with an (m × n)-matrix M is
the (` × n)-matrix M · L with entries
m−1
M
(M · L)i, j ¬ (M0, j ⊗ L i,0 ) ⊕ · · · ⊕ (Mm−1, j ⊗ L i,m−1 ) = Mk, j ⊗ L i,k
k=0

Null matrix The null (m × n)-matrix Zm,n has entries

(Zm,n )i, j ¬ 0
Matrix addition The addition of two (m × n)-matrices M and L is the matrix M + L with entries

(M + L)i, j ¬ Mi, j ⊕ L i, j
Matrix from relation For a relation R: [m] → [n] we have a (m × n)-matrix mat(R) over the com-
mutative semiring of Booleans given by

mat(R)i, j ¬ (i, j) ∈ R

Relation from matrix For an (m × n)-matrix M over the semiring of Booleans we have a relation
D I S C R E T E M AT H E M AT I C S SUMMARY

rel(M ): [m] → [n] given by


(i, j) ∈ rel(M ) ⇐⇒ Mi, j

Graphs A directed graph (A, R) consists of a set A and a relation R: A → A

Path For a directed graph (A, R) and s, t ∈ A, a path of length n ∈ N in R with source s and target
t is a tuple (a0 , . . . , an ) ∈ An+1 such that a0 = s, an = t and ai R ai+1 for all 0 ≤ i < n.
Adjacency matrix The adjacency matrix of a finite directed graph ([n], R) for n ∈ Z+ is the
(n × n)-matrix mat(R). There is an edge between nodes labelled i and j iff (i, j) ∈ mat(R).

Theorems

Algebraic properties Let A, B , C be sets and m, n be natural numbers.

• The set of relations Rel(A) on A forms a monoid (Rel(A), ◦, idA).


• More generally, sets and relations between them form a category Rel with the associative
relational composition S ◦ R: A → C for R: A → B and S : B → C , and unital identity
relation idA for all sets A.
• Square matrices of order n over a semiring form a monoid (SqMat(n), ⊗, I n ).
• More generally, matrices form a (slightly unusual) category Mat whose objects are natural
numbers, and the arrows between naturals m and n are (m × n)-matrices. The categorical
composition of an (` × m)-matrix M and an (m × n)-matrix L is the (` × n)-matrix M · L ,
where · is the associative matrix multiplication. The identity arrow for every object n ∈ N
is the identity matrix I n .
• (SqMat(n), ⊗, I n , ⊕, Zn,n ) forms a semiring.
• More generally, matrix multiplication is associative and has the identity matrix as a neutral
element; matrix addition is commutative and associative and has the null matrix as a
neutral element; for every (` × m)-matrix L , L 0 and (m × n)-matrix M , M 0 , we have the
annihilation laws
M · Z`,m = Z`,n Zm,n · L = Z`,n

and distributivity laws

M · (L + L 0 ) = (M · L) + (M · L 0 ) (M + M 0 ) · L = (M · L) + (M 0 · L)
Relations and matrices The functions rel and mat are bijective inverses: for every matrix M over the
semiring of Booleans, mat(rel(M )) = M and for every relation R, rel(mat(R)) = R.

More generally, this shows that the categories Rel and Mat are isomorphic, and the inverse
transformations rel: Mat → Rel and mat: Rel → Mat are structure-preserving mappings of
categories (called functors), which means that they map composition and identities in one
category into composition and identities in the other:
rel(M · L) = rel(M ) ◦ rel(L) mat(S ◦ R) = mat(R) · mat(S)

rel(I n ) = id[n] mat id[n] = I n

Paths and adjacency matrices Given a finite directed graph ([n], R) with adjacency matrix M , the
adjacency matrix M ∗ = mat(R◦∗ ) can be computed as Mn by repeated matrix addition and
D I S C R E T E M AT H E M AT I C S SUMMARY

multiplication:
M0 = I n Mk+1 = I n + (M · Mk )

The graph has a path of length k between nodes i and j if and only if (Mk )i, j holds. Thus, a
node j is inaccessible from i iff (M ∗ )i, j does not hold.

Closures Given a relation R: A → A and a property P (such as reflexivity), the closure of R under P
bP = FR,P where the family FR,P ⊆ P (A × A) is defined as:
T
can be defined as R

FR,P ¬ { Q : A → A | R ⊆ Q ∧ Q satisfies P }
Intuitively, every relation of the family FR,P satisfies the first two conditions in the definition of
a closure above (so it is the set of upper bounds for the closure R
b P ), and the smallest such
relation is the least element of this family of sets, i.e. the meet defined to be the intersection.

Functions
Definitions

Functionality A relation R: A → B is functional if it relates an element a ∈ A with at most one


element b ∈ B : ∀a ∈ A. ∀b1 , b2 ∈ B. a R b1 ∧ a R b2 =⇒ b1 = b2 .

Totality A relation R: A → B is total if it relates every element a ∈ A with some element of b ∈ B :


∀a ∈ A. ∃b ∈ B. a R b.
Partial function A partial function f : A * B ∈ PFun(A, B) is a functional relation. The domain of
definition D f ¬ { a ∈ A | ∃b ∈ B. (a, b) ∈ f } is the set of elements a ∈ A which are mapped
to some b ∈ B . If an a ∈ A is also in D f , we say that the partial function f is defined at a
(denoted f (a)↓) with value f (a) = b (where b is unique because of functionality). If a ∈
/ Df , f
is undefined at a, denoted f (a)↑.

Total function A total function (or just function or map) f : A → B ∈ Fun(A, B) is a total func-
tional relation, or a total partial function. The totality and functionality (existence and unique-
ness of mapping, respectively) combines into the unique existence of mapping for functions:
∀a ∈ A. ∃!b ∈ B. f (a) = b. A partial function f : A * B is total if its domain of definition
coincides with its source: D f = A.

Surjection A surjective function or surjection f : A  B covers its whole codomain, i.e. maps every
a ∈ A to at least one b ∈ B : ∀b ∈ B. ∃a ∈ A. f (a) = b.
Injection An injective function or injection f : A š B embeds the domain into the codomain, i.e.
maps every a ∈ A to at most one b ∈ B : ∀a1 , a2 ∈ A. ( f (a1 ) = f (a2 )) =⇒ a1 = a2 .

Bijection A bijective function or bijection is a function that is both an injection and a surjection, i.e.
maps every a ∈ A to exactly one b ∈ B : ∀b ∈ B. ∃!a ∈ A. f (a) = b. Equivalently, a function
f : A → B is a bijection if there exists a necessarily unique function f −1 : B → A that is both:
• a retraction (left inverse) for f : g ◦ f = idA
• a section (right inverse) for f : f ◦ g = idB
D I S C R E T E M AT H E M AT I C S SUMMARY

Totality
Relation Total relation

Functionality Unique dom.

Surjectivity
Partial function Function Surjection
Exists dom.

Injectivity Unique cod.

Injection Bijection
Exists cod.

Theorems

Algebraic properties Sets and partial functions, functions, injections, surjections and bijections
between them all form categories, i.e. they all have respective neutral identity maps and are
closed under associative composition.
Cardinality Let A, B be finite sets.
(
0 if #A 6= #B
#PFun(A, B) = (#B + 1)#A #Fun(A, B) = #B #A #Bij(A, B) =
n! if #A = #B = n
Sections and retractions Every injection between sets is a section, and every surjection is a retraction.
The latter statement is equivalent to the axiom of choice, also stated as the Cartesian product
of a non-empty collection of sets is non-empty.

Isomorphisms and equivalence relations


Definitions

Isomorphism Two sets A, B are isomorphic (denoted A ∼


= B ) if they are in a bijective correspondence,

i.e. there exists a bijection f : A −
→ B between them. A finite set A of cardinality n ∈ N is
isomorphic to [n]. Two finite sets A and B are isomorphic if they have the same number of
= B ⇐⇒ #A = #B .
elements: A ∼

Characteristic function Given a set A and subset S ⊆ A, the characteristic function χS : A → B (where
= [2] is the set of Boolean truth values) associated with S is defined as: χS (a) = a ∈ S .
B∼
Equivalence relation A relation E ∈ Rel(A) is an equivalence relation if it is:

1. reflexive: ∀x ∈ A. x E x
2. symmetric: ∀x, y ∈ A. x E y ⇐⇒ y E x
3. transitive: ∀x, y, z ∈ A. x E y ∧ y E z =⇒ x E z

The set of all equivalence relations on A is denoted EqRel(A).

Partition A partition P of a set A is a set of non-empty subsets (i.e. P ⊆ P (A) \ ;) satisfying:

P =A
S
1. Covering:
2. Pairwise disjointness: ∀B1 , B2 ∈ P. B1 6= B2 =⇒ B1 ∩ B2 = ;

The set of all partitions of A is denoted Part(A).


D I S C R E T E M AT H E M AT I C S SUMMARY

Equivalence class Given a set A and equivalence relation E ∈ EqRel(A), the equivalence class of an
element a ∈ A is the set of elements it is related to by E :

[a] E ¬ { x ∈ A | x E a }

Quotient set Given a set A and equivalence relation E ∈ EqRel(A), the quotient of A by E is the set
of equivalence classes of A under E :

A/E ¬ { B ⊆ A | ∃a ∈ A. B = [a] E } = { [a] E ⊆ A | a ∈ A}

Relational image Let R: A → B be a relation.




• The direct image of a subset X ⊆ A under R is the set R (X ) ⊆ B , defined as


R (X ) ¬ { b ∈ B | ∃x ∈ X . x R b }
←−
• The inverse image of a subset Y ⊆ B under R is the set R (Y ) ⊆ A, defined as
←−
R (X ) ¬ { a ∈ A | ∀ y ∈ B. a R y =⇒ y ∈ Y }
Functional image Let f : A → B be a function.


• The direct image of a subset X ⊆ A under f is the set f (X ) ⊆ B , defined as


f (X ) ¬ { b ∈ B | ∃x ∈ X . f (x) = b } = { f (x) ∈ B | x ∈ X }
←−
• The inverse image of a subset Y ⊆ B under f is the set f (Y ) ⊆ A, defined as
←−
f (X ) ¬ { a ∈ A | f (a) ∈ Y }

Theorems

Partitions and equivalence classes For every set A, the the sets of equivalence relations and parti-
tions on A are isomorphic: EqRel(A) ∼
= Part(A). The bijection is established by mapping an
equivalence relation E ∈ EqRel(A) to the quotient set A/E , and it inverse maps a partition
P ∈ Part(A) to the relation ≡ P defined as x ≡ P y ⇐⇒ ∃B ∈ P. x ∈ B ∧ y ∈ B .
Calculus of bijections Let A, B , C , X , Y be sets.

• Isomorphism is an equivalence relation:

A∼
= A = B =⇒ B ∼
A∼ = A (A ∼ = C) =⇒ A ∼
= B ∧ B ∼ = C

• Isomorphism is a congruence relation: if A ∼


= X and B ∼
= Y , then

P (A) ∼
= P (X ) A× B ∼
= X ×Y A] B ∼
= X ]Y = Rel(X , Y )
Rel(A, B) ∼
= PFun(X , Y )
PFun(A, B) ∼ = Fun(X , Y )
Fun(A, B) ∼ = Bij(X , Y )
Bij(A, B) ∼
• (P (A), ], ×, ;, [1]) forms a commutative semiring up to isomorphism:
= A ] (B ] C) and (A × B) × C ∼
– (A ] B) ] C ∼ = A × (B × C): ] and × are associative.
= B ] A and A × B ∼
– A] B ∼ = B × A: ] and × are commutative.
= A ] [0] and A ∼
– A∼ = A × [1]: [0] is the unit for ], and [1] is the unit for ×.
= (A × C) ] (B × C): × distributes over ].
– (A ] B) × C ∼
• Properties of functions (cf. Section 1.1):
D I S C R E T E M AT H E M AT I C S SUMMARY

– (A ⇒ [1]) ∼
= [1]: unique constantly 0 function from A into the singleton set.
= [1]: unique empty function from the empty set to A.
– ([0] ⇒ A) ∼
– ([1] ⇒ A) ∼
= A: elements a of A are isomorphic to functions 0 7→ a .
– (A ⇒ [0]) ∼
= [0]: if A is nonempty, there are no functions from A into the empty set
(not even the empty function, since there is no b ∈ [0] for every a ∈ A).
– (A ⇒ (B × C)) ∼
= (A ⇒ B) × (A ⇒ C): a function returning a pair can be defined as a
pair of functions.
– ((A ] B) ⇒ C) ∼
= (A ⇒ C) × (B ⇒ C): a function taking a disjoint union can be
defined as a pair of functions (cf. case analysis).
– ((A× B) ⇒ C) ∼
= (A ⇒ (B ⇒ C)): a function taking a pair can be defined as a function
returning a function (cf. currying).
= (A ⇒ (B ] [1])): a partial function can be defined as a function with
– PFun(A, B) ∼
an extra unique value in its codomain (cf. option type).
– P (A) ∼
= (A ⇒ [2]): a subset S of A can be defined via its characteristic function χS .

Finite set isomorphisms For all m, n ∈ N,


P ([n]) ∼
= [2n ] [m] × [n] ∼
= [m · n] [m] ] [n] ∼
= [m + n]

PFun([m], [n]) ∼
= [(n + 1) ]
m
Fun([m], [n]) ∼
= [n ]
m
Bij([n], [n]) ∼
= [n!]

Images of surjections and injections Let s : A  B be a surjection, and i : A š B be an injection. The


direct image of A under s is the full codomain, and the direct image of A under i is isomorphic
s(A) = B and ~i(A) ∼
to the domain: ~ = A.

Indexing and enumerability


Definitions

Set-indexed constructions Given a set I , the family of sets indexed by I is the indexed family { Ai }i∈I
consisting of a set Ai for every i ∈ I . That is, we have a mapping i 7→ Ai from I to { Ai }i∈I .
Various set operations can be indexed by a set I : we recover the usual finitary versions with
I = N and { An }n∈N = { A0 , A1 , . . . }, and binary versions with I = [2] and { Ai }i∈[2] = { A0 , A1 }.
Indexed unions [ [
Ai ¬ { Ai | i ∈ I } = { a | ∃i ∈ I. a ∈ Ai }
i∈I

Indexed intersections For I 6= ;,


 
\ [
Ai ¬ a∈ Ai ∀i ∈ I. a ∈ Ai
i∈I i∈I

Indexed disjoint unions ] [


Ai ¬ {i} × Ai
i∈I i∈I

Indexed products
 
Ai ¬ α ∈ I ⇒ i∈I Ai ∀i ∈ I. α(i) ∈ Ai
Q S
i∈I
D I S C R E T E M AT H E M AT I C S SUMMARY

Finite sequences ]
A∗ ¬ An
n∈N

Indexed partial functions ]


PFunfin (A, B) ¬ (S ⇒ B)
S∈Pfin (A)

Enumerability A set is enumerable when there exists a surjection e : N  A called an enumeration.

Countability A set is countable if it is either empty or enumerable.

Theorems

Closure of countability Let A, B be countable sets.

• The set of natural numbers N is countable.


• If S ⊆ A, then S is countable.
• If A ∼
= X then X is countable.
• A × B and A ] B are countable.
U
• If {X i }i∈A is a countable indexed family of countable sets, then i∈A X i is countable.

As corollaries of the above, we have:

• Every finite set is countable.


+
= N ] N is countable.
• The set of integers Z ∼
• The set of rational numbers Q ∼
= N × N is countable.
• A∗ , Pfin (A) and PFunfin (A, B) are countable.

Cantor’s diagonalisation argument For every set A, no surjection A  P (A) exists. As a result, the set
P (N) is uncountable – it is ‘more infinite’ than the already infinite set N. This establishes that
the cardinality of natural numbers (called countable infinity and denoted ℵ0 ) is strictly smaller
than the cardinality of P (N) (which can be denoted as 2ℵ0 in cardinal arithmetic). Similarly,
ℵ0
| P (P (N)) | = 2(2 ) is strictly greater still, and repeated application of the powerset operation
lets us generate a countably infinite sequence of uncountably infinite sets, each strictly larger
than the previous one.

Cardinality of real numbers Any closed interval [a, b] of real numbers between a, b ∈ R is iso-
morphic to the real numbers. In particular, elements of the interval [0, 1] can be described as
binary sequence, corresponding to the bits after the ‘binary point’ in the binary expansion of a
real in [0, 1]. The set of all binary sequences [2]∞ thus also isomorphic to the real numbers,
and so is the set of functions from N to [2] that enumerate the bits in a binary sequence.
Finally, (N ⇒ [2]) is the set of characteristic functions on naturals and is isomorphic to P (N).

= [0, 1] ∼
= [2] = (N ⇒ [2]) ∼
= P (N)
∞ ∼
R∼

Given that the cardinalities of isomorphic sets are equal, this derivation shows that the cardin-
ality of the real numbers (called the continuum, denoted c) is equal to | P (N) | = 2ℵ0 .

Continuum hypothesis There is no set of cardinality strictly between the cardinality of N and R,
that is, there is no cardinal number between ℵ0 and c. Equivalently, if the smallest cardinal
D I S C R E T E M AT H E M AT I C S SUMMARY

number greater than ℵ0 is denoted ℵ1 , the continuum hypothesis states that ℵ1 = c = 2ℵ0 . A
generalisation of the hypothesis states that ℵk+1 = 2ℵk for any k ∈ N, so the infinite sequence

of cardinalities generated by #P k (N) k∈N
is exactly the sequence (ℵk )k∈N . Kurt Gödel and Paul
Cohen showed that the continuum hypothesis is neither provable nor disprovable in Zermelo–
Fraenkel set theory with the axiom of choice, so its validity is undecidable: no contradiction
would arise if either the CH or its negation is added to ZFC.

Regular languages and finite automata


Formal languages
Definitions

Alphabet An alphabet Σ is finite set of symbols.


Strings A string of length n ∈ N over an alphabet Σ is an ordered n-tuple of symbols. Σ∗ is the set
of all finite strings over Σ.
Empty string The unique string of length 0 is the empty string denoted " .
Concatenation Joining two strings u and v end-to-end creates the concatenation denoted by u · v or
uv. This generalises to the concatenation of any finite number of strings.
Language Given an alphabet Σ, a subset of Σ∗ is called a formal language.

Theorem

For an alphabet Σ, the structure (Σ∗ , ·, ") forms a monoid.

Inductive definitions
Definitions

Axioms and rules We can inductively define a subset of a given set U with axioms and rules, written

h1 h2 ··· hn
a c

where a (axiom), h1 , h2 , . . . , hn (hypotheses), and c (conclusion) are all elements of U .

Derivation Given a set of axioms and rules for inductively defining a subset of a set U , a derivation
or proof that a particular element u ∈ U is in the subset is a finite rooted tree with vertices
labelled by elements of U such that:

• the root of the tree is u (the conclusion of the derivation)


• each vertex of the tree is the conclusion of a rule whose hypotheses are the children of
the vertex
• each leaf of the tree is an axiom

A derivation for u ∈ U is therefore a concrete proof that the axioms can be combined and
translated into u via the rules.
D I S C R E T E M AT H E M AT I C S SUMMARY

Inductively defined subset Given a set of axioms and rules over U , the subset of U inductively
defined by the axioms and rules consists of all and only the elements u ∈ U for which there is
a derivation with the conclusion u.

Theorem

Closure property Given a set U and a collection of axioms and rules, the inductively defined subset
I ⊆ U is the closure of the set of axioms under the application of rules. That is, I is closed
under the rules (applying any rule to any elements of I will yield a conclusion already in I ),
and is the smallest such subset (for any other closed S ⊆ U , I ⊆ S ). This property gives rise to
the proof technique of rule induction.

Regular expressions
Definitions

Regular expression A symbolic description of a collection of strings of a language. Given an alphabet


Σ, the concrete syntax of regular expressions on Σ is the subset of U ¬ (Σ ∪ { ε, ;, |, ∗, (, ) })∗
inductively defined by the following axioms and rules:

r r s r s r
a ε ; (r) r |s rs r∗

Matching Each regular expression r over an alphabet Σ induces a language L(r) ⊆ Σ∗ . The strings u
in L(r) are by definition the ones that match r , where:

• a for a symbol a ∈ Σ is matched iff u = a


• ε is matched iff u is the empty string "
• ; is not matched by any string
• r | s is matched iff u either matches r or it matches s
• rs is matched iff u can be expressed as the concatenation u = vw where v matches r and
w matches s
• r ∗ is matched iff either u = " or u = r or u can be expressed as the concatenation of two
or more strings, each of which matches r

Finite automata
Definitions

Non-deterministic finite automaton (NFA) A 5-tuple M = (Q, Σ, ∆, s, F ), where:

• Q is a finite set of states


• Σ is the finite alphabet of input symbols
• ∆ ⊆ Q × Σ × Q is the transition relation
• s ∈ Q is the start state
• F ⊆ Q is the set of accepting states
a
→ q0 for (q, a, q0 ) ∈ ∆.
We write q −
D I S C R E T E M AT H E M AT I C S SUMMARY

Deterministic finite automaton (DFA) An NFA M = (Q, Σ, ∆, s, F ) with the property that for each state
a
q ∈ Q and each input symbol a ∈ Σ, there is a unique state q0 ∈ Q satisfying q −
→ q0 . That is, ∆
a
can be expressed as a next-state function δ : Q × Σ → Q where ∀q0 . q −→ q0 ⇔ q0 = δ(q, a).
"
" -transitions State transitions q −
→ q0 that do not consume any input symbol.
NFA with " -transitions (NFA" ) A tuple M = (Q, Σ, ∆, s, F, T ) where (Q, Σ, ∆, s, F ) is an NFA and T ⊆
"
Q × Q is the " -transition relation with elements (q, q0 ) ∈ T written as q −
→ q0 .
u
Language accepted by an NFA" We write q =
⇒ q0 to mean that there is a path in an NFA" M =
(Q, Σ, ∆, s, F, T ) from state q to state q0 whose non-" labels form the string u ∈ Σ∗ . A string
u
u ∈ Σ∗ is accepted by M if there exists a state t ∈ F such that s =
⇒ t . A language L(M ) accepted
by M is the set of all strings accepted by M .

Theorem

Subset construction For each NFA" M = (Q, Σ, ∆, s, F, T ) there is a DFA PM = (P (Q), Σ, δ, s0 , F 0 )


with L(PM) = L(M ) defined as follows:

• a state of PM is a set of states of M


• the input alphabet is the same Σ as for M
• the next-state function δ : P (Q) × Σ → P (Q) defined as:
¦ a ©
δ(S, a) ¬ q0 ∈ Q ∃q ∈ S. q =
⇒ q0 in M
¦ " ©
• the start state is s0 ¬ q0 ∈ Q s =⇒ q0
• the set of accepting states is F 0 ¬ { S ⊆ Q | S ∩ F 6= ; }

Since every DFA is an NFA" and the subset construction above creates a DFA from any NFA" , the
class of languages accepted by DFAs and NFA" s is the same – nondeterminism does not add
extra power.

Regular languages
Regular language A language is regular iff it is equal to L(M ) for some DFA M .

Theorems

Kleene’s Theorem The class of regular languages equals the class of languages accepted by a regular
expression. That is:

1. For every regex r , L(r) is a regular language. We establish this by constructing an NFA"
for any regular expression r by structural recursion on r .
2. Every regular language is of the form L(r) for some regex r . We establish this by inductively
defining a regex rq,q 0 for an NFA M = (Q, Σ, ∆, s, F ) satisfying:
S

u ∗ 0
€ Š ¦ ©
S
L rq,q 0 ¬ u ∈ Σ ∗
q −
→ q in M with all intermediate states of the transitions in S

and constructing the regex r ¬ rs,t


Q Q
| · · · |rs,t for all accepting states t i ∈ F .
1 k

Closure properties Regular languages are closed under the following operations:
D I S C R E T E M AT H E M AT I C S SUMMARY

Union L(r) ∪ L(s) = L(r | s)


Concatenation L(r)L(s) = { vw ∈ Σ∗ | v ∈ L(r) ∧ w ∈ L(s) } = L(rs)
Kleene star L(r)∗ = { " } ∪ { vw ∈ Σ∗ | v ∈ L(r) ∧ w ∈ L(r)∗ } = L(r ∗ )

Complementation If L is a regular language over Σ accepted by a DFA M = (Q, Σ, δ, s, F ), then


its complement L û ¬ { u ∈ Σ∗ | u 6∈ L } is also regular, since it is accepted by Not(M ) ¬
(Q, Σ, δ, s, Q \ F ). The corresponding regular expression is denoted ∼ r , matched by u iff
u does not match r .
Intersection If L1 and L2 are regular languages over Σ, then their intersection L1 ∩ L2 ¬ { u ∈
Σ∗ | u ∈ L1 ∧ u ∈ L2 } is also regular. This can be established either by constructing the

DFA And(M1 , M2 ) directly, or observing that by the de Morgan law L1 ∩ L2 = L1û ∪ L2û
and regular languages are closed under union and complementation. The corresponding
regular expression is denoted r & s, matched by u iff u matches both r and s.

Decidability of matching Determining whether a string u matches a regular expression r is decidable


by converting r into an NFA" M using Kleene’s Theorem, converting M into a DFA PM via the
subset construction, and checking whether PM accepts u.

Decidability of equivalence Determining whether two regular expressions r and s accept the same
set of languages is decidable, since L(r) = L(s) if and only if L((∼ r) & s) = ;, and checking
whether the DFA corresponding to the regex (∼ r) & s accepts any strings can be done in a finite
number of queries.

Pumping Lemma For every regular language L , there is a number ` ∈ Z+ satisfying the pumping
lemma property: all w ∈ L with | w | ≥ ` can be expressed as a concatenation of three strings
w = u1 vu2 which satisfy (1) v 6= " , (2) | u1 v | ≤ `, and (3) for all n ∈ N, u1 v n u2 ∈ L .
To prove that a language L is not regular, we can establish the negation of the Pumping Lemma:
for each ` ≥ 1, there is some w ∈ L with | w | ≥ ` such that no matter how w is split into three
strings w = u1 vu2 , with v 6= " and | u1 v | ≤ `, there is some n ∈ N for which u1 v n u2 6∈ L .

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy