  
  [1X2 [33X[0;0YBoolean Functions[133X[101X
  
  
  [1X2.1 [33X[0;0YBasic Operations[133X[101X
  
  [33X[0;0YLet [22Xf: Z_2^n -> Z_2[122X be a Boolean function. The vector[133X
  
  
  [24X[33X[0;6YF=(\;f(0),\; f(1),\; \ldots,\; f(2^n-1)\;)^T,[133X
  
  [124X
  
  [33X[0;0Ywhere  [22Xf(i)[122X  for  each [22Xi ∈ {0,1,...,2^n-1}[122X is the value of [22Xf(x_1,...,x_n)[122X of
  the i-th row in the truth table, is called the [3Xtruth vector[103X.[133X
  
  [33X[0;0YAs  a  generalization  of  Boolean logic we can consider the [22Xk[122X-valued logic,
  thus  [22Xf:  Z_k^n  ->  Z_k[122X.  Other  way  to  generalize the concept of Boolean
  functions  is  the  introduction  of  discrete  logic  functions, defined in
  Chapter [14X5[114X.[133X
  
  [1X2.1-1 LogicFunction[101X
  
  [33X[1;0Y[29X[2XLogicFunction[102X( [3XNumVars[103X, [3XDimension[103X, [3XOutput[103X ) [32X function[133X
  
  [33X[0;0YFor  the  positive  integer  [10XNumVars[110X  -  the number of variables, a positive
  integer  [10XDimension[110X  -  the  number  of  possible  logical  values and a list
  non-negative   integers   [10XOutput[110X   -   the   truth   vector   of  the  given
  [10XDimension[110X-valued   logic   function   of  [10XNumVars[110X  variables,  the  function
  [10XLogicFunction[110X  returns  an  object,  representing  the  corresponding  logic
  function.[133X
  
  [33X[0;0YNote  that  [10XDimension[110X can be also a list of [10XNumVars[110X positive integer numbers
  if we deal with discrete logic functions.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(2,2,[0,0,1,1]);
[127X[104X
    [4X[28X< Boolean function of 2 variables >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(f);
[127X[104X
    [4X[28XBoolean function of 2 variables.
[128X[104X
    [4X[28X[ 0, 0 ] || 0
[128X[104X
    [4X[28X[ 0, 1 ] || 0
[128X[104X
    [4X[28X[ 1, 0 ] || 1
[128X[104X
    [4X[28X[ 1, 1 ] || 1
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(2,3,[0,0,1,1,2,1,2,0,1]);
[127X[104X
    [4X[28X< 3-valued logic function of 2 variables >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(f);
[127X[104X
    [4X[28X3-valued logic function of 2 variables.
[128X[104X
    [4X[28X[ 0, 0 ] || 0
[128X[104X
    [4X[28X[ 0, 1 ] || 0
[128X[104X
    [4X[28X[ 0, 2 ] || 1
[128X[104X
    [4X[28X[ 1, 0 ] || 1
[128X[104X
    [4X[28X[ 1, 1 ] || 2
[128X[104X
    [4X[28X[ 1, 2 ] || 1
[128X[104X
    [4X[28X[ 2, 0 ] || 2
[128X[104X
    [4X[28X[ 2, 1 ] || 0
[128X[104X
    [4X[28X[ 2, 2 ] || 1
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X2.1-2 IsLogicFunction[101X
  
  [33X[1;0Y[29X[2XIsLogicFunction[102X( [3XObj[103X ) [32X function[133X
  
  [33X[0;0YFor  the  object  [10XObj[110X  the function [10XIsLogicFunction[110X returns [10Xtrue[110X if [10XObj[110X is a
  logic function (see [2XLogicFunction[102X ([14X2.1-1[114X)), and [10Xfalse[110X otherwise.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(2,2,[0,1,1,1]);;
[127X[104X
    [4X[25Xgap>[125X [27XIsLogicFunction(f);
[127X[104X
    [4X[28Xtrue
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X2.1-3 PolynomialToBooleanFunction[101X
  
  [33X[1;0Y[29X[2XPolynomialToBooleanFunction[102X( [3XPol[103X, [3XNumVars[103X ) [32X function[133X
  
  [33X[0;0YFor  the  polynomial  [10XPol[110X  over [22XGF(2)[122X and the number of variables [10XNumVar[110X the
  function  [10XPolynomialToBooleanFunction[110X returns a Boolean logic function which
  is realized by [10XPol[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xx:=Indeterminate(GF(2),"x");;
[127X[104X
    [4X[25Xgap>[125X [27Xy:=Indeterminate(GF(2),"y");;
[127X[104X
    [4X[25Xgap>[125X [27Xpol:=x+y;;
[127X[104X
    [4X[25Xgap>[125X [27Xf:=PolynomialToBooleanFunction(pol,2);
[127X[104X
    [4X[28X< Boolean function of 2 variables >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(f);
[127X[104X
    [4X[28XBoolean function of 2 variables.
[128X[104X
    [4X[28X[ 0, 0 ] || 0
[128X[104X
    [4X[28X[ 0, 1 ] || 1
[128X[104X
    [4X[28X[ 1, 0 ] || 1
[128X[104X
    [4X[28X[ 1, 1 ] || 0
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X2.1-4 IsUnateInVariable[101X
  
  [33X[1;0Y[29X[2XIsUnateInVariable[102X( [3XFunc[103X, [3XVar[103X ) [32X function[133X
  
  [33X[0;0YA  Boolean  function  [22Xf(x_1,...  ,x_n)[122X  is  [3Xpositive unate[103X in [22Xx_i[122X if for all
  possible values of [22Xx_j[122X with [22Xj≠ i[122X we have[133X
  
  
  [24X[33X[0;6Yf(x_{1},\ldots    ,x_{i-1},1,x_{i+1},\ldots    ,x_{n})\geq    f(x_{1},\ldots
  ,x_{i-1},0,x_{i+1},\ldots ,x_{n}).[133X
  
  [124X
  
  [33X[0;0YA Boolean function [22Xf(x_1,... ,x_n)[122X is [3Xnegative unate[103X in [22Xx_i[122X if[133X
  
  
  [24X[33X[0;6Yf(x_{1},\ldots    ,x_{i-1},0,x_{i+1},\ldots    ,x_{n})\geq    f(x_{1},\ldots
  ,x_{i-1},1,x_{i+1},\ldots ,x_{n}).[133X
  
  [124X
  
  [33X[0;0YFor the Boolean function [10XFunc[110X and the positive integer [10XVar[110X (which represents
  the number of the variable) the function [10XIsUnateBooleanFunction[110X returns [10Xtrue[110X
  if  [10XFunc[110X  is  unate (either positive or negative) in this variable and [10Xfalse[110X
  otherwise.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(3,2,[0,0,0,0,0,1,1,0]);
[127X[104X
    [4X[28X< Boolean function of 3 variables >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(f);
[127X[104X
    [4X[28XBoolean function of 3 variables.
[128X[104X
    [4X[28X[ 0, 0, 0 ] || 0
[128X[104X
    [4X[28X[ 0, 0, 1 ] || 0
[128X[104X
    [4X[28X[ 0, 1, 0 ] || 0
[128X[104X
    [4X[28X[ 0, 1, 1 ] || 0
[128X[104X
    [4X[28X[ 1, 0, 0 ] || 0
[128X[104X
    [4X[28X[ 1, 0, 1 ] || 1
[128X[104X
    [4X[28X[ 1, 1, 0 ] || 1
[128X[104X
    [4X[28X[ 1, 1, 1 ] || 0
[128X[104X
    [4X[25Xgap>[125X [27XIsUnateInVariable(f,1);
[127X[104X
    [4X[28Xtrue
[128X[104X
    [4X[25Xgap>[125X [27XIsUnateInVariable(f,2);
[127X[104X
    [4X[28Xfalse
[128X[104X
    [4X[25Xgap>[125X [27XIsUnateInVariable(f,3);
[127X[104X
    [4X[28Xfalse
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X2.1-5 IsUnateBooleanFunction[101X
  
  [33X[1;0Y[29X[2XIsUnateBooleanFunction[102X( [3XFunc[103X ) [32X function[133X
  
  [33X[0;0YIf  a  Boolean  function  [22Xf[122X  is  either  positive  or negative unate in each
  variable  then  it  is  said to be [3Xunate[103X (note that some [22Xx_i[122X may be positive
  unate  and some negative unate to satisfy the definition of unate function).
  A Boolean function [22Xf[122X is [3Xbinate[103X if it is not unate (i.e., is neither positive
  unate nor negative unate in at least one of its variables).[133X
  
  [33X[0;0YAll  threshold  functions  are  unate.  However,  the  converse is not true,
  because  there  are certain unate functions, that can not be realized by STE
  [AQR99].[133X
  
  [33X[0;0YFor  the  Boolean  function [10XFunc[110X the function [10XIsUnateBooleanFunction[110X returns
  [10Xtrue[110X if [10XFunc[110X is unate and [10Xfalse[110X otherwise.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(2,2,[0,1,1,1]);;
[127X[104X
    [4X[25Xgap>[125X [27XIsUnateBooleanFunction(f);
[127X[104X
    [4X[28Xtrue
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(2,2,[0,1,1,0]);;
[127X[104X
    [4X[25Xgap>[125X [27XIsUnateBooleanFunction(f);
[127X[104X
    [4X[28Xfalse
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X2.1-6 InfluenceOfVariable[101X
  
  [33X[1;0Y[29X[2XInfluenceOfVariable[102X( [3XFunc[103X, [3XVar[103X ) [32X function[133X
  
  [33X[0;0YThe  influence  of  a  variable [22Xx_i[122X measures how many times out of the total
  existing  cases a change on that variable produces a change on the output of
  the function.[133X
  
  [33X[0;0YFor  the  Boolean  function  [10XFunc[110X  and the positive integer [10XVar[110X the function
  [10XInfluenceOfVariable[110X  returns  a positive integer - the weighted influence of
  the  variable [10XVar[110X (to obtain integer values we multiply the influence of the
  variable by [22X2^n[122X, where [22Xn[122X is the number of variables of [10XFunc[110X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(3,2,[0,0,0,0,0,1,1,0]);
[127X[104X
    [4X[28X< Boolean function of 3 variables >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(f);
[127X[104X
    [4X[28XBoolean function of 3 variables.
[128X[104X
    [4X[28X[ 0, 0, 0 ] || 0
[128X[104X
    [4X[28X[ 0, 0, 1 ] || 0
[128X[104X
    [4X[28X[ 0, 1, 0 ] || 0
[128X[104X
    [4X[28X[ 0, 1, 1 ] || 0
[128X[104X
    [4X[28X[ 1, 0, 0 ] || 0
[128X[104X
    [4X[28X[ 1, 0, 1 ] || 1
[128X[104X
    [4X[28X[ 1, 1, 0 ] || 1
[128X[104X
    [4X[28X[ 1, 1, 1 ] || 0
[128X[104X
    [4X[25Xgap>[125X [27XInfluenceOfVariable(f,2);
[127X[104X
    [4X[28X2
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X2.1-7 SelfDualExtensionOfBooleanFunction[101X
  
  [33X[1;0Y[29X[2XSelfDualExtensionOfBooleanFunction[102X( [3XFunc[103X ) [32X function[133X
  
  [33X[0;0YThe  [3Xself-dual  extension[103X  of  a  Boolean  function  [22Xf^n:Z_2^n  ->  Z_2[122X of [22Xn[122X
  variables  is  a  Boolean  function  [22Xf^n+1:Z_2^n+1  ->  Z_2[122X of [22Xn+1[122X variables
  defined as[133X
  
  
  [24X[33X[0;6Yf^{n+1}(x_1,\ldots,x_n,x_{n+1})=f^{n}(x_1,\ldots,x_n)    \quad   \textrm{if}
  \quad x_{n+1}=0,[133X
  
  [124X
  
  
  [24X[33X[0;6Yf^{n+1}(x_1,\ldots,x_n,x_{n+1})=1-f^{n}(\overline  x_1,\ldots,\overline x_n)
  \quad \textrm{if} \quad x_{n+1}=1,[133X
  
  [124X
  
  [33X[0;0Ywhere [22Xoverline x_i = x_i ⊕ 1[122X is the negation of the [22Xi[122X-th variable.[133X
  
  [33X[0;0YEvery  threshold  function is unate. However, in [FSAJ06] was shown that the
  unatness in the self-dual space of [22Xn+1[122X variables is much stronger condition.[133X
  
  [33X[0;0YFor       the       Boolean       function       [10XFunc[110X      the      function
  [10XSelfDualExtensionOfBooleanFunction[110X returns the self-dual extension of [10XFunc[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(2,2,[0,0,0,1]);
[127X[104X
    [4X[28X< Boolean function of 2 variables >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(f);
[127X[104X
    [4X[28XBoolean function of 2 variables.
[128X[104X
    [4X[28X[ 0, 0 ] || 0
[128X[104X
    [4X[28X[ 0, 1 ] || 0
[128X[104X
    [4X[28X[ 1, 0 ] || 0
[128X[104X
    [4X[28X[ 1, 1 ] || 1
[128X[104X
    [4X[25Xgap>[125X [27Xfsd:=SelfDualExtensionOfBooleanFunction(f);
[127X[104X
    [4X[28X< Boolean function of 3 variables >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(fsd);
[127X[104X
    [4X[28XBoolean function of 3 variables.
[128X[104X
    [4X[28X[ 0, 0, 0 ] || 0
[128X[104X
    [4X[28X[ 0, 0, 1 ] || 0
[128X[104X
    [4X[28X[ 0, 1, 0 ] || 0
[128X[104X
    [4X[28X[ 0, 1, 1 ] || 1
[128X[104X
    [4X[28X[ 1, 0, 0 ] || 0
[128X[104X
    [4X[28X[ 1, 0, 1 ] || 1
[128X[104X
    [4X[28X[ 1, 1, 0 ] || 1
[128X[104X
    [4X[28X[ 1, 1, 1 ] || 1
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X2.1-8 SplitBooleanFunction[101X
  
  [33X[1;0Y[29X[2XSplitBooleanFunction[102X( [3XFunc[103X, [3XVar[103X, [3XBool[103X ) [32X function[133X
  
  [33X[0;0YThe  method of splitting a function in terms of a given variable is known as
  Shannon decomposition and it was formally introduced in 1938 by Shannon.[133X
  
  [33X[0;0YLet  [22Xf(x_1,...,x_n)[122X  be  a Boolean function. Decompose [22Xf[122X as a disjunction of
  the following two Boolean functions [22Xf_a[122X and [22Xf_b[122X defined as:[133X
  
  
  [24X[33X[0;6Y\textstyle    f_a(x_1,\ldots,x_n)=f(x_1,\ldots,x_{i-1},0,x_{i+1},\ldots,x_n)
  \quad \textrm{if} \quad x_i=0,[133X
  
  [124X
  
  
  [24X[33X[0;6Yf_a(x_1,\ldots,x_n)=0, \quad \textrm{if} \quad x_i=1;[133X
  
  [124X
  
  [33X[0;0Yand[133X
  
  
  [24X[33X[0;6Yf_b(x_1,\ldots,x_n)= 0 \quad \textrm{if} \quad x_i=0,\quad[133X
  
  [124X
  
  
  [24X[33X[0;6Yf_b(x_1,\ldots,x_n)=f(x_1,\ldots,x_{i-1},1,x_{i+1},\ldots,x_n)         \quad
  \textrm{if} \quad x_i=1.[133X
  
  [124X
  
  [33X[0;0YIf  we are intended to use conjunction, we can apply the same equations with
  1 for undetermined outputs instead of 0.[133X
  
  [33X[0;0YFor  the  Boolean  function  [10XFunc[110X,  a  positive  integer  [10XVar[110X (the number of
  variable),  Boolean  variable  [10XBool[110X  ([10Xtrue[110X  for  disjunction  and  [10Xfalse[110X for
  conjunction)  the  function  [10XSplitBooleanFunction[110X  returns  a  list with two
  entries: the resulting Boolean logic functions.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(2,2,[0,1,1,0]);;
[127X[104X
    [4X[25Xgap>[125X [27XDisplay(f);
[127X[104X
    [4X[28XBoolean function of 2 variables.
[128X[104X
    [4X[28X[ 0, 0 ] || 0
[128X[104X
    [4X[28X[ 0, 1 ] || 1
[128X[104X
    [4X[28X[ 1, 0 ] || 1
[128X[104X
    [4X[28X[ 1, 1 ] || 0
[128X[104X
    [4X[25Xgap>[125X [27Xout:=SplitBooleanFunction(f,1,false);;
[127X[104X
    [4X[25Xgap>[125X [27XPrint(out[1]);
[127X[104X
    [4X[28X[2, 2,[ 0, 1, 1, 1 ]]
[128X[104X
    [4X[25Xgap>[125X [27XPrint(out[2]);
[127X[104X
    [4X[28X[2, 2,[ 1, 1, 1, 0 ]]
[128X[104X
    [4X[25Xgap>[125X [27Xout:=SplitBooleanFunction(f,1,true);;
[127X[104X
    [4X[25Xgap>[125X [27XPrint(out[1]);
[127X[104X
    [4X[28X[2, 2,[ 0, 1, 0, 0 ]]
[128X[104X
    [4X[25Xgap>[125X [27XPrint(out[2]);
[127X[104X
    [4X[28X[2, 2,[ 0, 0, 1, 0 ]]
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X2.1-9 KernelOfBooleanFunction[101X
  
  [33X[1;0Y[29X[2XKernelOfBooleanFunction[102X( [3XFunc[103X ) [32X function[133X
  
  [33X[0;0YFor  a Boolean function [22Xf(x_1,...,x_n)[122X we define the following two sets (see
  [ABGG80]):[133X
  
  [33X[0;0YThe kernel [22XK(f)[122X of the Boolean function [22Xf[122X is defined as[133X
  
  
  [24X[33X[0;6YK(f)=f^{-1}(1), \quad \textrm{ if } \quad |f^{-1}(1)| \geq |f^{-1}(0)|;[133X
  
  [124X
  
  
  [24X[33X[0;6YK(f)=f^{-1}(0), \quad \textrm{otherwise,}[133X
  
  [124X
  
  [33X[0;0Ywhere [22X|f^-1(i)|[122X is the cardinality of the set [22Xf^-1(i)[122X with [22Xi ∈ {0,1}[122X.[133X
  
  [33X[0;0YFor the Boolean function [10XFunc[110X the function [10XKernelOfBooleanFunction[110X returns a
  list  in  which  the first element of the output list represents the kernel,
  and the second element equals either [22X1[122X or [22X0[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(3,2,[0,1,1,0,1,0,0,0]);;
[127X[104X
    [4X[25Xgap>[125X [27Xk:=KernelOfBooleanFunction(f);
[127X[104X
    [4X[28X[ [ [ 0, 0, 1 ], [ 0, 1, 0 ], [ 1, 0, 0 ] ], 1 ]
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X2.1-10 ReducedKernelOfBooleanFunction[101X
  
  [33X[1;0Y[29X[2XReducedKernelOfBooleanFunction[102X( [3XKer[103X ) [32X function[133X
  
  [33X[0;0YLet  [22Xf(x_1,...,x_n)[122X be a Boolean function with the kernel [22XK(f)={ a_1,...,a_m
  }[122X,  where [22Xm ≤ 2^n-1[122X. The reduced kernel [22XK(f)_i[122X of the function [22Xf[122X relative to
  the element [22Xa_i ∈ K(f)[122X is the following set (see [ABGG80]):[133X
  
  
  [24X[33X[0;6YK(f)_i=\big\{\;a_1 \oplus a_i, \; a_2 \oplus a_i,\; \ldots,\; a_m \oplus a_i
  \; \big\},[133X
  
  [124X
  
  [33X[0;0Ywhere [22X⊕[122X is a component-wise addition of vectors from [22XK(f)[122X over [22XGF(2)[122X.[133X
  
  [33X[0;0YThe reduced kernel [22XT(f)[122X of [22Xf[122X is the following set:[133X
  
  
  [24X[33X[0;6YT(f)=\big\{ \;K(f)_i \;\mid\; i=1,2,\ldots,m \;\big\}.[133X
  
  [124X
  
  [33X[0;0YFor  the  [22Xm  ×  n[122X  matrix  [10XKer[110X,  which represents the kernel of some Boolean
  function  [22Xf[122X, the function [10XReducedKernelOfBooleanFunction[110X returns the reduced
  kernel [22XT(f)[122X of [22Xf[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27X## Continuation of Example 2.2.4
[127X[104X
    [4X[25Xgap>[125X [27Xrk:=ReducedKernelOfBooleanFunction(k[1]);;
[127X[104X
    [4X[25Xgap>[125X [27Xj:=1;;
[127X[104X
    [4X[25Xgap>[125X [27Xfor i in rk do Print(j,".\n"); Display(i); Print("\n"); j:=j+1; od;
[127X[104X
    [4X[28X1.
[128X[104X
    [4X[28X . . .
[128X[104X
    [4X[28X . 1 1
[128X[104X
    [4X[28X 1 . 1
[128X[104X
    [4X[28X
[128X[104X
    [4X[28X2.
[128X[104X
    [4X[28X . 1 1
[128X[104X
    [4X[28X . . .
[128X[104X
    [4X[28X 1 1 .
[128X[104X
    [4X[28X
[128X[104X
    [4X[28X3.
[128X[104X
    [4X[28X 1 . 1
[128X[104X
    [4X[28X 1 1 .
[128X[104X
    [4X[28X . . .
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
