# How a boolean function is made for a circuit?

I studied the Boolean algebra and the Boolean function as they can be expressed as sum of minterms or product of maxterms. But what actually the fuction is and where it came from? As we only simply take some of minterms and find there sum resulting in a specific boolean function..for example we take a function $F(x,y,z)=\sum (0,2,4,5,6)$ which is $F(x,y,z)=z'+xy'$

But where it came from? Why we take only 0 2 4 5 6 terms?

Q: "But where it came from?" A: From the problem to be solved. The problem statement could be something like "build 4-bit adder", "build a 2-bit multiplexer" etc. You can look at https://www.cs.umd.edu/class/spring2010/cmsc250-010x/circuits.pdf for example to see how one goes from problem statement first to boolean function and then to circuit. This is the usual workflow.

The reverse, going from circuit to function only happens if want to... ahem... reverse-engineer a circuit, for example you don't know what it does exactly. Actually the latter is useful in circuit verification too.

The output of any digital circuit depends on the input(s). The relation between them can be expressed in many ways:

Boolean function
The relation between the inputs($x_1,x_2,x_3\ldots$) and output ($y$) can be expressed mathematically as a (boolean) function: $$y = f(x_1,x_2,x_3\ldots)$$

for example, $$y=x_1+x_2\cdot x_3$$

There are two canonical way of writing any boolean function:
1. The Sum of Product (SOP) form
2. The Product of Sum (POS) form

Truth table:
This relation can also be expressed as a table giving input combinations in one column and corresponding output in the other and this representation is called a truth table representation.

Minterms and Maxterms:
Since these boolean functions are going to give either $1$ or $0$ as the output they can also be represented as a list of input combinations for which the output becomes $1$, called the minterms or as a list of input combinations for which the output becomes $0$, called the maxterms.

Each minterm corresponds to an input combination for which the output is $1$, the output can be written as the sum (logical OR) of minterms. $$y = \sum(\mathrm{minterms})$$

Each maxterm corresponds to an input combination for which the output is $0$, and the output can be written as the product (logical AND) of maxterms $$y = \Pi(\mathrm{maxterms})$$

Why we take only 0 2 4 5 6 terms?

These are the minterms. The output should be high when any one of these input combination is $1$. So then the function can be written as the OR of these input combinations:

$$F = x'y'z' + x'yz' + xy'z' + xy'z + xyz'$$

Which can to reduce further to obtain a nice expression.

You can also write this function as a product of the maxterms: 1, 3, 7:

$$F = (x'+y'+z)\cdot(x'+y+z)\cdot(x+y+z)$$

reducing this will also give the same expression that was obtained earlier.

• That's all nice thanks @nidhin. I want to ask that for a typical circuit designed for some specific task how we obtain that function? – Sohail Ahmed Oct 18 '15 at 14:28
• @SohailAhmed The trivial way is to calculate/measure the output obtained for all the possible input combinations. And then use a K-map to obtain the simplified expression. – nidhin Oct 18 '15 at 17:16
• Is that calculation/measure is some sort of practical calculation? – Sohail Ahmed Oct 18 '15 at 18:08
• @SohailAhmed Yes, when you have implemented circuit not circuit diagram. If you already have the circuit diagram, then obtaining the function is much easier. – nidhin Oct 18 '15 at 18:32

The function comes from some problem that needs to be solved.

Now we can create our truth table from this information, then reduce it, using karnaugh or Boolean identities. The circuit can now be realized using a minimal of gates.

And a Boolean expression can have any number of inputs.

• Morse code is a rather bad example as it's not really binary code. And what you're describing here sounds more like a sequential circuit rather than a combinatorial one. – Fizz Oct 18 '15 at 13:03
• @Respawned Full, thanks for the feedback, updates my answer. – Tyler Oct 18 '15 at 13:07