Jump to content

Algebraic normal form: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Line 24: Line 24:
* = 1 ⊕ x ⊕ y ⊕ xy
* = 1 ⊕ x ⊕ y ⊕ xy


OR (logical disjunction) uses De Morgan's laws with AND (which is NOT((NOT a) AND (NOT b))):
OR (logical disjunction) uses De Morgan's laws (that is, x + y = (x ⊕ 1)(y ⊕ 1) ⊕ 1)):
* (1 ⊕ x) + (1 ⊕ x ⊕ y)
* (1 ⊕ x) + (1 ⊕ x ⊕ y)
* (1 ⊕ x ⊕ 1)(1 ⊕ x ⊕ y ⊕ 1) ⊕ 1
* (1 ⊕ x ⊕ 1)(1 ⊕ x ⊕ y ⊕ 1) ⊕ 1

Revision as of 17:11, 3 July 2013

In Boolean logic, the algebraic normal form (ANF) is a method of standardizing and normalizing logical formulas. As a normal form, it can be used in automated theorem proving (ATP), but is more commonly used in the design of cryptographic random number generators, specifically linear feedback shift registers (LFSRs). A logical formula is considered to be in ANF if and only if it is a single algebraic sum (XOR) of a constant and one or more conjunctions of the function arguments. ANF is also known as "Zhegalkin polynomials" (Russian: полиномы Жегалкина) and as "Positive Polarity (or Parity) Reed-Muller" expression.

Putting a formula into ANF makes it easy to identify linear functions, as is needed for linear feedback in LFSRs: a linear function is one that is a sum of literals. Properties of nonlinear feedback shift registers can also be deduced from certain properties of the feedback function in ANF.

Performing standard boolean operations

There are straightforward ways to perform the standard boolean operations on ANF inputs in order to get ANF results.

XOR is performed directly:

  • (1 ⊕ x) ⊕ (1 ⊕ x ⊕ y)
  • 1 ⊕ 1 ⊕ x ⊕ x ⊕ y
  • y

NOT (logical complement) is XORing 1:

  • ¬(1 ⊕ x ⊕ y)
  • = (1 ⊕ x ⊕ y) ⊕ 1
  • = 1 ⊕ 1 ⊕ x ⊕ y
  • = x ⊕ y

AND (logical conjunction) is distributed algebraically:

  • (1 ⊕ x)(1 ⊕ x ⊕ y)
  • = 1(1 ⊕ x ⊕ y) ⊕ x(1 ⊕ x ⊕ y)
  • = (1 ⊕ x ⊕ y) ⊕ (x ⊕ xx ⊕ xy)
  • = 1 ⊕ x ⊕ x ⊕ x ⊕ y ⊕ xy
  • = 1 ⊕ x ⊕ y ⊕ xy

OR (logical disjunction) uses De Morgan's laws (that is, x + y = (x ⊕ 1)(y ⊕ 1) ⊕ 1)):

  • (1 ⊕ x) + (1 ⊕ x ⊕ y)
  • (1 ⊕ x ⊕ 1)(1 ⊕ x ⊕ y ⊕ 1) ⊕ 1
  • x(x ⊕ y) ⊕ 1
  • 1 ⊕ x ⊕ xy

Obtaining algebraic normal form

The above ways of performing operations can be used to obtain ANF form from an arbitrary boolean expression. For example:

  • x + (y · ¬z)
  • = x + (y(1 ⊕ z))
  • = x + (y ⊕ yz)
  • = x ⊕ (y ⊕ yz) ⊕ (xy ⊕ xyz)
  • = x ⊕ y ⊕ xy ⊕ yz ⊕ xyz

ANF can represent all boolean functions

The general ANF can be written as:

where fully describes .

For each function there is a unique ANF. There are only four functions with one argument: , , , .

To represent a function with multiple arguments one can use the following equality:

, where

Indeed,

  • if then and so
  • if then and so

Since both and have fewer arguments than it follows that using this process recursively we will finish with functions with one variable. For example, let us construct ANF of (logical or):

  • since and
  • it follows that
  • by opening the parentheses we get the final ANF:

See also