<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %A  relation.xml                GAP documentation          Andrew Solomon       -->
<!-- %% -->
<!-- %% -->
<!-- %Y  (C) 1999 School Math and Comp. Sci., University of St Andrews, Scotland -->
<!-- %Y  Copyright (C) 2002 The GAP Group -->
<!-- %% -->
<Chapter Label="Relations">
<Heading>Relations</Heading>

<#Include Label="[1]{relation}">


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="General Binary Relations">
<Heading>General Binary Relations</Heading>

This section lists general constructors of relations.

<#Include Label="IsBinaryRelation">
<#Include Label="BinaryRelationByElements">
<#Include Label="IdentityBinaryRelation">
<#Include Label="EmptyBinaryRelation">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Properties and Attributes of Binary Relations">
<Heading>Properties and Attributes of Binary Relations</Heading>

<#Include Label="IsReflexiveBinaryRelation">
<#Include Label="IsSymmetricBinaryRelation">
<#Include Label="IsTransitiveBinaryRelation">
<#Include Label="IsAntisymmetricBinaryRelation">
<#Include Label="IsPreOrderBinaryRelation">
<#Include Label="IsPartialOrderBinaryRelation">
<#Include Label="IsHasseDiagram">
<#Include Label="IsEquivalenceRelation">
<#Include Label="Successors">
<#Include Label="DegreeOfBinaryRelation">
<#Include Label="PartialOrderOfHasseDiagram">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Binary Relations on Points">
<Heading>Binary Relations on Points</Heading>

We have special construction methods when the underlying <A>X</A>
of our relation is the set of integers <M>\{ 1, \ldots, n \}</M>.

<#Include Label="BinaryRelationOnPoints">
<#Include Label="RandomBinaryRelationOnPoints">
<#Include Label="AsBinaryRelationOnPoints">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Closure Operations and Other Constructors">
<Heading>Closure Operations and Other Constructors</Heading>

<#Include Label="ReflexiveClosureBinaryRelation">
<#Include Label="SymmetricClosureBinaryRelation">
<#Include Label="TransitiveClosureBinaryRelation">
<#Include Label="HasseDiagramBinaryRelation">
<#Include Label="StronglyConnectedComponents">
<#Include Label="PartialOrderByOrderingFunction">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Equivalence Relations">
<Heading>Equivalence Relations</Heading>

<Index>equivalence relation</Index>
An <E>equivalence relation</E> <A>E</A> over the set <A>X</A> is a relation
on <A>X</A> which is reflexive, symmetric, and transitive.
A <E>partition</E> <A>P</A> is a set of subsets of <A>X</A> such that
for all <M>R, S \in P</M>, <M>R \cap S</M> is the empty set and
<M>\cup P = X</M>.
An equivalence relation induces a partition such that if <M>(x,y) \in E</M>
then <M>x, y</M> are in the same element of <A>P</A>.
<P/>
Like all binary relations in &GAP; equivalence
relations are regarded as general endomorphic mappings (and the operations,
properties and attributes of general mappings are available).
However, partitions provide an efficient way of representing equivalence
relations.  Moreover, only the non-singleton classes
or blocks are listed allowing for small equivalence relations to be
represented on infinite sets. Hence the main attribute of equivalence
relations is <Ref Attr="EquivalenceRelationPartition"/>
which provides the partition induced by the given equivalence.

<#Include Label="EquivalenceRelationByPartition">
<#Include Label="EquivalenceRelationByRelation">
<#Include Label="EquivalenceRelationByPairs">
<#Include Label="EquivalenceRelationByProperty">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Attributes of and Operations on Equivalence Relations">
<Heading>Attributes of and Operations on Equivalence Relations</Heading>

<#Include Label="EquivalenceRelationPartition">
<#Include Label="GeneratorsOfEquivalenceRelationPartition">
<#Include Label="JoinEquivalenceRelations">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Equivalence Classes">
<Heading>Equivalence Classes</Heading>

<#Include Label="IsEquivalenceClass">
<#Include Label="EquivalenceClassRelation">
<#Include Label="EquivalenceClasses">
<#Include Label="EquivalenceClassOfElement">

</Section>
</Chapter>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %E -->

