Sbgodin

Ce site ne comporte aucune information d’intérêt, sauf pour celui qui la cherche — Ĉi-retejo ne enhavas informon interesan, krom por iu kiu ĝin serĉas — This website doesn’t have any information of interest, except for who looks for it

XOR has good properties, is it the only one?

Rédigé par Sbgodin 2 commentaires

XOR is:

  • associative: (A+B)+C == A+(B+C)
  • commutative: A+B == B+A
  • an involution: (A+B)+B == A

Is it the only function with such qualities?

All the binary functions takes two arguments as entries and return one result. As the arguments can be 0 or 1 (False or True), there are 4 different results. The XOR function can be resumed as "0110", that is:

          0 1
        -----
       0| 0 1
       1| 1 0

All the binary functions are then made of strings for "0000", "0001", "0010", "0011", etc. until "1111". There are 16 such functions. I made a small Python program to review all of them.

In addition to the XOR function, the XNOR also complies. It could also be used in the encryption algorithms! Here they are:

   XOR    0 1             NXOR    0 1
        -----                   -----
       0| 0 1                  0| 1 0
       1| 1 0                  1| 0 1

XOR is "0110" whereas NXOR is "1001".


The program is available at Framagit/Sbgodin.


I tested the three good qualities of the XOR function and all the binary functions complying with any of them is listed below. First, each property separately, then two by two and finally altogether.

So, here's the program output:

A are associatives
C are commutatives
I are involutions
A   1010 1001 0110 0101
C   0000 1001 1110 0110 1111 0111 0001 1000
I   0000 0011 1001 0101 0110 1111 0001 0111
AC  0110 1001
AI  0000 1001 0110 1111 0001 0111
CI  0000 1001 0110 1111 0001 0111
ACI 1001 0110

https://sbgodin.fr/

2 commentaires

#1  - Machin a dit :

https://en.wikipedia.org/wiki/Truth_table

Répondre
#2  - Sbgodin a dit :

Good link, if you have any more comment, please proceed ^^

Répondre

Fil RSS des commentaires de cet article

Écrire un commentaire

Quelle est la deuxième lettre du mot bnltb ?