Check for associativity from truth table

127 Views Asked by At

Is there a way of checking if a binary boolean operator is associative just by looking at its truth table, similar to how you can check to see if the middle two rows are different to check if it is commutative?

This question seems to answer my problem: Is there an easy way to see associativity or non-associativity from an operation's table? but it concludes that checking all the triples of inputs is the best method (or other methods with the same worst case). I was wondering if the fact that it is a boolean function might mean that there are other methods that are applicable.

1

There are 1 best solutions below

4
On BEST ANSWER

Here's what I do when I need to check whether one of the 16 binary Boolean operations is associative. I can't promise that this is the most "efficient" trick, but it's easy to do by hand and is definitely faster than the naive method of checking all triples $x,y,z$ for $(x \bullet y) \bullet z = x \bullet (y \bullet z)$.


First check whether the operation $\bullet$ is idempotent, i.e. whether $x \bullet x = x$ always. You can do this by checking that the "top" row is all true, and the "bottom" row is all false. If a binary Boolean operation is idempotent, then it is associative, so you're done.

If the operation is not idempotent, then it is associative precisely if $T \bullet T = F \bullet F$ (the rightmost values in the top and bottom rows are the same) and $T \bullet F = F \bullet T$ (the rightmost values in the middle two rows are the same, your commutativity test).