In Boolean algebra, the algebraic normal form (ANF), ring sum normal form (RSNF or RNF), Zhegalkin normal form, or Reed–Muller expansion is a way of writing propositional logic formulas in one of three subforms:
1
0
∧
⊕
Formulas written in ANF are also known as Zhegalkin polynomials and Positive Polarity (or Parity) Reed–Muller expressions (PPRM).
ANF is a canonical form, which means that two logically equivalent formulas will convert to the same ANF, easily showing whether two formulas are equivalent for automated theorem proving. Unlike other normal forms, it can be represented as a simple list of lists of variable names—conjunctive and disjunctive normal forms also require recording whether each variable is negated or not. Negation normal form is unsuitable for determining equivalence, since on negation normal forms, equivalence does not imply equality: a ∨ ¬a is not reduced to the same thing as 1, even though they are logically equivalent.
Putting a formula into ANF also makes it easy to identify linear functions (used, for example, in linear-feedback shift registers): a linear function is one that is a sum of single literals. Properties of nonlinear-feedback shift registers can also be deduced from certain properties of the feedback function in ANF.
There are straightforward ways to perform the standard boolean operations on ANF inputs in order to get ANF results.
XOR (logical exclusive disjunction) is performed directly:
⊕
⊕
1 ⊕ 1 ⊕ x ⊕ x ⊕ y
y
NOT (logical negation) is XORing 1:[1]
1 ⊕ 1 ⊕ x ⊕ y
x ⊕ y
AND (logical conjunction) is distributed algebraically[2]
(⊕)
⊕
(1 ⊕ x ⊕ y) ⊕ (x ⊕ x ⊕ xy)
1 ⊕ x ⊕ x ⊕ x ⊕ y ⊕ xy
1 ⊕ x ⊕ y ⊕ xy
OR (logical disjunction) uses either 1 ⊕ (1 ⊕ a)(1 ⊕ b)[3] (easier when both operands have purely true terms) or a ⊕ b ⊕ ab[4] (easier otherwise):
+
1 ⊕ (1 ⊕)(1 ⊕)
1 ⊕ x(x ⊕ y)
1 ⊕ x ⊕ xy
Each variable in a formula is already in pure ANF, so one only needs to perform the formula's boolean operations as shown above to get the entire formula into ANF. For example:
x + (y ⋅ ¬z)
x + (y(1 ⊕ z))
x + (y ⊕ yz)
x ⊕ (y ⊕ yz) ⊕ x(y ⊕ yz)
x ⊕ y ⊕ xy ⊕ yz ⊕ xyz
ANF is sometimes described in an equivalent way:
f(x1,x2,\ldots,xn)= | a0 ⊕ | |
a1x1 ⊕ a2x2 ⊕ … ⊕ anxn ⊕ | ||
a1,2x1x2 ⊕ … ⊕ an-1,nxn-1xn ⊕ | ||
… ⊕ | ||
a1,2,\ldots,nx1x2\ldotsxn |
where
a0,a1,\ldots,a1,2,\ldots,n\in\{0,1\}*
f
There are only four functions with one argument:
f(x)=0
f(x)=1
f(x)=x
f(x)=1 ⊕ x
To represent a function with multiple arguments one can use the following equality:
f(x1,x2,\ldots,xn)=g(x2,\ldots,xn) ⊕ x1h(x2,\ldots,xn)
g(x2,\ldots,xn)=f(0,x2,\ldots,xn)
h(x2,\ldots,xn)=f(0,x2,\ldots,xn) ⊕ f(1,x2,\ldots,xn)
Indeed,
x1=0
x1h=0
f(0,\ldots)=f(0,\ldots)
x1=1
x1h=h
f(1,\ldots)=f(0,\ldots) ⊕ f(0,\ldots) ⊕ f(1,\ldots)
Since both
g
h
f
f(x,y)=x\lory
f(x,y)=f(0,y) ⊕ x(f(0,y) ⊕ f(1,y))
f(0,y)=0\lory=y
f(1,y)=1\lory=1
f(x,y)=y ⊕ x(y ⊕ 1)
f(x,y)=y ⊕ xy ⊕ x=x ⊕ y ⊕ xy
. Ingo . Wegener . Ingo Wegener. The complexity of Boolean functions . . 1987 . 3-519-02107-2 . 6 .