**4. Satisfiability in Discrete Hopfield Neural Network**

HNN [33] consists of interconnected neurons without a hidden layer. Each neuron in HNN is defined in bipolar state *Si* ∈ {1, −1} that represents true and false, respectively. An interesting feature about HNN is the ability to restructure the neuron state until the network reached its minimum state. Hence, the proposed HNN achieved the optimal final

state if the collection of neurons in the network reached the lowest value of the minimum energy. The general definition of HNN with the *i*-th activation is given as follows

$$S\_i = \begin{cases} \begin{array}{c} 1 \\ \end{array} , \quad \begin{array}{c} if \\ \end{array} \sum\_{i=0}^{N} \mathcal{W}\_{ij} \mathcal{S}\_j \ge \theta \\\ -1 \quad , \quad \text{otherwise} \end{array} \tag{4}$$

where *θ* and *Wij* represent a threshold and synaptic weight of the network, respectively. Without compromising the generality of HNN, some study used *θ* = 0 as the threshold value. Note that *N* is the number of 2SAT variables. *Wij* is also defined as the connection between neuron *Si* and *Sj*. The idea of implementing *Q*2*SAT* in HNN (HNN-2SAT) is due to the need of some symbolic rule that can govern the output of the network. The cost function *EQ*<sup>2</sup>*SAT* of the proposed *Q*2*SAT* in HNN is given as follows:

$$E\_{Q\_{2SAT}} = \sum\_{i=1}^{NC} \prod\_{j=1}^{2} M\_{ij} \tag{5}$$

where *NC* is the number of *EQ*<sup>2</sup>*SAT* clause. The definition of the clause *Mij* is given as follows [9]

$$M\_{ij} = \begin{cases} \frac{1}{2} \left( 1 - S\_y \right), & \text{if } \neg y \\\frac{1}{2} \left( 1 + S\_y \right), & \text{otherwise} \end{cases} \tag{6}$$

where *y* is the negation of literal in *Q*2*SAT*. It is also worth mentioning that *EQ*<sup>2</sup>*SAT* = 0 if the <sup>1</sup> 4 1 ± *Sy* = 0 is because the neuron state *Sy* associated to *Q*2*SAT* is fully satisfied. Each variable inside a particular *Mij* will be connected by *Wij*. Structurally, the synaptic weight of *Q*2*SAT* is always symmetrical for both the second- and third-order logical rule:

$$\mathcal{W}\_{AB}^{(2)} = \mathcal{W}\_{BA}^{(2)} \tag{7}$$

with no self-connection between neurons:

$$\mathcal{W}\_{AA}^{(2)} = \mathcal{W}\_{BB}^{(2)} = 0 \tag{8}$$

Note that Equations (5)–(8) only account for a non-redundant logical rule because the logical redundancies will result in the diminishing effect of the synaptic weight. The goal of the learning in HNN is to minimize the logical inconsistency that leads to *Q*2*SAT* = −1 or ¬*Q*2*SAT* = 1. Although synaptic weight of the HNN can be properly trained by using conventional method, such as Hebbian learning [33], ref. [14] demonstrated that the Wan Abdullah method can obtain the optimal synaptic weight with minimal neuron oscillation compared to Hebbian learning. For example, if the embedded logical clause is *C*<sup>1</sup> = (*A* ∨ ¬*B*), the synaptic weights will read (*WA*, *WB*,*WAB*) = (0.25, 0.25, −0.25). During retrieval phase of HNN-2SAT, the neuron state will be updated asynchronously based on the following equation.

$$S\_{\vec{i}} = \begin{cases} 1 & \text{ $\mathcal{I}$ } \sum\_{j=1, j \neq j}^{N} \mathcal{W}\_{ij}^{(2)} \mathcal{S}\_{\vec{j}} + \mathcal{W}\_{\vec{i}}^{(1)} \ge \xi \\ & \text{ $\mathcal{I}$ } \sum\_{j=1, j \neq j}^{N} \mathcal{W}\_{ij}^{(2)} \mathcal{S}\_{\vec{j}} + \mathcal{W}\_{\vec{i}}^{(1)} < \xi \end{cases} \tag{9}$$

where *Si* is a final neuron state with pre-defined threshold *ξ*. In terms of output squashing, the Sigmoid function can be used to provide non-linearity effects during neuron classification. Potentially, the final state of the neuron must contain information that lead to

*EQ*<sup>2</sup>*SAT* = 0, and the quality of the obtained state can be computed by using Lyapunov energy function:

$$H\_{Q\_{\bar{2}SAT}} = -\frac{1}{2} \sum\_{i=0, i\neq j}^{N} \sum\_{j=0, j\neq i}^{N} W\_{ij}^{(2)} S\_i S\_j - \sum\_{i=0}^{N} W\_i^{(1)} S\_i \tag{10}$$

According to [33], the symmetry of the synaptic weight is sufficient condition for the existence of the Lyapunov function. Hence, the value of *HQ*<sup>2</sup>*SAT* in Equation (10) decreases monotonically with network. The absolute minimum energy *H* min *Q*2*SAT* can pre-determined by substituting interpretation that leads to *EQ*<sup>2</sup>*SAT* = 0. In this case, if the obtained neuron state can satisfy *HQ*<sup>2</sup>*SAT* <sup>−</sup> *<sup>H</sup>* min *Q*2*SAT* <sup>≤</sup> *Tol*, the final neuron state achieved global minimum energy. Note that the current conventions of *Si* ∈ {1, −1} can be converted to binary by implementing different a Lyapunov function coined by [6].

#### **5. Proposed Method**

2SATRA is a logic mining method that can extract a logical rule from the dataset. The philosophy of the 2SATRA is to find the most optimal logical rule of Equation (1), which corresponds to the dynamic system of Equation (9). In the conventional 2SATRA proposed by [20], the choice of variable in 2SATRA will be determined randomly which leads to poor quality of the induced logic. The choices of the neurons are arranged randomly before the learning of HNN can take place. In this section, chi-square analysis will be used during the pre-processing stage. The aim of the association method is to assign the two best neurons/clauses that correspond to the outcome *Q*2*SAT*. These neurons will take part during the learning phase of HNN-2SAT which leads to better induced logic. In other words, the additional optimization layer is added to reduce the pre-training effort for 2SATRA to find the best logical rule.

Let *N* the number of neurons represent the attribute of the datasets *Si* = (*S*1, *S*2, *S*3,..., *SN*) where each neuron is converted into bipolar interpretation *Si* = {−1, 1}. Necessarily, 2SATRA is required to select *d* neurons that will be learned by HNN-2SAT. In this case, the number of possible neuron permutation after considering the learning logic *Q<sup>l</sup> <sup>i</sup>* structure is *<sup>N</sup>*! 2(*N*−*d*)! . By considering the relationship between *Q<sup>l</sup> <sup>i</sup>* and neuron *Si*, we can optimally select the pair of *Si* for each clause *Ci*. The *Si* selection for each *Ci* is given as follows:

$$Q\_i^l = \bigwedge\_{i=0, i \neq j}^{NC} \left( S\_i^{\min|P\_i|} \vee S\_i^{\min|P\_j|} \right), \quad i \neq j, \quad 0 \le P\_i \le a, \quad 0 \le P\_j \le a \tag{11}$$

where *Pi* is the *P* value between *Q<sup>l</sup> <sup>i</sup>* and the neuron *Si*. min|*Pi*| signifies the minimized value of *Pi* recorded between *Q<sup>l</sup> <sup>i</sup>* and *Si*, and the value of *α* is pre-defined by the network. Note that *i* = *j* does not significy a self-connection between the same neurons. By considering the bestand worst-case scenario, the neuron will be chosen at random if min|*Pi*<sup>|</sup> <sup>=</sup> min *Pj* . If the examined neurons do not achieve the pre-determined association, HNN-2SAT will reset the search space, which fulfils the threshold association value. Hence, by using Equation (11), the proposed 2SATRA is able to learn the early feature of the dataset. After obtaining the right set of neurons for *Q<sup>l</sup> i* , the dataset will be converted into bipolar representation:

$$S\_{\bar{i}} = \begin{cases} \begin{array}{c} 1 \\ -1 \end{array} , \quad S\_{\bar{i}} = 1 \\ \begin{array}{c} \text{otherwise} \end{array} \end{cases} \tag{12}$$

Note that we only consider the second-order clause or *C*(2) *<sup>i</sup>* for each clause in *<sup>Q</sup><sup>l</sup> i* . Hence, the collection of *Si* that leads to positive outcome of the learning data or *Q<sup>l</sup> <sup>i</sup>* = 1 will be segregated. By calculating the collection of *C*(2) *<sup>i</sup>* that leads to *<sup>Q</sup><sup>l</sup> <sup>i</sup>* = 1, the optimum logic *Qbest* is given as follows:

$$Q\_{\text{best}} = \max \left[ n \left( \mathbf{C}\_i^{(2)} \right) \right], \quad Q\_i^l = 1 \tag{13}$$

where *n C*(2) *i* is the number of *Q<sup>l</sup> <sup>i</sup>* that leads to *<sup>Q</sup><sup>l</sup> <sup>i</sup>* = 1. Hence, the logical feature of the *Qbest* can be learned by obtaining the synaptic weight of the HNN. In this case, the cost function in Equation (11) which corresponds to *Qbest* will be compared to Equation (5). By using Equation (9), we obtain the final neuron state *S<sup>B</sup> i* .

$$\boldsymbol{S}\_{i}^{induced} = \begin{cases} \boldsymbol{S}\_{i} & \text{ $\boldsymbol{S}\_{i}^{B}$ } = 1\\ \boldsymbol{\neg} \boldsymbol{S}\_{i} & \text{ $\boldsymbol{S}\_{i}^{B}$ } = -1 \end{cases} \tag{14}$$

Since the proposed HNN-2SAT only allows an optimal final neuron state, the quality of the *S<sup>B</sup> <sup>i</sup>* will be verified by using *HQ*<sup>2</sup>*SAT* <sup>−</sup> *<sup>H</sup>*min *Q*2*SAT* <sup>≤</sup> *Tol*. In this case, *<sup>S</sup><sup>B</sup> <sup>i</sup>* that leads to local minima will not be considered. Hence, the classification of the induced *Q<sup>B</sup> <sup>i</sup>* is as follows:

$$Q\_i^B = \left\{ \begin{array}{ll} \mathcal{Q}\_i^B & , \\ 0 & , \end{array} \, \Big|\, H\_{Q\_i^B} - H\_{Q\_i^B}^{\min} \Big| \le \mathfrak{d} \\ \text{ (15)}$$

where *H*min *Q<sup>B</sup> i* can be obtained from Equation (10). It is worth mentioning that if the two neurons do not have the strong association, the neurons will not be considered. Thus, if the association value for all neurons does not achieve the threshold variable 0 ≤ *ρ<sup>i</sup>* ≤ *α*, the proposed network will be reduced to conventional *k*SATRA proposed by [21,31]. Figure 1 shows the implementation of the proposed supervised logic mining or (S2SATRA). Algorithm 1 shows Pseudo code of the Proposed S2SATRA.


**Figure 1.** The implementation of the proposed S2SATRA.
