Skolemization for Weighted First-Order Model Counting

Guy Van den Broeck, Wannes Meert, Adnan Darwiche

Introduction

Weighted model counting (WMC) is a generalization of model counting (?). In model counting, also known as #SAT, one counts the number of satisfying assignments of a propositional sentence. In WMC, each assignment has an associated weight and the task is to compute the sum of the weights of all satisfying assignments. One application of WMC is to probabilistic graphical models. For example, exact inference algorithms for Bayesian networks encode probabilistic inference as a WMC task, which can then be solved by knowledge compilation (?) or exhaustive DPLL search (?).

WMC also plays an important role in first-order probabilistic representations. These became popular in recent years, in statistical relational learning (?) and probabilistic logic learning (?), which are concerned with modeling and learning complex logical and probabilistic interactions between large numbers of objects. Efficient algorithms again reduce exact probabilistic inference to a WMC problem on a propositional knowledge base (?; ?; ?). Encoding first-order probabilistic models into propositional logic retains a key advantage of the Bayesian network algorithms: WMC naturally exploits determinism and local structure in the probabilistic model (?; ?). A disadvantage is that the high-level first-order structure is lost. ? (?) observed that knowing the symmetries that are abundant in first-order structure can speed up probabilistic inference. Lifted inference algorithms reason about groups of objects as a whole, similar to the high-level reasoning of first-order resolution. This has lead ? (?) and ? (?) to propose weighted first-order model counting (WFOMC) as the core reasoning task underlying lifted inference algorithms. WFOMC assigns a weight to interpretations in finite-domain, function-free first-order logic, and computes the sum of the weights of all models.

Counting models at the first-order level has computational advantages. For certain classes of theories, knowing the first-order structure gives exponential speedups (?). For example, counting the models of a first-order universally quantified CNF with up to two logical variables per clause can always be done in time polynomial in the size of the domain of discourse. In contrast, a propositionalization of these CNFs will often have a treewidth polynomial in the domains size, and propositional model counting runs in exponential time.

One major limitation of first-order model counters, however, is that they require input in Skolem normal form (i.e., without existential quantifiers). This is a common requirement for first-order automated reasoning algorithms, such as theorem provers. It is usually dealt with by Skolemization, which introduces Skolem constants and functions. However, the introduction of functions is problematic for first-order model counters as they expect a function-free input.

The main contribution of this paper is a Skolemization procedure that is specific for weighted first-order model counting. The procedure maps a logical input theory to an output theory that is devoid of existential quantifiers and functions, yet has an identical weighted first-order model count. The procedure is modular, in that it remains sound when extending the input and output theories with a new sentence. Furthermore, it is purely first-order as it is independent of the domain of discourse.

The proposed Skolemization algorithm has a range of implications. First, it opens up new possibilities for lifted inference algorithms. For example, on Markov Logic Networks with quantifiers (?), and various forms of Probabilistic Logic Programs (e.g., ? (?)), lifted algorithms currently provide little or no benefit over propositional ones. The main reason is that the WFOMC form of these representations generally contain existential quantifiers. The proposed Skolemization algorithm allows us, for the first time, to perform lifted inference on these representations. Second, there are liftability theorems that define classes of theories for which WFOMC is domain-lifted, meaning that it runs in time polynomial in the domain size (?). These theorems had to assume Skolem normal form for the mentioned reason, but now apply more generally. Finally, the Skolemization algorithm averts the need for special inference rules that deal with existential quantifiers, simplifying the design of future WFOMC algorithms.

Weighted First-Order Model Counting

We start by formally defining the weighted first-order model counting task. We also compare it to propositional weighted model counting and discuss existing algorithms.

Throughout this paper, we will work with the function-free finite-domain fragment of first-order logic (FOL), which we now briefly review. An atom P(t1,…,tn)\mathtt{P}(t_{1},\dots,t_{n}) consists of predicate P/n\mathtt{P}/n of arity nn followed by nn arguments, which are either constants from a finite domain \mathbfsfD={A,B,… }\mathbfsf{D}=\{\mathsf{A},\mathsf{B},\dots\} or logical variables {x,y,… }\{x,y,\dots\}. We use y\mathbf{y} to denote a sequence of logical variables. A literal is an atom or its negation. A formula combines atoms with logical connectives and quantifiers ∃\exists and ∀\forall. A logical variable xx is quantified if it is enclosed by a ∀x\forall x or ∃x\exists x. A free variable is one that is not quantified. A sentence is a formula without free variables. A formula is ground if it contains no logical variables. A clause is a disjunction of literals and a CNF is a conjunction of clauses. The groundings of a quantifier-free formula is the set of formulas obtained by instantiating the free variables with any possible combination of constants from \mathbfsfD\mathbfsf{D}. The grounding of ∀x,ϕ\forall x,\phi and ∃x,ϕ\exists x,\phi is the conjunction resp. disjunction of all groundings of ϕ\phi.

We will make use of Herbrand semantics (?), as is customary in statistical relational learning and probabilistic logic learning. The Herbrand base of sentence Δ\Delta for domain \mathbfsfD\mathbfsf{D} is the set of all ground atoms that can be constructed from predicates and constants in \mathbfsfD\mathbfsf{D}. A Herbrand interpretation is a truth-value assignment to all atoms in the Herbrand base. We will find it convenient to represent interpretations as sets of literals. A Herbrand model of Δ\Delta is a Herbrand interpretation ω\omega that satisfies Δ\Delta, denoted by ω ⊨\mathbfsfD Δ\omega~{}\models_{\mathbfsf{D}}~{}\Delta.

Definitions

We first review propositional weighted model counting.

a sentence Δ\Delta in propositional logic over literals L\mathcal{L}, and

WFOMC lifts WMC to the first-order level as follows.

a sentence Δ\Delta in FOL containing predicates P\mathcal{P},

a set of constants \mathbfsfD\mathbfsf{D}, including the constants in Δ\Delta, and

the weighted first-order model count (WFOMC) is

where ω0\omega_{0} and ω1\omega_{1} consists of the true, respectively false, literals in ω\omega, and pred⁡\operatorname*{pred} maps literals to their predicate.

The weight functions assign a weight to each predicate. The weight of a positive (negative) literal is the weight of its predicate in w⁡\operatorname{w} (wˉ⁡\operatorname{\bar{w}}). The weight of a model is the product of its literal weights. Finally, the total count is the sum of the weights of all the Herbrand models of Δ\Delta.

Our WFOMC definition deviates from WMC in two ways. First, WMC directly assigns weights to literals. WFOMC instead assigns weights to predicates, and defines literal weights in terms of predicate weights. This distinguishes WFOMC from probabilistic databases (see Section 6). If for modeling reasons, certain literals need to be assigned unique weights, this can always be achieved by introducing new predicates.

Second, our definition permits predicate weights to be negative numbers. Negative weights will turn out to be crucial for our Skolemization algorithm. Historically, the WMC weight function has mostly been used to represent probabilities. This led to the (sometimes implicit) assumption that weights are between zero and one, or at least non-negative. Nevertheless, all exact weighted model counters we are aware of can handle negative weights.In fact, the only underlying requirement of exact model counting approaches is that literal weights are elements from a commutative semiring (?). It appears that the positive weight assumption is more intrinsic to approximate weighted model counters (?; ?). Section 6 discusses negative weights in more detail.

Motivation

A WFOMC problem can always be propositionalized into a WMC problem. We can ground Δ\Delta for \mathbfsfD\mathbfsf{D}, turn every atom in the Herbrand base into a propositional atom, and associate with every propositional literal the weight of its original predicate. One may wonder why we define this task at the first-order level.

Our motivation is computational. Similar to how a single step of first-order resolution can perform a large number of propositional resolution steps, a WFOMC solver can often provide exponential speedups over WMC solvers. First-order quantifiers make statements about groups of symmetric objects, which we can reason about jointly.

Without going into algorithmic details, we will now illustrate this principle on concrete examples. For the sake of simplicity, the examples are non-weighted model counting problems, corresponding to WFOMC problems where w⁡(P)=wˉ⁡(P)=1\operatorname{w}(\mathtt{P})=\operatorname{\bar{w}}(\mathtt{P})=1 for all predicates P\mathtt{P}. Consider Δ\Delta to be

Assuming that \mathbfsfD={A}\mathbfsf{D}=\{\mathsf{A}\}, every interpretation of Stress(A)\mathtt{Stress}(\mathsf{A}) and Smokes(A)\mathtt{Smokes}(\mathsf{A}) satisfies Δ\Delta, except when Stress(A)\mathtt{Stress}(\mathsf{A}) is true and Smokes(A)\mathtt{Smokes}(\mathsf{A}) is false. Therefore, the model count is 33. Now let Δ\Delta be

Without changing \mathbfsfD\mathbfsf{D}, the model count is still 33. When we expand \mathbfsfD\mathbfsf{D} to contain nn constants, we get nn independent copies of Formula 1. For each person xx, atoms Stress(x)\mathtt{Stress}(x) and Smokes(x)\mathtt{Smokes}(x) can jointly take 33 values, and the total model count becomes 3n3^{n}.

This example already demonstrates the benefits of first-order counting. A propositional model counter on the groundings of Formula 2 would detect that all nn clauses are independent, recompute for every clause that it has 33 models, and multiply these counts nn times. Propositional model counters have no elementary operation for exponentiation. A first-order model counter reads from the first-order structure that it suffices to compute the model count of a single ground clause, and then knows to exponentiate. It never actually grounds the formula, and given the size of \mathbfsfD\mathbfsf{D}, it runs in logarithmic time. This gives an exponential speedup over propositional counting, which runs in linear time.

These first-order counting techniques can interplay with propositional ones. Take for example Δ\Delta to be

This sentence is about a specific individual who may be a female, depending on whether the proposition Female\mathtt{Female} is true. We can separately count the models in which Female\mathtt{Female} is true, and those in which it is false (i.e., a Shannon decomposition). When Female\mathtt{Female} is false, Δ\Delta is satisfied, and the ParentOf\mathtt{ParentOf} and MotherOf\mathtt{MotherOf} atoms can take on any value. This gives 4n4^{n} models. When Female\mathtt{Female} is true, Δ\Delta is structurally identical to Formula 2, and has 3n3^{n} models. The total model count is then 3n+4n3^{n}+4^{n}.

These concepts can be applied recursively to count more complicated formulas. Take for example

There is now a partition of the ground clauses into nn independent sets of nn clauses. The sets correspond to values of xx, and the individual clauses to values of yy. The formula for each specific xx, that is, each set of clauses, is structurally identical to Formula 3 and has count of 3n+4n3^{n}+4^{n}. The total model count is then (3n+4n)n(3^{n}+4^{n})^{n}.

The most impressive improvements are attained when propositional model counters run in time exponential in nn, yet first-order model counters run in polynomial time. To consider an example where this comes up, let Δ\Delta be

This time, the clauses in the grounding of Δ\Delta are no longer independent, and it would be wrong to simply exponentiate their counts. Let us first assume that we know a partial interpretation of the Smokes\mathtt{Smokes} atoms with kk positive literals (i.e., kk people smoke). The question is now: how many models extend this partial interpretation? Formula 4 encodes that a smoker cannot be friends with a non smoker. Hence, out of n2n^{2} Friends\mathtt{Friends} atoms, k(n−k)k(n-k) have to be false, and the others can take either truth value. Thus, the number of models is 2n2−k(n−k)2^{n^{2}-k(n-k)}. Second, we know that there are (nk)\binom{n}{k} partial interpretations with kk smokers, and kk can range from to nn. This results in the total model count of

In fact, the systems discussed in the next section can automatically construct this formula and compute the model count of Formula 4 in time polynomial in nn. On the other hand, existing propositional WMC algorithms require time that is exponential in nn on this problem. We note here that the treewidth of the grounding of Δ\Delta is linear in nn.

There are space considerations that motivate first-order model counting as well. When converting a WFOMC problem to WMC, the grounding of Δ\Delta has size polynomial in the size of \mathbfsfD\mathbfsf{D}, but the degree of this polynomial can be high. When the grounding does not fit into memory, even approximate WMC becomes a problem.

Algorithms

Several algorithms exist for solving propositional WMC. Exact solvers are based on either exhaustive DPLL search (?), or knowledge compilation to a circuit language that supports efficient model counting, such as d-DNNF (?; ?) or SDD (?). Approximate WMC algorithms use local search (?) or sampling (?).

More recently, algorithms were introduced that directly solve the WFOMC task. They take a WFOMC problem and automatically generate and evaluate the types of expressions shown in the previous section. Their elementary operations include exponentiation, summation and binomial coefficients. They are called lifted inference algorithms. In particular, two lifted algorithms were proposed for exact WFOMC, one based on first-order knowledge compilation (?; ?; ?), and the other based on first-order DPLL search (?). Approximate algorithms were also proposed, including lifted importance sampling (?; ?). More generally, there is a large literature on exact and approximate lifted probabilistic inference in statistical relational models, which can be adapted to solve certain WFOMC tasks. See ? (?) for an overview.

Normal Forms

It is common for logical reasoning algorithms to operate on normal form representations instead of arbitrary sentences. For example, propositional SAT solvers and weighted model counters often expect CNF inputs. We distinguish the following first-order normal forms.

A theory in prenex normal form consists of formulas Q1x1,…,Qnxn, ϕ,Q_{1}x_{1},\dots,Q_{n}x_{n},~{}\phi, where each QiQ_{i} is either a universal or existential quantifier, and ϕ\phi is quantifier-free.

A theory in prenex clausal form is a theory in prenex normal form where ϕ\phi is a clause.

A theory in Skolem normal form is a theory in prenex normal form where all QiQ_{i} are universal quantifiers.

A first-order CNF is a theory in Skolem and prenex clausal form. Thus, all sentences take the form ∀x1,…,∀xn, l1∨⋯∨lm\forall x_{1},\dots,\forall x_{n},~{}l_{1}\lor\dots\lor l_{m}.

Existing WFOMC algorithms require a theory to be in first-order CNF. The same requirement is often posed by automated theorem provers, such as first-order resolution.

Skolemization for WFOMC

It is well known that one can take any arbitrary formula and convert it to prenex clausal form. This involves pushing negations inside, pushing quantifiers to the front, and distributing disjunctions over conjunctions. The situation for Skolem normal form is different.

Not every formula can be transformed into an equivalent Skolem normal form. This problem is typically dealt with by Skolemization, which eliminates existential quantifiers from a prenex normal form. This is done by replacing existentially quantified variables by Skolem constants and functions. The result is not logically equivalent to the original formula, but only equisatisfiable (i.e., satisfiable precisely when the original formula is satisfiable).

The standard Skolemization algorithm is specific to the satisfiability task and may be unsuitable for other tasks. It is particularly unsuitable for WFOMC as it may produce a result with functions, which are not permitted in the WFOMC task. For example, standard Skolemization would transform the formula

into the following formula with the Skolem function Sk()\mathsf{Sk}().

As soon as we allow functions, the Herbrand base becomes infinite, which makes the model counting task ill-defined, therefore, ruling out standard Skolemization for WFOMC.One could obtain a Skolem normal form by grounding existential quantifiers, replacing them by large, but finite disjunctions. While this may still permit limited runtime improvements on vacuous formulas, it is for all practical purposes equivalent to reducing the WFOMC problem to a WMC problem. Moreover, that transformation is dependent on the domain and leads to large formulas whose conversion to CNF blows up (e.g., when grounding ∃x∀y\exists x\forall y).

Algorithm

This section introduces a Skolemization technique for WFOMC. It takes as input a triple (Δ,w⁡,wˉ⁡)(\Delta,\operatorname{w},\operatorname{\bar{w}}) whose Δ\Delta is an arbitrary sentence and returns a triple (Δ′,w⁡′,wˉ⁡′)(\Delta^{\prime},\operatorname{w}^{\prime},\operatorname{\bar{w}}^{\prime}) whose Δ′\Delta^{\prime} is in Skolem normal form (i.e., no existential quantifiers). Such a Δ′\Delta^{\prime} can then be turned into first-order CNF using standard transformations. The proposed technique does not introduce functions. It satisfies two properties, one is essential and the other expands the applications of the technique.

Skolemization of (Δ,w⁡,wˉ⁡)(\Delta,\operatorname{w},\operatorname{\bar{w}}) to (Δ′,w⁡′,wˉ⁡′)(\Delta^{\prime},\operatorname{w}^{\prime},\operatorname{\bar{w}}^{\prime}) is sound iff for any \mathbfsfD\mathbfsf{D}, we have that

To motivate the second property, we note that one may be interested in queries of the form WFOMC⁡(Δ∧ϕ,\mathbfsfD,w⁡,wˉ⁡)\operatorname*{WFOMC}(\Delta\land\phi,\mathbfsf{D},\operatorname{w},\operatorname{\bar{w}}), where Δ\Delta, w⁡\operatorname{w} and wˉ⁡\operatorname{\bar{w}} are fixed, but where ϕ\phi is changing. For example, we will see in Section 4 that probabilistic inference can be reduced to these types of queries. Therefore, we want to achieve a stronger form of soundness.

Skolemization of (Δ,w⁡,wˉ⁡)(\Delta,\operatorname{w},\operatorname{\bar{w}}) to (Δ′,w⁡′,wˉ⁡′)(\Delta^{\prime},\operatorname{w}^{\prime},\operatorname{\bar{w}}^{\prime}) is modular iff for any \mathbfsfD\mathbfsf{D} and any sentence ϕ\phi,

That is, by replacing ϕ\phi, one does not invalidate the Skolemization obtained under a different ϕ\phi.

The proposed Skolemization algorithm eliminates existential quantifiers one by one. Its basic building block is the following transformation.

Suppose that Δ\Delta contains a subexpression of the form ∃x,ϕ(x,y)\exists x,\phi(x,\mathbf{y}), where ϕ(x,y)\phi(x,\mathbf{y}) is an arbitrary sentence containing the free logical variables xx and y\mathbf{y}. Let nn be the number of variables in y\mathbf{y}. First, we introduce two new predicates: the Tseitin predicate Z/n\mathtt{Z}/n and the Skolem predicate S/n\mathtt{S}/n. Second, we replace the expression ∃x,ϕ(x,y)\exists x,\phi(x,\mathbf{y}) in Δ\Delta by the atom Z(y)\mathtt{Z}(\mathbf{y}), and append the formulas

The functions w⁡′\operatorname{w}^{\prime} and wˉ⁡′\operatorname{\bar{w}}^{\prime} are equal to w⁡\operatorname{w} and wˉ⁡\operatorname{\bar{w}}, except that w⁡′(Z)=wˉ⁡′(Z)=w⁡′(S)=1\operatorname{w}^{\prime}(\mathtt{Z})=\operatorname{\bar{w}}^{\prime}(\mathtt{Z})=\operatorname{w}^{\prime}(\mathtt{S})=1 and wˉ⁡′(S)=−1\operatorname{\bar{w}}^{\prime}(\mathtt{S})=-1.

In the resulting theory Δ′\Delta^{\prime}, a single existential quantifier is now eliminated. This building block can eliminate single universal quantifiers as well. When Δ\Delta contains a subexpression ∀x,ϕ(x,y)\forall x,\phi(x,\mathbf{y}), we replace it by ¬∃x,¬ϕ(x,y)\neg\exists x,\neg\phi(x,\mathbf{y}), whose existential quantifier can be eliminated with Definition 3.

Repeated application of Definition 3 comprises a modular Skolemization algorithm.

The detailed proof can be found in the appendix.

Intuition

Our Skolemization algorithm implicitly tries to enforce an equivalence between the eliminated subexpression and the Tseitin predicateThis equivalence represents a set of propositional Tseitin encodings, in which each Z\mathtt{Z} atom is a Tseitin variable (?)., which is explicitly written as

This equivalence contains an existential quantifier so it cannot be represented explicitly. Instead, the algorithms enforces a relaxed equivalence, represented by the three formulas in Definition 3. The intuition is that by relaxing the equivalence we introduce additional models to the theory, but for every additional model with weight WW, there is exactly one additional model with weight −W-W.This is not dissimilar to the inclusion-exclusion principle. The WFOMC therefore stays the same.

The interaction between the three relaxed formulas, the intended equivalence, and the model weights becomes more apparent after a case analysis on Z(y)\mathtt{Z}(\mathbf{y}):

When Z(y)\mathtt{Z}(\mathbf{y}) is false, it implies that ∃x,ϕ(x,y)\exists x,\phi(x,\mathbf{y}) is false, which is intended. It also implies that S(y)\mathtt{S}(\mathbf{y}) is true, which does not change the model count, since we multiply by 11.

When Z(y)\mathtt{Z}(\mathbf{y}) is true, it implies that only three states of S(y)\mathtt{S}(\mathbf{y}) and ∃x,ϕ(x,y)\exists x,\phi(x,\mathbf{y}) are allowed:

∃x,ϕ(x,y)\exists x,\phi(x,\mathbf{y}) is true and S(y)\mathtt{S}(\mathbf{y}) is true. This is again intended, because Z(y)\mathtt{Z}(\mathbf{y}) and ∃x,ϕ(x,y)\exists x,\phi(x,\mathbf{y}) are equivalent.

∃x,ϕ(x,y)\exists x,\phi(x,\mathbf{y}) is false and S(y)\mathtt{S}(\mathbf{y}) is true. This is an unintended state with a positive weight WW.

∃x,ϕ(x,y)\exists x,\phi(x,\mathbf{y}) is true and S(y)\mathtt{S}(\mathbf{y}) is false. This is an unintended state with a weight −W-W. The negative weight comes from the fact that wˉ⁡(S)=−1\operatorname{\bar{w}}(\mathtt{S})=-1.

The weights of the unintended models cancel each other out.

Examples

We will now illustrate our Skolemization algorithm on concrete examples. Suppose that Δ\Delta is Formula 5, that is,

We can apply Definition 3 to the subexpression ∃y, WorksFor(x,y)∨Boss(x)\exists y,~{}\mathtt{WorksFor}(x,y)\lor\mathtt{Boss}(x), resulting in a Δ′\Delta^{\prime} equal to

The first formulas is the original formula with the subexpression substituted by Z(x)\mathtt{Z}(x).

To get a better insight into the result, we will simplify it using first-order unit propagation (?) while noting that the first formula is a unit clause. The simplified theory is

We verify the correctness of this Skolemization as follows.

When Boss(x)\mathtt{Boss}(x) is true, the formula is satisfied for xx, and the models of Δ′\Delta^{\prime} are intended, that is, they correspond to models of Δ\Delta. Indeed, S(x)\mathtt{S}(x) is entailed to be true and the model weights are multiplied by one.

When Boss(x)\mathtt{Boss}(x) is false and WorksFor(x,y)\mathtt{WorksFor}(x,y) is true for at least one yy, then S(x)\mathtt{S}(x) is entailed to be true. Again these models are intended, because ∃y, WorksFor(x,y)∨Boss(x)\exists y,~{}\mathtt{WorksFor}(x,y)\lor\mathtt{Boss}(x) is now satisfied for xx. The model weights are multiplied by one.

When Boss(x)\mathtt{Boss}(x) is false and WorksFor(x,y)\mathtt{WorksFor}(x,y) is false for all yy then S(x)\mathtt{S}(x) can be either true or false. This is where unintended models appear, once with S(x)\mathtt{S}(x) true and once with S(x)\mathtt{S}(x) false. Because they have opposing weights, the contributions of these unintended models cancel out.

As a second example, consider Δ\Delta to be

Skolemization of the inner existential quantifier results in

This example shows the need for a Tseitin predicate Z1\mathtt{Z}_{1}. The first sentence still contains an existential quantifier. One more elimination and unit propagation step replaces that sentence by ∀y,∀x, S2(y)∨¬Z1(x,y)\forall y,\forall x,~{}\mathtt{S}_{2}(\mathbf{y})\lor\neg\mathtt{Z}_{1}(x,y) and the result is in Skolem normal form.

Properties

Theorem 3 suggests the repeated application of Definition 3, as long as the sentence contains an existential quantifier, or a universal quantifier not in prenex form. This approach has one caveat: eliminating ∃x,ϕ(x,y)\exists x,\phi(x,\mathbf{y}) adds the expression ¬ϕ(x,y)\neg\phi(x,\mathbf{y}) to Δ′\Delta^{\prime}. When we eliminate quantifiers from left to right, ϕ(x,y)\phi(x,\mathbf{y}) itself can contain quantifiers. This operation will introduce new quantifiers in ¬ϕ(x,y)\neg\phi(x,\mathbf{y}) and cause a blow up due to the duplication in the newly added formulas. This can be avoided by eliminating from right to left, that is, from innermost to outermost. We can show the following theorem, whose proof is in the appendix.

Repeated application of Definition 3 will terminate with a sentence in Skolem normal form. Moreover, this can be achieved in time polynomial in the size of Δ\Delta.

The resulting Skolem normal form sentence can subsequently be transformed into first-order CNF. When using Tseitin’s transformation (?), this can even be done in polynomial time.

In our first example, the Tseitin predicate Z\mathtt{Z} could be removed from Δ′\Delta^{\prime} by unit propagation. The following proposition generalizes that observation.

Suppose that we are eliminating a subexpression ∃x,ϕ(x,y)\exists x,\phi(x,\mathbf{y}) from a sentence ∀y,∃x,ϕ(x,y)\forall\mathbf{y},\exists\mathbf{x},\phi(x,\mathbf{y}) using the procedure of Definition 3. That is, the existential quantifier in this subexpression is only preceded by universal quantifiers. Then, we can avoid adding Tseitin predicate Z\mathtt{Z} and instead define Δ′\Delta^{\prime} to be

This simplifies the transformation when applicable, in particular when Δ\Delta is already in prenex normal form.

WFOMC Encodings

We will show in this section how the proposed Skolemization technique can extend the scope of first-order model counters to new situations. We will consider in particular one undirected first-order probabilistic language (Markov Logic) and one directed language (Probabilistic Logic Programs). First-order model counters currently apply to a subset of the first representation, and not to the second representation. With Skolemization, these model counters can now be applied to both. Our treatment is based on providing WFOMC encodings of these representations, to which our Skolemization technique is then applied.These encodings are implemented in the WFOMC system: http://dtai.cs.kuleuven.be/wfomc

Consider a first-order probabilistic model that induces the distribution Pr⁡D(.)\Pr\nolimits{D}(.) for domain \mathbfsfD\mathbfsf{D}. A WFOMC encoding of this model is a triple (Δ,w⁡,wˉ⁡)(\Delta,\operatorname{w},\operatorname{\bar{w}}) which guarantees that for any sentence ϕ\phi (usually a conjunction of literals) and domain \mathbfsfD\mathbfsf{D}, we have that

We will now introduce a WFOMC encoding for Markov logic networks (MLN) (?).

An MLN is a set of tuples (w,ψ)(w,\psi), where ww is a real number representing a weight and ψ\psi is a formula in first-order logic. When ww is infinite, ψ\psi represents a first-order logic constraint, also called a hard formula.

Building further on the example given before, consider the following MLN

This statement softens the logical sentence we saw earlier. Instead of saying that every person either has a boss, or is a boss, it states that worlds with many employed people are more likely. That is, it is now possible to have a world with unemployed people, but the more unemployed people there are, the lower the probability of that world.

The semantics of a first-order MLN Φ\Phi is defined in terms of its grounding for a given domain of constants \mathbfsfD\mathbfsf{D}. The grounding of Φ\Phi is the MLN obtained by first grounding all its quantifiers and then replacing each formula in Φ\Phi with all its groundings (using the same weight). With the domain \mathbfsfD={A,B}\mathbfsf{D}=\{\mathsf{A},\mathsf{B}\} (e.g., two people, Alice and Bob), the above first-order MLN represents the following grounding.

This ground MLN contains six different random variables, which correspond to all groundings of atoms WorksFor(x,y)\mathtt{WorksFor}(x,y) and Boss(x)\mathtt{Boss}(x). This leads to a distribution over 262^{6} possible worlds (i.e., interpretation). The weight of each world is simply the product of all weights ewe^{w}, where (w,γ)(w,\gamma) is a ground MLN formula and γ\gamma is satisfied by the world. The weights of worlds that do not satisfy a hard formula are set to zero. The probabilities of worlds are obtained by normalizing their weights.

Encoding a Markov Logic Network

The WFOMC encoding (Δ,w⁡,wˉ⁡)(\Delta,\operatorname{w},\operatorname{\bar{w}}) of an MLN is constructed as follows. For each MLN formula (wi,ϕi(xi))(w_{i},\phi_{i}(\mathbf{x}_{i})), where xi\mathbf{x}_{i} denotes the free logical variables in ϕi\phi_{i}, we introduce a parameter predicate Pi/∣xi∣\mathtt{P_{i}}/|\mathbf{x}_{i}|. For each MLN formula, Δ\Delta contains the sentence ∀xi, Pi(xi)⇔ϕi(xi)\forall\mathbf{x}_{i},~{}\mathtt{P_{i}}(\mathbf{x}_{i})\Leftrightarrow\phi_{i}(\mathbf{x}_{i}). The weight function sets w⁡(Pi)=ewi\operatorname{w}(\mathtt{P_{i}})=e^{w_{i}}, wˉ⁡(Pi)=1\operatorname{\bar{w}}(\mathtt{P_{i}})=1, and w⁡(Q)=wˉ⁡(Q)=1\operatorname{w}(\mathtt{Q})=\operatorname{\bar{w}}(\mathtt{Q})=1 for all other predicates Q\mathtt{Q}.

Each Pi\mathtt{P_{i}} captures the truth value of ϕi\phi_{i} and carries its weight. Hard formulas can directly be encoded as constraints.

The encoding of Formula 6 has Δ\Delta equal to

Its w⁡\operatorname{w} maps P\mathtt{P} to e1.3e^{1.3} and all other predicates to 11. Its wˉ⁡\operatorname{\bar{w}} maps all predicates to 11.

As discussed in Section 2, WFOMC algorithms require first-order CNF input. Definition 4 will only yield a Δ\Delta in Skolem normal form (and thus rewritable into CNF) if the MLN formulas are quantifier-free. Then, the only quantifiers in Δ\Delta are the universal ones introduced by the encoding itself. Therefore, ? (?) and ? (?) resort to grounding all quantifiers in the MLN formulas so as to obtain a CNF. This makes the WFOMC encoding specific to the domain \mathbfsfD\mathbfsf{D}, and partly removes first-order structure from the problem.

Our discussion is based on ? (?). It is similar to the encoding of ? (?), whose parameter predicates have more arguments. While these encodings are specific to MLNs, it is straightforward to generalize them to other undirected languages, such as parfactor graphs (?).

Applying Skolemization

We can now perform WFOMC inference in MLNs with quantifiers. Skolemization and CNF conversion for the example above results in a Δ′\Delta^{\prime} equal to

This theory can be used for WFOMC inference.

Probabilistic Logic Programs

We now show a WFOMC encoding for a directed first-order probabilistic language. The encoding is explained for the ProbLog language (?; ?).

ProbLog extends logic programs with facts that are annotated with probabilities. A ProbLog program Φ\Phi is a set of probabilistic facts FF and a regular logic program LL. A probabilistic fact p ⁣:: ⁣ap\!::\!a consists of a probability pp and an atom aa. A logic program is a set of rules, with the form Head:-⁡Body\mathtt{Head}\operatorname{:-}\mathtt{Body}, where the head is an atom and the body is a conjunction of literals. For example,

This program expresses that if more people attend a workshop, it more likely turns into a series of workshops.

The semantics of a ProbLog program Φ\Phi are defined by a distribution over the groundings of the probabilistic facts for a given domain of constants \mathbfsfD\mathbfsf{D} (?).Our treatment assumes a function-free and finite-domain fragment of ProbLog. Starting from classical ProbLog semantics, one can obtain the a finite function-free domain for a given query by exhaustively executing the Prolog program and keeping track of the goals that are called during resolution. The probabilistic facts pi ⁣:: ⁣aip_{i}\!::\!a_{i} induce a set of possible worlds, one for each possible partition of aia_{i} in positive and negative literals. The set of true aia_{i} literals with the logic program LL define a well-founded model (?). The probability of such a model is the product of pip_{i} for all true aia_{i} literals and 1−pi1-p_{i} for all false aia_{i} literals.

For the domain \mathbfsfD={A,B}\mathbfsf{D}=\{A,B\} (two people), the above first-order ProbLog program represents the following grounding:

This ground ProbLog program contains 4 probabilistic facts which corresponds to 242^{4} possible worlds. The weight of, for example, the world in which Attends(A)\mathtt{Attends}(A) and ToSeries(A)\mathtt{ToSeries}(A) are true would be 0.1⋅(1−0.1)⋅0.3⋅(1−0.3)=0.01890.1\cdot(1-0.1)\cdot 0.3\cdot(1-0.3)=0.0189 and the model would be {Attends(A),ToSeries(A),Series}\{\mathtt{Attends}(A),\mathtt{ToSeries}(A),\mathtt{Series}\}.

Encoding a ProbLog Program

The transformation from a ProbLog program to a first-order logic theory is based on Clark’s completion (?). This is a transformation from logic programs to first-order logic. For certain classes of programs, called tight logic programs (?), it is correct, in the sense that every model of the logic program is a model of the completion, and vice versa. Intuitively, for each predicate P\mathtt{P}, the completion contains a single sentence encoding all its rules. These rules have the form P(x):-⁡bi(x,yi)\mathtt{P}(\mathbf{x})\operatorname{:-}b_{i}(\mathbf{x},\mathbf{y}_{i}), where bib_{i} is a body and yi\mathbf{y}_{i} are the variables that appear in the body bib_{i} but not in the head. The sentence encoding these rules in the completion is ∀x, P(x)⇔⋁i∃yi, bi(x,yi)\forall\mathbf{x},~{}\mathtt{P}(\mathbf{x})\Leftrightarrow\bigvee_{i}\exists\mathbf{y}_{i},~{}b_{i}(\mathbf{x},\mathbf{y}_{i}). If the program contains cyclic rules, the completion is not sound, and, it is necessary to first apply a conversion to remove positive loops (?).

The WFOMC encoding (Δ,w⁡,wˉ⁡)(\Delta,\operatorname{w},\operatorname{\bar{w}}) of a tight ProbLog program has Δ\Delta equal to Clark’s completion of LL. For each probabilistic factIf multiple probabilistic facts are defined for the same predicate, auxiliary predicates need to be introduced. p ⁣:: ⁣ap\!::\!a we set the weight function to w⁡(pred⁡(a))=p\operatorname{w}(\operatorname*{pred}(a))=p and wˉ⁡(pred⁡(a))=1−p\operatorname{\bar{w}}(\operatorname*{pred}(a))=1-p.

Again, a Skolem normal form is required to use WFOMC. However, we get this form only when the variables that appear in the body of a rule also appear in the head of a rule. This is not the case for most Prolog programs though. For example, if we apply Definition 5 to the example above, an existential quantifier appears in the sentence:

Furthermore, w⁡\operatorname{w} maps Attends\mathtt{Attends} to 0.10.1 and ToSeries\mathtt{ToSeries} to 0.30.3, and wˉ⁡\operatorname{\bar{w}} maps Attends\mathtt{Attends} to 0.90.9 and ToSeries\mathtt{ToSeries} to 0.70.7. Both w⁡\operatorname{w} and wˉ⁡\operatorname{\bar{w}} are 11 for all other predicates. This example is not in Skolem normal form and requires Skolemization before it can be processed by WFOMC algorithms.

Applying Skolemization

Skolemization followed by CNF conversion gives a Δ′\Delta^{\prime} equal to

Sentence Δ′\Delta^{\prime} is in Skolem normal form and is now processable by WFOMC algorithms.

A simple ProbLog program as the one above is identical to a noisy-or structure (?), popular in Bayesian network modeling. Skolemization thus offers a fundamental method to lift first-order, directed structures, such as the noisy-or, in a generic manner (see also Section 6).

Liftability Implications

In our motivation for introducing first-order model counting, we touched upon the runtime and complexity improvements that can be attained by first-order counting. These complexity improvements have inspired a particular notion of lifted inference, called domain-lifted inference, which says that a WFOMC algorithm is lifted when it runs in time polynomial in the size of \mathbfsfD\mathbfsf{D} (?).

While this notion of lifted inference may not capture everyone’s perception of lifting, it does provide a clear formal framework. In particular, we can now talk about classes of sentences Δ\Delta for which an algorithm is domain-lifted. We say that the algorithm is complete for those classes. We can also talk about classes of sentences Δ\Delta for which there exists, or cannot exist a domain-lifted algorithm. We call the former classes liftable (?).

All existing completeness and liftability theorems require that Δ\Delta is in first-order CNF. This requirement carries over from the existing WFOMC algorithms. Given our Skolemization algorithm, we can now restate these theorems to apply more generally. For example, the positive liftability result of ? (?) becomes the following

Suppose that Δ\Delta is a theory of sentences with up to two logical variables, and otherwise arbitrary structure. The complexity of computing the WFOMC of Δ\Delta is polynomial in the size of \mathbfsfD\mathbfsf{D}. That is, this class is domain-liftable.

Other notions of liftability also include queries ϕ\phi in the complexity analysis, since they are important for lifted probabilistic inference. Based on ? (?), and ? (?), we can now claim the following.

Suppose that Δ\Delta is a theory of sentences with up to two logical variables, and otherwise arbitrary structure. The complexity of computing the WFOMC of Δ∧ϕ\Delta\land\phi is polynomial in the size of \mathbfsfD\mathbfsf{D} and ϕ\phi, provided that ϕ\phi is a conjunction of only unary literals, and binary literals of bounded Boolean rank.

These WFOMC liftability theorems have direct implications for all languages with a WFOMC encoding. For example, we can now say that MLNs with up to two logical variables per formula are domain-liftable, regardless of the quantifiers used. Previously, this was only true for quantifier-free MLNs. We can now also show that ProbLog programs with up to two logical variables per clause are guaranteed to be liftable. This is the first such liftability result for probabilistic logic programs.

Related Work

In the encodings for MLNs and probabilistic logics, the weight functions (indirectly) represent probabilities and are therefore always positive. Our Skolemization algorithm introduces negative weights. This might appear odd when interpreting the weights as negative probabilities. This issue has been discussed before. For example, ? (?) writes “Negative probabilities allow an abstract calculation which permits freedom to do mathematical calculations in any order simplifying the analysis enormously”.

The potential of negative probabilities was already observed by ? (?) for answering queries in probabilistic databases and served as inspiration for our approach. Probabilistic databases (?) are fundamentally a type of first-order probabilistic model. It can be viewed as a special type of weighted model counting problem (Δ,w)(\Delta,w), where the weight function encodes the probability w(t)w(t) with which a tuple tt can be found in the database. A query on such a database is typically a union of conjunctive queries (UCQ), which corresponds to a monotone DNF sentence Δ\Delta. A noticeable difference with most WMC solvers (and WFOMC) is that the solvers for probabilistic databases expect the theory Δ\Delta to be in DNF instead of CNF. Different from WFOMC is that although the query (i.e., Δ\Delta) is first-order, the weight function is defined on the propositional level like in WMC. Weights are thus assigned to ground literals (the tuples) whereas for WFOMC weights are assigned to predicates (the tables). This allows WFOMC to exploit more types of symmetries.

? (?) propose to extend probabilistic databases with MarkoViews, a representation similar to MLNs, in which each weighted formula is again a UCQ query, that is, a monotone DNF. To compute the probability of a query, they introduce negative tuple probabilities.

The use of negative probabilities has also come up for optimizing calculations for specific structures in probabilistic graphical models like noisy-or (?). This particular case has been translated to the first-order case by ? (?) and resulted in an approach to lift noisy-or structures. In Section 4 we showed how the application of Skolemization leads to lifting noisy-or and both methods turn out to output a similar encoding for this particular case. Therefore, the approach followed by ? (?) can be considered a special case of the Skolemization algorithm applied to a noisy-or model.

? (?) shows a negative liftability proof that uses relational Skolemization. Similar to our approach, subexpressions containing an existential quantifier are transformed and relaxed to eliminate the quantifier. Relational Skolemization, however, does not guarantee a correct model count. It rather guarantees that if the weight of a model is non-zero it will also be non-zero in the Skolemized version.

Conclusions

In this paper, we introduced a Skolemization procedure that is sound for weighted first-order model counting. It extends the applicability of first-order model counters to encodings which require an existential quantifier such as Markov logic models with quantifiers and probabilistic logic programs. It also extends the class of first-order sentences whose models we can count efficiently.

Acknowledgments

This work was supported by ONR grant #N00014-12-1-0423, NSF grant #IIS-1118122, NSF grant #IIS-0916161, and the Research Foundation-Flanders (FWO-Vlaanderen). GVdB is also at KU Leuven, Belgium.

Appendix

Appendix A Proof of Theorem 3

We will now prove the sequence of steps that leads to the removal of an existential quantifier in Δ\Delta to obtain Δ′\Delta^{\prime}, w⁡′\operatorname{w}^{\prime} and wˉ⁡′\operatorname{\bar{w}}^{\prime} while maintaining modularity. To replace the expression ∃x,ϕ(x,y)\exists x,\phi(x,\mathbf{y}) we perform the following steps.

Introduce a new Tseitin predicate Z/n\mathtt{Z}/n, whose arity nn is the number of y\mathbf{y} variables. Set w⁡′(Z)=wˉ⁡′(Z)=1\operatorname{w}^{\prime}(\mathtt{Z})=\operatorname{\bar{w}}^{\prime}(\mathtt{Z})=1 and for all other predicates P\mathtt{P}, set w⁡′(P)=w⁡(P)\operatorname{w}^{\prime}(\mathtt{P})=\operatorname{w}(\mathtt{P}) and wˉ⁡′(P)=wˉ⁡(P)\operatorname{\bar{w}}^{\prime}(\mathtt{P})=\operatorname{\bar{w}}(\mathtt{P}). Construct Δ′\Delta^{\prime} by replacing the expression ∃x,ϕ(x,y)\exists x,\phi(x,\mathbf{y}) in Δ\Delta by the atom Z(y)\mathtt{Z}(\mathbf{y}), and appending the equivalence .

In any grounding of Δ\Delta, this step performs a Tseitin encoding of all groundings of ∃x,ϕ(x,y)\exists x,\phi(x,\mathbf{y}). The groundings of Z(y)\mathtt{Z}(\mathbf{y}) play the role of Tseitin variables. This step therefore satisfies Property 2.

Rewrite equivalence ∀y, Z(y)⇔∃x,ϕ(x,y)\forall\mathbf{y},~{}\mathtt{Z}(\mathbf{y})\Leftrightarrow\exists x,\phi(x,\mathbf{y}) as two implications, ∀y, Z(y)⇒∃x,ϕ(x,y)\forall\mathbf{y},~{}\mathtt{Z}(\mathbf{y})\Rightarrow\exists x,\phi(x,\mathbf{y}) and ∀y, Z(y)⇐∃x,ϕ(x,y)\forall\mathbf{y},~{}\mathtt{Z}(\mathbf{y})\Leftarrow\exists x,\phi(x,\mathbf{y}). In clausal form, these become

This step satisfies Property 2 because it is a logical equivalence.

Introduce a new Skolem predicate predicate S/n\mathtt{S}/n. Set w⁡(S)=1\operatorname{w}(\mathtt{S})=1 and wˉ⁡(S)=0\operatorname{\bar{w}}(\mathtt{S})=0 and replace the sentence ∀y,∃x, ¬Z(y)∨ϕ(x,y)\forall\mathbf{y},\exists x,~{}\neg\mathtt{Z}(\mathbf{y})\lor\phi(x,\mathbf{y}) by

In all models of the resulting theory where ∀y,∃x, ¬Z(y)∨ϕ(x,y)\forall\mathbf{y},\exists x,~{}\neg\mathtt{Z}(\mathbf{y})\lor\phi(x,\mathbf{y}) is not satisfied, there will exist a y\mathbf{y} for which ∃x,¬Z(y)∨ϕ(x,y)\exists x,\neg\mathtt{Z}(\mathbf{y})\lor\phi(x,\mathbf{y}) is not satisfied. This will cause at least one S(y)\mathtt{S}(\mathbf{y}) atom to be false in those models, which means that the weight of those models is multiplied by . The weight of all other models remains the same. This step therefore satisfies Property 2.

Set wˉ⁡(S)=−1\operatorname{\bar{w}}(\mathtt{S})=-1 and turn the equivalence ∀y, S(y)⇔∃x,¬Z(y)∨ϕ(x,y)\forall\mathbf{y},~{}\mathtt{S}(\mathbf{y})\Leftrightarrow\exists x,\neg\mathtt{Z}(\mathbf{y})\lor\phi(x,\mathbf{y}) into an implication ∀y, S(y)⇐∃x,¬Z(y)∨ϕ(x,y)\forall\mathbf{y},~{}\mathtt{S}(\mathbf{y})\Leftarrow\exists x,\neg\mathtt{Z}(\mathbf{y})\lor\phi(x,\mathbf{y}), which in clausal form becomes

Replacing the equivalence by an implication and changing wˉ⁡(S)\operatorname{\bar{w}}(\mathtt{S}) to −1-1 is correct for the following reason. Let S(y)⇔Σ(y)\mathtt{S}(\mathbf{y})\Leftrightarrow\Sigma(\mathbf{y}) be the above equivalence which is in Δ\Delta, and let Γ\Gamma represent all other sentences in Δ\Delta (i.e., Δ≡(Σ(y)⇔S(y))∧Γ\Delta\equiv(\Sigma(\mathbf{y})\Leftrightarrow\mathtt{S}(\mathbf{y}))\land\Gamma). Our goal is now to construct a triple (Δ′,w⁡′,wˉ⁡′)(\Delta^{\prime},\operatorname{w}^{\prime},\operatorname{\bar{w}}^{\prime}), where Δ′≡(Σ(y)⇒S(y))∧Γ\Delta^{\prime}\equiv(\Sigma(\mathbf{y})\Rightarrow\mathtt{S}(\mathbf{y}))\land\Gamma, such that WFOMC⁡(Δ∧ϕ,\mathbfsfD,w⁡,wˉ⁡)=WFOMC⁡(Δ′∧ϕ,\mathbfsfD,w⁡′,wˉ⁡′)\operatorname*{WFOMC}(\Delta\land\phi,\mathbfsf{D},\operatorname{w},\operatorname{\bar{w}})=\operatorname*{WFOMC}(\Delta^{\prime}\land\phi,\mathbfsf{D},\operatorname{w}^{\prime},\operatorname{\bar{w}}^{\prime}) for all domains \mathbfsfD\mathbfsf{D} and all sentences ϕ\phi.

Let Σ(A)\Sigma(\mathsf{A}) and S(A)\mathtt{S}(\mathsf{A}) be any arbitrary grounding of Σ(y)\Sigma(\mathbf{y}) and S(y)\mathtt{S}(\mathbf{y}). A case analysis on the values of Σ(A)\Sigma(\mathsf{A}) and S(A)\mathtt{S}(\mathsf{A}) shows that WFOMC⁡(Δ∧ϕ,\mathbfsfD,w⁡,wˉ⁡)\operatorname*{WFOMC}(\Delta\land\phi,\mathbfsf{D},\operatorname{w},\operatorname{\bar{w}}) and WFOMC⁡(Δ′∧ϕ,\mathbfsfD,w⁡′,wˉ⁡′)\operatorname*{WFOMC}(\Delta^{\prime}\land\phi,\mathbfsf{D},\operatorname{w}^{\prime},\operatorname{\bar{w}}^{\prime}) consist of the following terms (for compactness we drop \mathbfsfD\mathbfsf{D} from the notation since it doesn’t change).

Note that wˉ⁡(S)=0\operatorname{\bar{w}}(\mathtt{S})=0 in the encoding of Δ\Delta, and that thus

Setting w⁡′(P)=w⁡(P)\operatorname{w}^{\prime}(\mathtt{P})=\operatorname{w}(\mathtt{P}) for all predicates P\mathtt{P} except for S\mathtt{S} ensures that WFOMC⁡(Γ∧Σ(A)∧ϕ,w⁡,wˉ⁡)=WFOMC⁡(Γ∧Σ(A)∧ϕ,w⁡′,wˉ⁡′)\operatorname*{WFOMC}(\Gamma\land\Sigma(\mathbf{A})\land\phi,\operatorname{w},\operatorname{\bar{w}})=\operatorname*{WFOMC}(\Gamma\land\Sigma(\mathbf{A})\land\phi,\operatorname{w}^{\prime},\operatorname{\bar{w}}^{\prime}), that WFOMC⁡(Γ∧¬Σ(A)∧ϕ,w⁡,wˉ⁡)=WFOMC⁡(Γ∧¬Σ(A)∧ϕ,w⁡′,wˉ⁡′)\operatorname*{WFOMC}(\Gamma\land\neg\Sigma(\mathbf{A})\land\phi,\operatorname{w},\operatorname{\bar{w}})=\operatorname*{WFOMC}(\Gamma\land\neg\Sigma(\mathbf{A})\land\phi,\operatorname{w}^{\prime},\operatorname{\bar{w}}^{\prime}). Furthermore, set w⁡(S)=w⁡′(S)\operatorname{w}(\mathtt{S})=\operatorname{w}^{\prime}(\mathtt{S}). What remains for WFOMC⁡(Δ∧ϕ,w⁡,wˉ⁡)\operatorname*{WFOMC}(\Delta\land\phi,\operatorname{w},\operatorname{\bar{w}}) to equal WFOMC⁡(Δ′∧ϕ,w⁡′,wˉ⁡′)\operatorname*{WFOMC}(\Delta^{\prime}\land\phi,\operatorname{w}^{\prime},\operatorname{\bar{w}}^{\prime}) is that w⁡′(S)+wˉ⁡′(S)=w⁡(S)+wˉ⁡′(S)=0\operatorname{w}^{\prime}(\mathtt{S})+\operatorname{\bar{w}}^{\prime}(\mathtt{S})=\operatorname{w}(\mathtt{S})+\operatorname{\bar{w}}^{\prime}(\mathtt{S})=0, which is achieved by setting wˉ⁡′(S)=−w⁡(S)=−1\operatorname{\bar{w}}^{\prime}(\mathtt{S})=-\operatorname{w}(\mathtt{S})=-1.

Appendix B Proof of Theorem 4

We begin by proving termination. Let the internal quantifier count of a sentence be the number of quantifiers it contains, excluding the leading universal quantifiers. Suppose that a sentence has an internal quantifier count of mm. We can select any subexpression that starts with a quantifier and apply Skolemization to it (potentially converting ∀\forall into ∃\exists first). This reduces the internal quantifier count of Δ\Delta to be at most m−1m-1 because at least one quantifier is removed. New sentences are added, however, containing the Tseitin and Skolem predicates, and expressions ¬ϕ(x,y)\neg\phi(x,\mathbf{y}). These sentences also have an internal quantifier count of at most m−1m-1. Suppose that the sentences in Δ\Delta have an internal quantifier count of at most mmaxm_{\mathit{max}}. Applying Skolemization to one quantifier in each sentence reduces the maximal internal quantifier count to at most mmax−1m_{max}-1. Therefore, by repeating this procedure for a finite number of steps, we obtain a theory with an internal quantifier count of zero, which is in Skolem normal form.

Next, we prove polynomial complexity. We can remove the quantifiers in a sentence Δ\Delta one by one, starting from the innermost quantifier. The removed subexpression ϕ(x,y)\phi(x,\mathbf{y}) does not contain any quantifiers, so the internal quantifier count of the added formulas is zero. They are in Skolem normal form. The innermost subexpression is replaced by a Tseitin predicate, reducing the internal quantifier count by one. The number of required elimination steps before the entire sentence is in Skolem normal form is thus equal to the number of quantifiers in Δ\Delta. Moreover, the number of added formulas, and their size, is polynomial in the size of Δ\Delta. ∎

References