Demystifying SOP and POS

Background

One of the most elementary fact taught in a standard digital electronics course is the fact that any boolean truth table can be written as a formula in one of the SOP (sum of products) or POS (product of sums).
This might seem slightly magical in the first encounter, especially if one wants to write down the formula using step by step instructions in these books.

For instance, consider the following boolean truth table:

xyzf
0001
0010
0100
0111
1000
1010
1101
1111
Then we can write

or

However, there is a very easy and intuitive way of understanding this.

Analogy

Consider creating a pixelated pattern using wood blocks. There are two obvious ways to do this:

  • Put the wooden blocks besides each other to form the pattern.
  • Carve the pattern out from a solid.
    First approach is the same as sum of products, and the second method is the product of sums.

But how does it work? The and formula and or formula as the following interesting properties, and the best way to put this is by an example. Let boolean variables, and consider the following formula

Then

  • is true if and only if .
  • g is false if and only if .

In other words, is always false except at one point, and is always true except at one point. In other words, is like the wooden blocks that we can place besides each other, and is like the carving masks.

So back to the example above, in order to produce the pattern , we can treat each of the rows that are , as the wooden pieces required to make the pattern, and each row with value as the parts that needs to be carved out.

So to produce the bit pattern in we can start with all zero rows, and add the rows with value one by one. Or start with all rows and carve out the rows with value .

Starting with all 0 rows and putting 1’s

For each row that its value is , we come up with a formula that is only at that row. We use the property of and formula that is zero everywhere except at one point. Then we add those building blocks:

Starting with all 1’s and carving 0’s

We use the property of the or formula that is 1 everywhere except at one row. So for each row with value zero that we want to carve out, we write an or formula that is zero only and only at that row, and multiply these masks. So

Note that the indicator functions for the POS can be derived via the De Morgan’s law. For instance suppose we want to find an expression that is zero in the second row, and is one everywhere else. To make that we can easily bake a function that is 1 at the second row and is zero everywhere else, which is

Now the original function of interest will be logical not of the function above:

which is the first expression in the written as SOP.

under development:

Similar Ideas in Probability Theory

In the probability theory it is often the case to write a simple random variable as sum of indicator functions. Let be a random variable

Then we can write this random variables as a sum of indicator random variables

where for any the indicator function

is defined as

We can also write the random variable as a product of indicator functions, that is