X: The under-appreciated Boolean logic state

posted: April 23, 2017

tl;dr: X can help reduce complexity by eliminating states that just don’t matter...

Digital computers and technology are built upon the foundation of Boolean logic, where the digits are usually represented as being in one of two states, either a “1” or a “0”. These two states receive all the mainstream press about Boolean logic; see the T-shirt design below for just one example:

Yet there is a third Boolean logic state that has benefited me tremendously throughout my career by limiting and/or reducing the complexity of digital systems, at both the software and the hardware layers. That Boolean state is “X”, the “don’t care” state. X doesn’t receive nearly the attention that it should, but smart developers know about it and put it to use in their code and logic designs.

X means that something can be either a “1” or a “0”, or perhaps some indeterminate or unknown state. In that sense it might better be classified as a meta-state, but it is helpful to think of it as a state in and of itself. It simplifies the creation of Boolean logic tables: for example the 2-input AND operator table is often written as:

0 AND 0 = 0
0 AND 1 = 0
1 AND 0 = 0
1 AND 1 = 1

By using X it can be represented as:

0 AND X = 0
1 AND X = X

X is most helpful when the final state or output of a system does not depend on all the possible combinations of state for all the inputs. In the example above, when the first input is a “0”, you don’t care what the state of the second input is; the output is “0” regardless. That’s why X is often called the “don’t care” state: sometimes, you don’t care what all the input states are when computing the output.

Good designers consider the X state in their designs and code accordingly. X can often eliminate lines of code, or blocks of circuitry in hardware designs. There are techniques that can be learned and applied for doing so.

Yet fully considering X means considering it up front when the requirements for a design are first determined and the design is first sketched out. When a new feature is to be implemented, it often means that new state information must be introduced into the system. The designer should think carefully about minimizing the places in the design where this new state is introduced; for much of the system, the impact of the new state is likely to be non-existent, meaning that for much of the system the new state can be X. Most designers know that keeping all state globally accessible is dangerous. The best designers figure out ways to isolate state information so that the system can grow and accommodate new features without falling apart due to complexity.

The X state applies to more than just Boolean logic. When making a choice, if it is a fully informed one and X is your state of mind, then the outcomes are in balance and it doesn’t matter which choice you make: just pick one at random and proceed. If you consider X throughout your day-to-day life, you will first ask the question “does it matter?” when presented with a new request; only if it does should you then proceed. There’s a little bit of a Zen aspect to X, if you fully put X to use.