This is the [Setoid.Overture.Bijective][] module of the agda-algebras library.
A bijective function from a setoid ๐จ = (A, โโ)
to a setoid ๐ฉ = (B, โโ)
is a function f : ๐จ โถ ๐ฉ
that is both injective and surjective. (See the definitions in [Setoid.Overture.Injective][] and [Setoid.Overture.Surjective][].
{-# OPTIONS --without-K --exact-split --safe #-} open import Relation.Binary using ( Setoid ) module Setoid.Overture.Bijective {ฮฑ ฯแต ฮฒ ฯแต }{๐จ : Setoid ฮฑ ฯแต}{๐ฉ : Setoid ฮฒ ฯแต} where -- Imports from Agda and the Agda Standard Library -------------------------- open import Agda.Primitive using ( _โ_ ; Level ) renaming ( Set to Type ) open import Data.Product using ( _,_ ; _ร_ ) open import Function.Bundles using () renaming ( Func to _โถ_ ) -- Imports from agda-algebras ----------------------------------------------- open import Setoid.Overture.Inverses using ( Image_โ_ ; Inv ) open import Setoid.Overture.Surjective using ( IsSurjective ) open import Setoid.Overture.Injective using ( IsInjective ) open Image_โ_ open Setoid ๐จ using () renaming (Carrier to A; _โ_ to _โโ_) open Setoid ๐ฉ using ( sym ; trans ) renaming (Carrier to B; _โ_ to _โโ_) IsBijective : (๐จ โถ ๐ฉ) โ Type (ฮฑ โ ฮฒ โ ฯแต โ ฯแต) IsBijective f = IsInjective f ร IsSurjective f BijInv : (f : ๐จ โถ ๐ฉ) โ IsBijective f โ ๐ฉ โถ ๐จ BijInv f (fM , fE) = record { f = finv ; cong = c } where finv : B โ A finv b = Inv f fE handler : โ {bโ bโ}(iโ : Image f โ bโ)(iโ : Image f โ bโ) โ bโ โโ bโ โ (Inv f iโ) โโ (Inv f iโ) handler (eq a x) (eq aโ xโ) bโโbโ = fM (trans (sym x) (trans bโโbโ xโ)) c : โ {bโ bโ} โ bโ โโ bโ โ (finv bโ) โโ (finv bโ) c bโโbโ = handler fE fE bโโbโ