Skip to content
Part IA Michaelmas, Lent Term

Functions: Partial and Total

Partial Functions

Definition

A relation f:ABf : A \nrightarrow B is functional (or a partial function) if:

aA.b1,b2B.(afb1afb2b1=b2)\forall a \in A. \forall b_1, b_2 \in B. (afb_1 \land afb_2 \Rightarrow b_1 = b_2)

Each input aa is related to at most one output.

Notation

  • f(a)f(a)\downarrow means ff is defined at aa (there exists bb with afbafb)
  • f(a)f(a)\uparrow means ff is undefined at aa
  • When defined, f(a)f(a) denotes the unique bb with afbafb

Domain

The domain of partial function f:ABf : A \nrightarrow B is:

dom(f)={aA:f(a)}\text{dom}(f) = \{a \in A : f(a)\downarrow\}

Total Functions

Definition

A partial function f:ABf : A \nrightarrow B is total if dom(f)=A\text{dom}(f) = A.

We write f:ABf : A \to B for a total function from AA to BB.

Verification: For all aAa \in A, there exists exactly one bBb \in B with afbafb.

Examples

FunctionTotal?Notes
f:RR,f(x)=x2f : \mathbb{R} \to \mathbb{R}, f(x) = x^2YesDefined everywhere
f:RR,f(x)=xf : \mathbb{R} \nrightarrow \mathbb{R}, f(x) = \sqrt{x}PartialOnly defined for x0x \geq 0
f:RR,f(x)=1/xf : \mathbb{R} \nrightarrow \mathbb{R}, f(x) = 1/xPartialUndefined at x=0x = 0

Cardinality of Function Spaces

Partial Functions

AB=(B+1)A|A \nrightarrow B| = (|B| + 1)^{|A|}

Each of the A|A| inputs independently chooses one of B|B| outputs or “undefined”.

Total Functions

AB=BA|A \to B| = |B|^{|A|}

Each of the A|A| inputs independently chooses one of B|B| outputs.

Example

For A={0,1}A = \{0, 1\} and B={a,b}B = \{a, b\}:

  • AB=22=4|A \to B| = 2^2 = 4: constant functions xax \mapsto a, xbx \mapsto b, swap 0a,1b0 \mapsto a, 1 \mapsto b, swap 0b,1a0 \mapsto b, 1 \mapsto a
  • AB=(2+1)2=9|A \nrightarrow B| = (2+1)^2 = 9: the 4 total functions plus 5 partial ones

Composition of Functions

Partial Function Composition

Given f:ABf : A \nrightarrow B and g:BCg : B \nrightarrow C, define gf:ACg \circ f : A \nrightarrow C by:

(gf)(a)={g(f(a))if f(a) and g(f(a))undefinedotherwise(g \circ f)(a) = \begin{cases} g(f(a)) & \text{if } f(a)\downarrow \text{ and } g(f(a))\downarrow \\ \text{undefined} & \text{otherwise} \end{cases}

Total Function Composition

Given f:ABf : A \to B and g:BCg : B \to C, the composite gf:ACg \circ f : A \to C is always total:

aA.(gf)(a)=g(f(a))\forall a \in A. (g \circ f)(a) = g(f(a))

Closure Properties

  • The composite of two functional relations is functional
  • The composite of two total functions is total

Identity Function

The identity function idA:AA\text{id}_A : A \to A is:

idA(a)=afor all aA\text{id}_A(a) = a \quad \text{for all } a \in A

This is total and serves as the unit for composition.

Function Application vs Relational Image

For a function f:ABf : A \to B and SAS \subseteq A:

  • Direct image: f(S)={f(a):aS}Bf(S) = \{f(a) : a \in S\} \subseteq B
  • Inverse image: f1(T)={a:f(a)T}Af^{-1}(T) = \{a : f(a) \in T\} \subseteq A

These extend relational images to the functional case.


Summary

  • A partial function f:ABf : A \nrightarrow B maps each aa to at most one bb
  • A total function f:ABf : A \to B maps each aa to exactly one bb
  • AB=BA|A \to B| = |B|^{|A|} and AB=(B+1)A|A \nrightarrow B| = (|B|+1)^{|A|}
  • Composition preserves functionality; total functions are closed under composition