Keywords

1 Introduction

Satisfiability is a semantic problem: it relates not just to a logic (here, the infinite-valued Łukasiewicz logic), but to a semantics interpreting that logic (here, the MV-algebra on the real unit interval with natural order, called “standard MV-algebra” and denoted ).

A propositional formula \(\varphi (x_1,\dots ,x_n)\) of the language of Łukasiewicz logic is satisfiable in an MV-algebra \( {\mathcal {A}}\) provided there is an assignment of elements of the universe of \( {\mathcal {A}}\) to \(x_1,\dots ,x_n\) that yields the value \(1^{ {\mathcal {A}}}\) (i.e., the top element in the lattice order of \( {\mathcal {A}}\)). This definition determines, for a given MV-algebra \( {\mathcal {A}}\), a unique set of its satisfiable formulas \(\textbf{SAT}( {\mathcal {A}})\). The satisfiability notion extends immediately to a finite list of formulas \(\langle \varphi _1,\dots , \varphi _m\rangle \), which is satisfiable in \( {\mathcal {A}}\) if and only if so is the conjunction of the formulas on the list.Footnote 1

This paper works with the standard MV-algebra without mentioning it explicitly from now on; thus we write \(\textbf{SAT}\) for and likewise for the MaxSAT problems considered in this paper. If another algebra, distinct from , is considered, it will be indicated explicitly.

The focus of this paper is not on satisfiability, but on maximum satisfiability, an optimization problem (with a natural decision version): given a multiset (i.e., a list) of arbitrary formulas of the language of Łukasiewicz logic, find the maximum number among them that can be satisfied under a single assignment, over all assignments. The formulas are not required to be in a normal form. It has been recognized early on by Mundici [22] that formulas of Łukasiewicz logic are a suitable device for counting; his paper gives a reduction of the (decision version of) the Boolean MaxSAT problem to the problem \(\textbf{SAT}\); see also [25].

The MaxSAT problem for a list of arbitrary formulas over the three-element MV-chain has been addressed in [19], using semantic tableaux; the approach generalizes to other finite MV-chains, but not to MV-chains with infinitely many elements. Earlier results in satisfiability go back to Mundici’s proof of the \(\textbf{NP}\)-completeness of the \(\textbf{SAT}\) problem, obtained by bounding the denominators of a satisfying assignment. This line of research was continued in [1, 2], see also [27].

Our main contribution consists in showing that the MaxSAT problem can be reduced to the \(\textbf{SAT}\) problem, in Sect. 3, and can then be used as a benchmark to assess the analytic method in Sect. 4; a similar analysis could then be performed with any other calculi for the maximum satisfiability problem.

This paper is structured as follows. Section 2 defines the problem and introduces technical tools. Section 3 gives a method for solving the MaxSAT problem in based on a Cook reduction of MaxSAT to the \(\textbf{SAT}\) problem. Section 4 outlines an analytic method with preprocessing via a Tseitin transformation, using a variant of the approach of [12, 24], where each branch of a tableau tree ends with solving a system of linear constraints. The method is proved sound and complete. Eliminating the branching of the tree can also be achieved, using established tools.

2 Problem Formulation and Preliminaries

The language of propositional Łukasiewicz logic Ł, denoted , has two basic connectives: \(\lnot \) (negation, unary) and \(\oplus \) (strong disjunction, binary). Other connectives are definable: 1 is \(x\oplus \lnot x\); 0 is \(\lnot 1\); \(x\odot y\) is \(\lnot (\lnot x\oplus \lnot y)\) (strong conjunction); \(x\rightarrow y\) is \(\lnot x \oplus y\); \(x\leftrightarrow y\) is \((x\rightarrow y)\odot (y\rightarrow x)\); \(x\vee y\) is \((x\rightarrow y) \rightarrow y\) (weak disjunction); and \(x\wedge y\) is \(\lnot (\lnot x \vee \lnot y)\) (weak conjunction).

Well-formed formulas of are built up from an infinite set of propositional variables \(\textrm{Var}=\{ x_i \}_{i\in {\mathbb {N}}}\) using the connectives of . The basic language is a point of reference for complexity considerations; other connectives are used as shortcuts. If \(\varphi \) is a formula of in the basic language, \(|\varphi |\) denotes the number of occurrences of propositional variables in \(\varphi \). Given that \(\lnot \lnot \alpha \leftrightarrow \alpha \) is a theorem of Ł for any formula , we will assume double negation does not occur in formulas. With this convention in place, the number of occurrences of connectives in \(\varphi \) is bounded by \(2|\varphi |\). Thus \(|\varphi |\) is a good notion of length of \(\varphi \). Moreover \(||\varphi ||\) denotes the number of distinct subformulas of \(\varphi \).

MV-algebras can be introduced using Mundici’s \(\varGamma \)-functor [10, 20]: any MV-algebra is isomorphic to \(\varGamma ( {\mathcal {G}},u)\) for a lattice-ordered Abelian group \( {\mathcal {G}}\) with a strong unit u (in particular, define \(x\oplus y = u \wedge (x+y)\) and \(\lnot x = u-x\) for \(x,y\in G\); then \( \varGamma ( {\mathcal {G}},u) = \langle [0,u], \oplus , \lnot \rangle \) is an MV-algebra). The standard MV-algebra is \(\varGamma ({\mathbb {R}},1)\), interpreting the basic connectives in [0, 1] as follows: for any assignment v, \(v(\lnot \varphi ) = 1 - v(\varphi )\) and \(v(\varphi \oplus \psi ) = \min (1, v(\varphi ) + v(\psi ))\). Any assignment to variables of \(\varphi \) in language extends to all its subformulas in the interpretation provided by ; this also determines the notion of satisfiability in and the set of satisfiable formulas of , denoted \(\textbf{SAT}\).

The interpretations of \(\oplus \), \(\odot \), \(\wedge \) and \(\vee \) are commutative and associative, so one can write \(x_1 \oplus \dots \oplus x_n\) without worrying about order and parentheses. We write \(x^n\) for \(\underbrace{x\odot \dots \odot x}_{n \text { occurrences}}\) and nx for \(\underbrace{x\oplus \dots \oplus x}_{n \text { occurrences}}\). Also, \(\vee \) and \(\wedge \) distribute over each other and \(\odot \) distributes over \(\vee \).

Unlike the Boolean MaxSAT problem over the two-element Boolean algebra, here we work with arbitrary formulas of . We formulate both the optimization and the decision version of the MaxSAT problem.

MaxSAT-OPT

Instance: multiset \(\langle \varphi _1,\dots ,\varphi _m\rangle \) of formulas of in variables \(\{x_1,\dots ,x_n\}\).

Output: the maximum integer \(k\le m\) such that there is an assignment v to \(\{x_1,\dots ,x_n\}\) that satisfies at least k formulas in the multiset \( \langle \varphi _1,\dots ,\varphi _m \rangle \).

MaxSAT-DEC

Instance: multiset \(\langle \varphi _1,\dots ,\varphi _m \rangle \) of formulas of in variables \(\{x_1,\dots ,x_n\}\) and a positive integer \(k\le m\).

Output: (Boolean) Is MaxSAT-OPT\((\langle \varphi _1,\dots ,\varphi _m \rangle (x_1,\dots ,x_n))\) at least k?

Let \({\textbf{A}}\) be an integer \(m \times n\) matrix. Let \({\textbf{x}}\) be an n-vector of variables and \({\textbf{b}}\) be an integer m-vector. The solvability of the system of inequalities \({\textbf{A}}{\textbf{x}} \le \textbf{b}\) in \({\mathbb {R}}\) can be tested in polynomial time [28].

More generally, for the system \({\textbf{A}}{\textbf{x}} \le \textbf{b}\), one can ask about the maximal size (number of lines) of a subsystem that is solvable in \({\mathbb {R}}\). This problem is known as the maximum feasible subsystem [4] of a system of linear constraints: the solution is a natural number k bounded by m (the total number of lines in the system). This problem is \(\textbf{NP}\)-hard. We shall refer to this problem as Max-FS problem. Notice that the system is not defined as a set, so the same constraint may appear multiple times.

There are many variants of the Max-FS problem, indeed many were already suggested in the paper [4]. We will use a variant that partitions the linear constraints into two groups: those that need to be satisfied by any feasible solution (often called hard constraints; the paper [4] refers to them as “mandatory”) and those the satisfied number of which is to be maximized (often called soft constraints; [4] refers to them as “optional”) over all feasible solutions. This variant of Max-FS problem will be called Max-FS with hard and soft constraints within this paper.

3 Canonical Method

First we give a polynomial-time, many-one (a.k.a. Karp) reduction of MaxSAT-DEC to \(\textbf{SAT}\). Our reduction is similar to those used in [25] (which, in turn, refers to [22]) and in [15]. The differences arise from the fact that, in our case, an unsatisfied formula can take any value below 1 (but not necessarily 0), and this needs to be addressed in the definition of the set of formulas in the reduction.

Let \(\langle \varphi _1,\dots ,\varphi _m \rangle (x_1,\dots ,x_n)\) and \(k\le m\) be an instance of MaxSAT-DEC. It is well known that one can implicitly define any rational value in with a formula of : an early example of suitable formulas can be found in [30]. Let \(k\ge 2\) and y be a new variable, not among \((x_1,\dots ,x_n)\), and let

$$ \rho _{1/k} {:}{=}\ \ y \leftrightarrow \lnot ( (k-1) y)$$

Then we have that \(\rho _{1/k}\) implicitly defines the rational value 1/k in (see, e.g., [25, Lemma 2]): that is, an assignment v in sends \(\rho _{1/k}\) to 1 if and only if it sends y to 1/k. Moreover, the length of this formula is linear in \(k\le m\), therefore linear in the size of the instance on input.

For \(1\le i \le m\), consider a new variable \(y_{i,k}\), let \(\varPhi _{\varphi _i,k}\) be the set of formulas

$$ \{ (\varphi _i \leftrightarrow k\, y_{i,k}) \vee \lnot y_{i,k} {\ \ ,\ \ } (y_{i,k} \leftrightarrow y )\vee \lnot y_{i,k} \}$$

and let \(\varPhi _{k}\) be the list of formulas \(\bigcup _{1\le i\le m} \{\varPhi _{\varphi _i,k}\}\).

Theorem 1

The pair \(\langle \varphi _1,\dots ,\varphi _m \rangle (x_1,\dots ,x_n)\) and k with \(2\le k\le m\) belongs to MaxSAT-DEC if and only if the set \(\{ \rho _{1/k} \} \cup \varPhi _{k} \cup \{ \bigoplus _{i=1}^m y_{i,k}\}\) belongs to \(\textbf{SAT}\).

Proof

For the left-to-right direction, assume v to be an assignment satisfying—without loss of generality—the first k formulas of the list. Consider then the assignment \(v'\) that coincides with v on the variables \(x_1, \ldots , x_n\) and puts \(v'(y) = 1/k\) and

$$\begin{aligned} v'(y_{i,k}) = {\left\{ \begin{array}{ll} 1/k&{}\hbox { if } i \le k\\ 0 &{}\hbox {otherwise.}\end{array}\right. } \end{aligned}$$

The assignment \(v'\) clearly satisfies \(\rho _{1/k}\). Next, since \(v'(y_{1,k}) = \ldots = v'(y_{k,k}) = 1/k\), also \(v'(\bigoplus _{i=1}^m y_{i,k}) = 1\). Lastly, the formulas in \(\varPhi _{k}\) are satisfied under \(v'\): the formulas \((y_{i,k} \leftrightarrow y )\vee \lnot y_{i,k}\) are trivially satisfied, since each \(y_{i,k}\) is indeed sent to either 1/k (and hence, \(v'(y)\)) or to 0. For the other formulas in \(\varPhi _{k}\), first \(v'(\varphi _j) = 1\) and \(kv'(y_{j,k}) = k1/k = 1\) for each \(1 \le j \le k\), and \(v'(\lnot y_{j,k}) = 1\) for \(k < j \le m\), hence they are all satisfied.

For the right-to-left direction, let v be an assignment satisfying \(\{ \rho _{1/k} \} \cup \varPhi _{k} \cup \{ \bigoplus _{i=1}^m y_{i,k}\}\). From \(\varPhi _{k}\) and \(\rho _{1/k}\) we know \(v(y_{i,k})\) is either 1/k or 0. Therefore, for \(v(\bigoplus _{i=1}^m y_{i,k}) = 1\), necessarily at least k many y-variables are evaluated to 1/k. Assume, again without loss of generality, that \(v(y_{1,k}) = \ldots = v(y_{k,k}) = 1/k\). From \(\varPhi _{k}\), we get that \(v((\varphi _i \leftrightarrow k\, y_{i,k}) \vee \lnot y_{i,k}) = 1\) for each \(1\le i \le m\). In particular, since \(v(\lnot y_{j,k}) \ne 1\) for every \(1 \le j \le k\), necessarily \(v((\varphi _j \leftrightarrow k\, y_{j,k}))\) for each such j. Together with the previously observed fact that \(y_{j,k} = 1/k\) for each such j, this implies that \(v(\varphi _1)= \ldots = v(\varphi _k) = 1\), concluding the proof.

For \(k=1\), it is immediate that \(\langle \varphi _1,\dots ,\varphi _m\rangle \) and k is in MaxSAT-DEC if and only if \((\dots (\varphi _1\vee \varphi _2)\vee \dots )\vee \varphi _m\) is in \(\textbf{SAT}\). Given that for \(m=k=1\) both problems coincide, we get:

Corollary 1

The problem MaxSAT-DEC is \(\textbf{NP}\)-complete.

This reduction from MaxSAT-DEC to SAT provides a practical approach to the MaxSAT problem in , provided that we use a competitive algorithm for solving \(\textbf{SAT}\) (i.e., the satisfiability problem in ). We could rely on either of the following two \(\textbf{SAT}\) solvers, which have been shown rather efficient. The first one is the tableau with constraints method proposed by Hähnle [12] that reduces \(\textbf{SAT}\) to Mixed Integer Programming (MIP) and can therefore use any available MIP solver. The second one is the Satisfiability Modulo Theory (SMT) methods proposed by Ansótegui et al. that reduces \(\textbf{SAT}\) to an SMT satisfiability problem and can use any available SMT solver [6, 7, 32]. These methods can take advantage of the latest developments and innovations in MIP and SMT solvers, avoiding the need to implement a \(\textbf{SAT}\) solver from scratch.

A polynomial-time Turing (a.k.a. Cook) reduction of MaxSAT-OPT to MaxSAT-DEC can be given, as we proceed to explain. It is this approach that prompts our referring to this method of solving MaxSAT-OPT as canonical, given its wide scope of applicability to optimization problems (see, e.g., [29]). The reduction uses an unspecified algorithm for MaxSAT-DEC as an oracle; as usual with oracle computations, any call to the oracle counts as one step in the computation and under this proviso, the oracle computation runs in time polynomial in the input size (\(\varSigma _{i=1}^m |\varphi _i|\)). Indeed, given an instance \(\langle \varphi _1,\dots ,\varphi _m\rangle \), it is easy to arrive at the optimal value for MaxSAT-OPT using binary search on the discrete, polynomial-size search space \(\{1,\dots ,m\}\) of possible solutions, using at most \(\lceil \log m\rceil \) oracle calls. Considering that MaxSAT-DEC is \(\textbf{NP}\)-complete by Corollary 1, we have the following:

Corollary 2

MaxSAT-OPT is in \(\textbf{FP}^{\textbf{NP}}\).

For this conclusion, it is not important that the oracle solves MaxSAT-DEC; any oracle solving an \(\textbf{NP}\)-complete problem (an \(\textbf{NP}\)-oracle) would suit, and indeed one can use any algorithm for \(\textbf{SAT}\), relying on Theorem 1. In view of the obvious reduction from MaxSAT-DEC to MaxSAT-OPT, the two problems are equivalent in the sense that if either has a polynomial-time algorithm, so does the other. This is standard, and it is why the decision version of an optimization problem is often considered in lieu of the problem as such.

Can one do better than \(O(\log m)\) oracle calls? Below, we provide a classification of the problem in terms of Krentel’s work [17] that suggests a negative answer subject to \(\textbf{P}\not = \textbf{NP}\). Krentel ranks optimization problems in \(\textbf{FP}^{\textbf{NP}}\) in terms of the number of calls to an \(\textbf{NP}\)-oracle. For \(z: {\mathbb {N}}\longrightarrow {\mathbb {N}}\) a smooth function (i.e., z is non-decreasing and polynomial-time computable in unary representation), \(\textbf{FP}^{\textbf{NP}}[z(n)]\) is the class of functions computable in polynomial time with an \(\textbf{NP}\) oracle with at most \(z(\left| x\right| )\) oracle calls for instance x, where \(\left| x\right| \) denotes the length of x. By definition, \(\textbf{FP}^{\textbf{NP}}\) coincides with \(\textbf{FP}^{\textbf{NP}}[n^{O(1)}]\) since a polynomial-time algorithm can make no more than a polynomial amount of oracle calls.

For \(\varSigma \) a finite alphabet let \(f,g: \varSigma ^*\longrightarrow {\mathbb {N}}\). A metric reduction [17] from f to g is a pair \((h_1,h_2)\) of polynomial-time computable functions where \(h_1:\varSigma ^*\longrightarrow \varSigma ^*\) and \(h_2:\varSigma ^*\times {\mathbb {N}}\longrightarrow {\mathbb {N}}\) such that \(f(x)=h_2(x,g(h_1(x)))\) for all \(x\in \varSigma ^*\). The notion of a metric reduction is a natural generalization of polynomial-time many-one reduction to optimization problems. It follows from the definition that for each smooth function z as above, \(\textbf{FP}^{\textbf{NP}}[z(n)]\) is closed under metric reductions.

Theorem 2

( [17], see also [29]) Assume \(\textbf{P}\not =\textbf{NP}\).

Then \(\textbf{FP}^{\textbf{NP}}[O(\log \log n)] \subsetneq \textbf{FP}^{\textbf{NP}}[O(\log n)] \subsetneq \textbf{FP}^{\textbf{NP}}[n^{O(1)}]\).

Recall that Boolean algebras form a subvariety of MV-algebras. In particular, in any Boolean algebra, the interpretations of the strong and the weak disjunction coincide, as do the interpretations of the strong conjunction and the weak conjunction. When mapping the Boolean connectives to the connectives, we take \(\lnot \) for the Boolean negation, \(\vee \) for the Boolean disjunction, and \(\odot \) as the Boolean conjunction.

Moreover, in every nontrivial MV-algebra \( {\mathcal {A}}\), the set consisting of its bottom element \(0^{ {\mathcal {A}}}\) and its top element \(1^ {\mathcal {A}}\) is closed under all operations of \( {\mathcal {A}}\) and the subalgebra of \( {\mathcal {A}}\) on the universe consisting of these two elements is isomorphic to the two-element Boolean algebra.

Now let us recall the MaxSAT problem in the two-element Boolean algebra for CNF formulas, given as multisets of clauses.

Classical-MaxSAT-OPT

Instance: multiset \(\langle C_1,\dots ,C_m\rangle \) of Boolean clauses in variables \(\{x_1,\dots ,x_n\}\).

Output: the maximum integer \(k\le m\) such that there is an assignment v in the two-element Boolean algebra on \(\{0,1\}\) to \(\{x_1,\dots ,x_n\}\) that satisfies at least k clauses.

Krentel [17] proves the following result: Classical-MaxSAT-OPT is complete for \(\textbf{FP}^{\textbf{NP}}[O(\log m)]\) under metric reductions.

We now prepare a few technical tools for eventually giving a metric reduction of Classical-MaxSAT-OPT to MaxSAT-OPT. Following [16, Def. 7.1], consider the language \(\mathcal L\)(Ł) including the definable connectives and define:

  1. (i)

    a literal is a variable (such as x) or a negation thereof (such as \(\lnot x\)).

  2. (ii)

    A \((\odot , \vee )\)-formula is built up from literals using arbitrary combination of \(\odot \) and \(\vee \).

  3. (iii)

    In particular, a clause is built up from literals using only \(\vee \).

Lemma 1

([16, Thm. 7.4])

  • The interpretation of any \((\odot , \vee )\)-formula with n variables in is a convex function in \([0,1]^n\);

  • any \((\odot , \vee )\)-formula (in particular, any clause) is satisfiable in if and only if it is satisfiable in the two-element Boolean algebra \(\{0,1\}\).

Lemma 2

Let \(C_1,\dots ,C_l\) be clauses in in variables \(\{x_1,\dots ,x_n\}\). Assume \(\bar{a} \in [0,1]^n\) is such that \(C_i(\bar{a})=1\) for each \(1\le i\le l\). Then there is an element \(\bar{b}\in \{0,1\}^n\) such that \(C_i(\bar{b})=1\) for \(1\le i\le l\).

Proof

We construct \(\bar{b}\) from \(\bar{a}\) in n independent steps. Let \(\bar{b}_1 {:}{=}\bar{a}\). The j-th step takes a \(\bar{b}_j\), assuming the property that \(C_i(\bar{b}_j)=1\) for each \(1\le i\le l\), and produces \(\bar{b}_{j+1}\) with the same property, replacing the real value in the j-th coordinate of \(\bar{b}_j\) with a Boolean value (i.e., either a 0 or a 1). Lastly, we set \(\bar{b} {:}{=}\bar{b}_{n+1}\): all coordinates of \(\bar{b}\) are Boolean.

We describe the j-th step. We simplify notation by writing \(\bar{b}'\) for \(\bar{b}_j\). We thus have \(\bar{b}' = \langle b_1',\dots ,b_n'\rangle \). Consider the j-th component of this vector: if \(b_j'\) is 0 or 1, we set \(\bar{b}_{j+1} {:}{=}\bar{b}_{j}\), whereby the step is finished. If \( 0< b_j' < 1\), define \({\bar{b}'}_0 {:}{=}\langle b_1',\dots , b_{j-1}',0,b_{j+1}',\dots ,b_n'\rangle \) and \({\bar{b}'}_1 {:}{=}\langle b_1',\dots , b_{j-1}',1,b_{j+1}',\dots ,b_n'\rangle \). By assumption, we have \(C_1(\bar{b}') =1\). From Lemma 1, the interpretation of \(C_1\) is a convex function. Now assume that either \(C_1({\bar{b}'}_0) \not = 1 \) or \(C_1({\bar{b}'}_1) \not = 1 \). Then there is a convex combination of \(C_1({\bar{b}'}_0)\) and \(C_1({\bar{b}'}_1)\) that is strictly below \(C_1(\bar{b}')\), a contradiction with the convexity fact. We conclude that \(C_1({\bar{b}'}_0) = C_1({\bar{b}'}_1) = 1\). An analogous argument holds for the remaining clauses \(C_2,\dots ,C_l\). This means that we can set either \(\bar{b}_{j+1} {:}{=}{\bar{b}'}_0\) or \(\bar{b}_{j+1} {:}{=}{\bar{b}'}_1\) and we will indeed have \(C_i(\bar{b}_{j+1})=1\) for each \(1\le i\le l\).

Theorem 3

MaxSAT-OPT is complete for \(\textbf{FP}^{\textbf{NP}}[O(\log m)]\) under metric reductions.

Proof

Containment was obtained in Corollary 2 and the discussion preceding it. We prove hardness. We claim that the metric reduction of Classical-MaxSAT-OPT to MaxSAT-OPT is provided by a pair of identity functions. Take an arbitrary instance of Classical-MaxSAT-OPT problem, namely a multiset \(\langle C_1,\dots ,C_m\rangle \) of Boolean clauses in variables \(\{x_1,\dots ,x_n\}\), and interpret it as a multiset of clauses in (no change in notation is needed, see above). By Lemma 1, the interpretation of each \(C_i\) for \(i=1,\dots ,m\) in is a convex function. The convexity of the interpretation is not violated by rewriting each \(C_i\) in the basic connectives of ; this yields formulas \(\langle C_1^*,\dots ,C_m^*\rangle \). Feed this m-tuple to the algorithm solving MaxSAT-OPT. The output is a natural number \(k\le m\) which indicates the maximal number among \(\langle C_1^*,\dots ,C_m^*\rangle \) that are simultaneously satisfiable by an assignment in . We assume without loss of generality that the first k formulas in the list are satisfied by some assignment; hence so are the first k among \(\langle C_1,\dots ,C_m\rangle \). By Lemma 2, the same clauses (hence, the same number of clauses) are also simultaneously satisfiable by a Boolean assignment. This gives a lower bound on the number of simultaneously satisfiable clauses among \(\langle C_1,\dots ,C_m\rangle \) in \(\{0,1\}\). At the same time, the two-element Boolean algebra is a subalgebra of , so any assignment in \(\{0,1\}^n\) is also an assignment in \([0,1]^n\): therefore, considering that k was the answer of the algorithm solving MaxSAT-OPT, no more than k clauses among \(\langle C_1,\dots ,C_m\rangle \) can be simultaneously satisfiable in \(\{0,1\}\), because otherwise k would not be optimal for MaxSAT-OPT. Therefore k is the optimal value.

The binary search algorithm always makes a logarithmic number of oracle calls, no matter what the instance is. Also, the complexity analysis as given does not take into account the efficiency of the computations executed by the oracle; all that is known about the oracle is that it correctly decides a particular \(\textbf{NP}\)-complete problem. Considering the experience obtained in Boolean MaxSAT solvers based on Boolean SAT solvers, there might be alternatives to binary search that might turn out to be more efficient in practice, where one departs from the paradigm that emphasizes worst-case complexity. A typical Boolean MaxSAT solver does a linear search, either from unsatisfiable to satisfiable (core-guided approach), or from satisfiable to unsatisfiable (model-guided approach) [8, 18]. The solvers heavily exploit the fact that the formulas in the multiset are Boolean clauses (i.e., a normal form is assumed) and that a SAT solver also returns a satisfying assignment or an unsatisfiable core; moreover, the calls to the SAT solver need not be its independent runs. These parallels invite an openness of mind when implementing MaxSAT solvers for Łukasiewicz logic.

4 Tableau-Like Method

4.1 Satisfiability

We give first a decision method for the \(\textbf{SAT}\) problem, combining several approaches that might be termed analytic. \(\textbf{SAT}\) and its complexity have been investigated in depth [1, 2, 6, 7, 9, 12, 14, 16, 21, 23, 26]. In particular, tableau calculi have been proposed in [12, 24]. Presenting our decision method for \(\textbf{SAT}\) has several goals. It outlines our approach to a simpler problem than MaxSAT-OPT, to be modified in Subsect. 4.2. Our method for \(\textbf{SAT}\) can then be used as a lower bound on the complexity of the method for MaxSAT-OPT in Subsect. 4.2. Furthermore, the method, in its variant generating a tree with an exponential number of branches, provides a simple proof for \(\textbf{SAT}\) in \(\textbf{NP}\) and an upper bound on the runtime of a deterministic algorithm for \(\textbf{SAT}\).

The method operates in two subsequent stages. The first one is a variant of Tseitin transformation of an arbitrary formula to a formula in normal form [31]; in classical logic, the target normal form is a CNF, while in our case, the target normal form is a system of equations in the language \(\mathcal L\)(Ł). The transformation preserves satisfiability, involves only a polynomial increase in size, and adds new variables. A variant of the transformation was used for testing \(\textbf{SAT}\) in [9].

Let \(||\varphi ||\) denote the number of pairwise distinct subformulas in \(\varphi \).Footnote 2 Recall at this point the formula \(\rho _{1/k}\) from Sect. 3 and its subformula \((k-1)y\). If brackets in this subformula nest to the right (or to the left), then \(||(k-1)y||\) is proportional to \(|(k-1)y|\). But if \((k-1)y\) is bracketed as a balanced binary tree, then \(||(k-1)y||\) is proportional to \(\log _2(|(k-1)y|)\).

The second stage is a tableau-like procedure that utilizes the system of equations obtained in the first stage as labels for nodes in a rooted linear tree, and expands the nodes using simple rules that translate these equations of into linear equations in the reals. Subsequently, each branch is evaluated for solvability in the reals, analogously to [12, 24].

The algorithm for \(\textbf{SAT}\) is given below. The presentation is informal.

figure al
figure am

Footnote 3 Footnote 4 Footnote 5

Typically in an analytic tableau method (cf. eg. Hähnle [12]), one starts with a given formula \(\varphi \) and decomposes it, taking one occurrence of a connective in each step and expanding the tableau using the given tableau rules. If a subformula of \(\varphi \) occurs multiple times in \(\varphi \), it is processed multiple times and each time, new variables are introduced with it: cf. e.g. [12, section 5.1] where new variables \(i_1\) and \(i_2\) are introduced for each occurrence of an implication. This is a feature of the analytic method. With creating the set of subformulas first, we avoid this and have potentially less new variables. (Cf. also the introduction in [24], where our method might therefore not qualify as purely analytic.)

Example 1

A simple example will illustrate the generation of the tree and the resulting systems of constraints. Consider the formula \(((x \oplus \lnot y) \oplus \lnot (x \oplus y)) \oplus \lnot (x \oplus y)\). A list of its subformulas is the following:

$$\langle x, y, \lnot y, x \oplus y, x \oplus \lnot y, \lnot (x \oplus y), (x \oplus \lnot y) \oplus (\lnot (x \oplus y)), ((x \oplus \lnot y) \oplus \lnot (x \oplus y)) \oplus \lnot (x \oplus y) \rangle $$

In order to present the example in a compact way, we write three initial nodes only: the first, with the boundary, target and ground equations; the second, with the equations from \(\textbf{S}\) with symbol \(\lnot \), and the third, with the equations from \(\textbf{S}\) with symbol \(\oplus \). Below this, we expand the tree as described by the algorithm. We omit marks (active, passive, final). We use vertical dots to indicate the tree that would be included in their place is a copy of the one depicted at its side.

figure an

Lemma 3

The expansion rules in step 7 of preserve the following invariant: for any assignment v of values in [0, 1] to all z-variables, v satisfies the equation in the premise in the algebra if and only if v satisfies all constraints in at least one branch in the conclusions of the rule in the algebra \({\mathbb {R}}\).

Proof

Notice that the expansion rules work as a switch between the signature of and language of real closed fields. (Where by slight abuse of language, we only differentiate between the two sets of the operation symbols, but not the relation symbols.) In both cases the statement is a straightforward consequence of the semantics of the connectives \(\lnot \) and \(\oplus \) in . We prove the case for \(\oplus \). Top-to-bottom: let v be an assignment of values in [0, 1] to z-variables introduced in step 2, and consider \(z_i,z_j,z_k\) s.t.  \(v(z_i)\oplus v(z_j) = v(z_k)\) is true in . Then it must be the case that either \(v(z_i) + v(z_j) \le 1\) and \(v(z_i) + v(z_j) = v(z_k)\) holds in \({\mathbb {R}}\), or \(v(z_i) + v(z_j) \ge 1\) in which case we also have \(v(z_k)=1\) in \({\mathbb {R}}\). Bottom to top: again let v be an assignment of values in [0, 1] to z-variables. If \(v(z_i) + v(z_j) \le 1\) and \(v(z_i) + v(z_j) = v(z_k)\) both hold in \({\mathbb {R}}\), we have \(v(z_i)\oplus v(z_j) = v(z_k)\) is true in . If \(v(z_i) + v(z_j) \ge 1\) and \(v(z_k) =1 \) in \({\mathbb {R}}\), we have \(v(z_i)\oplus v(z_j) = v(z_k)\) is true in . This exhausts possible cases.

Theorem 4

The method is sound and complete for \(\textbf{SAT}\).

Proof

The soundness claim states that whenever the method answers ‘yes’ on input \(\varphi \), then there is an assignment v to \(x_1,\dots ,x_n\) such that \(v(\varphi )=1\). So assume that there is a branch B of \({\textbf{T}}\) such that the system of constraints given by B is solvable, under some assignment v to variables on B, and fix v. In particular, for \(i=1,\dots ,n\), the variable \(x_i\) gets value \(v(x_i)\) (notice each \(x_i\) occurs on every branch). The assignment v extends to \(\varphi \) in a unique way and one shows by induction on the structure of \(\varphi \), using Lemma 3, that for any subformula \(\psi \) of \(\varphi \), we have \(v(\psi ) = v(z_j)\) for \(z_j\) with \(j\in \{1,\dots ,l\}\) being the z-variable assigned to \(\psi \) in step 2. In particular, \(v(\varphi ) =1 \).

The completeness claim states that if \(v(\varphi ) =1\) for some assignment v, then the method yields ‘yes’ on input \(\varphi \). So fix v s.t. \(v(\varphi ) =1\). We claim there is a branch of \({\textbf{T}}\) with a solvable system of equations. First produce the full tree \({\textbf{T}}\). Then assign values to all z-variables, starting from those that are names for \(x_1,\dots ,x_n\), and then inductively on the structure of \(\varphi \) using again that \(v(\psi ) = v(z_j)\) for a \(z_j\) assigned to \(\psi \) in step 2. This is consistent with equations obtained in step 3. By abuse of language, call this assignment v. The assignment v makes it possible to travel downward from the root of \({\textbf{T}}\) via labelled nodes, using Lemma 3 to show that v satisfies each label: in particular if \({\textbf{T}}\) branches due to a node with label \(z_i\oplus z_j = z_k\), then (assuming the label in the premise is satisfied by v), Lemma 3 guarantees that there is at least one branch on which the new (and hence, all) labels are satisfied by v. Finally a leaf L of \({\textbf{T}}\) is reached: since Lemma 3 was applied at each expansion, and since the boundary and the final constraint clearly hold under v, all final constraints on the branch determined by L hold under v.

Lemma 4

The problem \(\textbf{SAT}\) on instance \(\varphi \) can be solved deterministically by constructing the tree \({\textbf{T}}\) and testing the solvability of systems of linear constraints in \({\mathbb {R}}\) on no more than \(2^{||\varphi ||}\) branches. Each branch has at most \(4||\varphi ||+1\) constraints and \(||\varphi ||+n\) variables.

Proof

Branching of the tree takes place at each occurrence of \(\oplus \) in \(\textbf{S}\); the number of such occurrences is bounded by \(||\varphi ||\). Each branch has at most \(2||\varphi ||\) constraints for subformulas, plus \(2||\varphi ||\) boundary constraints, plus a target constraint. (Here we do not consider the possibility of replacing each equation with two inequalities.) Each branch of the tree uses all the variables: n input variables \(x_1,\dots , x_n\) and \(||\varphi ||\) z-variables.

Corollary 3

The problem \(\textbf{SAT}\) is in \(\textbf{NP}\), in particular, a formula is satisfiable if and only if there is a polynomial-size witness consisting of a tableau branch of the method and matching system of constraints solvable in \({\mathbb {R}}\).

Proof

Since the method is sound and complete for \(\textbf{SAT}\) by Theorem 4, any satisfiable formula has the following polynomial-size certificate of its own satisfiability in : the system of equations in z-variables constructed in step 3, and a branch of the tree \(\textbf{T}\), defined by a list of instructions specifying which branch to take upon each application of \(\oplus \)-rule, combined with a system C of constraints that matches the indicated branchings (in the sense that the equations with \(\oplus \) have been expanded according to the specified branch) and such that C is solvable in \({\mathbb {R}}\). On the other hand, the soundness and completeness theorem also says that an unsatisfiable formula cannot have such a certificate.

Furthermore, any decision tree obtained from the above procedure can be linearized, using the methods of [12]. In particular, any instance of the application of the branching rule introduced in step 7 can be replaced by an instance of an application of the following lemma (observing the condition that distinct Boolean variables will be used for distinct instances):

Lemma 5

(Cf. [12, Sect. 5.1], [13, Lemma 6.2.19]) Assume \(a_1,a_2,a_3\in [0,1]\). Then \(a_1 \oplus a_2 = a_3\) holds in if and only if there is an \(y\in \{0,1\}\) such that all of the following constraints hold in \({\mathbb {R}}\):

figure ba

Proof

Assume \(a_1 \oplus a_2 = a_3\) holds in . Case 1: \(a_1 + a_2 \le 1\), then from the assumption we have \(a_1 + a_2 = a_3\). We set \(y{:}{=}0\). The fact that \(a_1,a_2,a_3\in [0,1]\) implies (ii) and (v); the remaining constraints in the Lemma follow from \(a_1 + a_2 = a_3\). Case 2: \(a_1 + a_2 > 1\). The assumption implies \(a_3=1\); we set \(y{:}{=}1\), we get (v). The fact that \(a_1,a_2,a_3\in [0,1]\) implies (i) and (iv). From \(a_1 + a_2 > 1\) we get (ii) and (iii).

Now assume there is an \(y\in \{0,1\}\) such that all constraints listed hold in \({\mathbb {R}}\). Case 1: \(y=0\). We have (i) \(a_1 + a_2 \le 1\) and (iii,iv) \(a_3 \le a_1 + a_2 \le a_3\). Hence \(a_1 \oplus a_2 = a_3\). Case 2: \(y=1\). We have (v) \(1\le a_3\) and (ii) \(1\le a_1 + a_2\). Hence \(a_1 \oplus a_2 = a_3\).

This modification eventually yields, in step 8, a single MIP problem — one of the extant competitive ways to address the \(\textbf{SAT}\) problem. A major advantage of using a MIP solver is the advanced possibility of applying heuristics, whereas in the simple version above, the only optimization considered is aborting the computation upon finding a branch with a solvable system.Footnote 6 That is: by design, the algorithm needs to generate and perhaps eventually test exponentially many systems of equations. However, from the viewpoint of the worst-case deterministic complexity, the MIP method does not differ substantially from testing the (possibly exponentially many) branches.

4.2 Maximum Satisfiability

In this Subsection we adapt the previous method to the MaxSAT-OPT problem from Sect. 2. It is easily observed that usual methods for \(\textbf{SAT}\), the method from the previous Subsection among them (even if it easily adapts to test joint satisfiability of a list of formulas), are not applicable for MaxSAT-OPT; cf. [19] for a discussion. One problem is that they yield a Boolean value. Taking any satisfiable formula \(\alpha \) and considering the m-element list \(\langle \alpha ,\dots ,\alpha \rangle \), for any \(m>1\), clearly a complete method needs to produce the answer m on this input. The tableau approaches of [12, 24] uses MIP solvers on branches, also returning a Boolean value. Another feature of the method from the previous Subsection is that it considers distinct subformulas as a set; thus any repetition of the same formula in the list on input would be obliterated.

These considerations invite the approach of preserving the Tseitin-like procedure of listing equations obtained from the subformulas, but combining it with:

  • updating the target constraint for a multiset of formulas on input, and

  • updating the query about the system of constraints obtained on each branch.

The following algorithm updates the decision method from the Subsect. 4.1. To highlight the differences, each step only gives the information that has changed compared to the previous case.

figure be

Footnote 7

Example 2

Let us consider the list of formulas \(\langle (x \oplus \lnot y) \oplus \lnot x, \lnot x, x \oplus \lnot y, x\rangle \). A list of its subformulas (according to the definition in step 1) is the following:

$$\begin{aligned} \langle x, y, \lnot x, \lnot y, x \oplus \lnot y, (x \oplus \lnot y) \oplus \lnot x\rangle \end{aligned}$$

In order to depict the example in a compact way we use the same conventions as in Example 1. Furthermore, we will print in bold the soft constraints.

figure bf

Theorem 5

The method is sound and complete for MaxSAT-OPT.

Proof

The soundness claim states that whenever the method returns \(k\in {\mathbb {N}}\) on input \(\langle \varphi _1,\dots ,\varphi _m\rangle \), then there is an assignment v to variables \(x_1,\dots ,x_n\) that satisfies k formulas among \(\langle \varphi _1,\dots ,\varphi _m\rangle \). If returns k, that means the tree \({\textbf{T}}\) was constructed with a branch B and a system of constraints given by B that yielded k upon solving the Max-FS problem with hard and soft constraints, and that this was the maximum solution among all branches. Fix such a v and notice that v defines values for \(x_1,\dots ,x_n\). Using Lemma 3, all hard constraints from the system, in particular, all constraints from steps 3, 5 and 8 are satisfied by v, and so are k of the target constraints. If \(\psi \) is a subformula of some \(\varphi _i\) with \(i\in \{1,\dots ,m\}\), we have \(v(\psi ) = v(z_j)\) whenever \(z_j\) is the z-variable assigned to \(\psi \), by induction. In particular, from step 7 we have that there are k formulas \(\varphi _i\) among \(\langle \varphi _1,\dots ,\varphi _m\rangle \) such that \(v(\varphi _i) = 1 \).

The completeness claim states that if, for some assignment v, there are k items \(\varphi _i\) on the list \(\langle \varphi _1,\dots ,\varphi _m\rangle \) such that \(v(\varphi _i) =1\), then the method yields at least k on that instance. So assume that \(v(\varphi _i) =1\) for at least k such items and fix v. We claim there is a branch B of \({\textbf{T}}\) with a system of constraints that yields at least k upon solving its instance of Max-FS problem. First construct the tree \({\textbf{T}}\). From v, we get values for \(x_1,\dots ,x_n\), the z-variables that are their names, and using equations from step 3 for the remaining z-variables. The assignment v indicates a leaf of \({\textbf{T}}\) that defines a branch B via a series of (possibly non-unique) choices on the hard constraints. If \(\psi \) is a subformula of some \(\varphi _i\) with \(i\in \{1,\dots ,m\}\), also \(v(\psi ) = v(z_j)\) whenever \(z_j\) is the z-variable assigned to \(\psi \), all the hard constraints and at least k soft constraints are satisfied on B under v. Since k formulas on input are satisfied by v, also k soft constraints are satisfied. Thus the method , which returns a maximum over all branches, will yield a value no less than k.

To put side by side the efficiency of the method from Subsect. 4.1 with the method above, we assume a modification of that takes as input a finite list of arbitrary formulas \(\langle \varphi _1, \dots ,\varphi _m\rangle \) and tests their joint satisfiability. Then we obtain comparable trees from both methods, the main difference being in the target constraints. Each branch of the tree obtained from defines a set of constraints the solvability of which is in \(\textbf{P}\). It is typically not necessary to test solvability on all the branches. On the other hand, if \(\langle \varphi _1, \dots ,\varphi _m\rangle \) is an input to , then on each branch of the generated tree, it is indeed necessary to solve the Max-FS problem with hard and soft constraints that the branch defines, because the method eventually takes a maximum over all the branches. Moreover, the problem on each branch is \(\textbf{NP}\)-hard [4]. In this sense, the complexity of the method is a lower bound on the complexity of the method as presented above.

One can conceive optimizing the method by observing that, firstly, the multiset of soft constraints remains the same over all the branches, and secondly, if any subset \(S'\) of a set S of hard constraints is unsolvable, then so is S. We refrain from pursuing these considerations here, since they are addressed by the methods used in MIP solvers. The following lemma comes in useful.

Lemma 6

The tree obtained from the method can be linearized at the cost of adding at most \(||\varphi ||\) Boolean variables. The linearization method does not affect the soft constraints.

Proof

Any branching in step 8 of the algorithm can be replaced by expanding the tree with new nodes (without branching) using Lemma 5. The constraints obtained from the Lemma are all marked hard. This step therefore does not impact the set of possible solutions to the hard constraints in the system. The soft constraints are the same on all the branches, therefore the soft constraints in the linearization are well defined.

An extension of the Max-FS problem with Boolean variables among the set of hard constraints can also be rendered as a MIP problem with hard and soft constraints, with the Boolean variables not occurring in the soft constraints. Section 3 gives as benchmark for MaxSAT-OPT \(\log m\) calls to a MIP solver for \(\textbf{SAT}\) with inputs of size \(O(\varSigma _{i=1}^m|\varphi _i|+m^2)\).

5 Concluding Remarks and Future Work

Envisaged work on this material will consider finite-valued reductions of the \(\textbf{SAT}\) problem via upper bounds on denominators [1,2,3] to obtain a comparison with variants of for deterministic worst-case complexity for arbitrary formulas. Also, it remains to be seen whether upper bounds on denominators (a “small-model theorem”, cf., e.g., [11]) can be used to classify the decision version of the above Max-FS problem with Boolean variables among its hard constraints within \(\textbf{FP}^{\textbf{NP}}\) for a conclusive comparison with the canonical approach. Another line of possible work stems from a generalized notion of satisfiability, considering, instead of the MaxSAT family of problems, their MaxSAT\(_r\) version, for a rational \(r \in (0,1]\), asking for the maximum number of formulas that are assigned a value greater than or equal to r by a single assignment.