Let C,D be categories
.
Definition
A contravariant functor F:C→D consists of:
- an assignment on objects
X↦F(X),
- for every morphism
f:X→Y in C, a morphism
F(f):F(Y)→F(X)
in D,
such that:
- (Identities) F(idX)=idF(X) for every X (see identity morphism
),
- (Reversed composition) for composable XfYgZ,
F(g∘f)=F(f)∘F(g)
(see composition
).
Equivalently, a contravariant functor F:C→D is the same thing as an ordinary (covariant) functor
Cop⟶D,where Cop is the opposite category
of C.
Examples
Inverse-image on power sets (Set).
Let Set be the category of sets
and functions
.
Define F:Setop→Set by
- F(X)=P(X) (the set of subsets of X),
- for f:X→Y, F(f)=f−1:P(Y)→P(X), the preimage
map.
Then f−1(id)=id and (g∘f)−1=f−1∘g−1, so this is contravariant.
Representable hom-functor HomC(−,A).
Fix an object A∈C. The assignment
X⟼HomC(X,A)extends to a contravariant functor C→Set (equivalently Cop→Set) by sending f:X→Y to precomposition:
HomC(Y,A)→HomC(X,A),(h:Y→A)↦h∘f.This is a basic instance of a representable functor
.
Linear dual (Vectk or R-Mod).
In the category of vector spaces over a field k (or modules over a ring), define
V↦V∗=Homk(V,k).A linear map f:V→W induces f∗:W∗→V∗ by f∗(φ)=φ∘f.
The direction reverses, and (g∘f)∗=f∗∘g∗, so (−)∗ is contravariant.