|
Data.Relation.SetOfPairs | Portability | portable | Stability | experimental | Maintainer | joost.visser@di.uminho.pt |
|
|
|
|
|
Description |
An implementation of relations as sets of pairs.
|
|
Synopsis |
|
type Rel a b = Set (a, b) | | emptyRel :: Rel a b | | mkRel :: (Ord a, Ord b) => [(a, b)] -> Rel a b | | mkRelNeighbors :: (Ord a, Ord b) => a -> [b] -> Rel a b | | identityRel :: Ord a => Set a -> Rel a a | | totalRel :: Ord a => Set a -> Rel a a | | chainRel :: (Enum n, Num n, Ord n) => n -> Rel n n | | predRel :: Ord a => Set a -> (a -> Bool) -> Rel a a | | setRel :: Ord a => Set a -> Rel a a | | dom :: (Ord a, Ord b) => Rel a b -> Set a | | rng :: (Ord a, Ord b) => Rel a b -> Set b | | domWith :: (Ord a, Ord b) => Set b -> Rel a b -> Set a | | rngWith :: (Ord a, Ord b) => Set a -> Rel a b -> Set b | | pairs :: (Ord a, Ord b) => Rel a b -> [(a, b)] | | inv :: (Ord a, Ord b) => Rel a b -> Rel b a | | comp :: (Ord a, Eq b, Ord c) => Rel b c -> Rel a b -> Rel a c | | ker :: (Ord a, Ord b) => Rel a b -> Rel a a | | img :: (Ord a, Ord b) => Rel a b -> Rel b b | | projectWith :: (Ord a, Ord b) => (a -> b -> Bool) -> Rel a b -> Rel a b | | project :: (Ord a, Ord b) => Set a -> Rel a b -> Rel a b | | projectBackward :: (Ord a, Ord b) => Set b -> Rel a b -> Rel a b |
|
|
|
Representation
|
|
type Rel a b = Set (a, b) |
Type of relations
|
|
Building relations
|
|
emptyRel :: Rel a b |
Build an empty relation.
|
|
mkRel :: (Ord a, Ord b) => [(a, b)] -> Rel a b |
Build a relation from a list of pairs.
|
|
mkRelNeighbors :: (Ord a, Ord b) => a -> [b] -> Rel a b |
Build a relation from distributing an element to a set of elements
|
|
identityRel :: Ord a => Set a -> Rel a a |
Build identity relation, which contains an edge from each node to itself.
|
|
totalRel :: Ord a => Set a -> Rel a a |
Build total relation, which contains an edge from each node to
each other node and to itself.
|
|
chainRel :: (Enum n, Num n, Ord n) => n -> Rel n n |
Build a chain relation of given number of numerals.
|
|
predRel :: Ord a => Set a -> (a -> Bool) -> Rel a a |
Build a relation from a predicate
|
|
setRel :: Ord a => Set a -> Rel a a |
Build a relation (correflexive) from a set
|
|
Basic operations
|
|
dom :: (Ord a, Ord b) => Rel a b -> Set a |
Obtain the domain of a relation
|
|
rng :: (Ord a, Ord b) => Rel a b -> Set b |
Obtain the range of a relation
|
|
domWith :: (Ord a, Ord b) => Set b -> Rel a b -> Set a |
Obtain the subdomain of a relation given a subrange.
|
|
rngWith :: (Ord a, Ord b) => Set a -> Rel a b -> Set b |
Obtain the subrange of a relation given a subdomain.
|
|
pairs :: (Ord a, Ord b) => Rel a b -> [(a, b)] |
Convert relation to a list of pairs.
|
|
inv :: (Ord a, Ord b) => Rel a b -> Rel b a |
Take the inverse of a relation
|
|
comp :: (Ord a, Eq b, Ord c) => Rel b c -> Rel a b -> Rel a c |
Compose two relations
|
|
ker :: (Ord a, Ord b) => Rel a b -> Rel a a |
Kernel of a relationship.
|
|
img :: (Ord a, Ord b) => Rel a b -> Rel b b |
Image of a relationaship.
|
|
Projection
|
|
projectWith :: (Ord a, Ord b) => (a -> b -> Bool) -> Rel a b -> Rel a b |
Retrieve a subrelation given predicates on domain and range.
|
|
project :: (Ord a, Ord b) => Set a -> Rel a b -> Rel a b |
Projection of set through relation
|
|
projectBackward :: (Ord a, Ord b) => Set b -> Rel a b -> Rel a b |
Projection of set backward through relation
|
|
Produced by Haddock version 0.7 |