{-# OPTIONS --without-K --safe #-}

-- Exact category (https://ncatlab.org/nlab/show/exact+category)
-- is a regular category
-- in which every internal equivalence is a kernel pair

module Categories.Category.Exact where

open import Level

open import Categories.Category.Core
open import Categories.Diagram.Pullback
open import Categories.Category.Cocartesian
open import Categories.Object.Coproduct
open import Categories.Morphism
open import Categories.Diagram.Coequalizer
open import Categories.Diagram.KernelPair

open import Categories.Category.Regular
open import Categories.Morphism.Regular

open import Categories.Object.InternalRelation

record Exact {o ā„“ e : Level} (š’ž : Category o ā„“ e) : Set (suc (o āŠ” ā„“ āŠ” e)) where
  open Category š’ž
  open Pullback
  open Coequalizer
  open Equivalence

  field
    regular    : Regular š’ž
    quotient   : āˆ€ {X : Obj} (E : Equivalence š’ž X) ā†’ Coequalizer š’ž (R.pā‚ E) (R.pā‚‚ E)
    effective  : āˆ€ {X : Obj} (E : Equivalence š’ž X) ā†’ IsPullback š’ž (R.pā‚ E) (R.pā‚‚ E)
      (arr (quotient E)) (arr (quotient E))