{-# OPTIONS --without-K --safe #-}
open import Categories.Category.Core
module Categories.Morphism {o β e} (π : Category o β e) where
open import Level
open import Relation.Binary hiding (_β_)
open import Categories.Morphism.Reasoning.Core π
open Category π
private
  variable
    A B C : Obj
Mono : β (f : A β B) β Set (o β β β e)
Mono {A = A} f = β {C} β (gβ gβ : C β A) β f β gβ β f β gβ β gβ β gβ
record _β£_ (A B : Obj) : Set (o β β β e) where
  field
    mor  : A β B
    mono : Mono mor
Epi : β (f : A β B) β Set (o β β β e)
Epi {B = B} f = β {C} β (gβ gβ : B β C) β gβ β f β gβ β f β gβ β gβ
record _β _ (A B : Obj) : Set (o β β β e) where
  field
    mor : A β B
    epi : Epi mor
_SectionOf_ : (g : B β A) (f : A β B) β Set e
g SectionOf f = f β g β id
_RetractOf_ : (g : B β A) (f : A β B) β Set e
g RetractOf f = g β f β id
record Iso (from : A β B) (to : B β A) : Set e where
  field
    isoΛ‘ : to β from β id
    isoΚ³ : from β to β id
infix 4 _β
_
record _β
_ (A B : Obj) : Set (β β e) where
  field
    from : A β B
    to   : B β A
    iso  : Iso from to
  open Iso iso public
private
  β
-refl : Reflexive _β
_
  β
-refl = record
    { from = id
    ; to   = id
    ; iso  = record
      { isoΛ‘ = identityΒ²
      ; isoΚ³ = identityΒ²
      }
    }
  β
-sym : Symmetric _β
_
  β
-sym Aβ
B = record
    { from = to
    ; to   = from
    ; iso  = record
      { isoΛ‘ = isoΚ³
      ; isoΚ³ = isoΛ‘
      }
    }
    where open _β
_ Aβ
B
  β
-trans : Transitive _β
_
  β
-trans Aβ
B Bβ
C = record
    { from = from Bβ
C β from Aβ
B
    ; to   = to Aβ
B β to Bβ
C
    ; iso  = record
      { isoΛ‘ = begin
        (to Aβ
B β to Bβ
C) β from Bβ
C β from Aβ
B ββ¨ cancelInner (isoΛ‘ Bβ
C) β©
        to Aβ
B β from Aβ
B                       ββ¨  isoΛ‘ Aβ
B  β©
        id                                      β
      ; isoΚ³ = begin
        (from Bβ
C β from Aβ
B) β to Aβ
B β to Bβ
C ββ¨ cancelInner (isoΚ³ Aβ
B) β©
        from Bβ
C β to Bβ
C                       ββ¨ isoΚ³ Bβ
C β©
        id                                      β
      }
    }
    where open _β
_
          open HomReasoning
          open Equiv
β
-isEquivalence : IsEquivalence _β
_
β
-isEquivalence = record
  { refl  = β
-refl
  ; sym   = β
-sym
  ; trans = β
-trans
  }
module β
 = IsEquivalence β
-isEquivalence
β
-setoid : Setoid _ _
β
-setoid = record
  { Carrier       = Obj
  ; _β_           = _β
_
  ; isEquivalence = β
-isEquivalence
  }