Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I was reading the TECS book (The Elements of Computing Systems), in the book, we start to build the other logical gates with a single primitive logical gate, the $NAND$ gate. With it, we could easily make the $NOT$ gate, then the $AND$ gate and then the $OR$ gate.

With the $NOT$, $AND$ and $OR$ gates, we could express any truth table through cannonical representation.

The book has the table given below, I was wondering if we could do the same by taking any other boolean function as primitive, I'm quite sure that it's not possible to do with both constant $0$ nor constant $1$. What about the others?

enter image description here

share|improve this question

2 Answers 2

up vote 5 down vote accepted

Your question concerned arbitrary ($n$-ary) boolean functions, yet you seemed to have restricted your search to $0$-ary, $1$-ary and $2$-ary functions. A collection $C$ of boolean functions that can generate all the others by composition is called functionally complete, and when $C$ is a singleton $\{f\}$ we call such $f$ a Sheffer function. Now, a full characterization of functionally complete collections of boolean functions was given in "The Two-Valued Iterative Systems of Mathematical Logic" (Post 1941). As this book is hardly legible, though, I would heartily recommend the explanation of the main theorem in "Post's functional completeness theorem" instead. In "Composition and clones of Boolean functions", by Pöschel and Rosenberg (first chapter of Boolean Models and Methods in Mathematics, Computer Science, and Engineering), the exact number of $n$-ary Sheffer functions is determined: $2^{2^n - 2} - 2^{2^{n - 1} - 1}$. So, if you go beyond the $2$ binary functions NAND and NOR you should find $56$ functionally complete ternary functions, $16\,256$ functionally complete quaternary functions, and so on.

share|improve this answer

As you noted, it's impossible for the constants to generate all of the boolean functions; the gates which are functions of a single input also can't do it, for equally-obvious reasons (it's impossible to generate the boolean function $f(x,y)=y$ from either $f_1(x,y)=x$ or $f_2(x,y)=\bar{x}$).

OR and AND can't do it either, for a slightly more complicated reason — it's impossible to generate nothing from something! (More specifically, neither one of them is able to represent negation, and in particular neither one can represent a constant function — this is because any function composed of only ORs and ANDs will always return 0 when its inputs are all-0s and will return 1 when its inputs are all-1s.

XOR is a bit more complicated: it's obviously possible to generate 0 and 1 via XORs, and thus NOT; but the 'parity preserving' nature of XOR makes it impossible to represent $x\wedge y$ with XOR alone.

In fact, it can be shown that NOR and NAND are the only two-input boolean functions which suffice in and of themselves; for more details, have a look at the Wikipedia page on functional completeness.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.