| Copyright | (c) Andrey Mokhov 2016-2018 |
|---|---|
| License | MIT (see the file LICENSE) |
| Maintainer | andrey.mokhov@gmail.com |
| Stability | unstable |
| Safe Haskell | None |
| Language | Haskell2010 |
Algebra.Graph.Relation.InternalDerived
Description
This module exposes the implementation of derived binary relation data types. The API is unstable and unsafe, and is exposed only for documentation. You should use the non-internal modules Algebra.Graph.Relation.Reflexive, Algebra.Graph.Relation.Symmetric, Algebra.Graph.Relation.Transitive and Algebra.Graph.Relation.Preorder instead.
- newtype ReflexiveRelation a = ReflexiveRelation {
- fromReflexive :: Relation a
- newtype SymmetricRelation a = SymmetricRelation {
- fromSymmetric :: Relation a
- newtype TransitiveRelation a = TransitiveRelation {
- fromTransitive :: Relation a
- newtype PreorderRelation a = PreorderRelation {
- fromPreorder :: Relation a
Implementation of derived binary relations
newtype ReflexiveRelation a Source #
The ReflexiveRelation data type represents a reflexive binary relation
over a set of elements. Reflexive relations satisfy all laws of the
Reflexive type class and, in particular, the self-loop axiom:
vertexx ==vertexx *vertexx
The Show instance produces reflexively closed expressions:
show (1 :: ReflexiveRelation Int) == "edge 1 1" show (1 * 2 :: ReflexiveRelation Int) == "edges [(1,1),(1,2),(2,2)]"
Constructors
| ReflexiveRelation | |
Fields
| |
newtype SymmetricRelation a Source #
The SymmetricRelation data type represents a symmetric binary relation
over a set of elements. Symmetric relations satisfy all laws of the
Undirected type class and, in particular, the
commutativity of connect:
connectx y ==connecty x
The Show instance produces symmetrically closed expressions:
show (1 :: SymmetricRelation Int) == "vertex 1" show (1 * 2 :: SymmetricRelation Int) == "edges [(1,2),(2,1)]"
Constructors
| SymmetricRelation | |
Fields
| |
Instances
| Ord a => Eq (SymmetricRelation a) Source # | |
| (Num a, Ord a) => Num (SymmetricRelation a) Source # | |
| (Ord a, Show a) => Show (SymmetricRelation a) Source # | |
| Ord a => Undirected (SymmetricRelation a) Source # | |
| Ord a => Graph (SymmetricRelation a) Source # | |
| type Vertex (SymmetricRelation a) Source # | |
newtype TransitiveRelation a Source #
The TransitiveRelation data type represents a transitive binary relation
over a set of elements. Transitive relations satisfy all laws of the
Transitive type class and, in particular, the closure axiom:
y /= empty ==> x * y + x * z + y * z == x * y + y * zFor example, the following holds:
pathxs == (cliquexs :: TransitiveRelation Int)
The Show instance produces transitively closed expressions:
show (1 * 2 :: TransitiveRelation Int) == "edge 1 2" show (1 * 2 + 2 * 3 :: TransitiveRelation Int) == "edges [(1,2),(1,3),(2,3)]"
Constructors
| TransitiveRelation | |
Fields
| |
Instances
| Ord a => Eq (TransitiveRelation a) Source # | |
| (Num a, Ord a) => Num (TransitiveRelation a) Source # | |
| (Ord a, Show a) => Show (TransitiveRelation a) Source # | |
| Ord a => Transitive (TransitiveRelation a) Source # | |
| Ord a => Graph (TransitiveRelation a) Source # | |
| type Vertex (TransitiveRelation a) Source # | |
newtype PreorderRelation a Source #
The PreorderRelation data type represents a
binary relation that is both reflexive and transitive. Preorders satisfy all
laws of the Preorder type class and, in particular, the self-loop axiom:
vertexx ==vertexx *vertexx
and the closure axiom:
y /= empty ==> x * y + x * z + y * z == x * y + y * zFor example, the following holds:
pathxs == (cliquexs :: PreorderRelation Int)
The Show instance produces reflexively and transitively closed expressions:
show (1 :: PreorderRelation Int) == "edge 1 1" show (1 * 2 :: PreorderRelation Int) == "edges [(1,1),(1,2),(2,2)]" show (1 * 2 + 2 * 3 :: PreorderRelation Int) == "edges [(1,1),(1,2),(1,3),(2,2),(2,3),(3,3)]"
Constructors
| PreorderRelation | |
Fields
| |
Instances
| Ord a => Eq (PreorderRelation a) Source # | |
| (Num a, Ord a) => Num (PreorderRelation a) Source # | |
| (Ord a, Show a) => Show (PreorderRelation a) Source # | |
| Ord a => Preorder (PreorderRelation a) Source # | |
| Ord a => Transitive (PreorderRelation a) Source # | |
| Ord a => Reflexive (PreorderRelation a) Source # | |
| Ord a => Graph (PreorderRelation a) Source # | |
| type Vertex (PreorderRelation a) Source # | |