SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Zenan Li<sup>1</sup> Yunpeng Huang<sup>1</sup> Zhaoyu Li<sup>2</sup>  
Yuan Yao<sup>1</sup> Jingwei Xu<sup>1</sup> Taolue Chen<sup>3</sup> Xiaoxing Ma<sup>1</sup> Jian Lü<sup>1</sup>
$^{1}$ State Key Lab of Novel Software Technology, Nanjing University, China  
 $^{2}$ Department of Computer Science, University of Toronto, Canada  
 $^{3}$ School of Computing and Mathematical Sciences, Birkbeck, University of London, UK {lizn, hyp}@smail.nju.edu.cn, zhaoyu@cs.toronto.edu, t.chen@bbk.ac.uk, {y.yao,jingweix,xxm,lj}@nju.edu.cn
Neuro-symbolic systems combine neural perception and logical reasoning, representing one of the priorities of AI research. End-to-end learning of neuro-symbolic systems is highly desirable, but remains to be challenging. Resembling the distinction and cooperation between System 1 and System 2 of human thought (à la Kahneman), this paper proposes a framework that fuses neural network training, symbol grounding, and logical constraint synthesis to support learning in a weakly supervised setting. Technically, it is cast as a game with two optimization problems which correspond to neural network learning and symbolic constraint learning respectively. Such a formulation naturally embeds symbol grounding and enables the interaction between the neural and the symbolic part in both training and inference. The logical constraints are represented as cardinality constraints, and we use the trust region method to avoid degeneracy in learning. A distinguished feature of the optimization lies in the Boolean constraints for which we introduce a difference-of-convex programming approach. Both theoretical analysis and empirical evaluations substantiate the effectiveness of the proposed framework.
Perception and reasoning serve as fundamental human abilities that are intrinsically linked within the realm of human intelligence [Kahneman, 2011, Booch et al., 2021]. The objective of our study is to develop a learning framework for neuro-symbolic systems (e.g., the one illustrated in Figure 1), enabling simultaneous learning of neural perception and symbolic reasoning.
The merit of neuro-symbolic learning lies in resembling the integration of System 1 and System 2 of human minds [Kahneman, 2011, Yoshua and Gary, 2020, LeCun, 2022]. First, it eliminates unnatural and sometimes costly human labeling of the latent variables and conducts learning in an end-to-end fashion. Second, it generates not only a neural network for perception, but also a set of explicit (symbolic) constraints enabling exact and interpretable logical reasoning. Last but not least, the mutually beneficial interaction between the neural and the symbolic parts during both training and inference stages potentially achieves better performance than separated learning approaches.
However, existing approaches do not provide an adequate solution to the problem. They either (1) are not end-to-end, i.e., human intervention is employed to label the latent  $\mathbf{z}$  so that the task can be divided into a purely neural subtask of image classification and a purely symbolic subtask of constraint solving, or (2) are not interpretable, i.e., can only approximate symbolic reasoning with neural network but without explicit logical constraints generated (e.g., Wang et al. [2019], Yang et al. [2023]), which inevitably sacrifices the exactness and interpretability of symbolic reasoning, resulting in an inaccurate black-box predictor but not a genuine neuro-symbolic system.
Figure 1: An example of neuro-symbolic learning for visual SudoKu solving. In this task, the neural network is employed to transform the puzzle image (strawberry etc.) into its corresponding symbols, while symbolic reasoning is utilized to produce the puzzle's solution. Importantly, the neuro-symbolic learning task is framed in a weakly supervised setting, where only the raw input (the puzzle image  $\mathbf{x}$ ) and the final output (the puzzle solution  $\mathbf{y}$ , but without numbers in  $\mathbf{z}$ ) is observed.
We argue that end-to-end and interpretable neuro-symbolic learning is extremely challenging due to the semantic and representation gaps between the neural part and the symbolic part. The semantic gap caused by the latency of the intermediate symbol (i.e.,  $\mathbf{z}$  in Figure 1) makes the neural network training lack effective supervision and the logic constraint synthesis lack definite inputs. The representation gap between the differentiable neural network and the discrete symbol logic makes it difficult to yield explicit symbolic constraints given the continuous neural network parameters. Despite existing proposals mitigating some of these obstacles such as visual symbol grounding [Topan et al., 2021, Li et al., 2023], softened logic loss [Kimmig et al., 2012, Xu et al., 2018], semidefinite relaxation [Wang et al., 2019], etc., none of them realize the full merit of neuro-symbolic learning.
In this paper, we propose a new neuro-symbolic learning framework directly meeting the challenges. It bridges the semantic gap with an efficient symbol grounding mechanism that models the cooperative learning of both the neural network and the logical constraint as a bilevel optimization problem. It bridges the representation gap by employing difference-of-convex (DC) programming as a relaxation technique for Boolean constraints in the optimization. DC programming ensures the convergence to explicit logical constraints, which enables exact symbolic reasoning with powerful off-the-shell tools such as SAT/SMT solvers [Eén and Sorensson, 2006, Bailleux and Boufkhad, 2003, Bailleux et al., 2006] during the inference stage. In addition, to address degeneracy in logical constraint learning, i.e., the tendency to learn only trivial logical constraints (e.g., resulting in simple rules insufficient to solve SudoKu), we introduce an additional trust region term [Boyd et al., 2004, Conn et al., 2000], and then employ the proximal point algorithm in the learning of logical constraints.
We provide a theoretical analysis of the convergence of our algorithm, as well as the efficacy of the DC relaxation in preserving the exactness and the trust region in preventing degeneracy. Empirical evaluations with four tasks, viz. Visual Sudoku Solving, Self-Driving Path Planning, Chained XOR, and Nonograms, demonstrate the new learning capability and the significant performance superiority of the proposed framework.
Organization. Section 2 formulates our neuro-symbolic learning framework. Section 3 details the algorithm and theoretical analysis. Section 4 presents empirical evaluations. Section 5 covers related work. Section 6 discusses the limitations. Section 7 concludes the paper.
2 Neuro-symbolic Learning Framework
In this paper, we focus on end-to-end neuro-symbolic systems comprising two components: (1) neural network  $f_{\theta} \colon \mathcal{X} \to \mathcal{Z}$ , which transforms the raw input  $\mathbf{x} \in \mathcal{X}$  into a latent state  $\mathbf{z} \in \mathcal{Z}$ ; and (2) symbolic reasoning  $g_{\phi} \colon \mathcal{Z} \to \mathcal{Y}$ , which deduces the final output  $\mathbf{y} \in \mathcal{Y}$  from state  $\mathbf{z} \in \mathcal{Z}$ . Both components are built simultaneously, taking only the input  $\mathbf{x}$  and output  $\mathbf{y}$  as supervision. We assume that  $\mathcal{Z}$  and  $\mathcal{Y}$  are represented by finite sets, and thus we can encode  $\mathbf{z}$  and  $\mathbf{y}$  by binary vectors using
one-hot encoding. For ease of discussion, we directly define  $\mathcal{Z}$  and  $\mathcal{V}$  to be spaces  $\mathcal{B}^u$  and  $\mathcal{B}^v$  of Boolean vectors, respectively, where  $\mathcal{B} = \{0,1\}$ .
Unlike existing work (e.g., SATNet [Wang et al., 2019]) that simulates logical reasoning in an implicit and approximate way via a network layer, our key insight is to learn explicit logical constraints  $h_{\phi} \colon \mathcal{B}^{u + v} \to \mathcal{B}$  on  $(\mathbf{z}, \mathbf{y})$  in the training phrase, which allow to perform exact reasoning by off-the-shelf constraint solvers (e.g., SMT solvers) in the inference phrase. Fig. 1 illustrates our neuro-symbolic learning framework.
The latent state  $\mathbf{z}$  enables the interaction between neural perception and logical reasoning. If  $\mathbf{z}$  were observable, we could perform the learning of neural network and logical constraint by solving the following two separate optimization problems:
$$
\pmb {\theta} = \arg \min _ {\pmb {\theta}} \mathbb {E} _ {(\mathbf {x}, \mathbf {z}) \sim \mathcal {D} _ {1}} [ \ell_ {1} (f _ {\pmb {\theta}} (\mathbf {x}), \mathbf {z}) ], \qquad \phi = \arg \min _ {\pmb {\phi}} \mathbb {E} _ {(\mathbf {z}, \mathbf {y}) \sim \mathcal {D} _ {2}} [ \ell_ {2} (h _ {\phi} (\mathbf {z}, \mathbf {y}), 1) ],
$$
where  $\ell_1(f_\theta(\mathbf{x}), \mathbf{z})$  refers to the error between network prediction  $f_\theta(\mathbf{x})$  and the actual symbol  $\mathbf{z}$ , and  $\ell_2(h_\phi(\mathbf{z}, \mathbf{y}), 1)$  refers to the (un)satisfaction degree of the learned logical constraints  $h_\phi(\mathbf{z}, \mathbf{y}) = 1$ .
Nevertheless, with  $\mathbf{z}$  being latent, these two problems become tightly coupled:
$$
\begin{array}{l} \boldsymbol {\theta} = \arg \min  _ {\boldsymbol {\theta}} \mathbb {E} _ {(\mathbf {x}, \mathbf {y}) \sim \mathcal {D}} [ \ell_ {1} (f _ {\boldsymbol {\theta}} (\mathbf {x}), \mathbf {z}) ], \quad \boldsymbol {\phi} = \arg \min  _ {\boldsymbol {\phi}} \mathbb {E} _ {(\mathbf {x}, \mathbf {y}) \sim \mathcal {D}} [ \ell_ {2} (h _ {\boldsymbol {\phi}} (\mathbf {z}, \mathbf {y}), 1) ], \\ \text {s . t .} \quad h _ {\phi} (\mathbf {z}, \mathbf {y}) = 1, \mathbf {z} \in \mathcal {Z}; \quad \text {s . t .} \quad \mathbf {z} = f _ {\theta} (\mathbf {x}), \mathbf {z} \in \mathcal {Z}. \\ \end{array}
$$
We further surrogate the constraint satisfaction by loss functions, and obtain essentially a game formulation as follows:
$$
\begin{array}{l} \boldsymbol {\theta} = \arg \min  _ {\boldsymbol {\theta}} \mathbb {E} _ {(\mathbf {x}, \mathbf {y}) \sim \mathcal {D}} [ \ell_ {1} (f _ {\boldsymbol {\theta}} (\mathbf {x}), \bar {\mathbf {z}}) ], \quad \phi = \arg \min  _ {\boldsymbol {\phi}} \mathbb {E} _ {(\mathbf {x}, \mathbf {y}) \sim \mathcal {D}} [ \ell_ {2} (h _ {\boldsymbol {\phi}} (\bar {\mathbf {z}}, \mathbf {y}), 1) ], \tag {1} \\ \text {s . t .} \quad \bar {\mathbf {z}} = \arg \min  _ {\mathbf {z} \in \mathcal {Z}} \ell_ {2} \left(h _ {\phi} (\mathbf {z}, \mathbf {y}), 1\right); \qquad \text {s . t .} \quad \bar {\mathbf {z}} = \arg \min  _ {\mathbf {z} \in \mathcal {Z}} \ell_ {1} \left(f _ {\theta} (\mathbf {x}), \mathbf {z}\right). \\ \end{array}
$$
Three players are involved in this game: neural network  $f_{\theta}$  and logical constraint  $h_{\phi}$  pursue optimal (prediction/satisfaction) accuracy, while  $\mathbf{z}$  strives for the grounding that integrates the network prediction and logical reasoning.
2.1 Efficient and Effective Logical Constraint Learning
For efficient learning of logical constraints, we adopt cardinality constraint [Syrjänen, 2009, 2004, Fiorini et al., 2021] to represent logical constraint. Cardinality constraints can be easily arithmetized, enabling the conventional optimization method and avoiding the computationally expensive model counting or sampling [Manhaeve et al., 2018, Xu et al., 2018, Li et al., 2020, 2023], which significantly boosts the learning efficiency. In addition, the conjunctive normal form and cardinality constraints can be easily converted from each other, ensuring not only the expressiveness of the learned constraints, but also the seamless compatibility with existing reasoning engines.
Formally, we denote the column concatenation of  $\mathbf{z}$  and  $\mathbf{y}$  by  $(\mathbf{z};\mathbf{y})$ , and define a cardinality constraint  $h_{\phi}(\mathbf{z},\mathbf{y}) := \mathbf{w}^{\mathrm{T}}(\mathbf{z};\mathbf{y}) \in [b_{\min}, b_{\max}]$ , where  $\phi = (\mathbf{w}, b_{\min}, b_{\max}), \mathbf{w} \in \mathcal{B}^{u + v}$  is a Boolean vector, and  $b_{\min}, b_{\max} \in \mathcal{N}_{+}$  are two positive integers. Moreover, we can directly extend  $h_{\phi}$  to the matrix form representing  $m$  logical constraints, i.e.,
$$
h _ {\phi} (\mathbf {z}, \mathbf {y}) := \boldsymbol {W} (\mathbf {z}; \mathbf {y}) = \left(\boldsymbol {w} _ {1} ^ {\top} (\mathbf {z}; \mathbf {y}), \dots , \boldsymbol {w} _ {m} ^ {\top} (\mathbf {z}; \mathbf {y})\right) \in [ \boldsymbol {b} _ {\min }, \boldsymbol {b} _ {\max } ],
$$
where  $\phi = (\pmb{W},\pmb{b}_{\min},\pmb{b}_{\max})$ $\pmb {W}\coloneqq (\pmb{w}_1^{\top};\dots ;\pmb{w}_m^{\top})\in \mathcal{B}^{m\times (u + v)}$  , and  $\pmb{b}_{\mathrm{min}},\pmb{b}_{\mathrm{max}}\in \mathcal{N}_{+}^{m}$
For effective learning of logical constraints, one must tackle the frequent problem of degeneracy that causes incomplete or trivial constraints $^2$ . First, for the bounding box  $[b_{\min}, b_{\max}]$ , any of its superset is a feasible result of logical constraint learning, but we actually expect the tightest one. To overcome this difficulty, we propose to use the classic mean squared loss, i.e., defining  $\ell_2(h_\phi(\mathbf{z}, \mathbf{y}), 1) = \| \mathbf{W}(\mathbf{z}; \mathbf{y}) - \mathbf{b} \|^2$ , where  $\mathbf{b}$  can be computed in optimization or pre-defined. Then, our logical constraint learning problem can be formulated as a Boolean least squares problem [Vandenberghe and Boyd, 2004]. The unbiased property of least squares indicates that  $\mathbf{b} \approx (\mathbf{b}_{\min} + \mathbf{b}_{\max}) / 2$ , and
$^1$ Cardinality constraints express propositional logic formulae by constraining the number of variables being true. For example,  $x \vee y \vee \neg z$  is encoded as  $x + y + \bar{z} \geq 1$ .
For example, suppose the targeted logical constraints are  $\mathbf{z}_1 + \mathbf{z}_2 + \mathbf{y}_1 \geq 2$  and  $\mathbf{z}_1 \geq 1$ . Degeneracy happens if one only obtains a single constraint  $\mathbf{z}_1 + \mathbf{z}_2 + \mathbf{y}_1 \geq 2$  or a trivial constraint  $\mathbf{z}_1 \geq 0$ .
the minimum variance property of least squares ensures that we can achieve a tight bounding box  $\left[\pmb{b}_{\min},\pmb{b}_{\max}\right]$  [Henderson, 1975, Bjorck, 1990, Hastie et al., 2009].
Second, it is highly possible that some of the  $m$  distinct logical constraints as indicated by matrix  $\mathbf{W}$  eventually degenerate to the same one during training, because the Boolean constraints and stochastic gradient descent often introduce some implicit bias [Gunasekar et al., 2017, Smith et al., 2021, Ali et al., 2020]. To mitigate this problem, we adopt the trust region method [Boyd et al., 2004, Conn et al., 2000], i.e., adding constraints  $\| \pmb{w}_i - \pmb{w}_i^{(0)}\| \leq \lambda, i = 1,\dots,m$ , where  $\pmb{w}_i^{(0)}$  is a pre-defined centre point of the trust region. The trust region method enforces each  $\pmb{w}_i$  to search in their own local region. We give an illustrative figure in Appendix D to further explain the trust region method.
To summarize, using the penalty instead of the trust region constraint, we can formulate the optimization problem of logical constraint learning in (1) as
$$
\min  _ {(\boldsymbol {W}, \boldsymbol {b})} \mathbb {E} _ {(\mathbf {x}, \mathbf {y}) \sim \mathcal {D}} [ \| \boldsymbol {W} (\bar {\mathbf {z}}; \mathbf {y}) - \boldsymbol {b} \| ^ {2} ] + \lambda \| \boldsymbol {W} - \boldsymbol {W} ^ {(0)} \| ^ {2}, \tag {2}
$$
$$
\mathrm {s . t .} \quad \bar {\mathbf {z}} = \arg \min  _ {\mathbf {z} \in \mathcal {Z}} \ell_ {1} (f _ {\boldsymbol {\theta}} (\mathbf {x}), \mathbf {z}), \quad \boldsymbol {W} \in \mathcal {B} ^ {m \times (u + v)}, \quad \boldsymbol {b} \in \mathcal {N} _ {+} ^ {m}.
$$
2.2 Neural Network Learning in Tandem with Constraint Learning
A key challenge underlines end-to-end neuro-symbolic learning is symbol grounding, which is to tackle the chicken-and-egg situation between network training and logical constraint learning: training the network requires the supervision of symbol  $\mathbf{z}$  that comes from solving the learned logical constraints, but the constraint learning needs  $\mathbf{z}$  as input recognized by the trained network. Specifically, since matrix  $\pmb{W}$  is often underdetermined in high-dimensional cases, the constraint  $\bar{\mathbf{z}} = \arg \min_{\mathbf{z} \in \mathcal{Z}} \ell_2(h_\phi(\mathbf{z}, \mathbf{y}), 1) := \| \pmb{W}(\mathbf{z}; \mathbf{y}) - \pmb{b} \|^2$  often has multiple minimizers (i.e., multiple feasible groundings of  $\mathbf{z}$ ), all of which satisfy the logical constraints  $h_\phi(\mathbf{z}, \mathbf{y}) = 1$ . Moreover, matrix  $\pmb{W}$  is also a to-be-trained parameter, meaning that it is highly risky to determine the symbol grounding solely on the logical constraints.
To address these issues, instead of (approximately) enumerating all the feasible solutions via model counting or sampling [Manhaeve et al., 2018, Xu et al., 2018, Li et al., 2020, van Krieken et al., 2022, Li et al., 2023], we directly combine network prediction and logical constraint satisfaction to establish symbol grounding, owing to the flexibility provided by the cardinality constraints. Specifically, for given  $\alpha \in [0, +\infty)$ , the constraint in network learning can be rewritten as follows,
$$
\bar {\mathbf {z}} = \arg \min  _ {\mathbf {z} \in \mathcal {Z}} \| \boldsymbol {W} (\mathbf {z}; \mathbf {y}) - \boldsymbol {b} \| ^ {2} + \alpha \| \mathbf {z} - f _ {\boldsymbol {\theta}} (\mathbf {x}) \| ^ {2}.
$$
The coefficient  $\alpha$  can be interpreted as the preference of symbolic grounding for network predictions or logical constraints. For  $\alpha \rightarrow 0$ , the symbol grounding process can be interpreted as distinguishing the final symbol  $\mathbf{z}$  from all feasible solutions based on network predictions. For  $\alpha \rightarrow +\infty$ , the symbol grounding process can be viewed as a "correction" step, where we revise the symbol grounding from network's prediction towards logical constraints. Furthermore, as we will show in Theorem 1 later, both symbol grounding strategies can finally converge to the expected results.
The optimization problem of network training in (1) can be written as
$$
\min  _ {\boldsymbol {\theta}} \mathbb {E} _ {(\mathbf {x}, \mathbf {y}) \sim \mathcal {D}} [ \| \bar {\mathbf {z}} - f _ {\boldsymbol {\theta}} (\mathbf {x}) \| ^ {2} ], \tag {3}
$$
$$
\mathrm {s . t .} \quad \bar {\mathbf {z}} = \arg \min  _ {\bar {\mathbf {z}} \in \mathcal {Z}} \| W (\bar {\mathbf {z}}; \mathbf {y}) - \mathbf {b} \| ^ {2} + \alpha \| \bar {\mathbf {z}} - f _ {\theta} (\mathbf {x}) \| ^ {2}.
$$
where we also use the mean squared loss, i.e.,  $\ell_1(f_\theta(\mathbf{x}), \mathbf{z}) = \| f_\theta(\mathbf{x}) - \mathbf{z} \|^2$ , for compatibility.
Our general framework is given by (1), instantiated by (2) and (3). Both optimizations contain Boolean constraints of the form  $\| Q\pmb{u} - \pmb{q}_1\|^2 + \tau \| \pmb{u} - \pmb{q}_2\|^2$  where  $\pmb{u}$  are Boolean variables. We propose to relax these Boolean constraints by difference of convex (DC) programming [Tao and Hoai An, 1997, Yuille and Rangarajan, 2003, Lipp and Boyd, 2016, Hoai An and Tao, 2018]. Specifically, a
$^3$ In (2), for each logic constraint,  $\pmb{Q} = (\mathbf{z};\mathbf{y})^{\top}$ ,  $\pmb{q}_1 = \pmb{b}_i$ ,  $\pmb{q}_2 = \pmb{w}_i^{(0)}$ , and  $\tau = \lambda$ ; in (3),  $\pmb{Q} = \pmb{W}$ ,  $\pmb{q}_1 = \pmb{b}$ ,  $\pmb{q}_2 = (f_\theta(\mathbf{x});\mathbf{y})$ , and  $\tau = \alpha$ .
Boolean constraint  $u \in \{0,1\}$  can be rewritten into two constraints of  $u - u^2 \geq 0$  and  $u - u^2 \leq 0$ . The first constraint is essentially a box constraint, i.e.,  $u \in [0,1]$ , which is kept in the optimization. The second one is concave, and we can equivalently add it as a penalty term, as indicated by the following proposition [Bertsekas, 2015, Hansen et al., 1993, Le Thi and Ding Tao, 2001].
Proposition 1. Let  $e$  denote the all-one vector. There exists  $t_0 \geq 0$  such that for every  $t > t_0$ , the following two problems are equivalent, i.e., they have the same optimum.
$(P)$ $\min_{\pmb {u}\in \{0,1\} ^n}q(\pmb {u})\coloneqq \| \pmb {Q}\pmb {u} - \pmb {q}_1\| ^2 +\tau \| \pmb {u} - \pmb {q}_2\| ^2,$
$(P_{t})$ $\min_{\pmb {u}\in [0,1]^{n}}q^{t}(\pmb {u}):= \| \pmb {Q}\pmb {u} - \pmb{q}_{1}\|^{2} + \tau \| \pmb {u} - \pmb{q}_{2}\|^{2} + t(\pmb{e}^{\top}\pmb {u} - \pmb{u}^{\top}\pmb {u}).$
Remarks. We provide more details, including the setting of  $t_0$ , in Appendix A.
However, adding this penalty term causes non-convexity. Thus, DC programming further linearizes the penalty  $u - u^2 \approx \tilde{u} - \tilde{u}^2 + (u - \tilde{u})(1 - 2\tilde{u})$  at the given point  $\tilde{u}$ , and formulates the problem in Proposition 1 as
$$
\min  _ {\boldsymbol {u} \in [ 0, 1 ] ^ {n}} \| \boldsymbol {Q} \boldsymbol {u} - \boldsymbol {q} _ {1} \| ^ {2} + \tau \| \boldsymbol {u} - \boldsymbol {q} _ {2} \| ^ {2} + t (\boldsymbol {e} - 2 \tilde {\boldsymbol {u}}) ^ {\mathsf {T}} \boldsymbol {u}.
$$
By applying this linearization, we achieve a successive convex approximation to the Boolean constraint [Razaviyayn, 2014], ensuring that the training is more stable and globally convergent [Lipp and Boyd, 2016]. Furthermore, instead of fixing the coefficient  $t$ , we propose to gradually increase it until the Boolean constraint is fully satisfied, forming an "annealing" procedure. We illustrate the necessity of this strategy in the following proposition [Beck and Teboulle, 2000, Xia, 2009].
Proposition 2. A solution  $\mathbf{u} \in \{0,1\}^n$  is a stationary point of  $(P_{t})$  if and only if
$$
[ \nabla q (\boldsymbol {u}) ] _ {i} (1 - 2 \boldsymbol {u} _ {i}) + t \geq 0, \quad i = 1, \dots , n.
$$
Then, if  $\mathbf{u} \in \{0,1\}^n$  is a global optimum of  $(P)$  (as well as  $(P_t)$ ), it holds that
$$
[ \nabla q (\boldsymbol {u}) ] _ {i} (1 - 2 \boldsymbol {u} _ {i}) + \rho_ {i} \geq 0, \quad i = 1, \dots , n,
$$
where  $\rho_{i}$  is the  $i$ -th diagonal element of  $(\pmb{Q}^{\mathsf{T}}\pmb{Q} + \tau \pmb{I})$
Remarks. The proposition reveals a trade-off of  $t$ : a larger  $t$  encourages exploration of more stationary points satisfying the Boolean constraints, but a too large  $t$  may cause the converged point to deviate from the optimality of (P). Therefore, a gradual increase of  $t$  is sensible for obtaining the desired solution. Moreover, the initial minimization under small  $t$  results in a small gradient value (i.e.,  $|[\nabla q(\pmb{u})]_i|$ ), thus a Boolean stationary point can be quickly achieved with a few steps of increasing  $t$ .
For a given dataset  $\{(\mathbf{x}_i,\mathbf{y}_i)\}_{i = 1}^N$ ,  $\mathbf{X} = (\mathbf{x}_1,\dots ,\mathbf{x}_N)$  and  $\mathbf{Y} = (\mathbf{y}_1,\dots ,\mathbf{y}_N)$  represent the data matrix and label matrix respectively, and  $f_{\pmb{\theta}^{(k)}}(\mathbf{X})$  denotes the network prediction at the  $k$ -th iteration.
Logical constraint learning. Eliminating the constraint in (2) by letting  $\mathbf{Z} = f_{\pmb{\theta}^{(k)}}(\mathbf{X})$ , the empirical version of the logical constraint learning problem at the  $(k + 1)$ -th iteration is
$$
\min  _ {(\boldsymbol {W}, \boldsymbol {b})} \sum_ {i = 1} ^ {m} \| (f _ {\boldsymbol {\theta} ^ {(k)}} (\mathbf {X}); \mathbf {Y}) \boldsymbol {w} _ {i} - \boldsymbol {b} _ {i} \| ^ {2} + \lambda \| \boldsymbol {w} _ {i} - \boldsymbol {w} _ {i} ^ {(0)} \| ^ {2} + t _ {1} (\boldsymbol {e} - 2 \boldsymbol {w} _ {i} ^ {(k)}) ^ {\top} \boldsymbol {w} _ {i},
$$
where  $\pmb{w}_1^{(k)},\dots,\pmb{w}_m^{(k)}$  are parameters of logical constraints at the  $k$ -th iteration. In this objective function, the first term is the training loss of logical constraint learning, the second term is the trust region penalty to avoid degeneracy, and the last term is the DC penalty of the Boolean constraint.