Partial Functions
Definition
A relation f:A↛B is functional (or a partial function) if:
∀a∈A.∀b1,b2∈B.(afb1∧afb2⇒b1=b2)
Each input a is related to at most one output.
Notation
- f(a)↓ means f is defined at a (there exists b with afb)
- f(a)↑ means f is undefined at a
- When defined, f(a) denotes the unique b with afb
Domain
The domain of partial function f:A↛B is:
dom(f)={a∈A:f(a)↓}
Total Functions
Definition
A partial function f:A↛B is total if dom(f)=A.
We write f:A→B for a total function from A to B.
Verification: For all a∈A, there exists exactly one b∈B with afb.
Examples
| Function | Total? | Notes |
|---|
| f:R→R,f(x)=x2 | Yes | Defined everywhere |
| f:R↛R,f(x)=x | Partial | Only defined for x≥0 |
| f:R↛R,f(x)=1/x | Partial | Undefined at x=0 |
Cardinality of Function Spaces
Partial Functions
∣A↛B∣=(∣B∣+1)∣A∣
Each of the ∣A∣ inputs independently chooses one of ∣B∣ outputs or “undefined”.
Total Functions
∣A→B∣=∣B∣∣A∣
Each of the ∣A∣ inputs independently chooses one of ∣B∣ outputs.
Example
For A={0,1} and B={a,b}:
- ∣A→B∣=22=4: constant functions x↦a, x↦b, swap 0↦a,1↦b, swap 0↦b,1↦a
- ∣A↛B∣=(2+1)2=9: the 4 total functions plus 5 partial ones
Composition of Functions
Partial Function Composition
Given f:A↛B and g:B↛C, define g∘f:A↛C by:
(g∘f)(a)={g(f(a))undefinedif f(a)↓ and g(f(a))↓otherwise
Total Function Composition
Given f:A→B and g:B→C, the composite g∘f:A→C is always total:
∀a∈A.(g∘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:A→A is:
idA(a)=afor all a∈A
This is total and serves as the unit for composition.
Function Application vs Relational Image
For a function f:A→B and S⊆A:
- Direct image: f(S)={f(a):a∈S}⊆B
- Inverse image: f−1(T)={a:f(a)∈T}⊆A
These extend relational images to the functional case.
Summary
- A partial function f:A↛B maps each a to at most one b
- A total function f:A→B maps each a to exactly one b
- ∣A→B∣=∣B∣∣A∣ and ∣A↛B∣=(∣B∣+1)∣A∣
- Composition preserves functionality; total functions are closed under composition