[H-GEN] Mysql & bitwise xor
W. Sierke
ws at senet.com.au
Tue Nov 18 00:25:33 EST 2003
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
"Raymond Smith" wrote:
> To the original poster: if you have 'and', 'or', and 'not' you
> can usually do everything you need. A quick search on Google for
> 'intro boolean logic' should bring up useful starting resources.
> When starting out, Truth Tables are your friend.
In fact only 'not' and one of either 'and' or 'or' are required: both 'and'
and 'or' can be constructed from the other when suitably combined with
'not'.
Consider the lily:
W = A or B
X = A and B
Y = ~A or ~B
Z = ~A and ~B
| A B | W X | |~A ~B | Y Z |
|------+------| |------+------|
| 0 0 | 0 0 | | 1 1 | 1 1 |
| 0 1 | 1 0 | | 1 0 | 1 0 |
| 1 0 | 1 0 | | 0 1 | 1 0 |
| 1 1 | 1 1 | | 0 0 | 0 0 |
Looking at the first (W, X) table, notice the symmetry for W and X, that is
X looks like W, but upside down (implying negation of the source operands)
and inverted (implying negation of the result - c.f. (Y, Z) ). Indeed by
comparing the tables for the 'or' (W, Y) and 'and' (X, Z) operations, we see
how either set in isolation is capable of producing equivalent results.
Again, a beautiful symmetry is evident (well, I guess it's like art, you
either get it or you don't). This also demonstrates that there are two ways
to achieve the same result - compare X and ~Y for an example (remembering
that X is an 'and' operation and Y is 'or').
| A B ~A ~B | W ~W Y ~Y | X ~X Z ~Z |
|------------+------------+------------|
| 0 0 1 1 | 0 1 1 0 | 0 1 1 0 |
| 0 1 1 0 | 1 0 1 0 | 0 1 0 1 |
| 1 0 0 1 | 1 0 1 0 | 0 1 0 1 |
| 1 1 0 0 | 1 0 0 1 | 1 0 0 1 |
Wayne
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'. See http://www.humbug.org.au/
More information about the General
mailing list