# How to enter the boolean formula

The formula is entered in reverse Polish notation (RPN), because no parentheses () are needed in RPN.

In reverse Polish notation, the operators follow their operands; for instance, to combine A and B by the boolean OR operator, one would enter A B OR rather than A OR B. If there are multiple operations, operators are given immediately after their last operand; so the expression written A AND (B OR C) in conventional notation would be entered A B C OR AND in reverse Polish notation. Since (B OR C) AND A is equivalent, one could also enter B C OR A AND.

In functional safety, an 'M-out-of-N' operation is needed frequently (the so-called COMBINATION gate). This is no boolean operator, but a combination of boolean operations in fact, with unknown number of operands. In the failure functions dialog, a COMBINATION gate is entered by pressing COMBINATION after the second operand and each additional operand. When you press COMBINATION after the second operand, you'll be asked to enter the minimum number of critical failures M for this combination.

The RPN is implemented by a stack. The operator will always be applied to the top one or two operands on the stack. The stack is shown in the stack field in the dialog (growing downwards, i.e. the "top" is the lowest line).

# Examples

Note: The '!' indicates the NOT operation, '*' the AND operation, '+' the OR operation.

Note: The NOT operator has highest priority, followed by the AND operator, and finally the OR operator. I.e. ((!A) * B * C) + D is equivalent to !A * B * C + D.

Formula | Input
--- | ---
(i1 + i2 + i3) * i4 | i1 i2 OR i3 OR i4 AND
i1 * i2 * i3 + i4 | i1 i2 AND i3 AND i4 OR
i1 * i2 * (i3 + i4) | i1 i2 AND i3 i4 OR AND (or i1 i2 i3 i4 OR AND AND)
(i1 + i2) * (i3 + i4) | i1 i2 OR i3 i4 OR AND
(i1 + i2 + i3) * i4 + i2 * (i1 + !i3 * !(i1 + i4)) | i1 i2 OR i3 OR i4 AND i2 i1 i3 NOT i1 i4 OR NOT AND OR AND OR (or i1 i2 OR i3 OR i4 AND i1 i4 OR NOT i3 NOT AND i1 OR i2 AND OR)
i1 * 2-out-of(i2,i3,i4,i5) | i1 i2 i3 COMBINATION (2) i4 COMBINATION i5 COMBINATION AND
i1 * 2oo(i2 + i3, i4 + i5, i6 + i7) | i1 i2 i3 OR i4 i5 OR COMBINATION (2) i6 i7 OR COMBINATION AND