on master help sign in
Added bijective property
commit721b24bdec742e709bc723857af4c1b1f5382602 authorArmando Santos <armandoifsantos@gmail.com> dateSun 12 Jan 2020, 16:06 (7 years ago) parentdfbd1d5
2 files changed+23
src/LAoP/Relation.hs+7 src/LAoP/Relation/Internal.hs+16
src/LAoP/Relation.hs+7
@@ -59,6 +59,13 @@ module LAoP.Relation
5959 ker,
6060 img,
6161
62+ -- * Taxonomy of binary relations
63+ entire,
64+ injective,
65+ surjective,
66+ simple,
67+ bijective,
68+
6269 -- * (Endo-)Relational properties
6370 reflexive,
6471 coreflexive,
src/LAoP/Relation/Internal.hs+16
@@ -67,6 +67,13 @@ module LAoP.Relation.Internal
6767 ker,
6868 img,
6969
70+ -- * Taxonomy of binary relations
71+ entire,
72+ injective,
73+ surjective,
74+ simple,
75+ bijective,
76+
7077 -- * (Endo-)Relational properties
7178 reflexive,
7279 coreflexive,
@@ -325,6 +332,15 @@ entire = reflexive . ker
325332surjective :: (KnownNat (I.Count (I.Normalize b)), I.FromLists Boolean (I.Normalize b) (I.Normalize b)) => Relation a b -> Bool
326333surjective = reflexive . img
327334
335+-- | A 'Relation' @r@ is bijective iff @'injective' r && 'surjective' r@
336+bijective ::
337+ ( KnownNat (I.Count (I.Normalize b)),
338+ KnownNat (I.Count (I.Normalize a)),
339+ I.FromLists Boolean (I.Normalize b) (I.Normalize b),
340+ I.FromLists Boolean (I.Normalize a) (I.Normalize a)
341+ ) => Relation a b -> Bool
342+bijective r = injective r && surjective r
343+
328344-- | A 'Relation' @r@ is transitive iff @(r `'comp'` r) `'sse'` r@
329345transitive :: Relation a a -> Bool
330346transitive r = (r `comp` r) `sse` r