module Cat.Diagram.Injective
  {o }
  (C : Precategory o )
  where

Injective objects🔗

Let be a precategory. An object is injective if for every morphism and monomorphism there merely exists an extension such that as in the following diagram:

More concisely, is injective if it has the right-lifting property relative to monomorphisms in

is-injective : (A : Ob)  Type _
is-injective A =
   {X Y} (i : Hom X A) (m : X  Y)
   ∃[ r  Hom Y A ] (r  m .mor  i)

Classically, injective objects are usually very easy to find. For example. the law of excluded middle implies that every pointed set is injective in the category of sets. To extend a map along an injection just decide if each is in the image of If it is, we can use If it isn’t, we can send it to the designated point.

Constructively, injective objects are a bit harder to come by, as we can’t use excluded middle to decide if some fibre is empty. However, they are much more abundant than projective objects. For example, the type of partial elements is injective for every type

A functorial definition🔗

Some authors prefer to define injective objects via a functorial approach. In particular, an object is injective if and only if the preserves epimorphisms.

For the forward direction, recall that in epis are surjective. Moreover, epimorphisms in are monomorphisms in This means that if is a mono in then is surjective, as preserves epis. This directly gives us the factorization we need!

preserves-epis→injective
  : preserves-epis (Hom-into C A)
   is-injective A
preserves-epis→injective {A = A} hom-epi {X = X} {Y = Y} i m =
  epi→surjective (el! (Hom Y A)) (el! (Hom X A))
    (_∘ m .mor)
     {c}  hom-epi (m .monic) {c = c})
    i

For the reverse direction, let be injective, be a mono, and be a pair of functions into an arbitrary set such that for any To show that preserves epis, we must show that which follows directly from the existence of an extension for every

injective→preserves-epis
  : is-injective A
   preserves-epis (Hom-into C A)
injective→preserves-epis inj {f = m} m-mono g h p =
  ext λ k 
    rec!  r r-retract 
      g k        ≡˘⟨ ap g r-retract ≡˘
      g (r  m)  ≡⟨ p $ₚ r 
      h (r  m)  ≡⟨ ap h r-retract 
      h k  )
      (inj k (make-mono m m-mono))

Closure of injectives🔗

Projective objects are equipped with a mapping-in property, so they tend to interact nicely with other constructions that are also characterised via mapping-in properties. For instance, f and are both injective, then their product is injective (if it exists).

product-injective
  :  {A B A×B} {π₁ : Hom A×B A} {π₂ : Hom A×B B}
   is-injective A
   is-injective B
   is-product C π₁ π₂
   is-injective A×B

The proof is a nice extension chase. Our goal is to fill the dashed line in the following diagram.

Both and are projective, so we can extend and along to get a pair of maps and

Finally, we can use the universal property of the product to combine and into a map Moreover, and so is a valid extension.

product-injective {π₁ = π₁} {π₂ = π₂} A-inj B-inj prod i m = do
  (r₁ , r₁-factor)  A-inj (π₁  i) m
  (r₂ , r₂-factor)  B-inj (π₂  i) m
  pure ( r₁ , r₂  , unique₂ (pulll π₁∘⟨⟩) (pulll π₂∘⟨⟩) (sym r₁-factor) (sym r₂-factor))
  where open is-product prod

We can extend this result to indexed products, provided that the indexing type is set projective.

indexed-coproduct-projective
  :  {κ} {Idx : Type κ}
   {Aᵢ : Idx  Ob} {∏Aᵢ : Ob} {π :  i  Hom ∏Aᵢ (Aᵢ i)}
   is-set-projective Idx 
   (∀ i  is-injective (Aᵢ i))
   is-indexed-product C Aᵢ π
   is-injective ∏Aᵢ

The idea of the proof is the same as the non-indexed case. We start with a diagram of the following shape.

Our plan is to construct componentwise extensions for each of the components of the product, and then use the universal property to staple them all together into a single extension

However, there is a snag in this plan: we only get the mere existence of each extension for each whereas we need the mere existence of all the extensions simultaneously. In general, this requires the axiom of choice, but we can avoid this by requiring that be set-projective.

indexed-coproduct-projective {Aᵢ = Aᵢ} {π = π} Idx-pro Aᵢ-inj prod {X = X} {Y = Y} ι m = do
  r  Idx-pro
     i  Σ[ rᵢ  Hom Y (Aᵢ i) ] rᵢ  m .mor  π i  ι)
     _  hlevel 2)
     i  Aᵢ-inj i (π i  ι) m)
  pure (tuple  i  r i .fst) , unique₂  i  pulll commute  r i .snd))
  where open is-indexed-product prod

Injectives are also closed under sections. This follows by a straightforward bit of algebra.

section→injective
  :  {S A}
   is-injective A
   (r : Hom A S)
   has-section r
   is-injective S
section→injective A-inj r s i m = do
  (t , t-factor)  A-inj (s .section  i) m
  pure (r  t , pullr t-factor  cancell (s .is-section))

If has all pullbacks, then every subobject classifier is injective.

Ω-injective
  : {Ω : Ob} {true : Subobject Ω}
   has-pullbacks C
   is-generic-subobject C true
   is-injective Ω

Let be a subobject classifier in and consider the following extension problem.

Ω-injective {Ω = Ω} {true = true} pullbacks Ω-subobj {X} {Y} i m =
  pure extension
  where
    open is-generic-subobject Ω-subobj
    open Pullbacks C pullbacks
    open props pullbacks (record { true = true ; generic = Ω-subobj })

At first glance, it seems like we might be able to just classify the subobject to get an extension Though this map does have the right type, it is not actually an extension of The core of the problem is that classifies generalized elements of that lie within but we need to classify generalized elements of that lie within instead!

We can do this by pulling back along to get a subobject of which we can then compose with to get a subobject of

    [i] : Subobject X
    [i] = named i

    m∩[i] : Subobject Y
    m∩[i] = cutₛ (∘-is-monic (m .monic) ([i] .monic))

We can then classify our subobject to get a map which is an extension of

To see this, recall that two maps are equal when is a pullback of along In our case, this means that we must show that the following square is a pullback square.

We can re-arrange this square a bit to get the following diagram.

The right-hand square is a pullback square, as classifies the subobject Moreover, the left-hand square is also a pullback square, as every is the pullback of along when is monic. We can paste these two squares together to get our original square, which must also be a pullback by pasting. This means that which completes the proof.

    extension : Σ[ i*  Hom Y Ω ] i*  m .mor  i
    extension .fst = name m∩[i]
    extension .snd =
      Ω-unique₂ $
      paste-is-pullback-along
        (classifies m∩[i])
        (is-pullback-along-monic (m .monic))
        refl

Enough injectives🔗

A category is said to have enough injectives if for every object there is some with injective. We will refer to as the injective resolution of

Note that there are two variations on this condition: one where there merely exists a injective resolution for every and another where those resolutions are provided as structure. We prefer to work with the latter, as it tends to be less painful to work with.

record Injectives : Type (o  ) where
  field
    Inj : Ob  Ob
    inj-resolve :  {X}  X  Inj X
    inj-injective :  {X}  is-injective (Inj X)