Local Open Scope morphism_scope.
Section PullBack.
Context {C : Category} {a b x : C} (f : a –≻ x) (g : b –≻ x).
(** Given two arrows f : a -> x and g : b -> x, their pullback is an object p together with two arrows π₁ : p -> a and π₂ : p -> b such that the following diagram commutes:  # <pre> π₂ p ————————–> b |            | π₁ |            | g |            | ↓            ↓ a —————————> x f </pre> #  Provided that for any object q and arrows p1 : q -> a and p2 : q -> b that the following diagram commutes:  # <pre> p2 q ————————–> b |            | p1 |            | g |            | ↓            ↓ a —————————> x f </pre> #  there is a unique arrow h : q -> p that makes the following diagram commute:  # <pre> p2 q ———————————————————– |  \                   | |    \ ∃!h             | |      \               | |        ↘     π₂      ↓ p1  |         p ————————–> b |         |            | |      π₁ |            | g |         |            | |         ↓            ↓ ——————–> a —————————> x f </pre> #  We usually use a half square in the corner of p to denote p is the pullback of f and g. Like so: # <pre> π₂ p ————————–> b |__|         | π₁ |            | g |            | ↓            ↓ a —————————> x f </pre> # *)
Record PullBack : Type :=
{
pullback : C;
pullback_morph_1 : pullback –≻ a;
pullback_morph_2 : pullback –≻ b;
pullback_morph_com : f ∘ pullback_morph_1 = g ∘ pullback_morph_2;
pullback_morph_ex (p' : Obj) (pm1 : p' –≻ a) (pm2 : p' –≻ b) :
f ∘ pm1 = g ∘ pm2 → p' –≻ pullback;
pullback_morph_ex_com_1 (p' : Obj) (pm1 : p' –≻ a) (pm2 : p' –≻ b)
(pmc : f ∘ pm1 = g ∘ pm2)
:
pullback_morph_1 ∘ (pullback_morph_ex p' pm1 pm2 pmc) = pm1;
pullback_morph_ex_com_2 (p' : Obj) (pm1 : p' –≻ a) (pm2 : p' –≻ b)
(pmc : f ∘ pm1 = g ∘ pm2)
:
pullback_morph_2 ∘ (pullback_morph_ex p' pm1 pm2 pmc) = pm2;
pullback_morph_ex_unique
(p' : Obj) (pm1 : p' –≻ a) (pm2 : p' –≻ b)
(pmc : f ∘ pm1 = g ∘ pm2) (u u' : p' –≻ pullback) :
pullback_morph_1 ∘ u = pm1 →
pullback_morph_2 ∘ u = pm2 →
pullback_morph_1 ∘ u' = pm1 →
pullback_morph_2 ∘ u' = pm2 → u = u'
}.
Coercion pullback : PullBack >-> Obj.

(** Pullbacks are unique up to isomorphism. *)
Theorem PullBack_iso (p1 p2 : PullBack) : (p1 ≃ p2)%isomorphism.
End PullBack.