Boolean functions
There are 16 possible functions with 2 bits of input and 1 bit of output.
Of these, only 6 are gates:
AND, OR, XOR, NAND, NOR, XNOR
All possible Boolean functions can be written using at most 3 gates:
Set {AND, OR, NOT} is computationally complete.
Also {NAND}, {NOR}, and some others.
Example: use NAND to implement OR
x | y = ~~(x | y)
= ~(~x & ~y)
= ~x NAND ~y
Looks like we also need NOT