{-# OPTIONS --universe-polymorphism #-}
module Relation.Binary.Bijection where

open import Level
open import Function
open import Data.Sum
open import Relation.Binary
import Relation.Binary.PropositionalEquality as 
open  using (_≡_;_≢_)

InjectiveREL :  {a b } (A : Set a) (B : Set b)  REL A B   Set _
InjectiveREL _ _ _∼_ =  {x y z}  x  z  y  z  x  y

InjectiveRel :  {a } (A : Set a)  Rel A   Set _
InjectiveRel A = InjectiveREL A A

SurjectiveREL :  {a b } (A : Set a) (B : Set b)  REL A B   Set _
SurjectiveREL A B  = InjectiveREL B A (flip )

SurjectiveRel :  {a } (A : Set a)  Rel A   Set _
SurjectiveRel A = SurjectiveREL A A

record BijectiveREL {a b } (A : Set a) (B : Set b) ( : REL A B ) : Set (  a  b) where
  constructor mkBijectiveREL
  field
    injectiveREL  : InjectiveREL A B 
    surjectiveREL : SurjectiveREL A B 

BijectiveRel :  {a } (A : Set a) ( : Rel A )  Set _
BijectiveRel A = BijectiveREL A A