bilbo
April 18th, 2005, 04:53
Hi all,
how can we prove that:
can be replaced by
???
Well, the "bruteforce" demonstration is obvious: we test the whole space for inputs (with SPACE 1 as well as 256 for X,Y,Z: it is enough the case one-bit)
but, is there some more elegant demonstration?
Thanks, bilbo
how can we prove that:
Code:
(X and Y) or (notX and Z)
Code:
(Z xor (X and (Y xor Z)))
Well, the "bruteforce" demonstration is obvious: we test the whole space for inputs (with SPACE 1 as well as 256 for X,Y,Z: it is enough the case one-bit)
Code:
#include <stdio.h>
#define SPACE 1
void
main(void)
{
int X, Y, Z;
for (X=0; X<SPACE; X++) for (Y=0; Y<SPACE; Y++) for (Z=0; Z<SPACE; Z++)
if ((X&Y | (~X&SPACE-1)&Z) != (Z ^ (X & (Y^Z)))) {
printf("ko: X=%d, Y=%d, Z=%d\n", X, Y, Z);
return;
}
printf("ok\n";
}
but, is there some more elegant demonstration?
Thanks, bilbo