The Timpson Lyceum seal

The Timpson Lyceum · Computation Theory

Lecture 2 (Computation Theory) Set Theory and Functions

Set Theory and Functions – Lecture 2

Overview

This lecture builds set theory on top of logic and uses it as the foundation for the rest of the course — every mathematical object, including the objects of computation theory, ultimately reduces to a set. It introduces what a set is, the standard number sets, and set-builder notation, then develops the relations and operations that act on sets (subset, equality, union, intersection, difference, complement, and Cartesian product). From there it moves up the ladder from lists and tuples to relations, and finally to functions and their key properties: onto, one-to-one, and bijection. A recurring theme is learning to read dense symbolic notation precisely rather than relying on intuition or pictures.

Key Concepts

Set. An unordered, unique collection of objects, written between curly braces, e.g. {1,2,□}\{1, 2, \square\}. "Unique" means repeated elements do not matter ({1,2,2}={1,2}\{1,2,2\} = \{1,2\}); "unordered" means order does not matter ({1,2}={2,1}\{1,2\} = \{2,1\}). Formally a set is an undefined term whose meaning comes from the axioms.

Membership. x∈Ax \in A means xx is an element of the set AA; x∉Ax \notin A means it is not. Note that {2}∈A\{2\} \in A and 2∈A2 \in A are different claims — the set {2}\{2\} is a distinct object from 22.

Standard sets.

The "…\dots" convention. Three dots mean: continue the obvious pattern indefinitely. It signals an infinite set, not the literal symbol "infinity."

Set-builder notation. { x:P(x) }\{\, x : P(x) \,\} — the set of all xx such that the predicate P(x)P(x) is true. The colon reads "such that." A shorthand pulls the source set out front: { x∈Z:x≥0 }\{\, x \in \mathbb{Z} : x \ge 0 \,\} means the same as { x:x∈Z and x≥0 }\{\, x : x \in \mathbb{Z} \text{ and } x \ge 0 \,\}. Inside the condition, a comma can be read as "and."

Set relations (produce a true/false value):

Lists and tuples. A list is an ordered collection, written with parentheses, e.g. (1,2,2)(1,2,2). For lists, order and duplicates matter, so (1,2)≠(2,1)(1,2) \ne (2,1) and (1,2,2)(1,2,2) has three entries. An ordered pair is a two-element list. An nn-tuple is a list with exactly nn elements.

Set operations (take sets, return a set):

Relation. A set whose every element is an ordered pair. {(1,2),(□,△),(3,4)}\{(1,2),(\square,\triangle),(3,4)\} is a relation; {(a,b),{2,3}}\{(a,b), \{2,3\}\} is not (the second element is a set, not a pair). The empty set is vacuously a relation. If RR is a relation, we write x R yx\,R\,y to mean (x,y)∈R(x,y) \in R. Example: "<<" is the relation { (x,y):x<y }\{\,(x,y) : x < y\,\}, so "1<21 < 2" just says (1,2)∈ <(1,2) \in\, <. A set-theoretic relation is a more restrictive notion than a logical relation (a two-variable predicate), but it still behaves like one.

Function. A relation ff is a function iff whenever (a,b)∈f(a,b) \in f and (a,c)∈f(a,c) \in f, then b=cb = c. In words: every input has exactly one output. Equivalently, a=b  ⟹  f(a)=f(b)a = b \implies f(a) = f(b). If (a,b)∈f(a,b) \in f we write f(a)=bf(a) = b. Asking for f(x)f(x) where xx is not an input, or applying f(⋅)f(\cdot) notation to a non-function, is meaningless.

Function-type notation. f:A→Bf : A \to B means ff is a function with domain equal to AA and image a subset of BB (not necessarily all of BB). Here AA and BB are sets and ff is a function. The full reading of f(x)=x2f(x) = x^2 from algebra is "f:R→Rf : \mathbb{R} \to \mathbb{R} by f(x)=x2f(x) = x^2," shorthand for { (x,y):x∈R, y=x2 }\{\,(x,y) : x \in \mathbb{R},\ y = x^2\,\}. A function is also called a map.

Properties of functions (for f:A→Bf : A \to B):

Reference examples.

Worked Example

Goal: decide whether f:A→Bf : A \to B with A={1,2,3}A = \{1,2,3\}, B={4,5,6}B = \{4,5,6\} and f={(1,4),(2,5),(3,6)}f = \{(1,4),(2,5),(3,6)\} is a bijection. The criteria are: one-to-one means equal outputs force equal inputs, and onto means the image equals BB.

domain(f)={1,2,3}=A(so f is a function from A)image(f)={4,5,6}=B⟹f is ontof(a)=f(b)⟹a=b(distinct inputs→distinct outputs)⟹f is one-to-oneone-to-one  ∧  onto⟹f is a bijection.\begin{aligned} \text{domain}(f) &= \{1,2,3\} = A \quad\text{(so } f \text{ is a function from } A\text{)} \\ \text{image}(f) &= \{4,5,6\} = B \quad\Longrightarrow\quad f \text{ is onto} \\ f(a) = f(b) &\Longrightarrow a = b \quad\text{(distinct inputs} \to \text{distinct outputs)} \quad\Longrightarrow\quad f \text{ is one-to-one} \\ \text{one-to-one} \;\wedge\; \text{onto} &\Longrightarrow f \text{ is a bijection.} \end{aligned}

By contrast, g={(1,6),(2,6),(3,6)}g = \{(1,6),(2,6),(3,6)\} is a function with domain AA, but its image is {6}⊊B\{6\} \subsetneq B, so gg is not onto; and since g(1)=g(2)g(1) = g(2) with 1≠21 \ne 2, it is not one-to-one either. The relation {(1,4),(2,5),(1,6)}\{(1,4),(2,5),(1,6)\} fails earlier still — 11 maps to both 44 and 66, so it is not even a function.

Summary