-3

Starting from a truth table of one subtractor with three inputs and two outputs I've obtained the following boolean formula for the second output z2 (the "loan" of the bit to the left) :

z2 = x0'x1'x2 + x0'x1x2' + x0'x1x2 + x0x1x2

(where x0' means NOT x0).

Simplifying it : z2 = x2(x0 ⊕ x1)' + x1(x0 ⊕ x2)' + x1x2

which means : z2 = x2(x0 XNOR x1) + x1(x0 XNOR x2) + x1x2

Can I simplify more? I've tried with z2 = (x0 XNOR x1) + (x0 XNOR x2) + x1x2 but it doesn't do the trick.

  • Please clarify what you mean by "simplify." Do you want the fewest possible operations or variable look-ups (treating two occurrences of the same variable as two) or something else? Which operations are allowed? – Rory Daulton Jun 12 '17 at 13:35
  • @RoryDaulton Yes I'm just wondering if there's some properties of the boolean algebra which I'm missing to reduce the expression, reducing its operations. Basically, a reduced version in terms of operations which even calculate the same truth table : [link](https://i.gyazo.com/782a67a0e5b7971ca8ef19dbb06349c3.png) , hope I'm clear – Alessandro Zavattaro Jun 12 '17 at 14:25
  • You answered my first question (you want minimal number of operations) but not my second. Which operations are allowed? For unary, complement (NOT)? For binary, AND, OR, NAND, NOR, XOR, implication either direction, others? Any ternary operators? – Rory Daulton Jun 12 '17 at 14:35
  • @RoryDaulton I've no restrictions in terms of operations, any unary and binary operations are allowed to me, the main goal is just to have a "smarter" version. – Alessandro Zavattaro Jun 12 '17 at 14:53
  • I'm voting to close this question as off-topic because it is about boolean algebra and [math.se] instead of programming or software development. – Pang Jun 15 '17 at 07:02

1 Answers1

1

Your original expression has 12 variable references and 16 operators. Your simplification has 8 variable references and 7 operators. Here is an expression with 6 variable references and 6 operators:

z2 = x0x1x2 + x0'(x1+x2)

I do not know if that is minimal in any sense.


You ask how I found that expression. I did not start from your simplification, I started from the truth table that you referenced in a comment. I reproduce it here:

Truth table for original expression

As I looked the table looking for patterns, I saw that it looks like a chiasm or skew-symmetric matrix: if I flip the last column upside-down then take the complements of all items I end up with the original column. (I don't know the proper term for this kind of symmetry; those are the terms that came to my mind.) I tried to encapsulate that symmetry into a logical expression but failed.

That led me to look at the upper and lower halves of that last column. The upper half is mostly ones and the lower half is mostly zeros. Then it struck me that the upper half looks like the truth table for the binary OR operation and the lower half looks like the binary AND operation. The upper half is for x0' and the lower half is for x0, of course. Putting those facts together gave me my expression.

I confirmed that expression by seeing if I could manipulate the original expression into mine. I could, by doing

z2 = x0'x1'x2 + x0'x1x2' + x0'x1x2 + x0x1x2
   = x0'(x1'x2 + x1x2' + x1x2) + x0x1x2
   = x0'(x1 + x2) + x0x1x2
   = x0x1x2 + x0'(x1 + x2)

The transition from the second to third line is, of course, equivalent to recognizing the truth table for binary OR, so this is not much different from my actual discovery method.

That latter method may be more transferable to other problems: factor out a common factor from multiple terms. My actual method was more fun but less transferable. My favorite definition of mathematics is "the study of patterns" which explains why the method was fun.

Rory Daulton
  • 21,934
  • 6
  • 42
  • 50