3

I have studied many literature on boolean functions. The nonlinearity of a boolean function is defined as min of hamming distance of the function from all the linear functions in the set. There is also formulas for calculating nonlinerity of boolean function in terms of no of inputs (n). Now i have following two doubts

  1. Is the nonlinearity of all boolean functions in the same boolean space(say V5) is same or different for different functions ? IF different then how to calculate nonlinearity of each one seperatly ?

  2. How to calculate minimum nonlinearity of a given boolean function in a given boolean space say(V5).

DeoChandra
  • 49
  • 5

2 Answers2

4

You can give a boolean function by it's truth table. For example if $f(x, y, z) = x + z$ you have the following truth table:

  x   y   z   f(x, y, z) = x + z
 ----------------------
  0   0   0     0
  0   0   1     1
  0   1   0     0
  0   1   1     1
  1   0   0     1
  1   0   1     0
  1   1   0     1
  1   1   1     0

just enumerating the last columns gives you $(0, 1, 0, 1, 1, 0, 1, 0)$. This $f$ is by its definition clearly a linear function. If you want to enumerate all linear functions you can look at the Hadamard matrix and Hadamard transform.

To calculate the linearity of a boolean function $g$ as explained in this question you take the minimum Hamming distance between the output vector of $g$ and all linear functions.

So if your function would for example be $g = (1, 0, 0, 0, 1, 1, 0, 1)$ the Hamming distance to $f$ would be.

g: 1 0 0 0 1 1 0 1
f: 0 1 0 1 1 0 1 0
------------------
   1 1 0 1 0 1 1 1 => HD 6 => non-linearity at most 6

In fact if you where to try all linear functions you would find $h = (0, 0, 0, 0, 1, 1, 1, 1)$ with

g: 1 0 0 0 1 1 0 1
h: 0 0 0 0 1 1 1 1
------------------
   1 0 0 0 0 0 1 0 => HD 2

and this is the lowest value so the non-linearity of $g$ is 2.

I hope this answers your second question.

Now we can answer your first question simply by finding examples. Here are two 4-bit functions with different non-linearity:

  1. [1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0]
    Non-linearity here is 2. It cannot be more than 2 because the middle two bits are swapped from
    [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]
    which is clearly linear (depends only on highest value bit). And it cannot be less than 2 because the function is non-linear and balanced.
  2. [1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0] has non-linearity 4.

This, I hope answers your first questions negatively. Not all functions have the same non-linearity.

Biv
  • 10,088
  • 2
  • 42
  • 68
Elias
  • 4,933
  • 1
  • 16
  • 32
1

Let $V_n$ be the vector space of dimension $n$ over the binary field $F_2$ and let $f:V_n\rightarrow F_2.$

The Walsh Hadamard transform coefficient $\hat{f}(a)$ is defined as $$\hat{f}(a)=\sum_{x \in V_n} (-1)^{f(x)+a\cdot x}=\sum_{x \in V_n} (-1)^{f(x)}(-1)^{a\cdot x}=2^n-2 d_H(f,L_a)$$ where we define the linear function $L_a(x)=a\cdot x,$ and note that $d_H(f,L_a)$ denotes the Hamming distance between the truth tables of $f$ and $L_a$. To clarify when $f(x)$ agrees with $L_a(x)$ on a specific $x$ the product in the sum is $+1,$ otherwise it is $-1.$

Clearly $f$ is linear, if and only if $\hat{f}(a)=\pm 2^n$ for some $a \in V_n.$

As the other answer to this question alludes to, for an arbitrary function, there is no easy/direct way of obtaining nonlinearity from the truth table, short of evaluating the full algebraic normal form $$f(x_1,\ldots,x_n)=a_0+a_1 x_1+\cdots+a_n x_n+ a_{12} x_1 x_2 +\cdots+a_{12\cdots n} x_1 x_2 \cdots x_n$$ for which an algorithm similar in complexity to the Walsh Hadamard transform exists, given the truth table of $f$ as the input.

However, there is an efficient randomized way of verifying that the function is nonlinear (BLR testing) just pick $x,x'\in V_n$ randomly and check if $f(x)+f(x')=f(x+x')$ from the truth table (assuming fast access to any position you like of the truth table).

kodlu
  • 25,146
  • 2
  • 30
  • 63