Considering that there are an infinite number of Boolean functions, it's amazing that they can all be built from only 3 Boolean functions.
The set of functions {AND2, OR2, NOT } are said to be functionally complete.
Here's a definition:
Definition A set of Boolean functions is functionally complete, if all other Boolean functions can be constructed from this set and a set of input variables are provided.
We imagine that there is a set of input Boolean variables to these functions, and that these functions can be applied as many times as needed.
If you were a mathematician, you're next thought should be "are there functionally complete sets with fewer Boolean functions?" and the natural follow-up "what's the minimum number of Boolean functions that are functionally complete?". The answer is yes and 1.
From the previous set of notes, you should know that any
truth table can be written as a sum of products. This has the
following general form.
Z = P1 + P2 + ... + Pk
where Pi consists of literals connected by
AND2. In particular, Pi =
l1l2..lm where li
is a literal.
The expression Z, above, can be written equivalent as:
Z = NOT( NOT( P1 + P2 + ... + Pk ) )
This is an application of double-negation.
Then, apply DeMorgan's Law on the inner negation.
Z = NOT( \P1 * \P2 * ... * \Pk ) )
Notice that the ORs changed to ANDs when applying one level
of DeMorgan's Law, and that each of the product terms now has
a negation (indicated by the prime). We don't apply DeMorgan's
any further. In particular, we leave Pi' alone
because we don't want to convert the ANDs in the Pi
to ORs.
As you can see, by applying double negation and DeMorgan's Law once, there are no more OR2.
You should try applying these laws to show that OR2 and NOT are also functionally complete.
Similarly, if you set all the input variables' values to 0, the output of the function is always 0, no matter how you create the function.
However, you can clearly define a truth table whose output is 1 when all the input variable's values are all 0's, and whose output is 0 when all the input variable's values are all 1's. You can't implement such a circuit using only { AND2, OR2 }.
This is the intuition behind why { AND2, OR2 } is not functionally complete. You could prove this by induction, too.
Does that mean it's not possible? Of course, we have many other Boolean functions we haven't tried. At the very least, we know that if there is a single function, it must have at least two inputs, otherwise, we couldn't construct Boolean functions with two or more inputs.
It turns out that there are two functionally complete sets that only have one function in it: { NAND2 } and { NOR2 }.
It's easy to argue that both are functionally complete. Let's show how to do it with NAND2. The argument is similar for NOR2.
To show that NAND2 is functionally complete, all we have to do is show how to use NAND2 to implement functions in a set we've already seen is functionally complete.
In particular, we'll implement { AND2, NOT } using only NAND2.
You can show NOR2 is functionally complete by implementing OR2 and NOT.