Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- data Relation a
- empty :: Ord a => [a] -> [a] -> Relation a
- compose :: Ord a => Relation a -> Relation a -> Relation a
- id :: Ord a => [a] -> Relation a
- inverseRelation :: Ord a => Relation a -> Relation a
- updateRelation :: Ord a => a -> a -> Relation a -> Relation a
- removeFromDomain :: Ord a => a -> Relation a -> Relation a
- removeFromCodomain :: Ord a => a -> Relation a -> Relation a
- insertOnCodomain :: Ord a => a -> Relation a -> Relation a
- apply :: Ord a => Relation a -> a -> [a]
- domain :: Relation a -> [a]
- codomain :: Relation a -> [a]
- image :: Eq a => Relation a -> [a]
- mapping :: Relation a -> Map a [a]
- orphans :: Eq a => Relation a -> [a]
- isFunctional :: Relation a -> Bool
- isInjective :: Ord a => Relation a -> Bool
- isPartialInjective :: Ord a => [a] -> Relation a -> Bool
- isSurjective :: Ord a => Relation a -> Bool
- isTotal :: Ord a => Relation a -> Bool
Types
Datatype for endorelations on a
Construction
empty :: Ord a => [a] -> [a] -> Relation a Source #
An empty relation, with domain and codomain specified.
Transformation
updateRelation :: Ord a => a -> a -> Relation a -> Relation a Source #
Add a mapping between x
and y
to the relation. If x
already exists,
y
is joined to the corresponding elements.
removeFromDomain :: Ord a => a -> Relation a -> Relation a Source #
Remove an element from the domain of the relation
removeFromCodomain :: Ord a => a -> Relation a -> Relation a Source #
Remove an element from the codomain of the relation
insertOnCodomain :: Ord a => a -> Relation a -> Relation a Source #
Insert an element on the codomain of the relation
Query
apply :: Ord a => Relation a -> a -> [a] Source #
Return a list of all elements that x
gets mapped into.
image :: Eq a => Relation a -> [a] Source #
Return a list of all elements in the image of the relation.
orphans :: Eq a => Relation a -> [a] Source #
Return the elements in the domain which are not in the image of the relation (orphans)
Predicates
isFunctional :: Relation a -> Bool Source #
Test if r
is functional.