Can any boolean function be expressed as a tree with each node having at least one variable input?

179 Views Asked by At

Is that possible to express arbitrary boolean function, with only one boolean output value as a tree of logical gates, with a condition that every node (gate) of this tree has at least one input variable as input?

The gates considered in this question can be only AND, OR, NOT (optionally XOR in addition).

EDIT: The same input variable can be used as many times as needed. We can use the negation gate in any level of such a tree.

This is an example of such tree

1

There are 1 best solutions below

1
On

No. This is not possible for arbitrary expressions.

It would imply that the output depends on the input which is connected to the final gate.

A function which allows to factor out a single input variable in an AND output is called positive unate. Similarly, a negative unate function would allow to be decomposed into an input and a remainder function using an OR output gate. Not all functions are unate, let alone can be split into unate sub-functions.

Try to compose a 2-input XOR from AND, OR, NOT in this way. The output of XOR depends on two inputs rather than on just one.