<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body>
    <p>xor a b = (a + b) mod 2<br>
      <br>
      Many good properties follow. <a class="moz-txt-link-freetext" href="https://en.wikipedia.org/wiki/GF(2)">https://en.wikipedia.org/wiki/GF(2)</a>
      ...<br>
    </p>
    <p>- Oleg<br>
      <br>
    </p>
    <div class="moz-cite-prefix">On 29.9.2020 12.45, Andrew Butterfield
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:E365EC0F-5832-4A7C-8137-98B83073198D@scss.tcd.ie">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      Not only that, `xor` has inverses so it forms an abelian group<br
        class="">
      <div class=""><br class="">
        <div class="">Regards, Andrew</div>
      </div>
      <div><br class="">
        <blockquote type="cite" class="">
          <div class="">On 29 Sep 2020, at 10:41, Andrew Butterfield
            <<a href="mailto:Andrew.Butterfield@scss.tcd.ie" class=""
              moz-do-not-send="true">Andrew.Butterfield@scss.tcd.ie</a>>
            wrote:</div>
          <br class="Apple-interchange-newline">
          <div class="">
            <meta http-equiv="Content-Type" content="text/html;
              charset=windows-1252" class="">
            <div style="word-wrap: break-word; -webkit-nbsp-mode: space;
              line-break: after-white-space;" class="">Hmmm - I thought
              so at first
              <div class=""><br class="">
              </div>
              <div class="">A B A `xor` B</div>
              <div class="">0 0      0</div>
              <div class="">0 1      1</div>
              <div class="">1 0      1</div>
              <div class="">1 1      0</div>
              <div class=""><br class="">
              </div>
              <div class="">0 `xor` b = b</div>
              <div class="">a `xor` 0 = a</div>
              <div class=""><br class="">
              </div>
              <div class="">Looks like 0 is the identity to me.</div>
              <div class=""><br class="">
                <div class="">Regards, Andrew</div>
              </div>
              <div class=""><br class="">
                <blockquote type="cite" class="">
                  <div class="">On 29 Sep 2020, at 10:33, Ben Franksen
                    <<a href="mailto:ben.franksen@online.de" class=""
                      moz-do-not-send="true">ben.franksen@online.de</a>>
                    wrote:</div>
                  <br class="Apple-interchange-newline">
                  <div class="">
                    <div class="">Am 29.09.20 um 10:27 schrieb Mario
                      Lang:<br class="">
                      <blockquote type="cite" class="">instance Monoid
                        QuadBitboard where<br class="">
                         mempty = QBB 0 0 0 0<br class="">
                        <br class="">
                        -- | bitwise XOR<br class="">
                        instance Semigroup QuadBitboard where<br
                          class="">
                         QBB b0 b1 b2 b3 <> QBB b0' b1' b2' b3' =<br
                          class="">
                           QBB (b0 `xor` b0') (b1 `xor` b1') (b2 `xor`
                        b2') (b3 `xor` b3')<br class="">
                        <br class="">
                        But maybe I am violating some laws<br class="">
                      </blockquote>
                      <br class="">
                      The Semigroup is okay, since 'xor' is indeed
                      associative, and your<br class="">
                      instance basically lifts it to 4-tuples.<br
                        class="">
                      <br class="">
                      The Monoid instance is wrong, though. There is no
                      unit for 'xor'!<br class="">
                      <br class="">
                      Cheers<br class="">
                      Ben<br class="">
                      <br class="">
                      _______________________________________________<br
                        class="">
                      Haskell-Cafe mailing list<br class="">
                      To (un)subscribe, modify options or view archives
                      go to:<br class="">
                      <a
                        href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe"
                        class="" moz-do-not-send="true">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br
                        class="">
                      Only members subscribed via the mailman list are
                      allowed to post.</div>
                  </div>
                </blockquote>
              </div>
              <br class="">
              <div class="">
                <div dir="auto" style="caret-color: rgb(0, 0, 0);
                  letter-spacing: normal; text-align: start;
                  text-indent: 0px; text-transform: none; white-space:
                  normal; word-spacing: 0px; -webkit-text-stroke-width:
                  0px; text-decoration: none; word-wrap: break-word;
                  -webkit-nbsp-mode: space; line-break:
                  after-white-space;" class="">--------------------------------------------------------------------<br
                    class="">
                  Andrew Butterfield     Tel: +353-1-896-2517     Fax:
                  +353-1-677-2204<br class="">
                  Lero@TCD, Head of Software Foundations
                  & Verification Research Group<br class="">
                  School of Computer Science and Statistics,<br class="">
                  Room G.39, O'Reilly Institute, Trinity College,
                  University of Dublin<br class="">
                                           <a
                    href="http://www.scss.tcd.ie/Andrew.Butterfield/"
                    class="" moz-do-not-send="true">http://www.scss.tcd.ie/Andrew.Butterfield/</a><br
                    class="">
--------------------------------------------------------------------</div>
              </div>
              <br class="">
            </div>
            _______________________________________________<br class="">
            Haskell-Cafe mailing list<br class="">
            To (un)subscribe, modify options or view archives go to:<br
              class="">
            <a
              href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe"
              class="" moz-do-not-send="true">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br
              class="">
            Only members subscribed via the mailman list are allowed to
            post.</div>
        </blockquote>
      </div>
      <br class="">
      <div class="">
        <div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0,
          0, 0); letter-spacing: normal; text-align: start; text-indent:
          0px; text-transform: none; white-space: normal; word-spacing:
          0px; -webkit-text-stroke-width: 0px; text-decoration: none;
          word-wrap: break-word; -webkit-nbsp-mode: space; line-break:
          after-white-space;" class="">--------------------------------------------------------------------<br
            class="">
          Andrew Butterfield     Tel: +353-1-896-2517     Fax:
          +353-1-677-2204<br class="">
          Lero@TCD, Head of Software Foundations & Verification
          Research Group<br class="">
          School of Computer Science and Statistics,<br class="">
          Room G.39, O'Reilly Institute, Trinity College, University of
          Dublin<br class="">
                                   <a
            href="http://www.scss.tcd.ie/Andrew.Butterfield/" class=""
            moz-do-not-send="true">http://www.scss.tcd.ie/Andrew.Butterfield/</a><br
            class="">
--------------------------------------------------------------------</div>
      </div>
      <br class="">
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>
Only members subscribed via the mailman list are allowed to post.</pre>
    </blockquote>
  </body>
</html>