Debian Codegraph @

doc/ref/chap33.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5
6 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
7 <head>
8 <title>GAP (ref) - Chapter 33: Relations</title>
9 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
10 <meta name="generator" content="GAPDoc2HTML" />
11 <link rel="stylesheet" type="text/css" href="manual.css" />
12 <script src="manual.js" type="text/javascript"></script>
13 <script type="text/javascript">overwriteStyle();</script>
14 </head>
15 <body class="chap33" onload="jscontent()">
16
17
18 <div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chap5.html">5</a> <a href="chap6.html">6</a> <a href="chap7.html">7</a> <a href="chap8.html">8</a> <a href="chap9.html">9</a> <a href="chap10.html">10</a> <a href="chap11.html">11</a> <a href="chap12.html">12</a> <a href="chap13.html">13</a> <a href="chap14.html">14</a> <a href="chap15.html">15</a> <a href="chap16.html">16</a> <a href="chap17.html">17</a> <a href="chap18.html">18</a> <a href="chap19.html">19</a> <a href="chap20.html">20</a> <a href="chap21.html">21</a> <a href="chap22.html">22</a> <a href="chap23.html">23</a> <a href="chap24.html">24</a> <a href="chap25.html">25</a> <a href="chap26.html">26</a> <a href="chap27.html">27</a> <a href="chap28.html">28</a> <a href="chap29.html">29</a> <a href="chap30.html">30</a> <a href="chap31.html">31</a> <a href="chap32.html">32</a> <a href="chap33.html">33</a> <a href="chap34.html">34</a> <a href="chap35.html">35</a> <a href="chap36.html">36</a> <a href="chap37.html">37</a> <a href="chap38.html">38</a> <a href="chap39.html">39</a> <a href="chap40.html">40</a> <a href="chap41.html">41</a> <a href="chap42.html">42</a> <a href="chap43.html">43</a> <a href="chap44.html">44</a> <a href="chap45.html">45</a> <a href="chap46.html">46</a> <a href="chap47.html">47</a> <a href="chap48.html">48</a> <a href="chap49.html">49</a> <a href="chap50.html">50</a> <a href="chap51.html">51</a> <a href="chap52.html">52</a> <a href="chap53.html">53</a> <a href="chap54.html">54</a> <a href="chap55.html">55</a> <a href="chap56.html">56</a> <a href="chap57.html">57</a> <a href="chap58.html">58</a> <a href="chap59.html">59</a> <a href="chap60.html">60</a> <a href="chap61.html">61</a> <a href="chap62.html">62</a> <a href="chap63.html">63</a> <a href="chap64.html">64</a> <a href="chap65.html">65</a> <a href="chap66.html">66</a> <a href="chap67.html">67</a> <a href="chap68.html">68</a> <a href="chap69.html">69</a> <a href="chap70.html">70</a> <a href="chap71.html">71</a> <a href="chap72.html">72</a> <a href="chap73.html">73</a> <a href="chap74.html">74</a> <a href="chap75.html">75</a> <a href="chap76.html">76</a> <a href="chap77.html">77</a> <a href="chap78.html">78</a> <a href="chap79.html">79</a> <a href="chap80.html">80</a> <a href="chap81.html">81</a> <a href="chap82.html">82</a> <a href="chap83.html">83</a> <a href="chap84.html">84</a> <a href="chap85.html">85</a> <a href="chap86.html">86</a> <a href="chap87.html">87</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
19
20 <div class="chlinkprevnexttop">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp; <a href="chap0.html#contents">[Contents]</a>&nbsp; &nbsp;<a href="chap32.html">[Previous Chapter]</a>&nbsp; &nbsp;<a href="chap34.html">[Next Chapter]</a>&nbsp; </div>
21
22 <p id="mathjaxlink" class="pcenter"><a href="chap33_mj.html">[MathJax on]</a></p>
23 <p><a id="X838651287FCCEFD8" name="X838651287FCCEFD8"></a></p>
24 <div class="ChapSects"><a href="chap33.html#X838651287FCCEFD8">33 <span class="Heading">Relations</span></a>
25 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap33.html#X7DED7F1F78D31785">33.1 <span class="Heading">General Binary Relations</span></a>
26 </span>
27 <div class="ContSSBlock">
28 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X788D722F82165551">33.1-1 IsBinaryRelation</a></span>
29 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X7A1D8EEF8034B0B5">33.1-2 BinaryRelationByElements</a></span>
30 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X81878EEF873B34D5">33.1-3 <span class="Heading">IdentityBinaryRelation</span></a>
31 </span>
32 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X80DDCDD387BA23F2">33.1-4 EmptyBinaryRelation</a></span>
33 </div></div>
34 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap33.html#X7899E59181C46EBB">33.2 <span class="Heading">Properties and Attributes of Binary Relations</span></a>
35 </span>
36 <div class="ContSSBlock">
37 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X79D69B667F5FE8FE">33.2-1 IsReflexiveBinaryRelation</a></span>
38 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X785916A181555368">33.2-2 IsSymmetricBinaryRelation</a></span>
39 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X7823942478124563">33.2-3 IsTransitiveBinaryRelation</a></span>
40 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X870F72C38550A0A4">33.2-4 IsAntisymmetricBinaryRelation</a></span>
41 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X782B7C8A8136532F">33.2-5 IsPreOrderBinaryRelation</a></span>
42 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X7A1228207AB4FBA3">33.2-6 IsPartialOrderBinaryRelation</a></span>
43 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X80D3735C84D1CDC2">33.2-7 IsHasseDiagram</a></span>
44 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X82D6CB4B7CCE9E25">33.2-8 IsEquivalenceRelation</a></span>
45 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X85E2FD8B82652876">33.2-9 Successors</a></span>
46 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X7B4D22A17E752A91">33.2-10 DegreeOfBinaryRelation</a></span>
47 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X8278E4457C3C3A0D">33.2-11 PartialOrderOfHasseDiagram</a></span>
48 </div></div>
49 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap33.html#X78032F927F078E19">33.3 <span class="Heading">Binary Relations on Points</span></a>
50 </span>
51 <div class="ContSSBlock">
52 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X79E40E9385274F89">33.3-1 BinaryRelationOnPoints</a></span>
53 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X7D9323C283867515">33.3-2 RandomBinaryRelationOnPoints</a></span>
54 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X8315C7A47CEB6BB3">33.3-3 <span class="Heading">AsBinaryRelationOnPoints</span></a>
55 </span>
56 </div></div>
57 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap33.html#X7D9A14AE799142EF">33.4 <span class="Heading">Closure Operations and Other Constructors</span></a>
58 </span>
59 <div class="ContSSBlock">
60 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X8252B17C864A4904">33.4-1 ReflexiveClosureBinaryRelation</a></span>
61 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X820811E9785A7274">33.4-2 SymmetricClosureBinaryRelation</a></span>
62 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X853BFAD9858DCDF7">33.4-3 TransitiveClosureBinaryRelation</a></span>
63 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X79672B3A7BCB6991">33.4-4 HasseDiagramBinaryRelation</a></span>
64 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X85C22B3D812957C0">33.4-5 StronglyConnectedComponents</a></span>
65 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X86AAE6027A3AEF72">33.4-6 PartialOrderByOrderingFunction</a></span>
66 </div></div>
67 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap33.html#X7DAA67338458BB64">33.5 <span class="Heading">Equivalence Relations</span></a>
68 </span>
69 <div class="ContSSBlock">
70 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X7A44D73D8150266A">33.5-1 EquivalenceRelationByPartition</a></span>
71 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X82CD1C00810F6042">33.5-2 EquivalenceRelationByRelation</a></span>
72 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X7B70215E7E3F9CA4">33.5-3 EquivalenceRelationByPairs</a></span>
73 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X7C5AA9B97EE42DA5">33.5-4 EquivalenceRelationByProperty</a></span>
74 </div></div>
75 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap33.html#X85A2A8E27AF52769">33.6 <span class="Heading">Attributes of and Operations on Equivalence Relations</span></a>
76 </span>
77 <div class="ContSSBlock">
78 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X877389B683DD8F1A">33.6-1 EquivalenceRelationPartition</a></span>
79 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X79DC914C82D7903B">33.6-2 GeneratorsOfEquivalenceRelationPartition</a></span>
80 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X82BE360381476D92">33.6-3 JoinEquivalenceRelations</a></span>
81 </div></div>
82 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap33.html#X79EE13287DEB11B1">33.7 <span class="Heading">Equivalence Classes</span></a>
83 </span>
84 <div class="ContSSBlock">
85 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X8424996186DB14EA">33.7-1 IsEquivalenceClass</a></span>
86 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X78F967E77EB16386">33.7-2 EquivalenceClassRelation</a></span>
87 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X879439897EF4D728">33.7-3 EquivalenceClasses</a></span>
88 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap33.html#X7BB985BA7FD7A82E">33.7-4 EquivalenceClassOfElement</a></span>
89 </div></div>
90 </div>
91
92 <h3>33 <span class="Heading">Relations</span></h3>
93
94 <p>A <em>binary relation</em> <span class="SimpleMath">R</span> on a set <span class="SimpleMath">X</span> is a subset of <span class="SimpleMath">X × X</span>. A binary relation can also be thought of as a (general) mapping from <span class="SimpleMath">X</span> to itself or as a directed graph where each edge represents an element of <span class="SimpleMath">R</span>.</p>
95
96 <p>In <strong class="pkg">GAP</strong>, a relation is conceptually represented as a general mapping from <span class="SimpleMath">X</span> to itself. The category <code class="func">IsBinaryRelation</code> (<a href="chap33.html#X788D722F82165551"><span class="RefLink">33.1-1</span></a>) is a synonym for <code class="func">IsEndoGeneralMapping</code> (<a href="chap32.html#X81CFF5F87BBEA8AD"><span class="RefLink">32.13-3</span></a>). Attributes and properties of relations in <strong class="pkg">GAP</strong> are supported for relations, via considering relations as a subset of <span class="SimpleMath">X × X</span>, or as a directed graph; examples include finding the strongly connected components of a relation, via <code class="func">StronglyConnectedComponents</code> (<a href="chap33.html#X85C22B3D812957C0"><span class="RefLink">33.4-5</span></a>), or enumerating the tuples of the relation.</p>
97
98 <p><a id="X7DED7F1F78D31785" name="X7DED7F1F78D31785"></a></p>
99
100 <h4>33.1 <span class="Heading">General Binary Relations</span></h4>
101
102 <p>This section lists general constructors of relations.</p>
103
104 <p><a id="X788D722F82165551" name="X788D722F82165551"></a></p>
105
106 <h5>33.1-1 IsBinaryRelation</h5>
107
108 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsBinaryRelation</code>( <var class="Arg">R</var> )</td><td class="tdright">(&nbsp;property&nbsp;)</td></tr></table></div>
109 <p>is exactly the same category as (i.e. a synonym for) <code class="func">IsEndoGeneralMapping</code> (<a href="chap32.html#X81CFF5F87BBEA8AD"><span class="RefLink">32.13-3</span></a>).</p>
110
111 <p><a id="X7A1D8EEF8034B0B5" name="X7A1D8EEF8034B0B5"></a></p>
112
113 <h5>33.1-2 BinaryRelationByElements</h5>
114
115 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; BinaryRelationByElements</code>( <var class="Arg">domain</var>, <var class="Arg">elms</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
116 <p>is the binary relation on <var class="Arg">domain</var> and with underlying relation consisting of the tuples collection <var class="Arg">elms</var>. This construction is similar to <code class="func">GeneralMappingByElements</code> (<a href="chap32.html#X79D0D2F07A14D039"><span class="RefLink">32.2-1</span></a>) where the source and range are the same set.</p>
117
118
119 <div class="example"><pre>
120 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r:=BinaryRelationByElements(Domain([1..3]),[DirectProductElement([1,2]),DirectProductElement([1,3])]);</span>
121 &lt;general mapping: Domain([ 1 .. 3 ]) -&gt; Domain([ 1 .. 3 ]) &gt;
122 </pre></div>
123
124 <p><a id="X81878EEF873B34D5" name="X81878EEF873B34D5"></a></p>
125
126 <h5>33.1-3 <span class="Heading">IdentityBinaryRelation</span></h5>
127
128 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IdentityBinaryRelation</code>( <var class="Arg">degree</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
129 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IdentityBinaryRelation</code>( <var class="Arg">domain</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
130 <p>is the binary relation which consists of diagonal pairs, i.e., pairs of the form <span class="SimpleMath">(x,x)</span>. In the first form if a positive integer <var class="Arg">degree</var> is given then the domain is the set of the integers <span class="SimpleMath">{ 1, ..., <var class="Arg">degree</var> }</span>. In the second form, the objects <span class="SimpleMath">x</span> are from the domain <var class="Arg">domain</var>.</p>
131
132
133 <div class="example"><pre>
134 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IdentityBinaryRelation(5);</span>
135 &lt;equivalence relation on Domain([ 1 .. 5 ]) &gt;
136 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">s4:=SymmetricGroup(4);</span>
137 Sym( [ 1 .. 4 ] )
138 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IdentityBinaryRelation(s4);</span>
139 IdentityMapping( Sym( [ 1 .. 4 ] ) )
140 </pre></div>
141
142 <p><a id="X80DDCDD387BA23F2" name="X80DDCDD387BA23F2"></a></p>
143
144 <h5>33.1-4 EmptyBinaryRelation</h5>
145
146 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EmptyBinaryRelation</code>( <var class="Arg">degree</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
147 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EmptyBinaryRelation</code>( <var class="Arg">domain</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
148 <p>is the relation with <var class="Arg">R</var> empty. In the first form of the command with <var class="Arg">degree</var> an integer, the domain is the set of points <span class="SimpleMath">{ 1, ..., <var class="Arg">degree</var> }</span>. In the second form, the domain is that given by the argument <var class="Arg">domain</var>.</p>
149
150
151 <div class="example"><pre>
152 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">EmptyBinaryRelation(3) = BinaryRelationOnPoints([ [], [], [] ]);</span>
153 true
154 </pre></div>
155
156 <p><a id="X7899E59181C46EBB" name="X7899E59181C46EBB"></a></p>
157
158 <h4>33.2 <span class="Heading">Properties and Attributes of Binary Relations</span></h4>
159
160 <p><a id="X79D69B667F5FE8FE" name="X79D69B667F5FE8FE"></a></p>
161
162 <h5>33.2-1 IsReflexiveBinaryRelation</h5>
163
164 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsReflexiveBinaryRelation</code>( <var class="Arg">R</var> )</td><td class="tdright">(&nbsp;property&nbsp;)</td></tr></table></div>
165 <p>returns <code class="keyw">true</code> if the binary relation <var class="Arg">R</var> is reflexive, and <code class="keyw">false</code> otherwise.</p>
166
167 <p>A binary relation <span class="SimpleMath">R</span> (as a set of pairs) on a set <span class="SimpleMath">X</span> is <em>reflexive</em> if for all <span class="SimpleMath">x ∈ X</span>, <span class="SimpleMath">(x,x) ∈ R</span>. Alternatively, <span class="SimpleMath">R</span> as a mapping is reflexive if for all <span class="SimpleMath">x ∈ X</span>, <span class="SimpleMath">x</span> is an element of the image set <span class="SimpleMath">R(x)</span>.</p>
168
169 <p>A reflexive binary relation is necessarily a total endomorphic mapping (tested via <code class="func">IsTotal</code> (<a href="chap32.html#X83C7494E828CC9C8"><span class="RefLink">32.3-1</span></a>)).</p>
170
171
172 <div class="example"><pre>
173 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsReflexiveBinaryRelation(BinaryRelationOnPoints([[1,3],[2],[3]]));</span>
174 true
175 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsReflexiveBinaryRelation(BinaryRelationOnPoints([[2],[2]]));</span>
176 false
177 </pre></div>
178
179 <p><a id="X785916A181555368" name="X785916A181555368"></a></p>
180
181 <h5>33.2-2 IsSymmetricBinaryRelation</h5>
182
183 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsSymmetricBinaryRelation</code>( <var class="Arg">R</var> )</td><td class="tdright">(&nbsp;property&nbsp;)</td></tr></table></div>
184 <p>returns <code class="keyw">true</code> if the binary relation <var class="Arg">R</var> is symmetric, and <code class="keyw">false</code> otherwise.</p>
185
186 <p>A binary relation <span class="SimpleMath">R</span> (as a set of pairs) on a set <span class="SimpleMath">X</span> is <em>symmetric</em> if <span class="SimpleMath">(x,y) ∈ R</span> then <span class="SimpleMath">(y,x) ∈ R</span>. Alternatively, <span class="SimpleMath">R</span> as a mapping is symmetric if for all <span class="SimpleMath">x ∈ X</span>, the preimage set of <span class="SimpleMath">x</span> under <span class="SimpleMath">R</span> equals the image set <span class="SimpleMath">R(x)</span>.</p>
187
188
189 <div class="example"><pre>
190 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsSymmetricBinaryRelation(BinaryRelationOnPoints([[2],[1]]));</span>
191 true
192 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsSymmetricBinaryRelation(BinaryRelationOnPoints([[2],[2]]));</span>
193 false
194 </pre></div>
195
196 <p><a id="X7823942478124563" name="X7823942478124563"></a></p>
197
198 <h5>33.2-3 IsTransitiveBinaryRelation</h5>
199
200 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsTransitiveBinaryRelation</code>( <var class="Arg">R</var> )</td><td class="tdright">(&nbsp;property&nbsp;)</td></tr></table></div>
201 <p>returns <code class="keyw">true</code> if the binary relation <var class="Arg">R</var> is transitive, and <code class="keyw">false</code> otherwise.</p>
202
203 <p>A binary relation <var class="Arg">R</var> (as a set of pairs) on a set <span class="SimpleMath">X</span> is <em>transitive</em> if <span class="SimpleMath">(x,y), (y,z) ∈ R</span> implies <span class="SimpleMath">(x,z) ∈ R</span>. Alternatively, <span class="SimpleMath">R</span> as a mapping is transitive if for all <span class="SimpleMath">x ∈ X</span>, the image set <span class="SimpleMath">R(R(x))</span> of the image set <span class="SimpleMath">R(x)</span> of <span class="SimpleMath">x</span> is a subset of <span class="SimpleMath">R(x)</span>.</p>
204
205
206 <div class="example"><pre>
207 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsTransitiveBinaryRelation(BinaryRelationOnPoints([[1,2,3],[2,3],[]]));</span>
208 true
209 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsTransitiveBinaryRelation(BinaryRelationOnPoints([[1,2],[2,3],[]]));</span>
210 false
211 </pre></div>
212
213 <p><a id="X870F72C38550A0A4" name="X870F72C38550A0A4"></a></p>
214
215 <h5>33.2-4 IsAntisymmetricBinaryRelation</h5>
216
217 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsAntisymmetricBinaryRelation</code>( <var class="Arg">rel</var> )</td><td class="tdright">(&nbsp;property&nbsp;)</td></tr></table></div>
218 <p>returns <code class="keyw">true</code> if the binary relation <var class="Arg">rel</var> is antisymmetric, and <code class="keyw">false</code> otherwise.</p>
219
220 <p>A binary relation <var class="Arg">R</var> (as a set of pairs) on a set <span class="SimpleMath">X</span> is <em>antisymmetric</em> if <span class="SimpleMath">(x,y), (y,x) ∈ R</span> implies <span class="SimpleMath">x = y</span>. Alternatively, <span class="SimpleMath">R</span> as a mapping is antisymmetric if for all <span class="SimpleMath">x ∈ X</span>, the intersection of the preimage set of <span class="SimpleMath">x</span> under <span class="SimpleMath">R</span> and the image set <span class="SimpleMath">R(x)</span> is <span class="SimpleMath">{ x }</span>.</p>
221
222 <p><a id="X782B7C8A8136532F" name="X782B7C8A8136532F"></a></p>
223
224 <h5>33.2-5 IsPreOrderBinaryRelation</h5>
225
226 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsPreOrderBinaryRelation</code>( <var class="Arg">rel</var> )</td><td class="tdright">(&nbsp;property&nbsp;)</td></tr></table></div>
227 <p>returns <code class="keyw">true</code> if the binary relation <var class="Arg">rel</var> is a preorder, and <code class="keyw">false</code> otherwise.</p>
228
229 <p>A <em>preorder</em> is a binary relation that is both reflexive and transitive.</p>
230
231 <p><a id="X7A1228207AB4FBA3" name="X7A1228207AB4FBA3"></a></p>
232
233 <h5>33.2-6 IsPartialOrderBinaryRelation</h5>
234
235 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsPartialOrderBinaryRelation</code>( <var class="Arg">rel</var> )</td><td class="tdright">(&nbsp;property&nbsp;)</td></tr></table></div>
236 <p>returns <code class="keyw">true</code> if the binary relation <var class="Arg">rel</var> is a partial order, and <code class="keyw">false</code> otherwise.</p>
237
238 <p>A <em>partial order</em> is a preorder which is also antisymmetric.</p>
239
240 <p><a id="X80D3735C84D1CDC2" name="X80D3735C84D1CDC2"></a></p>
241
242 <h5>33.2-7 IsHasseDiagram</h5>
243
244 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsHasseDiagram</code>( <var class="Arg">rel</var> )</td><td class="tdright">(&nbsp;property&nbsp;)</td></tr></table></div>
245 <p>returns <code class="keyw">true</code> if the binary relation <var class="Arg">rel</var> is a Hasse Diagram of a partial order, i.e., was computed via <code class="func">HasseDiagramBinaryRelation</code> (<a href="chap33.html#X79672B3A7BCB6991"><span class="RefLink">33.4-4</span></a>).</p>
246
247 <p><a id="X82D6CB4B7CCE9E25" name="X82D6CB4B7CCE9E25"></a></p>
248
249 <h5>33.2-8 IsEquivalenceRelation</h5>
250
251 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsEquivalenceRelation</code>( <var class="Arg">R</var> )</td><td class="tdright">(&nbsp;property&nbsp;)</td></tr></table></div>
252 <p>returns <code class="keyw">true</code> if the binary relation <var class="Arg">R</var> is an equivalence relation, and <code class="keyw">false</code> otherwise.</p>
253
254 <p>Recall, that a relation <var class="Arg">R</var> is an <em>equivalence relation</em> if it is symmetric, transitive, and reflexive.</p>
255
256 <p><a id="X85E2FD8B82652876" name="X85E2FD8B82652876"></a></p>
257
258 <h5>33.2-9 Successors</h5>
259
260 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Successors</code>( <var class="Arg">R</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
261 <p>returns the list of images of a binary relation <var class="Arg">R</var>. If the underlying domain of the relation is not <span class="SimpleMath">{ 1, ..., n }</span>, for some positive integer <span class="SimpleMath">n</span>, then an error is signalled.</p>
262
263 <p>The returned value of <code class="func">Successors</code> is a list of lists where the lists are ordered as the elements according to the sorted order of the underlying set of <var class="Arg">R</var>. Each list consists of the images of the element whose index is the same as the list with the underlying set in sorted order.</p>
264
265 <p>The <code class="func">Successors</code> of a relation is the adjacency list representation of the relation.</p>
266
267
268 <div class="example"><pre>
269 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r1:=BinaryRelationOnPoints([[2],[3],[1]]);;</span>
270 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Successors(r1);</span>
271 [ [ 2 ], [ 3 ], [ 1 ] ]
272 </pre></div>
273
274 <p><a id="X7B4D22A17E752A91" name="X7B4D22A17E752A91"></a></p>
275
276 <h5>33.2-10 DegreeOfBinaryRelation</h5>
277
278 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DegreeOfBinaryRelation</code>( <var class="Arg">R</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
279 <p>returns the size of the underlying domain of the binary relation <var class="Arg">R</var>. This is most natural when working with a binary relation on points.</p>
280
281
282 <div class="example"><pre>
283 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">DegreeOfBinaryRelation(r1);</span>
284 3
285 </pre></div>
286
287 <p><a id="X8278E4457C3C3A0D" name="X8278E4457C3C3A0D"></a></p>
288
289 <h5>33.2-11 PartialOrderOfHasseDiagram</h5>
290
291 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PartialOrderOfHasseDiagram</code>( <var class="Arg">HD</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
292 <p>is the partial order associated with the Hasse Diagram <var class="Arg">HD</var> i.e. the partial order generated by the reflexive and transitive closure of <var class="Arg">HD</var>.</p>
293
294 <p><a id="X78032F927F078E19" name="X78032F927F078E19"></a></p>
295
296 <h4>33.3 <span class="Heading">Binary Relations on Points</span></h4>
297
298 <p>We have special construction methods when the underlying <var class="Arg">X</var> of our relation is the set of integers <span class="SimpleMath">{ 1, ..., n }</span>.</p>
299
300 <p><a id="X79E40E9385274F89" name="X79E40E9385274F89"></a></p>
301
302 <h5>33.3-1 BinaryRelationOnPoints</h5>
303
304 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; BinaryRelationOnPoints</code>( <var class="Arg">list</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
305 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; BinaryRelationOnPointsNC</code>( <var class="Arg">list</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
306 <p>Given a list of <span class="SimpleMath">n</span> lists, each containing elements from the set <span class="SimpleMath">{ 1, ..., n }</span>, this function constructs a binary relation such that <span class="SimpleMath">1</span> is related to <var class="Arg">list</var><code class="code">[1]</code>, <span class="SimpleMath">2</span> to <var class="Arg">list</var><code class="code">[2]</code> and so on. The first version checks whether the list supplied is valid. The <code class="code">NC</code> version skips this check.</p>
307
308
309 <div class="example"><pre>
310 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">R:=BinaryRelationOnPoints([[1,2],[2],[3]]);</span>
311 Binary Relation on 3 points
312 </pre></div>
313
314 <p><a id="X7D9323C283867515" name="X7D9323C283867515"></a></p>
315
316 <h5>33.3-2 RandomBinaryRelationOnPoints</h5>
317
318 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RandomBinaryRelationOnPoints</code>( <var class="Arg">degree</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
319 <p>creates a relation on points with degree <var class="Arg">degree</var>.</p>
320
321 <p><a id="X8315C7A47CEB6BB3" name="X8315C7A47CEB6BB3"></a></p>
322
323 <h5>33.3-3 <span class="Heading">AsBinaryRelationOnPoints</span></h5>
324
325 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AsBinaryRelationOnPoints</code>( <var class="Arg">trans</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
326 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AsBinaryRelationOnPoints</code>( <var class="Arg">perm</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
327 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AsBinaryRelationOnPoints</code>( <var class="Arg">rel</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
328 <p>return the relation on points represented by general relation <var class="Arg">rel</var>, transformation <var class="Arg">trans</var> or permutation <var class="Arg">perm</var>. If <var class="Arg">rel</var> is already a binary relation on points then <var class="Arg">rel</var> is returned.</p>
329
330 <p>Transformations and permutations are special general endomorphic mappings and have a natural representation as a binary relation on points.</p>
331
332 <p>In the last form, an isomorphic relation on points is constructed where the points are indices of the elements of the underlying domain in sorted order.</p>
333
334
335 <div class="example"><pre>
336 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">t:=Transformation([2,3,1]);;</span>
337 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r1:=AsBinaryRelationOnPoints(t);</span>
338 Binary Relation on 3 points
339 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r2:=AsBinaryRelationOnPoints((1,2,3));</span>
340 Binary Relation on 3 points
341 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">r1=r2;</span>
342 true
343 </pre></div>
344
345 <p><a id="X7D9A14AE799142EF" name="X7D9A14AE799142EF"></a></p>
346
347 <h4>33.4 <span class="Heading">Closure Operations and Other Constructors</span></h4>
348
349 <p><a id="X8252B17C864A4904" name="X8252B17C864A4904"></a></p>
350
351 <h5>33.4-1 ReflexiveClosureBinaryRelation</h5>
352
353 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ReflexiveClosureBinaryRelation</code>( <var class="Arg">R</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
354 <p>is the smallest binary relation containing the binary relation <var class="Arg">R</var> which is reflexive. This closure inherits the properties symmetric and transitive from <var class="Arg">R</var>. E.g., if <var class="Arg">R</var> is symmetric then its reflexive closure is also.</p>
355
356 <p><a id="X820811E9785A7274" name="X820811E9785A7274"></a></p>
357
358 <h5>33.4-2 SymmetricClosureBinaryRelation</h5>
359
360 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SymmetricClosureBinaryRelation</code>( <var class="Arg">R</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
361 <p>is the smallest binary relation containing the binary relation <var class="Arg">R</var> which is symmetric. This closure inherits the properties reflexive and transitive from <var class="Arg">R</var>. E.g., if <var class="Arg">R</var> is reflexive then its symmetric closure is also.</p>
362
363 <p><a id="X853BFAD9858DCDF7" name="X853BFAD9858DCDF7"></a></p>
364
365 <h5>33.4-3 TransitiveClosureBinaryRelation</h5>
366
367 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; TransitiveClosureBinaryRelation</code>( <var class="Arg">rel</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
368 <p>is the smallest binary relation containing the binary relation <var class="Arg">R</var> which is transitive. This closure inherits the properties reflexive and symmetric from <var class="Arg">R</var>. E.g., if <var class="Arg">R</var> is symmetric then its transitive closure is also.</p>
369
370 <p><code class="func">TransitiveClosureBinaryRelation</code> is a modified version of the Floyd-Warshall method of solving the all-pairs shortest-paths problem on a directed graph. Its asymptotic runtime is <span class="SimpleMath">O(n^3)</span> where <span class="SimpleMath">n</span> is the size of the vertex set. It only assumes there is an arbitrary (but fixed) ordering of the vertex set.</p>
371
372 <p><a id="X79672B3A7BCB6991" name="X79672B3A7BCB6991"></a></p>
373
374 <h5>33.4-4 HasseDiagramBinaryRelation</h5>
375
376 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; HasseDiagramBinaryRelation</code>( <var class="Arg">partial-order</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
377 <p>is the smallest relation contained in the partial order <var class="Arg">partial-order</var> whose reflexive and transitive closure is equal to <var class="Arg">partial-order</var>.</p>
378
379 <p><a id="X85C22B3D812957C0" name="X85C22B3D812957C0"></a></p>
380
381 <h5>33.4-5 StronglyConnectedComponents</h5>
382
383 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; StronglyConnectedComponents</code>( <var class="Arg">R</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
384 <p>returns an equivalence relation on the vertices of the binary relation <var class="Arg">R</var>.</p>
385
386 <p><a id="X86AAE6027A3AEF72" name="X86AAE6027A3AEF72"></a></p>
387
388 <h5>33.4-6 PartialOrderByOrderingFunction</h5>
389
390 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PartialOrderByOrderingFunction</code>( <var class="Arg">dom</var>, <var class="Arg">orderfunc</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
391 <p>constructs a partial order whose elements are from the domain <var class="Arg">dom</var> and are ordered using the ordering function <var class="Arg">orderfunc</var>. The ordering function must be a binary function returning a boolean value. If the ordering function does not describe a partial order then <code class="keyw">fail</code> is returned.</p>
392
393 <p><a id="X7DAA67338458BB64" name="X7DAA67338458BB64"></a></p>
394
395 <h4>33.5 <span class="Heading">Equivalence Relations</span></h4>
396
397 <p>An <em>equivalence relation</em> <var class="Arg">E</var> over the set <var class="Arg">X</var> is a relation on <var class="Arg">X</var> which is reflexive, symmetric, and transitive. A <em>partition</em> <var class="Arg">P</var> is a set of subsets of <var class="Arg">X</var> such that for all <span class="SimpleMath">R, S ∈ P</span>, <span class="SimpleMath">R ∩ S</span> is the empty set and <span class="SimpleMath">∪ P = X</span>. An equivalence relation induces a partition such that if <span class="SimpleMath">(x,y) ∈ E</span> then <span class="SimpleMath">x, y</span> are in the same element of <var class="Arg">P</var>.</p>
398
399 <p>Like all binary relations in <strong class="pkg">GAP</strong> 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 <code class="func">EquivalenceRelationPartition</code> (<a href="chap33.html#X877389B683DD8F1A"><span class="RefLink">33.6-1</span></a>) which provides the partition induced by the given equivalence.</p>
400
401 <p><a id="X7A44D73D8150266A" name="X7A44D73D8150266A"></a></p>
402
403 <h5>33.5-1 EquivalenceRelationByPartition</h5>
404
405 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EquivalenceRelationByPartition</code>( <var class="Arg">domain</var>, <var class="Arg">list</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
406 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EquivalenceRelationByPartitionNC</code>( <var class="Arg">domain</var>, <var class="Arg">list</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
407 <p>constructs the equivalence relation over the set <var class="Arg">domain</var> which induces the partition represented by <var class="Arg">list</var>. This representation includes only the non-trivial blocks (or equivalent classes). <var class="Arg">list</var> is a list of lists, each of these lists contain elements of <var class="Arg">domain</var> and are pairwise mutually exclusive.</p>
408
409 <p>The list of lists do not need to be in any order nor do the elements in the blocks (see <code class="func">EquivalenceRelationPartition</code> (<a href="chap33.html#X877389B683DD8F1A"><span class="RefLink">33.6-1</span></a>)). a list of elements of <var class="Arg">domain</var> The partition <var class="Arg">list</var> is a list of lists, each of these is a list of elements of <var class="Arg">domain</var> that makes up a block (or equivalent class). The <var class="Arg">domain</var> is the domain over which the relation is defined, and <var class="Arg">list</var> is a list of lists, each of these is a list of elements of <var class="Arg">domain</var> which are related to each other. <var class="Arg">list</var> need only contain the nontrivial blocks and singletons will be ignored. The <code class="code">NC</code> version will not check to see if the lists are pairwise mutually exclusive or that they contain only elements of the domain.</p>
410
411
412 <div class="example"><pre>
413 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">er:=EquivalenceRelationByPartition(Domain([1..10]),[[1,3,5,7,9],[2,4,6,8,10]]);</span>
414 &lt;equivalence relation on Domain([ 1 .. 10 ]) &gt;
415 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsEquivalenceRelation(er);</span>
416 true
417 </pre></div>
418
419 <p><a id="X82CD1C00810F6042" name="X82CD1C00810F6042"></a></p>
420
421 <h5>33.5-2 EquivalenceRelationByRelation</h5>
422
423 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EquivalenceRelationByRelation</code>( <var class="Arg">rel</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
424 <p>returns the smallest equivalence relation containing the binary relation <var class="Arg">rel</var>.</p>
425
426 <p><a id="X7B70215E7E3F9CA4" name="X7B70215E7E3F9CA4"></a></p>
427
428 <h5>33.5-3 EquivalenceRelationByPairs</h5>
429
430 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EquivalenceRelationByPairs</code>( <var class="Arg">D</var>, <var class="Arg">elms</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
431 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EquivalenceRelationByPairsNC</code>( <var class="Arg">D</var>, <var class="Arg">elms</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
432 <p>return the smallest equivalence relation on the domain <var class="Arg">D</var> such that every pair in <var class="Arg">elms</var> is in the relation.</p>
433
434 <p>In the <code class="code">NC</code> form, it is not checked that <var class="Arg">elms</var> are in the domain <var class="Arg">D</var>.</p>
435
436 <p><a id="X7C5AA9B97EE42DA5" name="X7C5AA9B97EE42DA5"></a></p>
437
438 <h5>33.5-4 EquivalenceRelationByProperty</h5>
439
440 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EquivalenceRelationByProperty</code>( <var class="Arg">domain</var>, <var class="Arg">property</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
441 <p>creates an equivalence relation on <var class="Arg">domain</var> whose only defining datum is that of having the property <var class="Arg">property</var>.</p>
442
443 <p><a id="X85A2A8E27AF52769" name="X85A2A8E27AF52769"></a></p>
444
445 <h4>33.6 <span class="Heading">Attributes of and Operations on Equivalence Relations</span></h4>
446
447 <p><a id="X877389B683DD8F1A" name="X877389B683DD8F1A"></a></p>
448
449 <h5>33.6-1 EquivalenceRelationPartition</h5>
450
451 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EquivalenceRelationPartition</code>( <var class="Arg">equiv</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
452 <p>returns a list of lists of elements of the underlying set of the equivalence relation <var class="Arg">equiv</var>. The lists are precisely the nonsingleton equivalence classes of the equivalence. This allows us to describe <q>small</q> equivalences on infinite sets.</p>
453
454 <p><a id="X79DC914C82D7903B" name="X79DC914C82D7903B"></a></p>
455
456 <h5>33.6-2 GeneratorsOfEquivalenceRelationPartition</h5>
457
458 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; GeneratorsOfEquivalenceRelationPartition</code>( <var class="Arg">equiv</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
459 <p>is a set of generating pairs for the equivalence relation <var class="Arg">equiv</var>. This set is not unique. The equivalence <var class="Arg">equiv</var> is the smallest equivalence relation over the underlying set which contains the generating pairs.</p>
460
461 <p><a id="X82BE360381476D92" name="X82BE360381476D92"></a></p>
462
463 <h5>33.6-3 JoinEquivalenceRelations</h5>
464
465 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; JoinEquivalenceRelations</code>( <var class="Arg">equiv1</var>, <var class="Arg">equiv2</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
466 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MeetEquivalenceRelations</code>( <var class="Arg">equiv1</var>, <var class="Arg">equiv2</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
467 <p><code class="func">JoinEquivalenceRelations</code> returns the smallest equivalence relation containing both the equivalence relations <var class="Arg">equiv1</var> and <var class="Arg">equiv2</var>.</p>
468
469 <p><code class="func">MeetEquivalenceRelations</code> returns the intersection of the two equivalence relations <var class="Arg">equiv1</var> and <var class="Arg">equiv2</var>.</p>
470
471 <p><a id="X79EE13287DEB11B1" name="X79EE13287DEB11B1"></a></p>
472
473 <h4>33.7 <span class="Heading">Equivalence Classes</span></h4>
474
475 <p><a id="X8424996186DB14EA" name="X8424996186DB14EA"></a></p>
476
477 <h5>33.7-1 IsEquivalenceClass</h5>
478
479 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsEquivalenceClass</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
480 <p>returns <code class="keyw">true</code> if the object <var class="Arg">obj</var> is an equivalence class, and <code class="keyw">false</code> otherwise.</p>
481
482 <p>An <em>equivalence class</em> is a collection of elements which are mutually related to each other in the associated equivalence relation. Note, this is a special category of objects and not just a list of elements.</p>
483
484 <p><a id="X78F967E77EB16386" name="X78F967E77EB16386"></a></p>
485
486 <h5>33.7-2 EquivalenceClassRelation</h5>
487
488 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EquivalenceClassRelation</code>( <var class="Arg">C</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
489 <p>returns the equivalence relation of which <var class="Arg">C</var> is a class.</p>
490
491 <p><a id="X879439897EF4D728" name="X879439897EF4D728"></a></p>
492
493 <h5>33.7-3 EquivalenceClasses</h5>
494
495 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EquivalenceClasses</code>( <var class="Arg">rel</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
496 <p>returns a list of all equivalence classes of the equivalence relation <var class="Arg">rel</var>. Note that it is possible for different methods to yield the list in different orders, so that for two equivalence relations <span class="SimpleMath">c1</span> and <span class="SimpleMath">c2</span> we may have <span class="SimpleMath">c1 = c2</span> without having <code class="code">EquivalenceClasses</code><span class="SimpleMath">( c1 ) =</span><code class="code">EquivalenceClasses</code><span class="SimpleMath">( c2 )</span>.</p>
497
498
499 <div class="example"><pre>
500 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">er:=EquivalenceRelationByPartition(Domain([1..10]),[[1,3,5,7,9],[2,4,6,8,10]]);</span>
501 &lt;equivalence relation on Domain([ 1 .. 10 ]) &gt;
502 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">classes := EquivalenceClasses(er);</span>
503 [ {1}, {2} ]
504 </pre></div>
505
506 <p><a id="X7BB985BA7FD7A82E" name="X7BB985BA7FD7A82E"></a></p>
507
508 <h5>33.7-4 EquivalenceClassOfElement</h5>
509
510 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EquivalenceClassOfElement</code>( <var class="Arg">rel</var>, <var class="Arg">elt</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
511 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; EquivalenceClassOfElementNC</code>( <var class="Arg">rel</var>, <var class="Arg">elt</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
512 <p>return the equivalence class of <var class="Arg">elt</var> in the binary relation <var class="Arg">rel</var>, where <var class="Arg">elt</var> is an element (i.e. a pair) of the domain of <var class="Arg">rel</var>. In the <code class="code">NC</code> form, it is not checked that <var class="Arg">elt</var> is in the domain over which <var class="Arg">rel</var> is defined.</p>
513
514
515 <div class="example"><pre>
516 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">EquivalenceClassOfElement(er,3);</span>
517 {3}
518 </pre></div>
519
520
521 <div class="chlinkprevnextbot">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp; <a href="chap0.html#contents">[Contents]</a>&nbsp; &nbsp;<a href="chap32.html">[Previous Chapter]</a>&nbsp; &nbsp;<a href="chap34.html">[Next Chapter]</a>&nbsp; </div>
522
523
524 <div class="chlinkbot"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chap5.html">5</a> <a href="chap6.html">6</a> <a href="chap7.html">7</a> <a href="chap8.html">8</a> <a href="chap9.html">9</a> <a href="chap10.html">10</a> <a href="chap11.html">11</a> <a href="chap12.html">12</a> <a href="chap13.html">13</a> <a href="chap14.html">14</a> <a href="chap15.html">15</a> <a href="chap16.html">16</a> <a href="chap17.html">17</a> <a href="chap18.html">18</a> <a href="chap19.html">19</a> <a href="chap20.html">20</a> <a href="chap21.html">21</a> <a href="chap22.html">22</a> <a href="chap23.html">23</a> <a href="chap24.html">24</a> <a href="chap25.html">25</a> <a href="chap26.html">26</a> <a href="chap27.html">27</a> <a href="chap28.html">28</a> <a href="chap29.html">29</a> <a href="chap30.html">30</a> <a href="chap31.html">31</a> <a href="chap32.html">32</a> <a href="chap33.html">33</a> <a href="chap34.html">34</a> <a href="chap35.html">35</a> <a href="chap36.html">36</a> <a href="chap37.html">37</a> <a href="chap38.html">38</a> <a href="chap39.html">39</a> <a href="chap40.html">40</a> <a href="chap41.html">41</a> <a href="chap42.html">42</a> <a href="chap43.html">43</a> <a href="chap44.html">44</a> <a href="chap45.html">45</a> <a href="chap46.html">46</a> <a href="chap47.html">47</a> <a href="chap48.html">48</a> <a href="chap49.html">49</a> <a href="chap50.html">50</a> <a href="chap51.html">51</a> <a href="chap52.html">52</a> <a href="chap53.html">53</a> <a href="chap54.html">54</a> <a href="chap55.html">55</a> <a href="chap56.html">56</a> <a href="chap57.html">57</a> <a href="chap58.html">58</a> <a href="chap59.html">59</a> <a href="chap60.html">60</a> <a href="chap61.html">61</a> <a href="chap62.html">62</a> <a href="chap63.html">63</a> <a href="chap64.html">64</a> <a href="chap65.html">65</a> <a href="chap66.html">66</a> <a href="chap67.html">67</a> <a href="chap68.html">68</a> <a href="chap69.html">69</a> <a href="chap70.html">70</a> <a href="chap71.html">71</a> <a href="chap72.html">72</a> <a href="chap73.html">73</a> <a href="chap74.html">74</a> <a href="chap75.html">75</a> <a href="chap76.html">76</a> <a href="chap77.html">77</a> <a href="chap78.html">78</a> <a href="chap79.html">79</a> <a href="chap80.html">80</a> <a href="chap81.html">81</a> <a href="chap82.html">82</a> <a href="chap83.html">83</a> <a href="chap84.html">84</a> <a href="chap85.html">85</a> <a href="chap86.html">86</a> <a href="chap87.html">87</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
525
526 <hr />
527 <p class="foot">generated by <a href="https://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
528 </body>
529 </html>