@@ -48,9 +48,7 @@ module LAoP.Relation.Internal
4848 FromListsN,
4949 Liftable,
5050 Trivial,
51− TrivialE,
5251 TrivialP,
53− TrivialP2,
5452
5553 -- * Primitives
5654 empty,
@@ -201,9 +199,7 @@ type CountableDimensionsN a b = (CountableN a, CountableN b)
201199type FromListsN a b = I.FromLists Boolean (I.Normalize a) (I.Normalize b)
202200type Liftable a b = (Bounded a, Bounded b, Enum a, Enum b, Eq b, Num Boolean, Ord Boolean)
203201type Trivial a = I.Normalize a ~ I.Normalize (I.Normalize a)
204−type TrivialE a b = I.Normalize (Either a b) ~ Either (I.Normalize a) (I.Normalize b)
205202type TrivialP a b = I.Normalize (a, b) ~ I.Normalize (I.Normalize a, I.Normalize b)
206−type TrivialP2 a b = I.Normalize (I.Normalize a, I.Normalize b) ~ I.Normalize (I.Normalize (a, b))
207203
208204-- | It isn't possible to implement the 'id' function so it's
209205-- implementation is 'undefined'. However 'comp' can be and this partial
@@ -244,8 +240,7 @@ one = R . I.One
244240-- | Boolean Matrix 'Junc' constructor, also known as relational coproduct.
245241--
246242-- See 'eitherR'.
247−junc :: (TrivialE a b)
248− => Relation a c -> Relation b c -> Relation (Either a b) c
243+junc :: Relation a c -> Relation b c -> Relation (Either a b) c
249244junc (R a) (R b) = R (I.Junc a b)
250245
251246infixl 3 |||
@@ -253,21 +248,18 @@ infixl 3 |||
253248--
254249-- See 'eitherR'.
255250(|||) ::
256− (TrivialE a b) =>
257251 Relation a c ->
258252 Relation b c ->
259253 Relation (Either a b) c
260254(|||) = junc
261255
262256-- | Boolean Matrix 'Split' constructor, also known as relational product.
263−split :: (TrivialE a b)
264− => Relation c a -> Relation c b -> Relation c (Either a b)
257+split :: Relation c a -> Relation c b -> Relation c (Either a b)
265258split (R a) (R b) = R (I.Split a b)
266259
267260infixl 2 ===
268261-- | Boolean Matrix 'Split' constructor
269262(===) ::
270− (TrivialE a b) =>
271263 Relation c a ->
272264 Relation c b ->
273265 Relation c (Either a b)
@@ -822,8 +814,7 @@ infixl 4 ><
822814-- @
823815-- 'eitherR' ('splitR' r s) ('splitR' t v) == 'splitR' ('eitherR' r t) ('eitherR' s v)
824816-- @
825−eitherR :: (TrivialE a b)
826− => Relation a c -> Relation b c -> Relation (Either a b) c
817+eitherR :: Relation a c -> Relation b c -> Relation (Either a b) c
827818eitherR = junc
828819
829820-- | Relational coproduct first component injection
@@ -835,8 +826,7 @@ eitherR = junc
835826i1 ::
836827 ( CountableDimensionsN a b,
837828 FromListsN b a,
838− FromListsN a a,
839− TrivialE a b
829+ FromListsN a a
840830 )
841831 => Relation a (Either a b)
842832i1 = R I.i1
@@ -850,8 +840,7 @@ i1 = R I.i1
850840i2 ::
851841 ( CountableDimensionsN a b,
852842 FromListsN a b,
853− FromListsN b b,
854− TrivialE a b
843+ FromListsN b b
855844 )
856845 => Relation b (Either a b)
857846i2 = R I.i2
@@ -868,9 +857,7 @@ infixl 5 -|-
868857 FromListsN b b,
869858 FromListsN d b,
870859 FromListsN b d,
871− FromListsN d d,
872− TrivialE a c,
873− TrivialE b d
860+ FromListsN d d
874861 )
875862 => Relation a b -> Relation c d -> Relation (Either a c) (Either b d)
876863(-|-) (R a) (R b) = R ((I.-|-) a b)
@@ -892,8 +879,8 @@ trans ::
892879 FromListsN (a, b) b,
893880 Trivial (a, b),
894881 Trivial (c, b),
895− TrivialP2 a b,
896− TrivialP2 c b
882+ TrivialP a b,
883+ TrivialP c b
897884 )
898885 => Relation (a, b) c -> Relation a (c, b)
899886trans r = splitR r p2 `comp` conv p1
@@ -913,8 +900,8 @@ untrans ::
913900 FromListsN (a, b) a,
914901 Trivial (a, b),
915902 Trivial (c, b),
916− TrivialP2 a b,
917− TrivialP2 c b
903+ TrivialP a b,
904+ TrivialP c b
918905 )
919906 => Relation a (c, b) -> Relation (a, b) c
920907untrans s = p1 `comp` conv (splitR (conv s) p2)
@@ -964,8 +951,7 @@ guard ::
964951 Enum b,
965952 CountableN b,
966953 FromListsN b b,
967− FromListsN Bool b,
968− TrivialE b b
954+ FromListsN Bool b
969955 ) => Relation b Bool -> Relation b (Either b b)
970956guard p = conv (eitherR (predR p) (predR (negate p)))
971957
@@ -975,8 +961,7 @@ cond ::
975961 Enum b,
976962 CountableN b,
977963 FromListsN b b,
978− FromListsN Bool b,
979− TrivialE b b
964+ FromListsN Bool b
980965 )
981966 => Relation b Bool -> Relation b c -> Relation b c -> Relation b c
982967cond p r s = eitherR r s `comp` guard p