How to implement an Antisymmetric Function?
<p>I am trying to test whether the relations (pairs) of the set are antisymmetric meaning:
    a binary relation R on a set X is antisymmetric if, for all a and b in X
      if R(a,b) and R(b,a), then a = b,
    or, equivalently,
      if R(a,b) with a ≠ b, then R(b,a) must not hold.</p>

<pre><code>antisymetric: 
 set holds to true
 for each pair(e,f) in b
    if pair(f,e) is in b
        if f is not e
            set holds to false
            break
</code></pre>

<p>What am I doing wrong??</p>

<p>Here is my function along with a sample test in the main:</p>

<pre><code>void antiSymmetric(int b[], int sizeOfB)
{
bool hold = true; // set hold to true
for(int i = 0; i &lt; sizeOfB;) // for each pair (e,f) in b
{
    if(hold == false)
    {
        cout &lt;&lt; "AntiSymmetric - No" &lt;&lt; endl; 
        break; //Did not find (e,e) in b
    }
    for(int j = 0; j &lt; sizeOfB;)
    {
        if(b[i] == b[j+1] &amp;&amp; b[i+1] == b[j]) //If true, then pair(f,e) exists
        {
            if(b[i+1] != b[i]) //If true, relation is antisymmetric
            {
                hold = true;
                break;
            }
            else
            {
                hold = false;
                j = j + 2;
            }
        }
        else
        {
            hold = false;
            j = j + 2;
        }

    }
    i = i + 2;

}
if(hold == true)
    cout &lt;&lt; "AntiSymmetric - Yes" &lt;&lt; endl;

}

int main()
{
    int set4[8] = {1, 2, 3, 4, 5, 6, 7, 8};
    int rel4[20] = {1, 7, 2, 5, 2, 8, 3, 6, 4,
                    7, 5, 8, 6, 6, 1, 1, 2, 2);

    cout &lt;&lt; "Set 4: " &lt;&lt; endl;
    antiSymmetric(rel4, 20);

  return 0;
}
</code></pre>
