Heuristic Minimization of Symmetric Index Generation Functions utilizing their Properties

Memory-based logic synthesis of index generation functions (IGF) gained a lot of interest due to the applications of those functions (Sasao (2011, 2017, 2020)) in realizing pattern matching circuits. In the literature, there are many examples of using those functions in telecommunication, cybersecurity, and the Internet of Things for devices such as virtual routers and malicious data detection systems. What is more, the concept of a hardware implementation of index generation functions has been reported by Sasao (2020) as the key device in the network hardware. Index generation function maps unique integer value {1,2, ... , } to elements of a set Abstract

that consists of K different binary vectors, whose length equals N. Other assignments are left unspecified and function returns zero. The important property of those functions is that they are not fully defined, i.e., ≪ 2 . Thus, they can be efficiently minimized and implemented using fewer variables than N. In the literature, techniques such as variable reduction (Borowik and Łuba (2014), Sasao (2020)) and functional decomposition (Mazurkiewicz (2020a(Mazurkiewicz ( , 2020b, Nagayama et al. (2020)) are used very often to minimize memory usage. However, linear decomposition (using XOR gates) has been identified as being very efficient (Łuba et al. (2016), Mazurkiewicz and Łuba (2019), Sasao (2017Sasao ( , 2020), i.e., for M-out-of-N coders. Interestingly, logic synthesis methods can be easily transferred and adapted to the field of knowledge discovery and data mining (Borowik (2014), Borowik and Łuba (2014)), i.e., to minimize the number of attributes and remove redundant decision rules.
Using the linear decomposition, an index generation function is implemented as a composition of a linear transformation L (using EXOR gates) and a general function G that is implemented using memory (RAM/ROM). Linear transformation, i.e., a composition of several linear functions, reduces the number of variables from N to P. Thus, 2 -bit memory is required to implement function G.
In this paper, we analyze how the properties of symmetric index generation functions, i.e., their structure, influence the process of their minimization. In particular, we focus on the application of the existing heuristic linear decomposition algorithm by Mazurkiewicz and Łuba (2019). Symmetric index generation functions are a special class of index generation functions. We prove that existing heuristic methods can be easily applied to minimize this class of functions. According to our best knowledge, other authors (Nagayama et al. (2020)) addressed only optimum linear decomposition algorithms.
In this paper, we also prove that properties of symmetric index generation functions can be used to simplify the computations, i.e., the number of variables N can be efficiently reduced. The approach proposed in this paper was presented in Fig. 1. Since ≥ ′ ≥ , typically less memory needs to be used to implement the input function.

Fig. 1: Proposed approach
The rest of this paper is organized as follows: the second section defines symmetric index generation functions and compound degree. The linear decomposition algorithm using discernibility sets is described in the next section. In Section 4, we analyze the properties of symmetric index generation functions and their influence on the number of variables, i.e., we analyze functions. We also extend our previous work by Mazurkiewicz (2020c) and present the properties of functions. The results obtained using experimental software are presented in Section 5. The efficiency of the heuristic linear decomposition algorithm using the variable reduction method described in this paper is investigated in that section. The last section concludes the paper.

Preliminaries
An index generation function represents the following mapping: where is a set of different binary vectors, called registered vectors, i.e., ⊆ {0,1} . The important property of this function is that | | = ≪ 2 . Function F assigns the corresponding index (unique integer value from 1 to K) for every vector ∈ .
A characteristic function of an index generation function is where In this paper, we focus on symmetric index generation functions, i.e., index generation functions whose characteristic function is symmetric.
M-out-of-N coders are often used as standard benchmark functions of linear decomposition algorithms. Typically, , ∈ {1,2,3,4} and ∈ {16,20}. Those coders consist of = 0 , 1 binary vectors, whose length is N and Hamming weight is M. Such functions represent symmetric index generation functions (Sasao (2020)) and are denoted 2 . An example of such a function was presented in Table 1.  What is important, the classical variable reduction methods fail for 2 functions and reduce only one variable. Therefore, linear decomposition algorithms are mostly used to minimize those functions. In that case, an input function F(X) is realized using a general function G(Y) and P linear functions. Consider a linear function = =⊕ ?@ A ? B ? , where A ? ∈ C, B ? ∈ {0,1}. The compound degree of such function equals δ = ∑ B ?
?@ (each B ? is viewed as an integer). Therefore, the compound degree of the function G(Y) is equal to max ?@ , ,…, δ.

Linear Decomposition
To find a linear decomposition of an index generation function, a discernibility set might be used. In this section, we shortly present an iterative algorithm using such sets. For a detailed description please refer to the original paper by Mazurkiewicz and Łuba (2019). The efficiency of this algorithm for general index generation functions was already proven.
A discernibility set, denoted as I JK is defined as follows: p and q are indexes of registered vectors. Each vector ∈ has index p iff F(v) = p.
The collection of all I JK sets, i.e., for L, N ∈ {1,2, … , } and L < N, will be denoted as PI JK and its complement as IQ,RPI JK S. Additionally, the complement limited to sets with cardinality r will be denoted as IQ,RPI JK T S, ( ≤ . To find the decomposition of a function using several linear functions, the simple test can be used (Łuba et al. (2016), Mazurkiewicz and Łuba (2019)). Function A ? ⊕ A V (A ? , A V ∈ C) is a decomposition function of F iff WA ? , A V X ∉ PI JK . In that case, WA ? , A V X ∈ IQ,RPI JK S. This simple test can be generalized. For example, pair of two linear functions: The discernibility matrix can be used to represent PI JK . To improve the time efficiency of the algorithm, the repeating values are removed from this matrix. To illustrate the idea of discernibility sets, all I JK sets generated for the [ function, i.e., PI JK , were presented in Table 2. Additionally, the discernibility matrix was presented in Table  3. In each row, A ? = 1 iff A ? ∈ I JK . Notice that each row can be generated using EXOR operation on p-th and q-th vectors from the truth table.
To find linear functions that decompose an index generation function, an iterative approach was proposed (Mazurkiewicz and Łuba (2019)). The algorithm was presented as Algorithm 1. Some speed-up techniques were described in the original paper.
In this paper, we assume that the input function is not preprocessed using the argument reduction procedure (step 1 in Algorithm 1). For symmetric functions 2 , this procedure reduces only one variable and leads to a single row of all zeroes, which heavily affects the properties of analyzed functions. Furthermore, in our experiments, this step is replaced with the procedure described in Section 4.
The mentioned algorithm works as follows.
Firstly, discernibility sets are calculated and used to form a discernibility matrix (step 2).
Another approach called MinR was proposed to address this issue. It uses the number R of distinct row vectors in a truth table of a function limited to a subset of input variables C\i, where d denotes variables used in a linear function and |i| = (. For example, if = = A ⊕ A , then i = {A , A } and C\i = {A`, A b , … , A }. The function that provides the minimum value of R is chosen as a decomposition function. If two or more subsets have the same value of R, then the first function found is chosen. In that case, we proceed similarly to the FF method. Due to the additional calculations in a decomposition selection procedure, the MinR approach is more time-consuming than the FF approach. However, the results presented in the literature (Mazurkiewicz and Łuba (2019)) prove that it provides better results for M-out-of-N coders. On average, both approaches lead to similar results in terms of the solution quality. Therefore, the FF approach is much more useful for typical index generation functions due to the timeefficiency.
What is important, in both approaches the algorithm searches in each iteration for a decomposition function with a compound degree as small as possible. Thus, firstly IQ,RPI JK S is analyzed, then IQ,RPI JK S, and so on as long as ( ≤ and IQ,RRC~•S ≠ ∅.

Properties of Symmetric Functions
In this section, we analyze the properties of symmetric functions. We determine how they can be used for reducing the number of variables. In particular, they are used to modify the truth table of a function in the first step of Algorithm 1. In the first and second subsections, we focus on symmetric index generation functions with , = 1, i.e., . The last subsection extends previous work by Mazurkiewicz (2020c) and deals with functions.
As mentioned earlier, the classical variable reduction methods fail for 2 functions. Thus, the approach described in this section is really useful to speed-up other minimization techniques by reducing the number of input variables. The correctness of the theoretical consideration presented in this section was practically confirmed using experimental software (written in Python) and the functions that are presented in the next section.

Basic Minimization
Let , = 1 and ≥ 3. In that case, = . In a symmetric index generation function variable A ? = 1 (A ? ∈ C) in each registered vector ∈ iff * = !. Recall that Table 1 illustrates this property. In that case, any I JK set contains only two variables: A J and A K since registered vectors with indexes p and q will always differ on those two variables. Therefore, the generation of PI JK leads to a discernibility matrix that contains all possible vectors, whose length is N, and Hamming weight is two. Any variable A ? = 1 iff * = L ∨ * = N. Thus, IQ,RPI JK S = ∅ and no function with compound degree two can be used as a decomposition function.
On the other hand, PI JK does not contain any set with a cardinality bigger than two. Therefore, since {A , A , A`} ∈ IQ,RPI JK S the algorithm chooses a pair of functions: = = A ⊕ A and = = A ⊕ A` as decomposition functions in the FF approach. Recall that the MinR approach requires additional computations to select a function. However, the discernibility matrix of the analyzed symmetric index generation function can be also treated as a symmetric function. Thus, the value of R will be the same for all possible subsets d. This leads to the conclusion that the same pair of functions is chosen also in the MinR approach.
Notice that a pair of functions will be used as decomposition functions for any symmetric index generation function . What is important is that the pair is known in advance without any computations whatsoever. The number of variables is reduced from N to ′ = − 1.
Consider now the function after first iteration of the algorithm if ≥ 6, i.e., C! = ‚ A b , A a , … , A , = , = !. Notice that first and third vectors are vectors whose Hamming weight equals one. On the other hand, the second vector has 1 on both = and = variables. Thus, the truth table of a function still contains all possible vectors with Hamming weight one. The length of those vectors equals ′ = − 1. Therefore, IQ,RPI JK S = ∅ one more time. Decomposed function [ and all calculated I JK sets with cardinality two were presented in Tables 4 and 5 accordingly to illustrate described theoretical considerations.   Notice that for the FF approach the described procedure will be used iteratively ƒ = " `… times. Thus, the number of variables can be reduced to ′ = − ƒ without any computations. In the next subsection, we investigate if some additional improvement can be achieved.
On the other hand, for the MinR approach, we have to proceed differently after finding the first pair of decomposition functions. Notice that if subset d contains only variables A ? , then all rows in a truth table are distinct. Thus, P = . Recall that in the MinR approach, we look for a subset d that minimizes the value of R. If = ∈ i, then the second and third rows are the same, i.e., all variables A ? are zeroes and = = 1. Other rows are distinct. Thus, P = − 1 and pair of functions: A b ⊕ A a and A a ⊕ = is chosen as decomposition functions. In the end, the number of variables is reduced by two without any computations.

Further Minimization
From this point, we analyze only the FF approach. Let = 3 • k, k ∈ ℕ and C! = ‚ = , = , … , = !. If k = 2, then IQ,RPI JK S ≠ ∅ and no further minimization is possible. If k > 2, then the vectors from the truth table of a function can be represented as a composition of the following two matrices: In the result, we get the following matrix: Notice that matrix B contains only zeroes. Matrix A contains two rows with Hamming weight equal to one and one with Hamming weight equal to two. What is more, this matrix contains all possible vectors, whose length is two, and Hamming weight is one. In the matrix M, every row and every column contain only one matrix A. Thus, the matrix M contains all possible vectors, whose length is 2 • k, and Hamming weight is one. In that case, IQ,RPI JK S = ∅ and no function with compound degree equal to two can be used as a decomposition function.
Since matrix A contains a row of all ones, it is not possible to find a pair of decomposition functions = ? ⊕ = V and = V ⊕ = Z such that " − * = 1 ∨ • − " = 1. Thus, the first (in the lexicographic order) pair of decomposition functions that satisfies this limitation is chosen, i.e., = ⊕ =` and =`⊕ = a . In that case, the number of variables was reduced to -= ` − 1 without any computations.
On the other hand, if ≠ 3 • k ( ≥ 7), then we have C! = ‚ A , = , = , … , = ˜ ! or C! = ‚ A ˜ , A , = , = , … , = ˜ !. In that case, instead of the matrix M, we get one of the following matrices accordingly: Recall that the matrix M contains all possible rows with Hamming weight equal to one, whose length is 2 • k. Thus, both , and , matrices contain all possible 2 • k + 1 and 2 • k+2-bit length vectors accordingly. Therefore, again IQ,RPI JK S = ∅.
Notice that the , matrix contains a row such that only = and = are one. Thus, {A , = , = } ∈ PI JK and a pair of functions A ⊕ = and = ⊕ = cannot be used as decomposition functions. On the other hand, {A , = , =`} ∈ IQ,RPI JK S and one more variable is reduced without computations. Similarly, the , matrix contains a row such that only = is one. Thus, {A ˜ , A , = } ∈ PI JK and {A ˜ , A , = } ∈ IQ,RPI JK S.
As a result, for both matrices, we obtain a reduction of variables by " `… − 1 without any computations whatsoever.

Several remarks on 3 7 • functions
Let , = 2. In that case, a truth table of symmetric index generation function contains all = 0 2 1 binary vectors, whose length is N and Hamming weight is two. In this subsection, we consider S b function and present the analysis of the properties of the S Ÿ functions.
The truth table of the S b function is presented in Table 6. Notice that A equals one for the first three vectors. In that case, the rest of the variables, i.e., A , A` and A b , represent all possible vectors, whose length is − 1 and Hamming weight is one. Thus, a discernibility matrix contains all possible vectors with A = 0, whose Hamming weight is two, i.e., rows that represent I , I ` and I ` sets.   It should be also noted that for other vectors A equals zero and their Hamming weight is two. Thus, for L = {1,2,3} and N = {4,5,6}, sets I JK contain all possible vectors with A = 1 and Hamming weight two. In that case, the generation of PI JK leads to a discernibility matrix that contains all possible vectors, whose length is N and Hamming weight is two. It also contains rows of all ones, e.g., The obtained discernibility matrix (before removing duplicates) was presented in Table 7. Based on that, the algorithm chooses a pair of functions to decompose the input function, i.e., = = A ⊕ A and = = A ⊕ A` 0{A , A , A`} ∈ IQ,RPI JK S1.  For bigger values of N ( ≥ 6), it should be noted that set of vectors for a subset of input variables, i.e., {A b , A a , … , A }, contains all possible vectors with Hamming weight equal to one and two, and vectors of all zeroes. Using considerations described earlier in this section, we know that {A b , A a , A [ } ∈ IQ,RPI JK S. Thus, =`= A b ⊕ A a and = b = A a ⊕ A [ . This leads to a conclusion that the approach for S Ÿ functions is quite similar to that described in Section 4a of this paper. We can repeat this procedure ƒ times in total. Therefore, the number of variables is reduced to -= − ƒ without any computations.

Evaluation
To evaluate the efficiency of the described approach, we analyze some basic symmetric index generation functions. The same functions were used by other authors (Nagayama et al. (2020)) to analyze the optimum algorithm. Table 8 shows obtained results, i.e., the reduction of the number of variables (from N to N'), using the described properties of symmetric functions and the FF approach. In table 8a, S. 4a denotes results obtained using the approach described in Section 4a of this paper. Column S. 4b shows the results after applying further minimization. Notice that the number of variables was significantly reduced without any computations. The values of N, K and the number of variables obtained using the approach from Section 4c for S Ÿ functions were presented in Table 8b. The linear decomposition algorithms can be applied to further reduce the number of variables. Since the time efficiency of all heuristic linear decomposition algorithms depends on the number of input variables, reducing it leads to better efficiency.  Table 9 shows the obtained results after minimizing symmetric functions using original heuristic algorithms by Mazurkiewicz and Łuba (2019). The column denoted Opt shows results obtained using the optimum method by Nagayama et al. (2020). However, this method searches only for solutions with a compound degree less or equal to five. Thus, it is possible to find a decomposition with fewer input variables than Opt. The column denoted ¤ presents the optimum theoretical solution calculated using the following formula:  MinR, were not designed to minimize the compound degree of a decomposed function.
Using the approach described in this paper, we obtain worse result by one variable for the [¡ function using the FF method. The main reason for this is that the argument reduction procedure is not applied. Thus, an input function is slightly different. For other analyzed symmetric functions, we get the same number of the variables P after linear decomposition.  The FF method is much faster than the optimum method by Nagayama et al. (2020) implemented in the C language and leads to quite good results. For example, it finds the solution for the £¡ function that is worse than the theoretical optimum by only one variable in 1.2 seconds. On the other hand, the time efficiency of the MinR method is much worse. Notice that the reduction of the number of variables leads to better time efficiency of both algorithms. Time FFp is up to 2.3 times shorter than the computation time of the original method. On the other hand, the MinR method has been accelerated only by 5%. Notice that the presented results prove that the MinR method is more time-consuming.
(a) The FF method.
(b) The MinR method. The obtained results are similar to those for functions. A significant reduction in computation time was achieved using the approach described in this paper. Notice that computation times are longer compared to those presented in Figure 2a. This is because the number of vectors K is much larger for functions. For example, the truth table of the `a function has = 35 vectors. On the other hand, if , = 2, then = 595 (see Table 8b).

Conclusion
In this paper, the properties of symmetric index generation functions were analyzed. Additionally, we proved that those properties can be used to efficiently reduce the number of variables. This leads to a lower computation time of the heuristic linear decomposition algorithms. In particular, the FF method was accelerated by up to 2.3 times for analyzed functions. Significant time improvement was also achieved for functions. What is more, we proved that heuristic algorithms can provide better results (in a shorter time) than the optimum algorithm in terms of the number of variables P. However, the compound degrees are much higher.
In this paper, we focused on symmetric functions with , ≤ 2. Therefore, our future work includes analysis of properties of functions with , ≥ 3 and their influence on heuristic linear decomposition algorithms.