Truth table for two input NAND:

``` A | B | (A*B)'
---------------
0 | 0 |  1
0 | 1 |  1
1 | 0 |  1
1 | 1 |  0
```

As earthquake says above, all boolean expressions can be implemented with the nand function alone. The following should help illustrate this concept. The nand function is indicated by the | character, often called the Sheffer stroke.

Consider A|A
```  A    A|A
----------
T     F
F     T
```
Thus, A|A is equivalent to ¬A.

Now to find the ∧ (and) function
```  A     B     A|B    (A|B)|(A|B)
--------------------------------
F     F      T          F
F     T      T          F
T     F      T          F
T     T      F          T
```
So we have (A|B)|(A|B) equivalent to A ∧ B (A and B)

From this point, we can achieve the disjunction (or) function as A∨B is equivalent to ¬(¬A∧¬B).
Therefore, A∨B can be represented in nand terms as
((A|A)|(B|B))|((A|A)|(B|B))|((A|A)|(B|B))|((A|A)|(B|B))

Simple!

Furthermore,
A→B (if A then B) is equivalent to
((A|(B|B))|(A|(B|B)))|((A|(B|B))|(A|(B|B)))

If you don't have a headache yet,
A↔B (A if and only if B) is equivalent to
(((A|B)|(A|B))|(((A|B)|(A|B))|((A|B)|(A|B)))))|(((A|B)|(A|B))|(((A|B)|(A|B))|((A|B)|(A|B))))) | ((((A|B)|(A|B))|(((A|B)|(A|B))|((A|B)|(A|B))))|(((A|B)|(A|B))|(((A|B)|(A|B))|((A|B)|(A|B)))))

Sorry if i made a mistake in that last one, but i applaud you for picking it out.

Log in or register to write something here or to contact authors.