  
  [1X3 [33X[0;0YThreshold Elements[133X[101X
  
  
  [1X3.1 [33X[0;0YBasic Operations[133X[101X
  
  [33X[0;0YFor  a  given  real  vector  and  a  threshold  , the [3Xthreshold element[103X is a
  function [22Xf: Z_2^n -> Z_2[122X defined by the following relations:[133X
  
  
  [24X[33X[0;6Yf(x_1,\dots,x_n)  = 1, \quad \textrm{if} \quad \sum_{i = 1}^{n} w_i x_i \geq
  T, \quad \textrm{and} \quad f(x_1,\dots,x_n) = 0 \quad \textrm{otherwise},[133X
  
  [124X
  
  [33X[0;0Yin which [22Xf(x_1,dots,x_n)[122X is the binary output (valued 0 or 1), each variable
  [22Xx_i[122X is the i-th input (valued 0 or 1), and [22Xn[122X is the number of inputs.[133X
  
  [33X[0;0YThe  vector  [22Xw[122X  is the [3Xweight[103X vector, and the [22Xx=(x_1, ..., x_n)[122X is the [3Xinput[103X
  vector.  The  vector  [22X(w_1,  ...,  w_n;T)[122X is called the [3Xstructure vector[103X (or
  simply the [3Xstructure[103X) of the threshold element.[133X
  
  [1X3.1-1 ThresholdElement[101X
  
  [33X[1;0Y[29X[2XThresholdElement[102X( [3XWeights[103X, [3XThreshold[103X ) [32X function[133X
  
  [33X[0;0YFor  the  list  of  rational  numbers [10XWeights[110X and the rational [10XThreshold[110X the
  function  [10XThresholdElement[110X  returns  a  threshold element with the number of
  inputs equal to the length of the [10XWeights[110X list.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xte:=ThresholdElement([1,2],3);
[127X[104X
    [4X[28X< threshold element with weight vector [ 1, 2 ] and threshold 3 >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(te);
[127X[104X
    [4X[28XWeight vector = [ 1, 2 ], Threshold = 3.
[128X[104X
    [4X[28XThreshold Element realizes the function f :
[128X[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[28XSum of Products:[ 3 ]
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe  function  [10XDisplay[110X  outputs  the stucture of the given threshold element
  [10XThrEl[110X  and  the  Sum  of  Products  or Product of Sums representation of the
  function  realized  by  [10XThrEl[110X.  For threshold elements of [22Xn ≤ 4[122X variables it
  also prints the truth table of the realized Boolean function.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xw:=[1,2,4,-4,6,8,10,-25,6,32];;
[127X[104X
    [4X[25Xgap>[125X [27XT:=60;;
[127X[104X
    [4X[25Xgap>[125X [27Xte:=ThresholdElement(w,T);
[127X[104X
    [4X[28X< threshold element with weight vector [ 1, 2, 4, -4, 6, 8, 10, -25, 6, 32
[128X[104X
    [4X[28X ] and threshold 60 >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(te);
[127X[104X
    [4X[28XWeight vector = [ 1, 2, 4, -4, 6, 8, 10, -25, 6, 32 ], Threshold = 60.
[128X[104X
    [4X[28XThreshold Element realizes the function f :
[128X[104X
    [4X[28XSum of Products:[ 59, 155, 185, 187, 251, 315, 379, 411, 427, 441, 443, 507, 5\
[128X[104X
    [4X[28X71, 667, 697, 699, 763, 827, 891, 923, 939, 953, 955, 1019 ]
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.1-2 IsThresholdElement[101X
  
  [33X[1;0Y[29X[2XIsThresholdElement[102X( [3XObj[103X ) [32X function[133X
  
  [33X[0;0YFor  the object [10XObj[110X the function [10XIsThresholdElement[110X returns [10Xtrue[110X if [10XObj[110X is a
  threshold element (see [2XThresholdElement[102X ([14X3.1-1[114X)), and [10Xfalse[110X otherwise.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xte:=ThresholdElement([1,2],3);
[127X[104X
    [4X[28X< threshold element with weight vector [ 1, 2 ] and threshold 3 >
[128X[104X
    [4X[25Xgap>[125X [27XIsThresholdElement(te);
[127X[104X
    [4X[28Xtrue
[128X[104X
    [4X[25Xgap>[125X [27XIsThresholdElement([[1,2],3]);
[127X[104X
    [4X[28Xfalse
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.1-3 OutputOfThresholdElement[101X
  
  [33X[1;0Y[29X[2XOutputOfThresholdElement[102X( [3XThrEl[103X ) [32X function[133X
  
  [33X[0;0YFor  the  threshold  element  [10XThrEl[110X  the  function  [10XOutputOfThresholdElement[110X
  returns the Boolean function, realized by [10XThrEl[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xte:=ThresholdElement([1,2],3);
[127X[104X
    [4X[28X< threshold element with weight vector [ 1, 2 ] and threshold 3 >
[128X[104X
    [4X[25Xgap>[125X [27Xf:=OutputOfThresholdElement(te);
[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[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.1-4 StructureOfThresholdElement[101X
  
  [33X[1;0Y[29X[2XStructureOfThresholdElement[102X( [3XThrEl[103X ) [32X function[133X
  
  [33X[0;0YFor  the  threshold  element  [10XThrEl[110X the function [10XStructureOfThresholdElement[110X
  returns  the  structure  vector  [[10XWeights[110X,[10XThreshold[110X]  (see  [2XThresholdElement[102X
  ([14X3.1-1[114X)).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xte:=ThresholdElement([1,2],3);
[127X[104X
    [4X[28X< threshold element with weight vector [ 1, 2 ] and threshold 3 >
[128X[104X
    [4X[25Xgap>[125X [27Xsv:=StructureOfThresholdElement(te);
[127X[104X
    [4X[28X[ [ 1, 2 ], 3 ]
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.1-5 RandomThresholdElement[101X
  
  [33X[1;0Y[29X[2XRandomThresholdElement[102X( [3XNumVar[103X, [3XLo[103X, [3XHi[103X ) [32X function[133X
  
  [33X[0;0YFor  the  integers  [10XNumVar[110X,  [10XLo[110X, and [10XHi[110X, the function [10XRandomThresholdElement[110X
  returns a threshold element of [10XNumVar[110X variables with a pseudo random integer
  weight  vector  and  an  integer  threshold,  where both the weights and the
  threshold are chosen from the interval [[10XLo[110X, [10XHi[110X].[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xte:=RandomThresholdElement(4,-10,10);
[127X[104X
    [4X[28X< threshold element with weight vector [ 7, -8, -6, 10 ] and threshold 2 >
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.1-6 Comparison of Threshold Elements[101X
  
  [33X[1;0Y[29X[2XComparison of Threshold Elements[102X( [3XThrEl1[103X, [3XThrEl2[103X ) [32X function[133X
  
  [33X[0;0YLet  [10XThrEl1[110X  and  [10XThrEl2[110X  be  two  threshold  elements of the same number of
  variables,    which   realize   the   following   Boolean   functions   (see
  [2XThresholdElement[102X  ([14X3.1-1[114X))  [22Xf_1[122X and [22Xf_2[122X, resprectively. By comparison of two
  threshold  elements  we  mean the comparison of the truth vectors of [22Xf_1[122X and
  [22Xf_2[122X (see [2XOutputOfThresholdElement[102X ([14X3.1-3[114X)).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xte1:=ThresholdElement([1,2],3);;
[127X[104X
    [4X[25Xgap>[125X [27XPrint(OutputOfThresholdElement(te1),"\n");
[127X[104X
    [4X[28X[2, 2,[ 0, 0, 0, 1 ]]
[128X[104X
    [4X[25Xgap>[125X [27Xte2:=ThresholdElement([1,2],0);;
[127X[104X
    [4X[25Xgap>[125X [27XPrint(OutputOfThresholdElement(te2),"\n");
[127X[104X
    [4X[28X[2, 2,[ 1, 1, 1, 1 ]]
[128X[104X
    [4X[25Xgap>[125X [27Xte3:=ThresholdElement([1,1],2);;
[127X[104X
    [4X[25Xgap>[125X [27XPrint(OutputOfThresholdElement(te3),"\n");
[127X[104X
    [4X[28X[2, 2,[ 0, 0, 0, 1 ]]
[128X[104X
    [4X[25Xgap>[125X [27Xte1<te2;
[127X[104X
    [4X[28Xtrue
[128X[104X
    [4X[25Xgap>[125X [27Xte1>te2;
[127X[104X
    [4X[28Xfalse
[128X[104X
    [4X[25Xgap>[125X [27Xte1=te3;
[127X[104X
    [4X[28Xtrue
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  
  [1X3.2 [33X[0;0YSingle Threshold Element Realizability[133X[101X
  
  [33X[0;0YOne  of  the  most  important questions is whether a Boolean function can be
  realized  by  a  single threshold element (STE). A Boolean function which is
  realizable  by  a  STE  is  called  a  [10XThreshold  Function[110X.  This section is
  dedicated to verification of STE-realizability.[133X
  
  [1X3.2-1 CharacteristicVectorOfFunction[101X
  
  [33X[1;0Y[29X[2XCharacteristicVectorOfFunction[102X( [3XFunc[103X ) [32X function[133X
  
  [33X[0;0YLet  [22Xf(x_1,...,x_n)[122X be a Boolean function. We can switch from the {0,1}-base
  to {-1,1}-base using the following transformation:[133X
  
  
  [24X[33X[0;6Yy_i = 2x_i-1, \quad (i = 1,2,\ldots,n)[133X
  
  [124X
  
  
  [24X[33X[0;6Yg(y_1,\ldots,y_n) = 2f(x_1,\ldots,x_n)-1.[133X
  
  [124X
  
  [33X[0;0YFor  each [22Xi ∈ {1,2,...,n}[122X the [22Xi[122X-th column of the truth table of the function
  [22Xg(y_1,...,y_n)[122X  (in {-1,1}-base) we denote by [22XY_i[122X, and the truth vector of [22Xg[122X
  we denote by [22XG[122X.[133X
  
  [33X[0;0YDefine the following vector:[133X
  
  
  [24X[33X[0;6Yb   =   \big(\;Y_1  \cdot  G,\;  \ldots,  \;  Y_n  \cdot  G,  \;  \textstyle
  \sum_{i=0}^{2^n-1} g(i) \; \big) \in \mathbb{R}^{n+1},[133X
  
  [124X
  
  [33X[0;0Ywhere  [22XY_k  ⋅  G[122X  is  the  classical  inner  (scalar)  product  for each [22Xk ∈
  {1,...,n}[122X.[133X
  
  [33X[0;0YVector  [22Xb[122X  is  called  the  [3Xcharacteristic  vector[103X of the Boolean function [22Xf[122X
  [Der65].  Comparing  the  characteristic  vector  of the function [22Xf[122X with the
  lists  of  characteristic  vectors of all STE-realizable functions we obtain
  the answer wheter [22Xf[122X is realizable by STE or not. In [5XThelma[105X package we have a
  database of all such vectors for STE-realizable functions of [22Xn ≤ 6[122X variables
  obtained   from   [Der65].  For  the  Boolean  function  [10XFunc[110X  the  function
  [10XCharacteristicVectorOfFunction[110X returns a characteristic vector. There are no
  limitations  on  the cardinality of [10XFunc[110X, but the database of STE-realizable
  functions is given only for [22Xn ≤ 6[122X variables.[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 [27XCharacteristicVectorOfFunction(f);
[127X[104X
    [4X[28X[ 2, 2, 2 ]
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.2-2 IsCharacteristicVectorOfSTE[101X
  
  [33X[1;0Y[29X[2XIsCharacteristicVectorOfSTE[102X( [3XChVect[103X ) [32X function[133X
  
  [33X[0;0YFor  the  characteristic  vector  [10XChVect[110X (see [2XCharacteristicVectorOfFunction[102X
  ([14X3.2-1[114X))  the function [10XIsCharacteristicVectorOfSTE[110X returns [10Xtrue[110X if [10XChVect[110X is
  a  characteristic  vector of some STE-realizable Boolean function, and [10Xfalse[110X
  otherwise.  Note,  that this function is implemented only for characteristic
  vectors of length not bigger than 7.[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 [27Xc:=CharacteristicVectorOfFunction(f);
[127X[104X
    [4X[28X[ 2, 2, 2 ]
[128X[104X
    [4X[25Xgap>[125X [27XIsCharacteristicVectorOfSTE(c);
[127X[104X
    [4X[28Xtrue
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.2-3 IsInverseInKernel[101X
  
  [33X[1;0Y[29X[2XIsInverseInKernel[102X( [3XFunc[103X ) [32X function[133X
  
  [33X[0;0YLet  [22Xf(x_1,...,x_n)[122X be a Boolean function with the kernel [22XK(f)[122X. The function
  [10XIsInverseInKernel[110X  returns  [10Xtrue[110X  if  there  is  a  pair of additive inverse
  vectors  in  [22XK(f)[122X  (this means that [22Xf[122X is not STE-realizable, see [GPR83]) or
  [10Xfalse[110X  otherwise.  Note  that  this  function also accepts the kernel of the
  Boolean  function [10XFunc[110X as an input. A vector [22Xb ∈ Z_2^n[122X is called an additive
  inverse to [22Xa ∈ Z_2^n[122X if [22Xa ⊕ b = 0[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(3,2,[0,1,0,1,0,1,1,0]);;
[127X[104X
    [4X[25Xgap>[125X [27Xk:=KernelOfBooleanFunction(f);;
[127X[104X
    [4X[25Xgap>[125X [27XDisplay(k[1]);
[127X[104X
    [4X[28X . . 1
[128X[104X
    [4X[28X . 1 1
[128X[104X
    [4X[28X 1 . 1
[128X[104X
    [4X[28X 1 1 .
[128X[104X
    [4X[25Xgap>[125X [27XIsInverseInKernel(f);
[127X[104X
    [4X[28Xtrue
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.2-4 IsKernelContainingPrecedingVectors[101X
  
  [33X[1;0Y[29X[2XIsKernelContainingPrecedingVectors[102X( [3XFunc[103X ) [32X function[133X
  
  [33X[0;0YA  vector  [22Xa=(α_1,...,α_n) ∈ Z_2^n[122X precedes a vector [22Xb=(β_1,...,β_n) ∈ Z_2^n[122X
  (we denote it as [22Xa ≺ b[122X) if [22Xα_i ≤ β_i for each i=1,..., n[122X.[133X
  
  [33X[0;0YFor a given vector [22Xc ∈ Z_2^n[122X denote [22XM_c={ a∈ Z_2^n ∣ a ≺ c }[122X.[133X
  
  [33X[0;0YLet  [22Xf(x_1,...,x_n)[122X be a Boolean function with reduced kernel [22XT(f)={K(f)_j ∣
  j=1,2,...,  m  }[122X.  If  [22Xf[122X is implemented by a single threshold element (STE),
  then there exists [22Xj ∈ {1,..., m }[122X such that[133X
  
  
  [24X[33X[0;6Y\forall a \in K(f)_j \qquad \textrm{holds} \qquad M_a \subseteq K(f)_j.[133X
  
  [124X
  
  [33X[0;0YThe  function  [10XIsKernelContainingPrecedingVectors[110X  returns [10Xfalse[110X for a given
  function  [10XFunc[110X  if [22XFunc[122X is not realizable by a single threshold element (see
  [GMB17]).  Note  that  this  function also accepts the kernel of the Boolean
  function [10XFunc[110X as an input.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27X##Continuation of the previous example
[127X[104X
    [4X[25Xgap>[125X [27XIsKernelContainingPrecedingVectors(f);
[127X[104X
    [4X[28Xfalse
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.2-5 IsRKernelBiggerOfCombSum[101X
  
  [33X[1;0Y[29X[2XIsRKernelBiggerOfCombSum[102X( [3XFunc[103X ) [32X function[133X
  
  [33X[0;0YLet [22Xf(x_1,...,x_n)[122X be a Boolean function with reduced kernel [22XT(f)[122X. Denote[133X
  
  
  [24X[33X[0;6Yk_i^*  =  \max\big\{  \;  \|a\| = \textstyle \sum_{j=1}^m a_j \; \mid \; a =
  (a_1, \ldots, a_m) \in T(f) \; \big\}, \quad (i=1,\ldots,n)[133X
  
  [124X
  
  [33X[0;0Yand[133X
  
  
  [24X[33X[0;6Yk_A^*=\min\big\{\;k_i^* \; \mid \; i=1, 2, \ldots,n \; \big\}.[133X
  
  [124X
  
  [33X[0;0YIf  [22Xf[122X is implemented by a single threshold element (STE), then the following
  condition holds:[133X
  
  
  [24X[33X[0;6Y|A| \geq \sum_{i=0}^{k_A^*} {{k_A^*}\choose{i}},[133X
  
  [124X
  
  [33X[0;0Ywhere  [22X{k_A^*choosei}[122X  is  the classical binomial coefficient and [22X|A|[122X is the
  cardinality of [22XA[122X.[133X
  
  [33X[0;0YFor  a  given  Boolean  function  [10XFunc[110X the function [10XIsRKernelBiggerOfCombSum[110X
  returns  [10Xfalse[110X  if  this  function is not STE-realizable (see [GMB17]). Note
  that  this  function also accepts the reduced kernel of the Boolean function
  [10XFunc[110X as an input.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(2,2,[0,1,1,0]);
[127X[104X
    [4X[28X< Boolean function of 2 variables >
[128X[104X
    [4X[25Xgap>[125X [27XIsRKernelBiggerOfCombSum(f);
[127X[104X
    [4X[28Xfalse
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.2-6 BooleanFunctionBySTE[101X
  
  [33X[1;0Y[29X[2XBooleanFunctionBySTE[102X( [3XFunc[103X ) [32X function[133X
  
  [33X[0;0YFor   a  given  Boolean  function  [10XFunc[110X  the  function  [10XBooleanFunctionBySTE[110X
  determines  whether  [10XFunc[110X is realizable by a single threshold element (STE).
  The  function  returns  a threshold element with integer weights and integer
  threshold.  If  [10XFunc[110X  is not realizable by STE, it returns an empty list [].
  The realization of the function [10XBooleanFunctionBySTE[110X is based on algorithms,
  proposed in [Gec10].[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(3,2,[1,1,0,0,1,0,0,0]);
[127X[104X
    [4X[28X< Boolean function of 3 variables >
[128X[104X
    [4X[25Xgap>[125X [27Xte:=BooleanFunctionBySTE(f);
[127X[104X
    [4X[28X< threshold element with weight vector [ -1, -4, -2 ] and threshold -2 >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(te);
[127X[104X
    [4X[28XWeight vector = [ -1, -4, -2 ], Threshold = -2.
[128X[104X
    [4X[28XThreshold Element realizes the function f :
[128X[104X
    [4X[28XBoolean function of 3 variables.
[128X[104X
    [4X[28X[ 0, 0, 0 ] || 1
[128X[104X
    [4X[28X[ 0, 0, 1 ] || 1
[128X[104X
    [4X[28X[ 0, 1, 0 ] || 0
[128X[104X
    [4X[28X[ 0, 1, 1 ] || 0
[128X[104X
    [4X[28X[ 1, 0, 0 ] || 1
[128X[104X
    [4X[28X[ 1, 0, 1 ] || 0
[128X[104X
    [4X[28X[ 1, 1, 0 ] || 0
[128X[104X
    [4X[28X[ 1, 1, 1 ] || 0
[128X[104X
    [4X[28XSum of Products:[ 0, 1, 4 ]
[128X[104X
    [4X[25Xgap>[125X [27Xf:=LogicFunction(2,2,[0,1,1,0]);
[127X[104X
    [4X[28X< Boolean function of 2 variables >
[128X[104X
    [4X[25Xgap>[125X [27Xte:=BooleanFunctionBySTE(f);
[127X[104X
    [4X[28X[  ]
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.2-7 PDBooleanFunctionBySTE[101X
  
  [33X[1;0Y[29X[2XPDBooleanFunctionBySTE[102X( [3XFunc[103X ) [32X function[133X
  
  [33X[0;0YLet  [22Xf(x_1,...,x_n)[122X  be a partially defined Boolean function. We denote by [10Xx[110X
  the positions in truth vector, where [22Xf[122X is undefined. Then [22Xf^-1[122X[10X(x)[110X is the set
  of  Boolean  vectors  of [22Xn[122X variables on which the function is undefined. The
  sets [22Xf^-1(0)[122X and [22Xf^-1(1)[122X are defined in [2XKernelOfBooleanFunction[102X ([14X2.1-9[114X). The
  function  [22Xf[122X is called a [3Xthreshold function[103X if there is an [22Xn[122X-dimensional real
  vector [22Xw=(w_1,...,w_n)[122X and a real threshold [22XT[122X such that[133X
  
  
  [24X[33X[0;6Ya \in f^{-1}(1) \quad \Longrightarrow \quad a\cdot w^T \geq T,[133X
  
  [124X
  
  
  [24X[33X[0;6Ya \in f^{-1}(0)\quad \Longrightarrow \quad a\cdot w^T < T,[133X
  
  [124X
  
  [33X[0;0Ywhere [22Xa⋅ w^T[122X is the classical inner (scalar) product.[133X
  
  [33X[0;0YFor  the  partially  defined  Boolean  function [10XFunc[110X (presented as a string,
  where  [10Xx[110X  presents the undefined values) the function [10XPDBooleanFunctionBySTE[110X
  returns  a  threshold  element if [10XFunc[110X can be realized by STE and empty list
  otherwise.  The  realization of the function [10XPDBooleanFunctionBySTE[110X is based
  on the algorithm, proposed in [GPR83].[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xf:="1x001x0x";
[127X[104X
    [4X[28X"1x001x0x"
[128X[104X
    [4X[25Xgap>[125X [27Xte:=PDBooleanFunctionBySTE(f);
[127X[104X
    [4X[28X< threshold element with weight vector [ -1, -2, -3 ] and threshold -1 >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(te);
[127X[104X
    [4X[28XWeight vector = [ -1, -2, -3 ], Threshold = -1.
[128X[104X
    [4X[28XThreshold Element realizes the function f :
[128X[104X
    [4X[28XBoolean function of 3 variables.
[128X[104X
    [4X[28X[ 0, 0, 0 ] || 1
[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 ] || 1
[128X[104X
    [4X[28X[ 1, 0, 1 ] || 0
[128X[104X
    [4X[28X[ 1, 1, 0 ] || 0
[128X[104X
    [4X[28X[ 1, 1, 1 ] || 0
[128X[104X
    [4X[28XSum of Products:[ 0, 4 ]
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  
  [1X3.3 [33X[0;0YIterative Training Methods[133X[101X
  
  [33X[0;0Y[5XThelma[105X also provides a few iterative methods for threshold element training.[133X
  
  [1X3.3-1 ThresholdElementTraining[101X
  
  [33X[1;0Y[29X[2XThresholdElementTraining[102X( [3XThrEl[103X, [3XStep[103X, [3XFunc[103X, [3XMax_Iter[103X ) [32X function[133X
  
  [33X[0;0YThis  is  a  basic iterative method for the perceptron training [Ros58]. For
  the threshold element [10XThrEl[110X (which is an arbitrary threshold element for the
  first  iteration),  the  positive integer [10XStep[110X (the value on which we change
  parameters  while training the threshold element), the Boolean function [10XFunc[110X
  and  the  positive  integer [10XMax_Iter[110X - the maximal number of iterations, the
  function  [10XThresholdElementTraining[110X  returns  a  threshold element, realizing
  [10XFunc[110X (if such threshold element exists).[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 [27Xte1:=RandomThresholdElement(2,-2,2);
[127X[104X
    [4X[28X< threshold element with weight vector [ 0, -1 ] and threshold 0 >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(OutputOfThresholdElement(te1));
[127X[104X
    [4X[28XBoolean function of 2 variables.
[128X[104X
    [4X[28X[ 0, 0 ] || 1
[128X[104X
    [4X[28X[ 0, 1 ] || 0
[128X[104X
    [4X[28X[ 1, 0 ] || 1
[128X[104X
    [4X[28X[ 1, 1 ] || 0
[128X[104X
    [4X[25Xgap>[125X [27Xte2:=ThresholdElementTraining(te1,1,f,100);
[127X[104X
    [4X[28X< threshold element with weight vector [ 2, 1 ] and threshold 3 >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(OutputOfThresholdElement(te2));
[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[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.3-2 ThresholdElementBatchTraining[101X
  
  [33X[1;0Y[29X[2XThresholdElementBatchTraining[102X( [3XThrEl[103X, [3XStep[103X, [3XFunc[103X, [3XMax_Iter[103X ) [32X function[133X
  
  [33X[0;0YFor the threshold element [10XThrEl[110X (which is an arbitrary threshold element for
  the  first  iteration),  the  positive  integer  [10XStep[110X (the value on which we
  change  parameters  while  training  the  threshold  element),  the  Boolean
  function  [10XFunc[110X,  and  the  positive integer [10XMax_Iter[110X - the maximal number of
  iterations,   the  function  [10XThresholdElementTraining[110X  returns  a  threshold
  element,  realizing  [10XFunc[110X  (if  such  threshold  element  exists)  via batch
  training.[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 [27Xte1:=RandomThresholdElement(2,-2,2);
[127X[104X
    [4X[28X< threshold element with weight vector [ 0, 2 ] and threshold 2 >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(OutputOfThresholdElement(te1));
[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 ] || 0
[128X[104X
    [4X[28X[ 1, 1 ] || 1
[128X[104X
    [4X[25Xgap>[125X [27Xte2:=ThresholdElementBatchTraining(te1,1,f,100);
[127X[104X
    [4X[28X< threshold element with weight vector [ 2, 2 ] and threshold 3 >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(OutputOfThresholdElement(te2));
[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[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.3-3 WinnowAlgorithm[101X
  
  [33X[1;0Y[29X[2XWinnowAlgorithm[102X( [3XFunc[103X, [3XStep[103X, [3XMax_Iter[103X ) [32X function[133X
  
  [33X[0;0YA  Boolean  function  [22Xf:Z_2^n -> Z_2[122X which can be presented in the following
  form:[133X
  
  
  [24X[33X[0;6Yf(x_1,\ldots,x_n)=x_{i_1} \vee \cdots \vee x_{i_k}, \qquad (k \leq n)[133X
  
  [124X
  
  [33X[0;0Yis  called  a  [3Xmonotone  disjunction[103X,  i.e.  it is a disjunction in which no
  variable appears negated.[133X
  
  [33X[0;0YIf  the  given  Boolean  function  [22Xf[122X  is  a monotone disjunction, the [3XWinnow
  algorithm[103X is more efficient than the classical Perceptron training algorithm
  [Lit88].[133X
  
  [33X[0;0YFor   the   Boolean   function   [10XFunc[110X,  which  is  a  monotone  disjunction,
  [10XWinnowAlgorithm[110X  returns  either a threshold element realizing [10XFunc[110X or [] if
  [10XFunc[110X  is  not trainable by [10XWinnowAlgorithm[110X. The positive ingetger [10XStep[110X which
  is  not  equal  to  1  defines the value on which we change parameters while
  running  the algorithm and the positive integer [10XMax_Iter[110X defines the maximal
  number of iterations.[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+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 ] || 1
[128X[104X
    [4X[25Xgap>[125X [27Xte:=WinnowAlgorithm(f,2,100);
[127X[104X
    [4X[28X< threshold element with weight vector [ 1, 1 ] and threshold 1 >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(OutputOfThresholdElement(te));
[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 ] || 1
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.3-4 Winnow2Algorithm[101X
  
  [33X[1;0Y[29X[2XWinnow2Algorithm[102X( [3XFunc[103X, [3XStep[103X, [3XMax_Iter[103X ) [32X function[133X
  
  [33X[0;0YFor any [22XX ⊆ Z_2^n[122X and for any [22Xδ[122X satisfying [22X0 < δ ≤ 1[122X let [22XF(X,δ)[122X be the class
  of  functions  from  [22XX[122X  to [22XZ_2^n[122X. Assume that [22XF(X,δ)[122X satisfies the following
  condition:[133X
  
  [33X[0;0Yfor  each  [22Xf  ∈  F(X,δ)[122X  there  exist  [22Xμ_1,...,μ_n  ≥  0[122X  such  that for all
  [22X(x_1,...,x_n) ∈ X[122X[133X
  
  
  [24X[33X[0;6Y\textstyle   \sum_{i=1}^n   \mu_i   x_i  \geq  1,  \quad  \textrm{if}  \quad
  f(x_1,\ldots,x_n)=1[133X
  
  [124X
  
  [33X[0;0Yand[133X
  
  
  [24X[33X[0;6Y\textstyle   \sum_{i=1}^n   \mu_i   x_i  \leq  1,  \quad  \textrm{if}  \quad
  f(x_1,\ldots,x_n)=0.[133X
  
  [124X
  
  [33X[0;0YIn  other words, the inverse images of 0 and 1 are linearly separable with a
  minimum  separation  that  depends  on  [22Xδ[122X. [10XWinnow2[110X algorithm is designed for
  training this class of the Boolean functions [Lit88].[133X
  
  [33X[0;0YFor  the  Boolean function [10XFunc[110X from the class of Boolean functions which is
  described  above,  the  function [10XWinnow2Algorithm[110X returns either a threshold
  element   which   realizes   [10XFunc[110X   or  []  if  [10XFunc[110X  is  not  trainable  by
  [10XWinnow2Algorithm[110X.  The positive integer [10XStep[110X which is not equal to 1 defines
  the value on which we change parameters while running the algorithm.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27X##Conjunction can not be trained by Winnow algorithm.
[127X[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 [27Xte:=WinnowAlgorithm(f,2,100);
[127X[104X
    [4X[28X[  ]
[128X[104X
    [4X[25Xgap>[125X [27X## But in the case of Winnow2 we can obtain the desirable result.
[127X[104X
    [4X[25Xgap>[125X [27Xte:=Winnow2Algorithm(f,2,100);
[127X[104X
    [4X[28X< threshold element with weight vector [ 1/2, 1/2 ] and threshold 1 >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(te);
[127X[104X
    [4X[28XWeight vector = [ 1/2, 1/2 ], Threshold = 1.
[128X[104X
    [4X[28XThreshold Element realizes the function f :
[128X[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[28XSum of Products:[ 3 ]
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
  [1X3.3-5 STESynthesis[101X
  
  [33X[1;0Y[29X[2XSTESynthesis[102X( [3XFunc[103X ) [32X function[133X
  
  [33X[0;0YThe  function [10XSTESynthesis[110X is based on the algorithm proposed in [Der65]. In
  each iteration we perturb an [22Xn+1[122X-dimensional weight-threshold vector in such
  manner   that   the   distance  between  the  given  vector  and  a  desired
  weight-threshold  vector,  if  such  vector  exists,  is  reduced. So if the
  Boolean function [10XFunc[110X is STE-realizable, then this procedure will eventually
  yield  an  acceptable  weight-threshold  vector. Otherwise iteration process
  will  eventually enter a limit cycle and the execution of [10XSTE_Synthesis[110X will
  be stopped.[133X
  
  [33X[0;0YFor  the Boolean function [10XFunc[110X the function [10XSTESynthesis[110X returns a threshold
  element if [10XFunc[110X is STE-realizable or an empty list otherwise.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X
[128X[104X
    [4X[25Xgap>[125X [27Xf:=x*y+x+y;;
[127X[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+x+y;;
[127X[104X
    [4X[25Xgap>[125X [27Xf:=PolynomialToBooleanFunction(pol,2);;
[127X[104X
    [4X[25Xgap>[125X [27Xte:=STESynthesis(f);
[127X[104X
    [4X[28X< threshold element with weight vector [ 2, 2 ] and threshold 1 >
[128X[104X
    [4X[25Xgap>[125X [27XDisplay(te);
[127X[104X
    [4X[28XWeight vector = [ 2, 2 ], Threshold = 1.
[128X[104X
    [4X[28XThreshold Element realizes the function f :
[128X[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 ] || 1
[128X[104X
    [4X[28XProduct of Sums:[ 0 ]
[128X[104X
    [4X[28X
[128X[104X
  [4X[32X[104X
  
