1 Introduction
Given a propositional formula $F$ , a model $\sigma \models F$ is minimal if $\forall \sigma ^\prime \subset \sigma$ , it holds that $\sigma ^\prime \not \models F$ (Angiulli et al. Reference Angiulli, Ben-Eliyahu, Fassetti and Palopoli2014). Minimal model reasoning is fundamental to several tasks in artificial intelligence, including circumscription (McCarthy Reference Mccarthy1980; Lifschitz Reference Lifschitz1985), default logic (Reiter Reference Reiter1980), diagnosis (De Kleer et al. Reference De kleer, Mackworth and Reiter1992), and deductive databases under the generalized closed-world assumption (Minker Reference Minker1982). Although not new, minimal model reasoning has been the subject of several studies (Eiter and Gottlob Reference Eiter and Gottlob1993; Ben-Eliyahu and Dechter Reference Ben-ELIYAHU and Dechter1996; Kirousis and Kolaitis Reference Kirousis and Kolaitis2003; Ben-Eliyahu Reference Ben-Eliyahu2005), covering tasks such as minimal model finding (finding a single minimal model), minimal model checking (deciding whether a model is minimal), and minimal model entailment and membership (deciding whether a literal belongs to all minimal models or some minimal models, respectively) (Ben-Eliyahu and Palopoli Reference Ben-ELIYAHU and Palopoli1997).
Complexity analysis has established that minimal model reasoning is intractable, tractable only for specific subclasses of CNF (Conjunctive Normal Form) formulas. Typically, finding one minimal model for positive CNF formulasFootnote 1 is in $\mathsf{P}^{\mathsf{NP}[\mathcal{O}(\log{n})]}$ -hard (Cadoli Reference Cadoli1992b). Additionally, checking whether a model is minimal is $\mathsf{co}$ - $\mathsf{NP}$ -complete (Cadoli Reference Cadoli1992a), whereas queries related to entailment and membership are positioned at the second level of the polynomial hierarchy (Eiter and Gottlob Reference Eiter and Gottlob1993).
This study delves into a nuanced reasoning task on minimal models, extending beyond the simplistic binary version of decision-based queries. Our focus shifts towards quantitative reasoning with respect to minimal models. Specifically, we aim to count the number of minimal models for a given propositional formula. While enumerating a single minimal model is insufficient in many applications, counting the number of minimal models provides a useful metric for related measures (Hunter et al. Reference Hunter and Konieczny2008; Thimm Reference Thimm2016). Apart from specific structures of Boolean formulas, exact minimal model counting is $\#{\mathsf{co}}$ - $\mathsf{NP}$ -complete (Kirousis and Kolaitis Reference Kirousis and Kolaitis2003), established through subtractive reductions.
Although minimal models can theoretically be counted by iteratively employing minimal model finding oracles, this approach is practical only for a relatively small number of minimal models and becomes impractical as their number increases. Advanced model counting techniques have scaled to a vast number of models through sophisticated knowledge compilation methods (Darwiche Reference Darwiche2004; Thurley Reference Thurley2006), which involve transforming an input formula into a specific representation that enables efficient model counting based on the size of this new representation. However, applying knowledge compilation to minimal model counting presents unique challenges, which is elaborated in Section 4. Beyond knowledge compilation, approximate model counting has emerged as a successful strategy for estimating the number of models with probabilistic guarantees (Chakraborty et al. Reference Chakraborty, Meel and Vardi2013). In particular, the hashing-based technique, which partitions the search space into smaller, roughly equal partitions using randomly generated XOR constraints (Gomes et al. Reference Gomes, Sabharwal and Selman2021), has attracted significant attention. The model count can be estimated by enumerating the models within one randomly partition (Chakraborty et al. Reference Chakraborty, Meel and Vardi2013).
Our empirical study reveals that both approaches to minimal model counting face scalability issues in practical scenarios. Furthermore, knowing a lower bound of the model count is still useful in many applications and is often computed in the model counting literature (Gomes et al. Reference Gomes, Hoffmann, Sabharwal and Selman2007). Some applications require the enumeration of all minimal models (Jannach et al. Reference Jannach, Schmitz and Shchekotykhin2016; Bozzano et al. Reference Bozzano, Cimatti, Griggio, Jonas and Kimberley2022), but complete enumeration becomes infeasible for a large number of minimal models. Here, the lower bound of the number of minimal models provides a useful criterion for assessing the feasibility of enumerating all minimal models. Knowing this lower bound of the model count is often beneficial to estimate the size of the search space, which enables more specific targeting within the search space (Fichte et al. Reference Fichte, Gaggl and Rusovac2022). Consequently, our research shifts focus from counting all minimal models to determining a lower bound for their number.
The primary contribution of this paper is the development of methods to estimate a lower bound for the number of minimal models of a given propositional formula. This is achieved by integrating knowledge compilation and hashing-based techniques with minimal model reasoning, thus facilitating the estimation of lower bounds. At the core, the proposed methods conceptualize minimal models of a formula as answer sets of an ASP program; Answer Set Programming (ASP) is a declarative programing paradigm for knowledge representation and reasoning (Marek and Truszczyński Reference Marek and Truszczynski1999). Additionally, our proposed methods depend on the efficiency of well-engineered ASP systems. Our approach utilizing knowledge compilation effectively counts the number of minimal models or provides a lower bound. Besides, our hashing-based method offers a lower bound with a probabilistic guarantee. We apply our minimal model counting method to the domain of itemset mining, showcasing its utility. The effectiveness of our proposed methods has been empirically validated on datasets from model counting competitions and itemset mining. To assess the performance of our proposed methods, we introduce a new metric that considers both the quality of the lower bound and the computational time; our methods achieve the best score compared to existing minimal model reasoning systems.
The paper is organized as follows: Section 2 presents the background knowledge necessary to understand the main contributions of the paper; Section 4 outlines our proposed techniques for estimating the lower bound on the number of minimal models; Section 5 demonstrates the experimental evaluation of our proposed techniques; and Section 6 concludes our work with some indications of future research directions.
2 Preliminaries
Before going to the technical description, we present some background about propositional satisfiability, answer set programing, itemset mining from data mining, and a relationship between minimal models and minimal generations in transaction records.
2.1 Propositional satisfiability
In propositional satisfiability, we define the domain $\{0,1\}$ , which is equivalently $\{\mathsf{false}, \mathsf{true}\}$ and a propositional variable or atom $v$ takes a value from the domain. A literal $\ell$ is either a variable $v$ (positive literal) or its negation $\neg{v}$ (negative literal). A clause $C$ is a disjunction of literals, denoted as $C = \bigvee _{i} \ell _i$ . A Boolean formula $F$ , in Conjunctive Normal Form (CNF), is a conjunction of clauses, represented as $F = \bigwedge _{j} C_j$ . We use the notation $\mathsf{Var}(F)$ to denote the set of variables within $F$ .
An assignment $\tau$ over $X$ is a function $\tau : X \rightarrow \{0,1\}$ , where $X \subseteq \mathsf{Var}(F)$ . For an atom $v \in X$ , we define $\tau (\neg{v}) = 1 - \tau (v)$ . The assignment $\tau$ over $\mathsf{Var}(F)$ is a model of $F$ if $\tau$ evaluates $F$ to be $\mathsf{true}$ . Given $X \subseteq \mathsf{Var}(F)$ and an assignment $\tau$ , we use the notation $\tau _{\downarrow X}$ to denote the projection of $\tau$ onto variable set $X \subseteq \mathsf{Var}(F)$ . Given a CNF formula $F$ (as a set of clauses) and an assignment $\tau : X \rightarrow \{0,1\}$ , where $X \subseteq \mathsf{Var}(F)$ , the unit propagation of $\tau$ on $F$ , denoted $F|_{\tau }$ , is recursively defined as follows:
$F|_{\tau } = \begin{cases} 1 & \text{if $F \equiv 1$}\\ F'|_{\tau } & \text{if $\exists C \in F$ s.t. $F' = F \setminus \{C\}$,} \text{$\ell \in C$ and $\tau (\ell ) = 1$} \\ F'|_{\tau } \cup \{C'\} & \text{if $\exists C \in F$ s.t. $F' = F \setminus \{C\}$,} \text{$\ell \in C$,} \text{$C' = C \setminus \{\ell \}$} \\&\text{ and ($\tau (\ell ) = 0$ or $\{\neg{\ell }\} \in F$)} \end{cases}$
We often consider an assignment $\tau$ as a set of literals it assigns and $\mathsf{Var}(\tau )$ denotes the set of variables assigned by $\tau$ . For two assignments $\tau _1$ and $\tau _2$ , $\tau _1$ satisfies $\tau _2$ , denoted as $\tau _1 \models \tau _2$ , if ${\tau _1}_{\downarrow \mathsf{Var}(\tau _2)} = \tau _2$ . Otherwise, $\tau _1$ does not satisfy $\tau _2$ , denoted as $\tau _1 \not \models \tau _2$ .
An XOR constraint over $\mathsf{Var}(F)$ is a Boolean “XOR” ( $\oplus$ ) applied to the variables $\mathsf{Var}(F)$ . A random XOR constraint over variables $\{x_1, \ldots, x_k\}$ is expressed as $a_1 \cdot x_1 \oplus \ldots a_k \cdot x_k \oplus b$ , where all $a_i$ and $b$ follow the Bernoulli distribution with a probability of ${1}/{2}$ . An XOR constraint $x_{i_1} \oplus \ldots x_{i_k} \oplus 1$ (or $x_{i_1} \oplus \ldots x_{i_k} \oplus 0$ resp.) is evaluated as $\mathsf{true}$ if an even (or odd resp.) number of variables from $\{x_{i_1}, \ldots, x_{i_k}\}$ are assigned to $\mathsf{true}$ .
To define minimal models of a propositional formula $F$ , we introduce an ordering operator over models. For two given models $\tau _1$ and $\tau _2$ , $\tau _1$ is considered smaller than $\tau _2$ , denoted as $\tau _1 \leq \tau _2$ , if and only if for each $x \in \mathsf{Var}(F)$ , $\tau _1(x) \leq \tau _2(x)$ . We define $\tau _1$ as strictly smaller than $\tau _2$ , denoted as $\tau _1 \lt \tau _2$ , if $\tau _1 \leq \tau _2$ and $\tau _1 \neq \tau _2$ . A model $\tau$ is a minimal model of $F$ if and only if $\tau$ is a model of $F$ and no model of $F$ is strictly smaller than $\tau$ . We use the notation $\mathsf{MinModels}(F)$ to denote minimal models of $F$ and for a set $X \subseteq \mathsf{Var}(F)$ , $\mathsf{MinModels}(F)_{\downarrow X}$ denotes the minimal models of $F$ projected onto the variable set $X$ . The minimal model counting problem seeks to determine the cardinality of $\mathsf{MinModels}(F)$ , denoted $|\mathsf{MinModels}(F)|$ .
In this paper, we sometimes represent minimal models by listing the variables assigned as $\mathsf{true}$ . For example, suppose $\mathsf{Var}(F) = \{a,b,c\}$ and under minimal model $\tau = \{a, b\}$ , $\tau (a) = \tau (b) ={\mathsf{true}}$ and $\tau (c) ={\mathsf{false}}$ . The notation $\neg{\tau }$ denotes the negation of assignment $\tau$ ; in fact, $\neg{\tau }$ is a clause or disjunction of literals (e.g., when $\tau = \{a, b\}$ , $\neg{\tau } = \neg{a} \vee \neg{b}$ ). Throughout the paper, we use the notations $\tau$ and $\sigma$ to denote an arbitrary assignment and a minimal model of $F$ , respectively. For each model $\sigma \in \mathsf{MinModels}(F)$ , each of the variables assigned to $\mathsf{true}$ is justified; more specifically, for every literal $\ell \in \sigma$ , there exists a clause $c \in F$ such that $\sigma \setminus \{\ell \} \not \models c$ . Otherwise, $\sigma \setminus \{\ell \}$ (smaller than $\sigma$ ) is a model of $F$ .
2.2 Answer set programming
An answer set program $P$ consists of a set of rules, each rule is structured as follows:
where, $a_1, \ldots, a_k, b_1, \ldots, b_m, c_1, \ldots, c_n$ are propositional variables or atoms, and $k,m,n$ are non-negative integers. The notations $\mathsf{Rules}(P)$ and $\mathsf{atoms}(P)$ denote the rules and atoms within the program $P$ . In rule $r$ , the operator “not” denotes default negation (Clark Reference Clark1978). For each rule $r$ (Eq. (1)), we adopt the following notations: the atom set $\{a_1, \ldots, a_k\}$ constitutes the head of $r$ , denoted by $\mathsf{Head}(r)$ , the set $\{b_1, \ldots, b_m\}$ is referred to as the positive body atoms of $r$ , denoted by $\mathsf{Body}(r)^+$ , and the set $\{c_1, \ldots, c_n\}$ is referred to as the negative body atoms of $r$ , denoted by $\mathsf{Body}(r)^-$ . A rule $r$ called a constraint when $\mathsf{Head}(r) = \emptyset$ . A program $P$ is called a disjunctive logic program if $\exists r \in \mathsf{Rules}(P)$ such that $|\mathsf{Head}(r)| \geq 2$ (Ben-Eliyahu and Dechter Reference Ben-Eliyahu and Dechter1994).
In ASP, an interpretation $M$ over $\mathsf{atoms}(P)$ specifies which atoms are assigned $\mathsf{true}$ ; that is, an atom $a$ is $\mathsf{true}$ under $M$ if and only if $a \in M$ (or $\mathsf{false}$ when $a \not \in M$ resp.). An interpretation $M$ satisfies a rule $r$ , denoted by $M \models r$ , if and only if $(\mathsf{Head}(r) \cup \mathsf{Body}(r)^{-}) \cap M \neq \emptyset$ or $\mathsf{Body}(r)^{+} \setminus M \neq \emptyset$ . An interpretation $M$ is a model of $P$ , denoted by $M \models P$ , when $\forall _{r \in \mathsf{Rules}(P)} M \models r$ . The Gelfond-Lifschitz reduct of a program $P$ , with respect to an interpretation $M$ , is defined as $P^M = \{\mathsf{Head}(r) \leftarrow \mathsf{Body}(r)^+| r \in \mathsf{Rules}(P), \mathsf{Body}(r)^- \cap M = \emptyset \}$ (Gelfond and Lifschitz Reference Gelfond and Lifschitz1991). An interpretation $M$ is an answer set of $P$ if $M \models P$ and no $M^\prime \subset M$ exists such that $M^\prime \models P^M$ . We denote the answer sets of program $P$ using the notation $\mathsf{AS}(P)$ .
2.3 From minimal models to answer sets
Consider a Boolean formula, $F = \bigwedge _{i} C_i$ , where each clause is of the form: $C_i = \ell _0 \vee \ldots \ell _{k} \vee \neg{\ell _{k+1}} \vee \ldots \neg \ell _{m}$ . We can transform each clause $C_i$ into a rule $r$ of the form: $\ell _{0} \vee \ldots \vee \ell _{k} \leftarrow \ell _{k+1}, \ldots, \ell _{m}$ . Given a formula $F$ , let us denote this transformation by the notation $\mathcal{DLP}(F)$ . Each minimal model of $F$ corresponds uniquely to an answer set of $\mathcal{DLP}(F)$ .
2.4 Approximate lower bound
We denote the probability of an event $e$ using the notation $\mathsf{Pr}[e]$ . For a Boolean formula $F$ , let $c$ represents a lower bound estimate for the number of minimal models of $F$ . We assert that $c$ is a lower bound for the number of minimal models with a confidence $\delta$ , when $\mathsf{Pr}[c \leq |\mathsf{MinModels}(F)|] \geq 1 - \delta$ .
2.5 Minimal generator in Itemset mining
We define transactions over a finite set of items, denoted by $\mathcal{I}$ . A transaction $t_i$ is an ordered pair of $(i, I_i)$ , where $i$ is the unique identifier of the transaction and $I_i \subseteq{\mathcal{I}}$ represents the set of items involved in the transaction. A transaction database is a collection of transactions, where each uniquely identified by the identifier $i$ , corresponding to the transaction $t_i$ . A transaction $(i, I_i)$ supports an itemset $J \subseteq \mathcal{I}$ if $J \subseteq I_i$ . The cover of an itemset $J$ within a database $D$ , denoted as $C(J,D)$ , is defined as: ${\mathcal{C}(J,D)} = \{i | (i,I_i) \in D \text{ and } J \subseteq I_i\}$ . Given an itemset $I$ and transaction database $D$ , the itemset $I$ is a minimal generator of $D$ if, for every itemset $J$ where $J \subset I$ , it holds that ${\mathcal{C}(I,D)} \subset{\mathcal{C}(J,D)}$ .
2.6 Encoding minimal generators as minimal models
Given a transaction database $D$ , we encode a Boolean formula $\mathsf{MG}(D)$ such that minimal models of $\mathsf{MG}(D)$ correspond one-to-one with the minimal generators of $D$ . This encoding introduces two types of variables: (i) for each item $a \in{\mathcal{I}}$ , we introduce a variable $p_a$ to denote that $a$ is present in a minimal generator (ii) for each transaction $t_i$ , we introduce a variable $q_i$ to denote the presence of the itemset in the transaction $t_i$ . Given a transaction database $D = \{t_i| i = 1,\ldots n\}$ , consisting of the union of transactions $t_i$ , consider the following Boolean formula:
Lemma 1. Given a transaction database $D$ , $\sigma$ is a minimal model of $\mathsf{MG}(D)$ if and only if the corresponding itemset $I_{\sigma } = \{a | p_a \in \sigma \}$ is a minimal generator of $D$ .
The encoding of $\mathsf{MG}(D)$ bears similarities to the encoding detailed in (Jabbour et al. Reference Jabbour, Sais and Salhi2017; Salhi Reference Salhi2019). However, our encoding achieves compactness by incorporating a one-sided implication, which enhances the efficiency of the representation.
3 Related Works
Given its significance in numerous reasoning tasks, minimal model reasoning has garnered considerable attention from the scientific community.
Minimal models of a Boolean formula $F$ can be computed using an iterative approach with a SAT solver (Li et al. Reference Li, Yisong, Zhongtao and Renyan2021). The fundamental principle is as follows: for any model $\alpha \in \mathsf{MinModels}(F)$ , no model of $F$ can exist that is strictly smaller than $\alpha$ ; thus, $F \wedge \neg{\alpha }$ yields no model. Conversely, if $F \wedge \neg{\alpha }$ returns a model, it is strictly smaller than $\alpha$ .
Minimal models can be efficiently determined using unsatisfiable core-based MaxSAT algorithms (Alviano Reference Alviano2017). This technique leverages the unsatisfiable core analysis commonly used in MaxSAT solvers and operates within an incremental solver to enumerate minimal models sorted by their size. In parallel, another line of research focuses on the enumeration of minimal models by applying cardinality constraints to calculate models of bounded size (Liffiton and Sakallah Reference Liffiton and Sakallah2008; Faber et al. Reference Faber, Vallati, Cerutti and Giacomin2016). Notably, Faber et al. Reference Faber, Vallati, Cerutti and Giacomin2016 employed an algorithm that utilized an external solver for the enumeration of cardinality-minimal models of a given formula. Upon finding a minimal model, a blocking clause is integrated into the input formula, ensuring that these models are not revisited by the external solver.
There exists a close relationship between minimal models of propositional formula and answer sets of ASP program (Ben-Eliyahu and Dechter Reference Ben-Eliyahu and Dechter1994). Beyond solving disjunctive logic programs (ref. Section 2), minimal models can also be effectively computed using specialized techniques within the context of ASP, such as domain heuristics (Gebser et al. Reference Gebser, Kaufmann and Schaub2013) and preference relations (Brewka et al. Reference Brewka, Delgrande, Romero and Schaub2015).
Due to the intractability of minimal model finding, research has branched into exploring specific subclasses of positive CNF formulas where minimal models can be efficiently identified within polynomial time (Ben-Eliyahu and Dechter Reference Ben-ELIYAHU and Dechter1996; Angiulli et al. Reference Angiulli, Ben-Eliyahu, Fassetti and Palopoli2014). Notably, a Horn formula possesses a singular minimal model, which can be derived in linear time using unit propagation (Ben-Eliyahu and Dechter Reference Ben-ELIYAHU and Dechter1996). Ben-Eliyahu and Palopoli Reference Ben-ELIYAHU and Palopoli1997 developed an elimination algorithm designed to find and verify minimal models for head-cycle-free formulas. Angiulli et al. Reference Angiulli, Ben-Eliyahu, Fassetti and Palapoli2022 introduced the Generalized Elimination Algorithm (GEA), capable of identifying minimal models across any positive formula when paired with a suitably chosen eliminating operator. The efficiency of the GEA hinges on the complexity of the specific eliminating operator used. With an appropriate eliminating operator, the GEA can determine minimal models of head-elementary-set-free CNF formulas in polynomial time. Notably, this category is a broader superclass of the head-cycle-free subclass.
Graph-theoretic properties have been effectively utilized in the reasoning about minimal models. Specifically, Angiulli et al. Reference Angiulli, Ben-Eliyahu, Fassetti and Palapoli2022 demonstrated that minimal models of positive CNF formulas can be decomposed based on the structure of their dependency graph. Furthermore, they introduced an algorithm that leverages model decomposition, utilizing the underlying dependency graph to facilitate the discovery of minimal models. This approach underscores the utility of graph-theoretic concepts in enhancing the efficiency and understanding of minimal model reasoning.
To the best of our knowledge, the literature on minimal model counting is relatively sparse. The complexity of counting minimal models for specific structures of Boolean formulas, such as Horn, dual Horn, bijunctive, and affine, has been established as $\#\mathsf{P}$ (Durand and Hermann Reference Durand and Hermann2008). This complexity is notably lower than the general case complexity, which is $\#{\mathsf{co}}$ - $\mathsf{NP}$ -complete (Kirousis and Kolaitis Reference Kirousis and Kolaitis2003).
4 Estimating the Number of Minimal Models
In this section, we introduce methods for determining a lower bound for the number of minimal models of a Boolean formula. We detail two specific approaches aimed at estimating this number. The first method is based on the decomposition of the input formula, whereas the second method utilizes a hashing-based approach of approximate model counting.
4.1 Formula decomposition and minimal model counting
Considering a Boolean formula $F = F_1 \wedge F_2$ , we define the components $F_1$ and $F_2$ as disjoint if no variable of $F$ is mentioned by both components $F_1$ and $F_2$ (i.e., $\mathsf{Var}(F_1) \cap \mathsf{Var}(F_2) = \emptyset$ ). Under this condition, the models of $F$ can be independently derived from the models of $F_1$ and $F_2$ and the vice versa. Thus, if $F_1$ and $F_2$ are disjoint in the formula $F = F_1 \wedge F_2$ , the total number of models of $F$ is the product of the number of models of $F_1$ and $F_2$ . This principle underpins the decomposition frequently applied in knowledge compilation (Lagniez and Marquis Reference Lagniez and Marquis2017).
Building on the concept of the knowledge compilation techniques, we introduce a strategy centered on formula decomposition to count minimal models. Unlike methods that count models for each disjoint component, we enumerate minimal models of $F$ projected onto the variables of disjoint components. Our approach incorporates a level of enumeration that stops upon enumerating a specific count of minimal models, thereby providing a lower bound estimate of the total number of minimal models. Our method utilizes a straightforward “Cut” mechanism to facilitate formula decomposition.
4.1.1 Formula decomposition by “Cut”
A “cut” $\mathcal{C}$ within a formula $F$ is identified as a subset of $\mathsf{Var}(F)$ such that for every assignment $\tau \in 2^{{\mathcal{C}}}$ , $F|_{\tau }$ effectively decomposes into disjoint components (Lagniez and Marquis Reference Lagniez and Marquis2017). This concept is often used in context of model counting (Korhonen and Järvisalo Reference Korhonen and Jarvisalo2021). It is important to note that models of $F|_{\tau }$ can be directly expanded into models of $F$ .
4.1.2 Challenges in knowledge compilation for counting minimal models
When it comes to counting minimal models, the straightforward application of unit propagation and the conventional decomposition approach are not viable (Kabir Reference Kabir2024). More specifically, simple unit propagation does not preserve minimal models. Additionally, the count of minimal models cannot be simply calculated by multiplying the counts of minimal models of its disjoint components. An example provided below demonstrates these inconsistencies.
Example 1. Consider a formula $F = \{a \vee b \vee c, \neg{a} \vee \neg{b} \vee d, \neg{a} \vee \neg{b} \vee e\}$ .
-
(i) With the assignment $\tau _1 = \{e\}$ . Then $\{a\}$ becomes a minimal model of $F|_{\tau _1}$ . However, the extended assignment $\tau _1 \cup \{a\}$ is not a minimal model of $F$ .
-
(ii) Considering a cut ${\mathcal{C}} = \{a, b\}$ and the partial assignment $\tau _2 = \{a, b\}$ , then $F|_{\tau _2}$ is decomposed into two components, each containing the unit clauses $\{d\}$ and $\{e\}$ , respectively. Despite this, the combined assignment $\tau _2 \cup \{d, e\} = \{a, b, d, e\}$ is not a minimal model of $F$ , as a strictly smaller assignment $\{a, d, e\}$ also satisfies $F$ .
Traditional methods such as unit propagation and formula decomposition cannot be straightforwardly applied to minimal model counting. Importantly, every atom in a minimal model must be justified. In Example1, (i) the variable $e$ is assigned truth values without justification, leading to an incorrect minimal model when the assignment is extended with the minimal model of $F|_{\{e\}}$ . (ii) The formula is decomposed without justifying the variables $a$ and $b$ , resulting in incorrect minimal model when combining assignments from the other two components of $F|_{\{a,b\}}$ . Therefore, for accurate minimal model counting, operations such as unit propagation and formula decomposition must be applied only to assignments that are justified. Consequently, a knowledge compiler for minimal model counting must frequently verify the justification of assignments. It is worth noting that verifying the justification of an assignment is computationally intractable.
4.1.3 Minimal model counting using justified assignment
We introduce the concept of a justified assignment $\tau ^{\star }$ , based on a given assignment $\tau$ . Within the minimal model semantics, any assignment of $\mathsf{false}$ is inherently justified. Therefore, we define justified assignment $\tau ^{\star }$ as follows: $\tau ^{\star } = \tau _{\downarrow \{v \in \mathsf{Var}(F) | \tau (v) = 0\}}$ .
By applying unit propagation of $\tau ^{\star }$ , instead of $\tau$ , every minimal model derived from $F|_{\tau ^{\star }}$ can be seamlessly extended into a minimal model of $F$ . While $F|_{\tau }$ effectively decompose into multiple disjoint components, the use of a justified assignment $\tau ^{\star }$ does not necessarily lead to effectively $F|_{\tau ^{\star }}$ decomposing into disjoint components.
A basic approach to counting minimal models involves enumerating all minimal models. When a formula is decomposed into multiple disjoint components, the number of minimal models can be determined by conducting a projected enumeration over these disjoint variable sets and subsequently multiplying the counts of projected minimal models. The following corollary outlines how projected enumeration can be employed across disjoint variable sets to accurately count the number of minimal models.
Lemma 2. Let $F$ be decomposed into disjoint components $F_1, \ldots, F_k$ , with each component $F_i$ having a variable set $V_i = \mathsf{Var}(F_i)$ , for $i \in [1,k]$ . Suppose $V = \mathsf{Var}(F) = \bigcup _{i} V_i$ . Then, $|\mathsf{MinModels}(F)| = \prod _{i=1}^k |\mathsf{MinModels}(F)_{\downarrow V_i}|$ .
4.1.4 Algorithm: counting minimal models by projected enumeration
We introduce an enumeration-based algorithm, called $\mathsf{Proj\text{-}Enum}$ , that leverages justified assignments and projected enumeration to accurately count the number of minimal models of a Boolean formula $F$ . The algorithm takes in as input a Boolean formula $F$ and a set of variables $\mathcal{C}$ , referred to as a “cut” in our context. To understand how the algorithm works, we introduce two new concepts: $\mathsf{MinModelswithBlocking}(F, \mathcal{B})$ and $\mathsf{ProjMinModels}(F, \tau, X)$ . $\mathsf{MinModelswithBlocking}(F, \mathcal{B})$ finds $\sigma \in \mathsf{MinModels}(F)$ such that $\forall \tau \in \mathcal{B}, \sigma \not \models \tau$ ; here, $\mathcal{B}$ is a set of blocking clauses and each blocking clause is an assignment $\tau$ . $\mathsf{ProjMinModels}(F, \tau, X)$ enumerates the set $\{\sigma _{\downarrow X} | \sigma \in \mathsf{MinModels}(F), \sigma \models \tau \}$ , where $\tau$ serves as the conditioning factor and $X$ serves as the projection set. The algorithm iteratively processes minimal models of $F$ (Line 2), starting with an initially empty set of blocking clauses ( $\mathcal{B} = \emptyset$ ). Upon identifying a minimal model $\sigma$ , the algorithm projects $\sigma$ onto $\mathcal{C}$ , denoting the projected set as $\tau$ . Subsequently, Algorithm1 enumerates all minimal models $\sigma \in \mathsf{MinModels}(F)$ that satisfy $\sigma \models \tau$ .
To address the inefficiency associated with brute-force enumeration, the algorithm utilizes the concept of justified assignment and projected enumeration (Line 5). Lemma2 establishes that the number of minimal models can be counted through multiplication. The notation $\mathsf{Components}(F)$ (Line 4) denotes all disjoint components of the formula $F$ . It is important to note that if $F|_{\tau ^{\star }}$ does not decompose into more than one component, then the projection variable set $X$ defaults to $\mathsf{Var}(F)$ , which leads to brute-force enumeration of non-projected minimal models. Finally, the algorithm adds $\tau$ to $\mathcal{B}$ (Line 7) to prevent the re-enumeration of the same minimal models.
4.1.5 Implementation details of $\mathsf{Proj\text{-}Enum}$ .
We implemented $\mathsf{Proj\text{-}Enum}$ using Python. To find minimal models using $\mathsf{MinModelswithBlocking}(F, \mathcal{B})$ , the algorithm invokes an ASP solver on $\mathcal{DLP}(F)$ (invoked $clingo$ as the underlying ASP solver). Each assignment $\tau \in \mathcal{B}$ is incorporated as a constraint (Alviano et al. Reference Alviano, Dodaro, Fiorentino, Previti and Ricca2022), which ensures that minimal models of $F$ are preserved ((Kabir et al. Reference Kabir, Everado, Shukla, Hecher, Fichte and Meel2022), see Corollary. 2). To compute $\mathsf{ProjMinModels}(F, \tau, X)$ , Algorithm1 employs an ASP solver on $\mathcal{DLP}(F)$ , using $X$ as the projection set. Additionally, it incorporates each literal from $\tau$ as a facet into $\mathcal{DLP}(F)$ (Alrabbaa et al. Reference Alrabbaa, Rudolph and Schweizer2018) to ensure that the condition $\tau$ is satisfied. We noted that the function $\mathsf{ProjMinModels}(F, \tau, X)$ requires more time to enumerate all minimal models. To leverage the benefits of decomposition, we enumerate upto a specific threshold number of minimal models (set the threshold to $10^6$ in our experiment) invoking $\mathsf{ProjMinModels}(F, \tau, X)$ . Consequently, our prototype either accurately counts the total number of minimal models or provides a lower bound. Employing a tree decomposition technique (Hamann and Strasser Reference Hamann and Strasser2018), we calculated a cut of the formula that effectively decompose the input formula into several components.
4.2 Hashing-based minimal model counting
The number of minimal models can be approximated using a hashing-based model counting technique, which adds constraints that restrict the search space. Specifically, this method applies uniform and random XOR constraints to a formula $F$ , focusing the search on a smaller subspace (Gomes et al. Reference Gomes, Sabharwal and Selman2021). A particular XOR-based model counter demonstrates that if $t$ trials are conducted where $s$ random and uniform XOR constraints are added each time, and the constrained formula of $F$ is satisfiable in all $t$ cases, then $F$ has at least $2^{s - \alpha }$ models with high confidence, where $\alpha$ is the precision slack (Gomes et al. Reference Gomes, Sabharwal and Selman2006a). Each XOR constraint incorporates variables from $\mathsf{Var}(F)$ . Our approach to minimal model counting fundamentally derives from the strategy of introducing random and uniform XOR constraints to the formula. In the domain of approximate model counting and sampling, the XOR constraints consist of variables from a subset of $\mathsf{Var}(F)$ , denoted as $\mathcal{X}$ within our algorithm, which is widely known as independent support (Chakraborty et al. Reference Chakraborty, Meel and Vardi2016; Soos and Meel Reference Soos and Meel2022).
Algorithm2 outlines a hashing-based algorithm, named $\mathsf{HashCount}$ , for determining the lower bound of minimal models of a Boolean formula $F$ . This algorithm takes in a Boolean formula $F$ , an independent support $\mathcal{X}$ , and a confidence parameter $\delta$ . During its execution, the algorithm generates total $|{\mathcal{X}}| - 1$ random and uniform XOR constraints, denoted as $Q^i$ , where $i$ ranges from $1$ to $|{\mathcal{X}}| - 1$ . To better explain the operation of the algorithm, we introduce a notation: $\mathsf{MinModels}(F^m)$ represents the minimal models of $F$ satisfying first $m$ XOR constraints, $Q^1, \ldots, Q^m$ . Upon generating random and uniform XOR constraints, the algorithm finds the value of $m$ such that $|\mathsf{MinModels}(F^{m})| \gt 0$ (meaning that $\exists \sigma \in \mathsf{MinModels}(F), \sigma \models Q^1 \wedge \ldots \wedge Q^m$ ), while $|\mathsf{MinModels}(F^{m+1})| = 0$ (meaning that $\not \exists \sigma \in \mathsf{MinModels}(F), \sigma \models Q^1 \wedge \ldots \wedge Q^{m+1}$ ) by iterating a loop (Line 6). The loop terminates either when a $\mathsf{Timeout}$ occurs or when it successfully identifies the value of $m$ . If the $\mathsf{Timeout}$ happens, the algorithm assigns the maximum observed value of $m$ (denoted as $\mathsf{\hat{m}}$ ) to $\mathsf{m^{\star }}$ , ensuring that $|\mathsf{MinModels}(F^{\mathsf{\hat{m}}})| \geq 1$ (Line 7), which is sufficient to offer lower bounds. Finally, Algorithm2 returns $2^{\mathsf{m^{\star }} - \alpha }$ as the probabilistic lower bound of $|\mathsf{MinModels}(F)|$ .
4.2.1 Implementation details of $\mathsf{HashCount}$
The effectiveness of an XOR-based model counter is dependent on the performance of a theory+XOR solver (Soos et al. Reference Soos, Gocht and Meel2020). In our approach, we begin by transforming a given formula $F$ into a disjunctive logic program $\mathcal{DLP}(F)$ and introduce random and uniform XOR constraints into $\mathcal{DLP}(F)$ to effectively partition the minimal models of $F$ . To verify the presence of any models in the XOR-constrained ASP program, we leverage the ASP + XOR solver capabilities provided by ApproxASP (Kabir et al. Reference Kabir, Everado, Shukla, Hecher, Fichte and Meel2022). To compute an independent support for $\mathsf{HashCount}$ , we implemented a prototype inspired by Arjun (Soos and Meel Reference Soos and Meel2022), which checks answer sets of a disjunctive logic program in accordance with Padoa’s theorem (Padoa Reference Padoa1901).
4.3 Putting it all together
We designed a hybrid solver $\mathsf{MinLB}$ , presented in Algorithm3, that selects either $\mathsf{Proj\text{-}Enum}$ or $\mathsf{HashCount}$ depending on the decomposability of the input formula. The core principle of $\mathsf{MinLB}$ is that $\mathsf{Proj\text{-}Enum}$ effectively leverages decomposition and projected enumeration on easily decomposable formulas. We use the size of the cut ( $|{\mathsf{Cut}(F)}|$ ) as a proxy to measure the decomposability. Thus, if $|{\mathsf{Cut}(F)}|$ is small, then $\mathsf{MinLB}$ employs $\mathsf{Proj\text{-}Enum}$ on $F$ (Line 2); otherwise, it employs $\mathsf{HashCount}$ (Line 3).
Theorem 1. $\mathsf{Pr}[{\mathsf{MinLB}}(F,\delta ) \leq |\mathsf{MinModels}(F)|] \geq 1 - \delta$
5 Experimental Results
5.1 Benchmarks and baselines
Our benchmark set is collected from two different domains: (i) model counting benchmarks from recent competitions (Fichte et al. Reference Fichte, Hecher and Hamiti2021) and (ii) minimal generators benchmark from itemset mining dataset CP4IM.Footnote 2 We used existing systems for minimal model reasoning as baselines. These included various approaches such as (i) repeated invocations of the SAT solver MiniSAT (Li et al. Reference Li, Yisong, Zhongtao and Renyan2021), (ii) the application of MaxSAT techniques (Alviano Reference Alviano2017), (iii) domain-specific heuristics (Gebser et al. Reference Gebser, Kaufmann and Schaub2013), and (iv) solving $\mathcal{DLP}(F)$ with ASP solvers, all systems primarily count via enumeration. These systems either return the number of minimal models by enumerating all of them or a lower bound of the number of minimal models in cases where they run out of time or memory. We cannot count minimal models by #SAT-based ASP counters (Kabir et al. Reference Kabir, Chakraborty and Meel2024) because of their incapablity of handling disjunctive logic programs. Experimentally, we observed that, for enumerating all minimal models, the technique solving disjunctive ASP programs using clingo (Gebser et al. Reference Gebser, Kaufmann and Schaub2012) surpassed the other techniques. Therefore, we have exclusively reported the performance of clingo in our experimental analysis. Additionally, we evaluated ApproxASP (Kabir et al. Reference Kabir, Everado, Shukla, Hecher, Fichte and Meel2022), which offers $(\epsilon, \delta )$ -guarantees in counting minimal models. We attempted an exact minimal model counting tool using a subtractive approach — subtracting the non-minimal model count from the total model count–we denote the implementation using the notation $\#\mathsf{MinModels}$ in further analysis. In our experiment, we ran $\mathsf{HashCount}$ with a confidence $\delta$ value of $0.2$ and ApproxASP with confidence $\delta = 0.2$ and tolerance $\epsilon = 0.8$ . The prototype is available at: https://github.com/meelgroup/MinLB.
5.2 Environmental settings
All experiments were conducted on a high-performance computing cluster equipped with nodes featuring AMD EPYC $7713$ CPUs, each with $128$ real cores. Throughout the experiment, the runtime and memory limits were set to $5000$ seconds and $16$ GB, respectively, for all considered tools.
5.3 Evaluation metric
The goal of our experimental analysis is to evaluate various minimal model counting tools based on their runtime and the quality of their lower bounds. It is essential to employ a metric that encompasses both runtime performance and the quality of the lower bound. Consequently, following the TAP score (Agrawal et al. Reference Agrawal, Pote and Meel2021; Kabir and Meel Reference Kabir and Meel2023), we have introduced a metric, called the Time Quality Penalty (TQP) score, which is defined for each tool and instance as follows:
In the metric, $\mathcal{T}$ represents the timeout for the experiment, $t$ denotes the runtime of the tool, $C$ is the lower bound returned by the tool, and $\mathsf{C_{min}}$ is the minimum lower bound returned by any of the tools under consideration for the instance. The TQP score is based on the following principle: lower runtime and higher lower bound yield a better score.
5.4 Performance on model counting competition benchmark
We present the TQP scores of $\mathsf{MinLB}$ alongside other tools in Table 1. This table indicates that $\mathsf{MinLB}$ achieves the lowest TQP scores. Among existing minimal model enumerators, clingo demonstrates the best performance in terms of TQP score. Additionally, in Figure 1, we graphically compare the lower bounds returned by $\mathsf{Proj\text{-}Enum}$ and $\mathsf{HashCount}$ against those returned by $clingo$ . Here, a point $(x, y)$ indicates that, for an instance, the lower bounds returned by our prototypes and clingo are $2^x$ and $2^y$ , respectively. For an instance, if the corresponding point resides below the diagonal line, it indicates that $\mathsf{Proj\text{-}Enum}$ ( $\mathsf{HashCount}$ , resp.) returns a better lower bound than $clingo$ . These plots clearly illustrate that $\mathsf{Proj\text{-}Enum}$ and $\mathsf{HashCount}$ return better lower bounds compared to other existing minimal model enumerators.
5.5 Performance on minimal generator benchmark
Table 2 showcases the TQP scores of $\mathsf{MinLB}$ alongside other tools on the minimal generator benchmark. Notably, $\mathsf{HashCount}$ achieves the most favorable TQP scores on the benchmark. Additionally, Figure 2 graphically compares the lower bounds returned by $\mathsf{Proj\text{-}Enum}$ and $\mathsf{HashCount}$ against those computed by $clingo$ .
For a visual representation of the lower bounds returned by our $\mathsf{HashCount}$ and $\mathsf{Proj\text{-}Enum}$ , we illustrate them graphically in Figure 3. In the plot, a point $(x, y)$ signifies that a tool returns a lower bound of at most $2^y$ for $x$ instances. The plot demonstrates that the lower bounds returned by $\mathsf{Proj\text{-}Enum}$ and $\mathsf{HashCount}$ surpass those of existing systems.
5.6 Another performance metric
To facilitate the comparison of lower bounds returned by two tools, we have introduced another metric for comparative analysis. If tools $A$ and $B$ yield lower bounds $C_A$ and $C_B$ respectively, their relative quality is defined in the following manner:
If $r_{AB} \gt 1$ , then the lower bound returned by tool $A$ is superior to that of tool $B$ .
5.6.1 In-depth study on $\mathsf{Proj\text{-}Enum}$ and $\mathsf{HashCount}$
The performance of $\mathsf{Proj\text{-}Enum}$ and $\mathsf{HashCount}$ contingent upon the size of the cut and independent support, respectively. In this analysis, we explore the strengths and weaknesses of $\mathsf{Proj\text{-}Enum}$ and $\mathsf{HashCount}$ by measuring their relative quality, as defined in Equation (3), across various sizes of cuts and independent supports, respectively. This comparative analysis is visually represented in Figure 4, where clingo serves as the reference baseline.
In the graphical representations, each point $(x,y)$ corresponds to an instance where for the size of cut (independent support resp.) is $x$ and the prototype $\mathsf{Proj\text{-}Enum}$ ( $\mathsf{HashCount}$ resp.) achieves a relative quality of $y$ . A relative quality exceeding $1$ indicates that the lower bound returned by $\mathsf{Proj\text{-}Enum}$ or $\mathsf{HashCount}$ surpasses that of clingo. These plots reveal that $\mathsf{Proj\text{-}Enum}$ tends to perform well with smaller cut sizes, while $\mathsf{HashCount}$ demonstrates better performance across a range from small to medium sizes of independent support.
6 Conclusion
This paper introduces two innovative methods for computing a lower bound on the number of minimal models. Our first method, $\mathsf{Proj\text{-}Enum}$ , leverages knowledge compilation techniques to provide improved lower bounds for easily decomposable formulas. The second method, $\mathsf{HashCount}$ , utilizes recent advancements in ASP + XOR reasoning systems and demonstrates performance that varies with the size of the independent support. Our proposed methods exploit the expressive power of ASP semantics and robustness of well-engineered ASP systems. Looking forward, our research will focus on counting projected minimal models. We also plan to explore the counting of minimal correction subsets, which are closely related to minimal models.
Acknowledgement
This work was supported in part by National Research Foundation Singapore under its NRF Fellowship Programme [NRF-NRFFAI1-2019-0004], Ministry of Education Singapore Tier $2$ grant MOE-T2EP20121-0011, and Ministry of Education Singapore Tier $1$ Grant [R-252-000-B59-114]. The computational work for this article was performed on resources of the National Supercomputing Centre, Singapore (https://www.nscc.sg). Kabir was visiting the University of Toronto during the research.
Appendix
The missing proofs are available in the extended version of the paper: https://arxiv.org/abs/2407.09744.
Analysis of $\mathsf{Proj\text{-}Enum}$
Lemma 3. For Boolean formula $F$ and a cut $\mathcal{C}$ , the minimal models of $F$ can be computed as follows: $\mathsf{MinModels}(F) = \bigcup _{\tau \in 2^{{\mathcal{C}}}} \mathsf{ProjMinModels}(F, \tau, \mathsf{Var}(F))$ .
Proof. Lemma2 demonstrates that minimal models can be computed through component decompositions. By taking the union over $\tau \in 2^{{\mathcal{C}}}$ , we iterate over all possible assignments of $\mathcal{C}$ . Consequently, $\mathsf{Proj\text{-}Enum}$ algorithm computes all minimal models of $F$ by conditioning over all possible assignments over $\mathcal{C}$ . Therefore, the algorithm is correct.
Analysis of $\mathsf{HashCount}$
We adopt the following notation: ${s^{\star }} = \log _{2}{|\mathsf{MinModels}(F)|}$ . Each minimal model $\sigma$ of $F$ is an assignment over $\mathsf{Var}(F)$ , and according to the definition of random XOR constraint (Gomes et al. Reference Gomes, Sabharwal and Selman2006b), $\sigma$ satisifies a random XOR constraint with probability of ${1}/{2}$ . Due to uniformity and randomness of XOR constraints, each minimal model of $F$ satisfies $m$ random and uniform XOR constraints with probability of ${1}/{2^m}$ . In our theoretical analysis, we apply the Markov inequality: if $Y$ is a non-negative random variable, then $\mathsf{Pr}[Y \geq a] \leq \frac{\mathbb{E}[Y]}{a}$ , where $a \gt 0$ .
Lemma 4. For arbitrary $s$ , $\mathsf{Pr}[|\mathsf{MinModels}(F^s) \geq 1|] \leq \frac{2^{{s^{\star }}}}{2^s}$ .
Proof. For each $\sigma \in \mathsf{MinModels}(F)$ , we define a random variable $Y_\sigma \in \{0,1\}$ and $Y_\sigma = 1$ indicates that $\sigma$ satisifies the first $s$ XOR constraints $Q^1, \ldots, Q^{s}$ , otherwise, $Y_\sigma = 0$ . The random variable $Y$ is the summation, $Y = \sum _{\sigma \in \mathsf{MinModels}(F)} Y_{\sigma }$ . The expected value of $Y$ can be calculated as $\mathbb{E}(Y) = \sum _{\sigma \in \mathsf{MinModels}(F)} \mathbb{E}(Y_\sigma )$ .
Due to the nature of random and uniform XOR constraints, each minimal model $\sigma \in \mathsf{MinModels}(F)$ satisfies all $s$ XOR constraints with probability $\frac{1}{2^s}$ . It follows that the expected value $\mathbb{E}(Y_\sigma ) = \frac{1}{2^s}$ , and the expected value of $Y$ is $\mathbb{E}(Y) = \frac{|\mathsf{MinModels}(F)|}{2^s} = \frac{2^{{s^{\star }}}}{2^s}$ . According to the Markov inequality: $\mathsf{Pr}[|\mathsf{MinModels}(F^s) \geq 1|] \leq \frac{2^{{s^{\star }}}}{2^s}$ .
Lemma 5. Given a formula $F$ and confidence $\delta$ , if $\mathsf{HashCount}(F, \delta )$ returns $2^{s - \alpha }$ , then $\mathsf{Pr}[2^{s - \alpha } \leq |\mathsf{MinModels}(F)|] \geq 1 - \delta$
Proof. Given a input Boolean formula $F$ and for each $m \in [1, |{\mathcal{X}}| - 1]$ , we denote the following two events: $I_m$ denotes the event that Algorithm2 invokes $\mathsf{MinModels}(F^m)$ and $E_m$ denotes the event that $|\mathsf{MinModels}(F^m)| \geq 1$ . The algorithm $\mathsf{HashCount}(F, \delta )$ returns an incorrect bound when $s - \alpha \gt {s^{\star }}$ and let use the notation $\mathsf{Error}$ to denote that $\mathsf{HashCount}(F, \delta )$ returns an incorrect bound or $\mathsf{HashCount}(F, \delta ) \gt 2^{{s^{\star }}}$ . The upper bound of $\mathsf{Pr}[{\mathsf{Error}}]$ can be calculated as follows:
Thus, $\mathsf{Pr}[\mathsf{HashCount}(F, \delta )$ returns $2^{s - \alpha }$ and $ s \leq{s^{\star }} + \alpha ] \geq 1 - \delta$ .