definition theorem proof

A Function is bijective (a bijection, drawn ) if it is both surjective and injective.

Sources: 7 Sketches Definition 1.22; Kittenlab Lecture 2 (theorem and proof); DaoFP §3.1.

Theorem (Kittenlab). A function has an inverse — i.e. is an Isomorphism in — if and only if it is surjective and injective.

Proof. If is surjective and injective then for each there is exactly one with (at least one by surjectivity, at most one by injectivity); define to be it. Then and . Conversely, if is an inverse then is surjective because , and injective because implies , hence .

DaoFP stresses that in a general category an arrow that is both mono and epi need not be an isomorphism (e.g. in monoids/rings, or dense inclusions in ); is special.

Two finite sets are isomorphic iff they have the same Cardinality.

Docs: FinSets — Kittenlab Lecture 2

using Catlab
f = FinFunction([2, 3, 1], 3)
is_iso(f)               # true
inv = FinFunction([3, 1, 2], 3)
compose(f, inv) == id(FinSet(3))   # true
#check @Function.Bijective            -- Injective ∧ Surjective
#check @Function.bijective_iff_has_inverse
#check (Equiv : Type u → Type v → Type _)   -- bundled bijection α ≃ β
-- a bijection bundled with its inverse (laws not enforced)
data Iso a b = Iso { to :: a -> b, from :: b -> a }
-- to . from = id, from . to = id