{-# OPTIONS --without-K --safe #-}
module Categories.Category.Dagger where

open import Level using (_⊔_; suc)
open import Relation.Unary using (Pred)

open import Categories.Category.Core using (Category)
open import Categories.Functor.Core using (Functor)
open import Categories.Morphism using (Iso)

record HasDagger {o  e} (C : Category o  e) : Set (o    e) where
  open Category C
  infix 10 _†

  field
    _† :  {A B}  A  B  B  A
    †-identity :  {A}  id {A}   id
    †-homomorphism :  {A B C} {f : A  B} {g : B  C}  (g  f)   f   g 
    †-resp-≈ :  {A B} {f g : A  B}  f  g  f   g 
    †-involutive :  {A B} (f : A  B)  f    f

  †-Functor : Functor op C
  †-Functor = record
    { F₀ = λ A  A
    ; F₁ = _†
    ; identity = †-identity
    ; homomorphism = †-homomorphism
    ; F-resp-≈ = †-resp-≈
    }

  isUnitary :  {A B}  Pred (A  B) e
  isUnitary f = Iso C f (f )

  isSelfAdjoint :  {A}  Pred (A  A) e
  isSelfAdjoint f = f   f

record DaggerCategory o  e : Set (suc (o    e)) where
  field
    C : Category o  e
    hasDagger : HasDagger C

  open Category C public
  open HasDagger hasDagger public