Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Discrete Mathematics: Relations, Matrices, and Graphs, Slides of Discrete Mathematics

DISCRETE MATHEMATICS. SUMMARY. Logic and proof theory. Boolean identities. Proof goals can often be simpli ed using logical identities.

Typology: Slides

2022/2023

Uploaded on 05/11/2023

juhy
juhy 🇺🇸

4.3

(6)

246 documents

1 / 24

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18

Partial preview of the text

Download Discrete Mathematics: Relations, Matrices, and Graphs and more Slides Discrete Mathematics in PDF only on Docsity!

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

  • Logic and proof theory much because you won’t have it in the exam!
    • Boolean identities
    • Proof patterns
    • Induction
  • Algebra and order theory
    • Algebraic structures
    • Order theory
  • Number theory
    • Definitions
    • Theorems
  • Set theory
    • Foundations
    • Relations, matrices and graphs
    • Functions
    • Isomorphisms and equivalence relations
    • Indexing and enumerability
  • Regular languages and finite automata
    • Formal languages
    • Inductive definitions
    • Regular expressions
    • Finite automata
    • Regular languages

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) ∧ Q(x) ∼= (∀x. P(x))∧(∀x. Q(x)) ∃x. P(x) ∨ Q(x) ∼= (∃x. P(x))∨(∃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) ∼= (∀x. P(x)) ∧ P(a) ∃x. P(x) ∼= (∃x. P(x)) ∨ P(a) Generalised de Morgan ¬(∀x. P(x)) ∼= ∃x. ¬P(x) ¬(∃x. P(x)) ∼= ∀x. ¬P(x)

- 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: P 1 ⇐⇒ P 2 ⇐⇒ · · · ⇐⇒ Pn
  • To assume : Assume either Pi and freely convert to a different Pj as needed.
  • To prove : Prove P 1 =⇒ P 2 , P 2 =⇒ P 3 ,... , Pn− 1 =⇒ Pn and finally Pn =⇒ P 1. 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.

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 ti , assuming P(ti ) for subtrees ti , prove P(b(t 1 ,... , tn)).

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

Rule induction

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

a

h 1 h 2 · · · hn 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;
  2. for every rule h^1 ··· c hi, assuming P(hi ) for every hypothesis hi , prove P(c) for the conclusion c.

[∀a. P(a)] ∧

ï ∀ h^1 · · ·^ hi c

. P(h 1 ) ∧ · · · ∧ P(hn) ⇒ P(c)

ò =⇒ ∀e. P(e)

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:

zero

n 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 ).

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.

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 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:

  • An upper bound: ∀a ∈ S. a v
S
  • Below any upper bound: ∀u ∈ P. (∀a ∈ S. a v u) =⇒

S v u Dually, the greatest lower bound (also called meet or infimum ), denoted

S, is the greatest element of the set of lower bounds of S:

  • A lower bound: ∀a ∈ S.

S v a

  • Above any lower bound: ∀l ∈ P. (∀a ∈ S. l v a) =⇒ l v
S.

These conditions can be equivalently presented with single bi-implications which follow from 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 operators: a ∨ b ¨

S and a ∧ b ¨

S. Given a, b ∈ P, the join a ∨ b has the properties: a v a ∨ b b v a ∨ b ∀u ∈ P. (a v u and b v u) =⇒ a ∨ b v u and the meet a ∧ b has the properties: a ∧ b v a a ∧ b v 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)

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,

ip^ ≡ i (mod p) p - i =⇒ ip−^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)

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

m ≡ m′^ (mod n) =⇒ CD(m, n) = CD(m′, 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+,

gcd(m, n) ¨

n if n | m 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: ∃k 0 , l 0 ∈ Z. gcd(m, n) = k 0 · m + l 0 · n (where the coefficients k 0 = lc 1 (m, n) and l 0 = lc 2 (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 · lc 2 (m, n) ≡ gcd(m, n) (mod m)
  2. If gcd(m, n) = 1 , [lc 2 (m, n)]m is the multiplicative inverse of [n]m in Zm
  3. For a prime p, every non-zero element of Zp has [ip−^2 ]p as a multiplicative inverse. Hence, the algebraic structure (Zp, +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)

Finitary product (^) n ∏

i= 1

Ai ¨ A 1 × · · · × An

Set exponent An^ ¨

∏n i= 1 A Tagging { _ } × A ¨ { ( _ , a) | a ∈ A} Disjoint union A ] B ¨ ({ 1 } × A) ∪ ({ 2 } × B) Finitary disjoint union (^) n ⊎ i= 1

Ai ¨ A 1 ] · · · ] An

Set multiplication n · A ¨

⊎n 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 (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

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, a′) ⇐⇒ a = a′. 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 }.

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︸ n times The iterated composition R◦∗^ : A → A is then R◦∗^ ¨

{ R◦n^ : A → A | n ∈ N } =

n∈N

R◦n

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

  1. R ⊆ bRP
  2. bRP satisfies P
  3. For any other T ∈ Rel(A) which is a superset of R and satisfies P, bRP ⊆ 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

(In)i, j ¨

1 if 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 · L)i, j ¨ (M0, j ⊗ Li,0) ⊕ · · · ⊕ (Mm−1, j ⊗ Li,m− 1 ) =

⊕^ m−^1 k= 0

Mk, j ⊗ Li,k

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 ⊕ Li, 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

multiplication: M 0 = In Mk+ 1 = In + (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 can be defined as bRP =

FR,P where the family FR,P ⊆ P(A × A) is defined as:

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 bRP ), 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. ∀b 1 , b 2 ∈ B. a R b 1 ∧ a R b 2 =⇒ b 1 = b 2.

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 Df ¨ { 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 Df , 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: Df = 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: ∀a 1 , a 2 ∈ A. ( f (a 1 ) = f (a 2 )) =⇒ a 1 = a 2.

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

Relation Total relation

Partial function Function Surjection

Injection Bijection

Totality

Functionality Unique dom.

Exists dom.

Surjectivity

Injectivity (^) Unique cod.

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.

#PFun(A, B) = (#B + 1 )#A^ #Fun(A, B) = #B#A^ #Bij(A, B) =

0 if #A 6 = #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 elements: A ∼= B ⇐⇒ #A = #B.

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

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:

  1. Covering:
P = A
  1. Pairwise disjointness: ∀B 1 , B 2 ∈ P. B 1 6 = B 2 =⇒ B 1 ∩ B 2 = ; The set of all partitions of A is denoted Part(A).

- (A ⇒ [ 1 ]) ∼= [ 1 ]: unique constantly 0 function from A into the singleton set. - ([ 0 ] ⇒ A) ∼= [ 1 ]: unique empty function from the empty set to 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). - PFun(A, B) ∼= (A ⇒ (B ] [ 1 ])): a partial function can be defined as a function with 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]) ∼= [ 2 n] [m] × [n] ∼= [m · n] [m] ] [n] ∼= [m + n]

PFun([m], [n]) ∼= [(n + 1 )m] Fun([m], [n]) ∼= [nm] 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 to the domain: ~ s(A) = B and ~ i(A) ∼= 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 = { A 0 , A 1 ,... }, and binary versions with I = [ 2 ] and { Ai }i∈[ 2 ] = { A 0 , A 1 }. Indexed unions (^) ⋃

i∈I

Ai ¨

{ Ai | i ∈ I } = { a | ∃i ∈ I. a ∈ Ai }

Indexed intersections For I 6 = ;, ⋂ i∈I

Ai ¨

a ∈

i∈I

Ai ∀i ∈ I. a ∈ Ai

Indexed disjoint unions (^) ⊎

i∈I

Ai ¨

i∈I

{i} × Ai

Indexed products (^) ∏ i∈I Ai^ ¨^

α

I ⇒

i∈I Ai

∀i ∈ I. α (i) ∈ Ai

Finite sequences A∗^ ¨

n∈N

An

Indexed partial functions PFunfin(A, B) ¨

S∈Pfin(A)

(S ⇒ B)

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.
  • If {Xi }i∈A is a countable indexed family of countable sets, then

i∈A Xi^ is countable. As corollaries of the above, we have:

  • Every finite set is countable.
  • The set of integers Z ∼= N ] N+^ is countable.
  • 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,

| P(P(N)) | = 2 (^2 ℵ^0 )^ 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).

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

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