1 Introduction

Modal logics have been used to represent and reason about mental attitudes such as knowledge, belief, desire and intention, see for example [17, 20, 31]. These can be represented using extensions of the basic modal logic \({\mathsf {K}}\) with one or more of the axioms \({\mathsf {B}}\) (symmetry), \({\mathsf {D}}\) (seriality), \({\mathsf {T}}\) (reflexivity), \({\mathsf {4}}\) (transitivity) and \({\mathsf {5}}\) (Euclideaness). The logic \({\mathsf {K}}\) and these extensions form the so-called modal cube, see Fig. 1. In the diagram, a line from a logic \(L_1\) to a logic \(L_2\) to its right and/or above means that all theorems of \(L_1\) are also theorems of \(L_2\), but not vice versa. As indicated in Fig. 1, some of the logics have the same theorems, e.g., \({\mathsf {KB5}}\) and \({\mathsf {KB4}}\). Also, all logics not explicitly listed have the same theorems as \({\mathsf {KT5}}\) aka \({\mathsf {S5}}\). In total there are 15 distinct logics.

Fig. 1.
figure 1

Modal Cube: Relationships between modal logics

While these modal logics are well-studied and a multitude of calculi and translations to other logics exist, see, e.g., [1, 3,4,5,6, 9, 13, 14, 16, 18, 22, 41], fully automatic support by provers is still lacking. Early implementations covering the full modal cube, such as Catach’s TABLEAUX system [7], are no longer available. LoTREC 2.0 [10] supports a wide range of logics but is not intended as an automatic theorem prover. MOIN [11] supports all the logics but the focus is on producing human-readable proofs and countermodels for small formulae. Other provers that go beyond just \({\mathsf {K}}\), like MleanCoP [28] and CEGARBox [15] only support a small subset of the 15 logics. There are also a range of translations from modal logics to first-order and higher-order logics [13, 18, 19, 27, 33]. Regarding implementations of those, SPASS [33, 43] is limited to a subset of the 15 logics, while LEO-III [13, 36] supports all the logics in the modal cube, but can only solve very few of the available benchmark formulae.

   [23] is a modal logic theorem prover that implements both the modal-layered resolution (MLR) calculus [25] for the modal logic \({\mathsf {K}}\) and the global resolution (GMR) calculus [24] for all the 15 logics considered here. It also supports several refinements of resolution and a range of simplification rules. In this paper, we give reductions of all logics of the modal cube into a normal form for the basic modal logic \({\mathsf {K}}\). We then compare the performance of the combination of these reductions with the modal-layered resolution calculus to that of the global resolution calculus on a new benchmark collection for the modal cube.

In [29] we have presented new reductionsFootnote 1 of the propositional modal logics \({\mathsf {KB}}\), \({\mathsf {KD}}\), \({\mathsf {KT}}\), \({\mathsf {K4}}\), and \({\mathsf {K5}}\) to Separated Normal Form with Sets of Modal Levels \(\mathsf {SNF}_{sml}^{}\). \(\mathsf {SNF}_{sml}^{}\) is a generalisation of the Separated Normal Form with Modal Level, \(\mathsf {SNF}_{ml}^{}\). In the latter, labelled modal clauses are used where a natural number label refers to a particular level within a tree Kripke structure at which a modal clause holds. In the former, a finite or infinite set of natural numbers labels each modal clause with the intended meaning that such a modal clause is true at every level of a tree Kripke structure contained in that set. As our prover and the modal-layered resolution calculus it implements currently only support sets of modal clauses in \(\mathsf {SNF}_{ml}^{}\), we then use a further reduction from \(\mathsf {SNF}_{sml}^{}\) to \(\mathsf {SNF}_{ml}^{}\) to obtain an automatic theorem prover for these modal logics. Where all modal clauses are labelled with finite sets, this reduction is straightforward. This is the case for \({\mathsf {KB}}\), \({\mathsf {KD}}\) and \({\mathsf {KT}}\). For \({\mathsf {K4}}\) and \({\mathsf {K5}}\), characterised by the axioms \(\Box \varphi \rightarrow \Box \Box \varphi \) and \(\Diamond \varphi \rightarrow \Box \Diamond \varphi \), modal clauses are in general labelled with infinite sets. However, using a result by Massacci [21] for \({\mathsf {K4}}\) and an analogous result for \({\mathsf {K5}}\) by ourselves, we are able to bound the maximal level occurring in those labelling sets which in turn makes a reduction to \(\mathsf {SNF}_{ml}^{}\) possible.

Also in [29], we have shown experimentally that these reductions allow us to reason effectively in these logics, compared to the global modal resolution calculus [24] and to the relational and semi-functional translation built into the first-order theorem prover SPASS 3.9 [33, 38, 42]. The reason that the comparison only included a rather limited selection of provers is that these are the only ones with built-in support for all six logics our reductions covered.

Unfortunately, we cannot simply combine our reductions for single axioms to obtain satisfiability preserving reductions for their combinations. There are two main reasons for this. First, our calculus does not use an explicit representation of the accessibility relationship within a Kripke structure, which would make it possible to reflect modal axioms via corresponding properties of that accessibility relationship. Instead, we add labelled modal clauses based on instances of the modal axioms for \(\Box \)-formulae occurring in the modal formula we want to check for satisfiability. However, if we deal with multiple modal axioms, then these axioms might interact making it necessary to add instances that are not necessary for each individual axiom. For instance, consider, the converse of axiom \({\mathsf {B}}\), \(\Diamond \Box \varphi \rightarrow \varphi \), and axiom \({\mathsf {4}}\), \(\Box \varphi \rightarrow \Box \Box \varphi \). Together they imply \(\Diamond \Box \varphi \rightarrow \Box \varphi \). Instances of this derived axiom are necessary for completeness of a reduction from \({\mathsf {KB4}}\) to \({\mathsf {K}}\), but are unsound for \({\mathsf {KB}}\) and \({\mathsf {K4}}\) separately.

Second, our reductions attempt to keep the labelling sets minimal in size in order to decrease the number of inferences that can be performed. Again, taking axioms \({\mathsf {B}}\) and \({\mathsf {4}}\) as examples, in \({\mathsf {KB}}\), a \(\Box \)-formula \(\Box \psi \) true at level ml in a tree-like Kripke structure \(M\) forces \(\psi \) to be true at level \(ml-1\), while in \({\mathsf {K4}}\), \(\Box \psi \) true at level ml in \(M\) forces \(\psi \) to be true all levels \(ml'\) with \(ml'>ml\). This is reflected in the labelling sets we use for these two logics. However, for \({\mathsf {KB4}}\), \(\Box \psi \) true at level ml forces \(\psi \) to be true at every level in a tree-like Kripke structure \(M\) (unless \(M\) consists only of a single world).

Since we intend to maintain these two properties of our reductions, we have to consider each modal logic individually. As we will see, for some logics a reduction can be obtained as the union of the existing reductions while for others we need a logic-specific reduction to accommodate the interaction of axioms.

The structure of the paper is as follows. In Sect. 2 we recall common concepts of propositional modal logic and the definition of our normal form \(\mathsf {SNF}_{ml}^{}\). Section 3 introduces our reduction for extensions of the basic modal logic \({\mathsf {K}}\) with combinations of the axioms \({\mathsf {B}}\), \({\mathsf {D}}\), \({\mathsf {T}}\), \({\mathsf {4}}\), and \({\mathsf {5}}\). Section 4 presents a transformation from \(\mathsf {SNF}_{sml}^{}\) to \(\mathsf {SNF}_{ml}^{}\) which allows us to use the modal resolution prover to reason in all the modal logics. In Sect. 5 we compare the performance of a combination of our reductions and the modal-layered resolution calculus implemented in the prover with resolution calculi specifically designed for the logics under consideration as well as the prover LEO-III.

2 Preliminaries

The language of modal logic is an extension of the language of propositional logic with a unary modal operator \(\Box \) and its dual \(\Diamond \). More precisely, given a denumerable set of propositional symbols, \(P= \{p, p_0, q, q_0, t, t_0,\ldots \}\) as well as propositional constants \(\text{ true }\) and \(\text{ false }\), modal formulae are inductively defined as follows: constants and propositional symbols are modal formulae. If \(\varphi \) and \(\psi \) are modal formulae, then so are \(\lnot \varphi \), \((\varphi \wedge \psi )\), \((\varphi \vee \psi )\), \((\varphi \rightarrow \psi )\), \(\Box \varphi \), and \(\Diamond \varphi \). We also assume that \(\wedge \) and \(\vee \) are associative and commutative operators and consider, e.g., \((p\vee (q\vee r))\) and \((r\vee (q\vee p))\) to be identical formulae. We often omit parentheses if this does not cause confusion. By \(\mathsf {var}(\varphi )\) we denote the set of all propositional symbols occurring in \(\varphi \). This function straightforwardly extends to finite sets of modal formulae. A modal axiom (schema) is a modal formula \(\psi \) representing the set of all instances of \(\psi \).

A literal is either a propositional symbol or its negation; the set of literals is denoted by \(L_{P}\). By \(\lnot l\) we denote the complement of the literal \(l\in L_{P}\), that is, if l is the propositional symbol p then \(\lnot l\) denotes \(\lnot p\), and if l is the literal \(\lnot p\) then \(\lnot l\) denotes p. By |l| for \(l\in L_{P}\) we denote p if \(l = p\) or \(l = \lnot p\). A modal literal is either \(\Box l\) or \(\Diamond l\), where \(l \in L_{P}\).

A (normal) modal logic is a set of modal formulae which includes all propositional tautologies, the axiom schema \(\Box {(\varphi \rightarrow \psi )} \rightarrow (\Box {\varphi } \rightarrow \Box {\psi })\), called the axiom \(\mathsf {K}\), it is closed under modus ponens (if \(\vdash {} \varphi \) and \(\vdash {} \varphi \rightarrow \psi \) then \(\vdash {}\psi \)) and the rule of necessitation (if \(\vdash {}\varphi \) then \(\vdash {} \Box {\varphi }\)).

\({\mathsf {K}}\) is the weakest modal logic, that is, the logic given by the smallest set of modal formulae constituting a normal modal logic. By \({\mathsf {K}}\!\varSigma \) we denote an extension of \({\mathsf {K}}\) by a set \(\varSigma \) of axioms.

The standard semantics of modal logics is the Kripke semantics or possible world semantics. A Kripke frame \(F\) is an ordered pair \(\langle W, R \rangle \) where \(W\) is a non-empty set of worlds and \(R\) is a binary (accessibility) relation over \(W\). A Kripke structure \(M\) over \(P\) is an ordered pair \(\langle F,V \rangle \) where \(F\) is a Kripke frame and the valuation V is a function mapping each propositional symbol in \(P\) to a subset V(p) of \(W\). A rooted Kripke structure is an ordered pair \(\langle M,w_0 \rangle \) with \(w_0\in W\). To simplify notation, in the following we write \(\langle W, R, V \rangle \) and \(\langle W, R, V,w_0 \rangle \) instead of \(\langle \langle W, R \rangle , V \rangle \) and \(\langle \langle \langle W, R \rangle , V \rangle ,w_0 \rangle \), respectively.

Satisfaction (or truth) of a formula at a world \(w\) of a Kripke structure \(M= \langle W, R, V \rangle \) is inductively defined by:

$$\begin{aligned}{}\begin{array}{@{}l@{\ }l@{}} \langle M, w \rangle \models \text{ true }; &{} \,\, \langle M, w \rangle \not \models \text{ false }; \\ \langle M, w \rangle \models p &{} \text { iff } w\in V(p), \text { where } p\in P; \\ \langle M, w \rangle \models \lnot \varphi &{} \text { iff } \langle M, w \rangle \not \models \varphi ; \\ \langle M, w \rangle \models (\varphi \wedge \psi ) &{} \text { iff } \langle M, w \rangle \models \varphi \text { and } \langle M, w \rangle \models \psi ; \\ \langle M, w \rangle \models (\varphi \vee \psi ) &{} \text { iff } \langle M, w \rangle \models \varphi \text { or } \langle M, w \rangle \models \psi ; \\ \langle M, w \rangle \models (\varphi \rightarrow \psi ) &{} \text { iff } \langle M, w \rangle \models \lnot \varphi \text { or } \langle M, w \rangle \models \psi ; \\ \langle M, w \rangle \models \Box \varphi &{} \text { iff for every } v, w\mathbin {R}v \text { implies } \langle M, v \rangle \models \varphi ; \\ \langle M, w \rangle \models \Diamond \varphi &{} \text { iff there is } v, w\mathbin {R}v \text { and } \langle M, v \rangle \models \varphi . \end{array} \end{aligned}$$

If \(\langle M, w \rangle \models \varphi \) holds then \(M\) is a model of \(\varphi \), \(\varphi \) is true at w in \(M\) and \(M\) satisfies \(\varphi \). A modal formula \(\varphi \) is satisfiable iff there exists a Kripke structure \(M\) and a world w in \(M\) such that \(\langle M, w \rangle \models \varphi \).

We are interested in extensions of \({\mathsf {K}}\) with the modal axioms shown in Table 1 and their combinations. Each of these axioms defines a class of Kripke frames where the accessibility relation \(R\) satisfies the first-order property stated in the table. Combinations of axioms then define a class of Kripke frames where the accessibility relation satisfies the combination of their corresponding properties.

Table 1. Modal axioms and relational frame properties

Given a normal modal logic L with corresponding class of frames \(\mathfrak {F}\), we say a modal formula \(\varphi \) is L-satisfiable iff there exists a frame \(F\in \mathfrak {F}\), a valuation V and a world \(w\in F\) such that \(\langle F,V,w \rangle \models \varphi \). It is L-valid or valid in L iff for every frame \(F\in \mathfrak {F}\), every valuation V and every world \(w\in F\), \(\langle F,V,w \rangle \models \varphi \). A normal modal logic \(L_2\) is an extension of a normal modal logic \(L_1\) iff all \(L_1\)-valid formulae are also \(L_2\)-valid.

A rooted Kripke structure \(M = \langle W,R,V,w_0 \rangle \) is a rooted tree Kripke structure iff R is a tree, that is, a directed acyclic connected graph where each node has at most one predecessor, with root \(w_0\). It is a rooted tree Kripke model of a modal formula \(\varphi \) iff \(\langle W,R,V,w_0 \rangle \models \varphi \). In a rooted tree Kripke structure with root \(w_0\) for every world \(w_k\in W\) there is exactly one path connecting \(w_0\) and \(w_k\), the length of that path is the modal level of \(w_k\) (in M), denoted by \(\mathsf {ml}_{M}(w_k)\).

It is well-known [17] that a modal formula \(\varphi \) is \({\mathsf {K}}\)-satisfiable iff there is a finite rooted tree Kripke structure \(M=\langle F,V,w_0 \rangle \) such that \(\langle M, w_0 \rangle \models \varphi \).

Table 2. Rewriting Rules for Simplification

For the reductions presented in the next section we assume that any modal formula \(\varphi \) has been simplified by exhaustively applying the rewrite rules in Table 2, and it is in Negation Normal Form (NNF). That is, a formula where only propositional symbols are allowed in the scope of negations. We say that such a formula is in simplified NNF.

The reductions produce formulae in a clausal normal form, called Separated Normal Form with Sets of Modal Levels \(\mathsf {SNF}_{sml}^{}\), introduced in [29]. The language of \(\mathsf {SNF}_{sml}^{}\) extends that of the basic modal logic \({\mathsf {K}}\) with sets of modal levels as labels. Clauses in \(\mathsf {SNF}_{sml}^{}\) have one of the following forms:

$$ \begin{array}{@{}l@{}} S: \textstyle \bigvee _{i=1}^{n} l_i\\ \text {(literal clause)} \end{array} \qquad \begin{array}{@{}l@{}} S: l' \rightarrow \Box l\\ \text {(positive modal clause)} \end{array} \qquad \begin{array}{@{}l@{}} S: l' \rightarrow \Diamond l\\ \text {(negative modal clause)} \end{array} $$

where \(S\subseteq \mathbb N\) and l, \(l'\), \(l_i\) are propositional literals with \(1 \le i \le n\), \(n \in \mathbb N\). We write \({{\,\mathrm{{\star }}\,}}: \varphi \) instead of \(\mathbb N:\varphi \) and such clauses are called global clauses. Positive and negative modal clauses are together known as modal clauses.

Given a rooted tree Kripke structure M and a set S of natural numbers, by M[S] we denote the set of worlds that are at a modal level in S, that is, \(M[S] = \{w\in W\mid \mathsf {ml}_{M}(w)\in S\}\). Then

$$M\models S:\varphi \text { iff } \langle M, w \rangle \models \varphi \text { for every world }w\in M[S]. $$

The motivation for using a set S to label clauses is that in our reductions the formula \(\varphi \) may hold at several levels, possibly an infinite number of levels. It therefore makes sense to label such formulae not with just a single level, but a set of levels. The Separated Normal Form with Modal Level, \(\mathsf {SNF}_{ml}^{}\), can be seen as the special case of \(\mathsf {SNF}_{sml}^{}\) where all labelling sets are singletons.

Note that if \(S=\emptyset \), then \(M\models S: \varphi \) trivially holds. Also, a Kripke structure \(M\) can satisfy \(S:\text{ false }\) if there is no world w with \(\mathsf {ml}_{M}(w)\in S\). On the other hand, \(S:\text{ false }\) with \(0\in S\) is unsatisfiable as a rooted tree Kripke structure always has a world with modal level 0.

If \(M\models S: \varphi \), then we say that \(S: \varphi \) holds in \(M\) or is true in \(M\). For a set \(\varPhi \) of labelled formulae, \(M\models \varPhi \) iff \(M\models S:\varphi \) for every \(S:\varphi \) in \(\varPhi \), and we say \(\varPhi \) is \({\mathsf {K}}\)-satisfiable.

We introduce some notation that will be used in the following. Let \(S^+= \{l + 1\in \mathbb N\mid l \in S\}\), \(S^- = \{ l - 1 \in \mathbb N\mid l \in S\}\), and \(S^\ge = \{n \mid n \ge \min (S)\}\), where \(\min (S)\) is the least element in S. Note that the restriction of the elements being in \(\mathbb N\) implies that \(S^-\) cannot contain negative numbers.

3 Extensions of \({\mathsf {K}}\)

In this section we define reductions from all the logics in the modal cube to \(\mathsf {SNF}_{sml}^{}\). We assume that the set \(P\) of propositional symbols is partitioned into two infinite sets Q and T such that Q contains the propositional symbols of the modal formula \(\varphi \) under consideration, and T surrogate symbols \(t_\psi \) for every subformula \(\psi \) of \(\varphi \) and supplementary propositional symbols. In particular, for every modal formula \(\psi \) we have \(\mathsf {var}(\psi )\subset Q\) and there exists a propositional symbol \(t_\psi \in T\) uniquely associated with \(\psi \). These surrogate symbols serve the same purpose as Tseitin variables [40] and Skolem predicates [30, 39] in the transformation of propositional and first-order formulae, respectively, to clausal form via structural transformation.

It turns out that given a reduction \(\rho _{{\mathsf {K}}\!{\varSigma }}\) for \({\mathsf {K}}{\varSigma } \) with \(\{{\mathsf {D}},{\mathsf {T}}\}\cap {\varSigma } =\emptyset \), there is a uniform and straightforward way we can obtain a reduction for \({\mathsf {KD}}{\varSigma } \) and \({\mathsf {KT}}{\varSigma } \) from \(\rho _{{\mathsf {K}}{\varSigma }}\). Also, the valid formulae of \({\mathsf {KDT}}{\varSigma } \) are the same as those of \({\mathsf {KT}}{\varSigma } \), so we do not need to consider the case of adding both axioms to \({\mathsf {K}}\!{\varSigma } \). Similarly, the logics \({\mathsf {KT45}}\), \({\mathsf {KDB4}}\), \({\mathsf {KTB4}}\) and \({\mathsf {KT5}}\) all have the same set of valid formulae. Therefore, as shown in Table 3, we can divide the 15 modal logics into three categories: Six ‘base logics’, five modal logics obtained by extending a ‘base logic’ with \({\mathsf {D}}\), and a further four modal logics obtained by extending a ‘base logic’ with \({\mathsf {T}}\). For four of the six ‘base logics’ (namely, \({\mathsf {K}}\), \({\mathsf {KB}}\), \({\mathsf {K4}}\), and \({\mathsf {K5}}\)) we have already devised reductions in [29], so only two (i.e., \({\mathsf {KB4}}\) and \({\mathsf {K45}}\)) remain.

Table 3. Categorisation of modal logics in the modal cube

Given a modal formula \(\varphi \) in simplified NNF and \(L = {\mathsf {K}}{\varSigma } \) with \({\varSigma } \subseteq \{{\mathsf {B}},{\mathsf {D}},{\mathsf {T}}, {\mathsf {4}}, {\mathsf {5}}\}\), we can obtain a set \(\varPhi _L\) of clauses in \(\mathsf {SNF}_{sml}^{}\) such that \(\varphi \) is L-satisfiable iff \(\varPhi _L\) is \({\mathsf {K}}\)-satisfiable with \(\varPhi _L = \rho ^{sml}_{L}(\varphi ) = \{\{ 0 \}: t_\varphi \}\cup \rho _{L}(\{0\}:t_\varphi \rightarrow \varphi )\), where \(\rho _{L}\) is defined as follows:

$$\begin{aligned} \rho _{L}(S : t \rightarrow \text{ true})&= \emptyset \\ \rho _{L}(S : t \rightarrow \text{ false})&= \{S:\lnot t\} \\ \rho _{L}(S : t \rightarrow (\psi _1 \wedge \psi _2))&= \begin{array}{@{}l@{}} \{S : \lnot t\vee \eta (\psi _1), S : \lnot t\vee \eta (\psi _2)\} \hbox {}{\,\cup \,}\delta _{L}(S,\psi _1){\,\cup \,}\delta _{L}(S,\psi _2) \end{array} \\ \rho _{L}(S : t \rightarrow \psi )&= \begin{array}{@{}l@{}} \{S: \lnot t \vee \psi \}\\ \text{ if } \psi \text{ is } \text{ a } \text{ disjunction } \text{ of } \text{ literals } \end{array} \\ \rho _{L}(S : t \rightarrow (\psi _1 \vee \psi _2))&= \begin{array}{@{}l@{}} \{S: \lnot t\vee \eta (\psi _1)\vee \eta (\psi _2)\} \hbox {}\cup \delta _{L}(S,\psi _1)\cup \delta _{L}(S,\psi _2)\\ \text{ if } \psi _1\vee \psi _2 \text{ is } \text{ not } \text{ a } \text{ disjunction } \text{ of } \text{ literals } \end{array} \\ \rho _{L}(S : t \rightarrow \Diamond \psi )&= \{S: t \rightarrow \Diamond \eta (\psi ) \} \cup \delta _{L}(S^+,\psi ) \\ \rho _{L}(S : t \rightarrow \Box \psi )&= P_L(S : t \rightarrow \Box \psi ) \cup \varDelta _{L}(S : t \rightarrow \Box \psi ) \end{aligned}$$

\(\eta \) and \(\delta _{L}\) are defined as follows:

and functions \(P_{L}\) and \(\varDelta _{L}\), are defined as shown in Table 4.

We can see in Table 4 that the reduction for \({\mathsf {KB4}}\) has an additional \(\mathsf {SNF}_{sml}^{}\) clause \({{\,\mathrm{{\star }}\,}}: t_{\Box \psi }\vee t_{\Box \lnot t_{\Box \psi }}\) that occurs neither in the reduction for \({\mathsf {KB}}\) nor in that for \({\mathsf {K4}}\). It can be seen as an encoding of the derived axiom \(\Diamond \Box \psi \rightarrow \Box \psi \) that follows from the contrapositive \(\Diamond \Box \psi \rightarrow \psi \) of \({\mathsf {B}}\) and \({\mathsf {4}}\) \(\Box \psi '\rightarrow \Box \Box \psi '\).

For \({\mathsf {K45}}\) we see that all the \(\mathsf {SNF}_{sml}^{}\) clauses in the reduction for \({\mathsf {K5}}\) carry over. These clauses are already sufficient to ensure that, semantically, if \(t_{\Box \psi }\) is true at any world at a level other than 0, then \(t_{\Box \psi }\) is true at every world. Consequently, to accommodate axiom \({\mathsf {4}}\), it suffices to add the \(\mathsf {SNF}_{sml}^{}\) clause \(\{0\}: t_{\Box \psi }\rightarrow \Box t_{\Box \psi }\) to ensure that this also holds for the root world at level 0.

figure f

where and are defined as follows

Table 4. Reduction of \(\Box \)-formulae, \({\varSigma } \subseteq \{{\mathsf {B}},{\mathsf {4}}, {\mathsf {5}}\}\).

For reductions of \({\mathsf {KD}}\varSigma \) and \({\mathsf {KT}}\varSigma \) we have favoured the reuse of reductions for \({\mathsf {K}}\varSigma \), \({\mathsf {KD}}\) and \({\mathsf {KT}}\) over optimisation for specific logics. For example, take \({\mathsf {KBD}}\). Given that in a symmetric model, every world w except the root world \(w_0\) has an \(R\)-successor, the axiom \({\mathsf {D}}\) only ‘enforces’ that \(w_0\) also has an \(R\)-successor. So, instead of adding a clause \(S:t_{\Box \psi }\rightarrow \Diamond \psi \) for every clause \(S:t_{\Box \psi }\rightarrow \Box \eta (\psi ) \) we could just add \(\{0\}:t_{\Box \psi }\rightarrow \Diamond \psi \) iff \(0\in S\). Similarly, in \({\mathsf {KT5}}\), because of \({\mathsf {5}}\), for all worlds w except \(w_0\) we already have \(w\mathbin {R}w\). So, we could again \(\{0\}:\lnot t_{\Box \psi }\vee \eta (\psi )\) for every clause \(S:t_{\Box \psi }\rightarrow \Box \eta (\psi )\) iff \(0\in S\).

For the \({\mathsf {KB4}}\)-unsatisfiable formula \(\psi _1 = (\lnot p \wedge \Diamond \Diamond \Box p)\), if we were to independently apply the reductions for \({\mathsf {KB}}\) and \({\mathsf {K4}}\), that is, we compute \(\{\{0\}:t_{\psi _1}\}\cup \rho _{{\mathsf {KB}}}(\{0\}:t_{\psi _1}\rightarrow \psi _1) \cup \rho _{{\mathsf {K4}}}(\{0\}:t_{\psi _1}\rightarrow \psi _1)\), then the result is the following set of clauses \(\varPhi _1\):

figure g

Clauses (1) to (5) stem from the transformation of \(\psi _1\) to \(\mathsf {SNF}_{sml}^{}\) for \({\mathsf {K}}\), Clauses (6) and (7) stem from the reduction for \({\mathsf {4}}\) and Clauses (8) and (9) stem from the reduction for \({\mathsf {B}}\). This set of \(\mathsf {SNF}_{sml}^{}\) clauses is \({\mathsf {K}}\)-satisfiable. The clauses imply \(\{1\}:p\), but neither \(\{1\}:\Box p\) nor \(\{0\}:p\) which we need to obtain a contradiction. Part of the reason is that we would need to apply the reduction for \({\mathsf {4}}\) and \({\mathsf {B}}\) recursively to newly introduced surrogates for \(\Box \)-formulae which in turn leads to the introduction of further surrogates and problems with the termination of the reduction.

In contrast, the clause set \(\varPhi _2\) obtained by our reduction for \({\mathsf {KB4}}\) is:

figure h

Note Clauses (19) and (20) in \(\varPhi _2\) for which there are no corresponding clauses in \(\varPhi _1\). Also, the set of labels of Clauses (15) to (18) are strict supersets of those of the corresponding Clauses (6) to (9). \(\varPhi _2\) implies both \(\{1\}:\Box p\) and \(\{0\}:p\). The latter, together with Clauses (10) and (11), means \(\varPhi _2\) is \({\mathsf {K}}\)-unsatisfiable.

Theorem 1

Let \(\varphi \) be a modal formula in simplified NNF, \(\varSigma \subseteq \{{\mathsf {B}},{\mathsf {D}},{\mathsf {T}},{\mathsf {4}},{\mathsf {5}}\}\), and \(\varPhi _{{\mathsf {K}}\!\varSigma } = \rho ^{sml}_{{\mathsf {K}}\!\varSigma }(\varphi )\). Then \(\varphi \) is \({\mathsf {K}}\!\varSigma \)-satisfiable iff \(\varPhi _{{\mathsf {K}}\!\varSigma }\) is \({\mathsf {K}}\)-satisfiable.

Proof (Sketch)

For \(|\varSigma | \le 1\) this follows from Theorem 5 in [29].

For \({\mathsf {K45}}\), \({\mathsf {KB4}}\), \({\mathsf {KD}}\!\varSigma '\), and \({\mathsf {KT}}\!\varSigma '\) with \(\varSigma '\subseteq \{{\mathsf {B}},{\mathsf {4}},{\mathsf {5}}\}\) we proceed in analogy to the proofs of Theorems 3 and 4 in [29]. Let L be one of these logics.

To show that if \(\varphi \) is L-satisfiable then \(\varPhi _L\) is \({\mathsf {K}}\)-satisfiable, we show that given a rooted L-model M of \(\varphi \) a small variation of the unravelling of M is a rooted tree \({\mathsf {K}}\)-model \(\vec {M}_L\) of \(\varPhi _L\). The main step is to define the valuation of the additional propositional symbols \(t_\psi \) so that we can prove that all clauses in \(\varPhi _L\) hold in \(\vec {M}_L\). To show that if \(\varPhi _L\) is \({\mathsf {K}}\)-satisfiable then \(\varphi \) is L-satisfiable, we take a rooted tree \({\mathsf {K}}\)-model \(M = \langle W,R,V,w_0 \rangle \) of \(\varPhi _L\) and construct a Kripke structure \(M_L = \langle W,R^L,V,w_0 \rangle \). The relation \(R^L\) is the closure of \(R\) under the relational properties associated with the axioms of L. The proof that \(M_L\) is a model of \(\varphi \) relies on the fact that the clauses in \(\varPhi _L\) ensure that for subformulae \(\Box \psi \) of \(\varphi \), \(\psi \) will be true at all worlds reachable via \(R^L\) from a world where \(\Box \psi \) is true.    \(\square \)

4 From \(\mathsf {SNF}_{sml}^{}\) to \(\mathsf {SNF}_{ml}^{}\)

As does not support \(\mathsf {SNF}_{sml}^{}\), in our evaluation of the effectiveness of the reductions defined in Sect. 3, we have used a transformation from \(\mathsf {SNF}_{sml}^{}\) to \(\mathsf {SNF}_{ml}^{}\). An alternative approach would be to reflect the use of \(\mathsf {SNF}_{sml}^{}\) in the calculus and re-implement the prover. Whilst we believe that redesigning the calculus presents few problems, re-implementing needs more thought in particular how to represent infinite sets. The route we adopt here allows us to experiment with the approach in general without having to change the prover. For extensions of \({\mathsf {K}}\) with one or more of the axioms \({\mathsf {B}}\), \({\mathsf {D}}\), \({\mathsf {T}}\) such a transformation is straightforward as the sets of modal levels occurring in the normal form of modal formulae are all finite. Thus, instead of a single \(\mathsf {SNF}_{sml}^{}\) clause \(S:\lnot t_\psi \vee \eta _f(\psi )\) we can use the finite set of \(\mathsf {SNF}_{ml}^{}\) clauses \(\{ml:\lnot t_\psi \vee \eta _f(\psi )\;|\;ml\in S\}\).

Table 5. Bounds on the length of prefixes in SST tableaux

For extensions of \({\mathsf {K}}\) with at least one of the axioms \({\mathsf {4}}\) and \({\mathsf {5}}\), potentially together with other axioms, the sets of modal levels labelling clauses are in general infinite. For each logic L it is, however, possible to define a computable function that maps the modal formula \(\varphi \) under consideration onto a bound \(db^\varphi _L\) such that, restricting the modal levels in the normal form of \(\varphi \) by \(db^\varphi _L\), preserves satisfiability equivalence.

To establish the bound and prove satisfiability equivalence, we need to introduce the basic notions of Single Step Tableaux (SST) calculi for a modal logic L [14, 21], which uses sequences of natural numbers to prefix modal formulae in a tableau. The SST calculus consists of a set of rules, with the (\(\pi \)) rule being the only rule increasing prefixes’ lengths (i.e., \(\sigma :\Diamond \varphi /\sigma . n:\varphi \) with \(\sigma . n\) new on the branch). For a logic L, an L-tableau \(\mathcal {T}\) in the SST calculus for a modal formula \(\varphi \) is a (binary) tree where the root of \(\mathcal {T}\). is labelled with \(1:\varphi \), and every other node is labelled with a prefixed formula \(\sigma : \psi \) obtained by application of a rule of the calculus. A branch \(\mathcal {B}\) is a path from the root to a leaf. A branch \(\mathcal {B}\) is closed if it contains either \(\text{ false }\) or a propositional contradiction at the same prefix. A tableau "\(\mathcal {T}\) is closed if all its branches are closed. A prefixed formula \(\sigma : \psi \) is reduced for rule (r) in \(\mathcal {B}\) if the branch \(\mathcal {B}\) already contains the conclusion of such rule application. By a systematic tableau construction we mean an application of the procedure in [14, p. 374] adapted to SST rules.

For each logic L, we establish its bound by considering an L-SST calculus, where a modal level in an \(\mathsf {SNF}_{sml}^{}\) clause corresponds to the length of a prefix in an SST tableau. The bound then either follows from an already known bound on the length of prefixes in an SST tableau preserving correctness of the SST calculus, or we establish such a bound ourselves. To prove satisfiability equivalence, we show that, for a closed SST tableau with such a bound on the length of prefixes in place, we can construct a resolution refutation of a set of \(\mathsf {SNF}_{sml}^{}\) or \(\mathsf {SNF}_{ml}^{}\) clauses with a corresponding bound on modal levels in those clauses.

For a modal formula \(\varphi \) in simplified NNF let \(d^\varphi _m\) be the modal depth of \(\varphi \), \(d^\varphi _\Diamond \) be the maximal nesting of \(\Diamond \)-operators not under the scope of any \(\Box \) operators in \(\varphi \), \(n^\varphi _\Box \) be the number of \(\Box \)-subformulae in \(\varphi \), and \(n^\varphi _\Diamond \) be the number of \(\Diamond \)-subformulae below \(\Box \)-operators in \(\varphi \). Our results for the bounds on the length of prefixes in SST tableaux can then be summarised by the following theorem.

Theorem 2

Let \(L={\mathsf {K}}\!\varSigma \) with \(\varSigma \subseteq \{{\mathsf {B}},{\mathsf {D}},{\mathsf {T}},{\mathsf {4}}{}{},{\mathsf {5}}\}\). A systematic tableau construction of an L-tableau for a modal formula \(\varphi \) in simplified NNF under the following Constraints (TC1) and (TC2)

(TC1):

a rule (r) of the SST calculus is only applicable to a prefixed formula \(\sigma : \psi \) in a branch \(\mathcal {B}\) if the formula is not already reduced for (r) in \(\mathcal {B}\);

(TC2):

rule (\(\pi \)) of the SST calculus is only applicable to prefixed formulae \(\sigma :\Diamond \psi \) with \(|\sigma |< db_L^\varphi \) for \(db_L^\varphi \) as defined in Table 5

terminates in one of following states:

(1):

all branches of the constructed tableau are closed and \(\varphi \) is L-unsatisfiable or

(2):

at least one branch \(\mathcal {B}\) is not closed, no rule is still applicable to a labelled formula in \(\mathcal {B}\), and \(\varphi \) is L-satisfiable.

The proof is analogous to Massacci’s [21, Section B.2]. Note that for logics \({\mathsf {KD4}}\) and \({\mathsf {KD5}}\), we use \(\max (1,n^\varphi _\Diamond )\) in the calculation of the bound. That is, if \(n^\varphi _\Diamond \ge 1\) then \(\max (1,n^\varphi _\Diamond ) = n^\varphi _\Diamond \) and the bound is the same as for \({\mathsf {K4}}\) and \({\mathsf {K5}}\). Otherwise \(\max (1,n^\varphi _\Diamond ) = 1\), that is, the bound is the same as for a formula with a single \(\Diamond \)-subformula below \(\Box \)-operators in \(\varphi \).

For \({\mathsf {K}}\), \({\mathsf {KD}}\), \({\mathsf {KT}}\), \({\mathsf {KB}}\) and \({\mathsf {KDB}}\) these bounds were already stated in [21, Tables III and IV]. The bound for \({\mathsf {KTB}}\) follows straightforwardly from that for \({\mathsf {KB}}\) and \({\mathsf {KDB}}\). For \({\mathsf {KD4}}\), Massacci [21, Tables III and IV] states the bound to be the same as for \({\mathsf {K4}}\). However, this is not correct for the case that the formula \(\varphi \) contains no \(\Diamond \)-formulae, where its bound would simply be 2, independent of \(\varphi \). For example, the formula \(\Box \Box \Box \text{ false }\) which is \({\mathsf {KD4}}\)-unsatisfiable, does not have a closed \({\mathsf {KD4}}\)-tableau with this bound. For the other logics the bounds are new. As argued in [21], the bounds allow tableau decision procedures for extensions of \({\mathsf {K}}\) with axioms \({\mathsf {4}}\) and \({\mathsf {5}}\) that do not require a loop check and are therefore of wider interest.

Note that in \({\mathsf {KT4}}\), \(\Box \Box \psi \) and \(\Box \psi \) are equivalent and so are \(\Box (\psi \wedge \Box \vartheta )\) and \(\Box (\psi \wedge \vartheta )\). So, it makes sense to further simplify \({\mathsf {KT4}}\) formulae using such equivalences before computing the normal form and the bound with the benefit that it may not only reduce the bound but also the size of the normal form. Similar equivalences that can be used to reduce the number of modal operators in a formula also exist for other logics, see, e.g., [8, Chapter 4].

To establish a relationship between closed tableaux and resolution refutations of a set of \(\mathsf {SNF}_{ml}^{}\) clauses, we formally define the modal layered resolution calculus. Table 6 shows the inference rules of the calculus restricted to labels occurring in our normal form. For GEN1 and GEN3, if the modal clauses in the premises occur at the modal level ml, then the literal clause in the premises occurs at modal level \(ml+1\).

Let \(\varPhi \) be a set of \(\mathsf {SNF}_{ml}^{}\) clauses. A (resolution) derivation from \(\varPhi \) is a sequence of sets \(\varPhi _0,\varPhi _1,\ldots \) where \(\varPhi _0 = \varPhi \) and, for each \(i>0\), \(\varPhi _{i+1} = \varPhi _i \cup \{D\}\), where \(D \not \in \varPhi _i\) is the resolvent obtained from \(\varPhi _i\) by an application of one of the inference rules to premises in \(\varPhi _i\). A (resolution) refutation of \(\varPhi \) is a derivation \(\varPhi _0,\ldots ,\varPhi _k\), \(k \in \mathbb N\), where \(0:\text{ false }\in \varPhi _k\).

To map a set of \(\mathsf {SNF}_{sml}^{}\) clauses to a set of \(\mathsf {SNF}_{ml}^{}\) clauses, using a bound \(n\in \mathbb N\) on the modal levels, we define a function \(\mathrm {db}_{n}\) on clauses and sets of clauses in \(\mathsf {SNF}_{sml}^{}\) as follows:

$$\begin{aligned} \mathrm {db}_{n}(S:\varphi )&= \{ml:\varphi \mid ml\in S\text { and }ml \le n\}\\ \mathrm {db}_{n}(\varPhi )&= \textstyle \bigcup _{S:\varphi \in \varPhi } \mathrm {db}_{n}(S:\varphi ) \end{aligned}$$

Note that prefixes in SST-tableaux have a minimal length of 1 while the minimal modal level in \(\mathsf {SNF}_{ml}^{}\) clauses is 0. So, a prefix of length n in a prefixed formula corresponds to a modal level \(n-1\) in an \(\mathsf {SNF}_{ml}^{}\) clause.

The proof of the following theorem then takes advantage of the fact that we have surrogates and associated clauses for each subformula of \(\varphi \) and proceeds by induction over applications of rule (\(\pi \)).

Theorem 3

Let \(L = {\mathsf {K}}\!\varSigma \) with \(\varSigma \subseteq \{{\mathsf {B}},{\mathsf {D}},{\mathsf {T}},{\mathsf {4}}{}{},{\mathsf {5}}\}\), \(\varphi \) be a \({\mathsf {K}}\!\varSigma \)-unsatisfiable formula in simplified NNF, \(db_{L}^\varphi \) be as defined in Table 5, and \(\varPhi _{L} = \rho ^{ml}_L(\varphi ) = \mathrm {db}_{db_{L}^\varphi -1}(\rho ^{sml}_L(\varphi ))\). Then there is a resolution refutation of \(\varPhi _L\).

Regarding the size of the encoding, we note that, ignoring the labelling sets, the reduction \(\rho ^{sml}_L\) into \(\mathsf {SNF}_{sml}^{}\) is linear with respect to the size of the original formula. The size including the labelling sets would depend on the exact representation of those sets, in particular, of infinite sets. As those are not arbitrary, there is still an overall polynomial bound on the size of the sets of \(\mathsf {SNF}_{sml}^{}\) clauses produced by \(\rho ^{sml}_L\). When transforming clauses from \(\mathsf {SNF}_{sml}^{}\) into \(\mathsf {SNF}_{ml}^{}\), we may need to add every clause to all levels within the bounds provided by Theorem 3. The parameters for calculating those bounds, \(d^\varphi _m\), \(d^\varphi _\Diamond \), \(n^\varphi _\Diamond \), and \(n^\varphi _\Box \), are all themselves linearly bound by the size of the formula. Thus, in the worst case, which is \({\mathsf {S4}}\), the size of the clause set produced by \(\rho ^{ml}_L\) is bounded by a polynomial of degree 3 with respect to the size of the original formula.

It is worth pointing out that both the reduction \(\rho ^{sml}_L\) of a modal formula to \(\mathsf {SNF}_{sml}^{}\) and the reduction \(\rho ^{ml}_L\) to \(\mathsf {SNF}_{ml}^{}\) are also reversible, that is, we can reconstruct the original formula from the \(\mathsf {SNF}_{sml}^{}\) and from the \(\mathsf {SNF}_{ml}^{}\) clause set obtained by \(\rho ^{sml}_L\) or \(\rho ^{ml}_L\), respectively. This reconstruction can also be performed in polynomial time. Thus the reduction itself does not affect the complexity of the satisfiability problem. For instance, the satisfiability problem for \({\mathsf {S5}}\) is NP-complete and so is the satisfiability problem of the subclass \(\mathbb {C}_{{\mathsf {S5}}}\) of \(\mathsf {SNF}_{ml}^{}\) clause sets that can be obtained as the result of an application of \(\rho ^{ml}_{{\mathsf {S5}}}\) to a modal formula. However, a generic decision procedure for \({\mathsf {K}}\) will not be a complexity-optimal decision procedure for \(\mathbb {C}_{{\mathsf {S5}}}\).

Table 6. Inference rules of the MLR calculus

5 Evaluation

An empirical evaluation of the practical usefulness of the reductions we presented in Sects. 3 and 4 faces the challenge that there is no substantive collection of benchmark formulae for the 15 logics of the modal cube except for basic modal logic. Catach [7] evaluates his prover on 31 modal formulae with a maximal length of 22 and maximal modal depth of 4. They are not sufficiently challenging. The QMLTP Problem Library for First-Order Modal Logics [32] focuses on quantified formulae and contains only a few formulae taken from the research literature that are purely propositional and were not written for the basic modal logic \({\mathsf {K}}\). The Logics Workbench (LWB) benchmark collection [2] contains formulae for \({\mathsf {K}}\), \({\mathsf {KT}}\) and \({\mathsf {S4}}\) but not for any of the other logics we consider. For each of these three logics, the collection consists of 18 parameterised classes with 21 formulae each, plus scripts with which further formulae could be generated if needed. All formulae in 9 classes are satisfiable and all formulae in the other 9 classes are unsatisfiable in the respective logic.

In [29] we have used the 18 classes of the LWB benchmark collection for \({\mathsf {K}}\) to evaluate our approach for the six logics consisting of \({\mathsf {K}}\) and its extensions with a single axiom. One drawback of using these 18 classes for other modal logics is that formulae that are \({\mathsf {K}}\)-satisfiable are not necessarily \({\mathsf {K}}\!\varSigma \)-satisfiable for non-empty sets \(\varSigma \) of additional axioms. For example, for \({\mathsf {K5}}\), only 60 out of 180 \({\mathsf {K}}\)-satisfiable formulae were \({\mathsf {K5}}\)-satisfiable. Another drawback is that while \({\mathsf {K}}\)-unsatisfiable formulae are also \({\mathsf {K}}\!\varSigma \)-unsatisfiable, a resolution refutation would not necessarily involve any of the additional clauses introduced by our reduction for \({\mathsf {K}}\!\varSigma \). It may be that the additional clauses allow us to find a shorter refutation, but it may just be a case of finding the same refutation in a larger search space. It is also worth recalling that simplification alone is sufficient to determine that all formulae in the class k_lin_p are \({\mathsf {K}}\)-unsatisfiable while pure literal elimination can be used to reduce all formulae in k_grz_p to the same simple formula [26]. Thus, some of the classes evaluate the preprocessing capabilities of a prover but not the actual calculus and its implementation.

We therefore propose a different approach here. The principles underlying our approach are that (i) there should be the same number of formulae for each logic though not necessarily the same formulae across all logics; (ii) there should be an equal number of satisfiable and unsatisfiable formulae for each logic; (iii) a formula that is L-unsatisfiable should only be \(L'\)-unsatisfiable for every extension \(L'\) of L; (iv) a formula that is \(L'\)-satisfiable should be L-satisfiable for every extension \(L'\) of L; (v) the formulae should belong to parameterised classes of formulae of increasing difficulty. Note that Principles (iii) and (iv) are intentionally not symmetric. For L-unsatisfiable formulae it should be necessary for a prover to use the rules or clauses specific to L instead of being able to find a refutation without those. For L-satisfiable formulae we want to maximise the search space for a model.

Table 7. Logic-specific modification of unsatisfiable benchmark formulae
Table 8. Benchmarking results

For unsatisfiable formulae, we take the five LWB classes k_branch_p, k_path_p, k_ph_p, k_poly_p, k_t4p_p and for each logic L in the modal cube transform each formula in a class so that is L-unsatisfiable, but \(L'\)-satisfiable for any logic \(L'\) that is not an extension of L. The transformation proceeds by first converting a formula \(\varphi \) to simplified NNF. Then for each propositional literal l it replaces all its occurrences by \((l\vee \psi ^p_{L})\) where \(|l| = p\) and \(\psi ^p_{L}\) is a modal formula uniquely associated with p and L, resulting in a formula \(\varphi '\). Finally, for logics \({\mathsf {KD4}}\) and \({\mathsf {KDB}}\) we need to add a disjunct \((\Box q\wedge \Box \lnot q)\) to \(\varphi '\), while for logics \({\mathsf {S4}}\) and \({\mathsf {KTB}}\) we need to add a disjunct \((q \wedge \Box \lnot q)\), where q is a propositional symbol not occurring in \(\varphi '\). These disjuncts are unsatisfiable in the respective logics but satisfiable in logics where \({\mathsf {D}}\), or \({\mathsf {T}}\), do not hold. Table 7 shows the formulae \(\psi ^p_{L}\) that we use in our evaluation. In the table, \(q_p\) and \(q'_p\) are propositional variables uniquely associated with p that do not occur in \(\varphi \). The overall effect of this transformation is that the resulting classes of formulae satisfy Principles (iii) and (v).

For satisfiable formulae, we use the five classes k_poly_n, s4_md_n, s4_ph_n, s4_path_n, s4_s5_n without modification. Although the first of these classes was designed to be \({\mathsf {K}}\)-satisfiable and the other four to be \({\mathsf {S4}}\)-satisfiable, the formulae in those classes are satisfiable in all the logics we consider. s4_ipc_n also consists only of \({\mathsf {S5}}\)-satisfiable formulae but these appear to be insufficiently challenging and have not been included in our benchmark set. All other classes of the LWB benchmark classes for \({\mathsf {K}}\) and \({\mathsf {S4}}\) are satisfiable in some of the logics, but not in all. The five classes satisfy Principles (iv) and (v). The benchmark collection consisting of all ten classes together then also satisfies Principles (i) and (ii).

Another challenge for an empirical evaluation is the lack of available fully automatic theorem provers for all 15 logics that we have already discussed in Sect. 1. This leaves us with just three different approaches we can compare (i) the higher-order logic prover LEO-III [12, 37], with E  2.6 as external reasoner, LEO-III+E for short, that supports a wide range of logics via semantic embedding into higher-order logic (ii) the combination of our reductions with the modal-layered resolution (MLR) calculus for \(\mathsf {SNF}_{ml}^{}\) clauses [25], R+MLR calculus for short, implemented in the modal theorem prover (iii) the global modal resolution (GMR) calculus, implemented in , which has resolution rules for all 15 logics [24]. For R+MLR and GMR calculi, resolution inferences between literal clauses can either be unrestricted (cplain option), restricted by negative resolution (cneg option), or restricted by an ordering (cord option). It is worth pointing out that negative and ordered resolution require slightly different transformations to the normal form that introduce additional clauses (snf+ and snf++ options, respectively). Also, the ordering cannot be arbitrary [25]. For the experiments, we have used the following options: (i) input processing: prenexing, together with simplification and pure literal elimination (bnfsimp, prenex, early_ple); (ii) preprocessing of clauses: renaming reuses symbols (limited_reuse_renaming), forward and backward subsumption (fsub, bsub) are enabled; the usable is populated with clauses whose maximal literal is positive (populate_usable, max_lit_positive); pure literal elimination is set for GMR (ple) and modal level ple is set for MLR (mlple); (iii) processing: inference rules not required for completeness are also used (unit, lhs_unit,mres), the options for preprocessing of clauses are kept and clause selection takes the shortest clause by level (shortest).

For LEO-III we provide the prover with a modal formula in the syntax it expects plus a logic specification that tells the prover in which modal logic the formula is meant to be solved, for example, $modal_system_S4. LEO-III can collaborate with external reasoners during proof search and we have used E  2.6 [34, 35] as external reasoner and restricted LEO-III to one instance of E running in parallel. LEO-III is implemented in Java and we have set the maximum heap size to 1 GB and the thread stack size to 64 MB for the JVM.

Table 8 shows our benchmarking results. The first three columns of the table show the logic in which we determine the satisfiability status of each formula, the satisfiability status of the formulae, and their number. The next six columns then show how many of those formulae were solved by with a particular calculus and refinement. The last column shows the result for LEO-III. The highest number or numbers are highlighted in bold. A time limit of 100 CPU seconds was set for each formula. Benchmarking was performed on a PC with an AMD Ryzen 5 5600X CPU @ 4.60 GHz max and 64 GB main memory using Fedora release 34 as operating system.

While the R+MLR calculus is competitive with GMR on extensions of \({\mathsf {K}}\) with axioms \({\mathsf {D}}\), \({\mathsf {T}}\) and, possibly, \({\mathsf {B}}\), the GMR calculus has better performance on extensions with axioms \({\mathsf {4}}\) and \({\mathsf {5}}\).

On satisfiable formulae, where for all logics we use exactly the same formulae and both resolution calculi have to saturate the set of clauses up to redundancy, the number of formulae solved is directly linked to the number of inferences necessary to do so. The fact that we reduce \(\mathsf {SNF}_{sml}^{}\) clauses to \(\mathsf {SNF}_{ml}^{}\) clauses via the introduction of multiple copies of the same clausal formulae with different labels clearly leads to a corresponding multiplication of the inferences that need to be performed. LEO-III+E does not solve any of the satisfiable formulae. This can be seen as an illustration of how important the use of additional techniques is that can turn resolution into a decision procedure on embeddings of modal logics into first-order logic [18, 33].

On unsatisfiable formulae, where we use different formulae for each logic, the number of formulae solved is linked to the number of inferences it takes to find a refutation. For instance, on \({\mathsf {K}}\) it takes the GMR calculus on average 6.2 times the number of inferences to find a refutation than the R+MLR calculus. However, for all other logics the opposite is true. On the remaining 14 logics, the R+MLR calculus on average requires 6.5 times the number of inferences to find a refutation than the GMR calculus. Given that the R+MLR calculus currently uses a reduction from a modal logic to \(\mathsf {SNF}_{sml}^{}\) followed by a transformation from \(\mathsf {SNF}_{sml}^{}\) to \(\mathsf {SNF}_{ml}^{}\), it is difficult to discern which of the two is the major problem. It is clear that multiple copies of the same clausal formulae are also detrimental to proof search. LEO-III+E does reasonably well on unsatisfiable formulae and the results clearly show the impact that additional axioms have on its performance. It performs best for \({\mathsf {KT}}\) and \({\mathsf {K}}\) but for logics involving axioms \({\mathsf {4}}\) and \({\mathsf {5}}\) very few formulae can be solved. The external prover E finds the proof for 121 out of the 122 modal formulae LEO-III+E can solve.

6 Conclusions

We have presented novel reductions of extensions of the modal logic \({\mathsf {K}}\) with arbitrary combinations of the axioms \({\mathsf {B}}\), \({\mathsf {D}}\), \({\mathsf {T}}\), \({\mathsf {4}}\), \({\mathsf {5}}\) to clausal normal forms \(\mathsf {SNF}_{sml}^{}\) and \(\mathsf {SNF}_{ml}^{}\) for \({\mathsf {K}}\). The implementation of those reductions combined with [26], allows us to reason in all 15 logics of the modal cube in a fully automatic way. Such support was so far extremely limited.

The transformation of sets of \(\mathsf {SNF}_{sml}^{}\) to sets of \(\mathsf {SNF}_{ml}^{}\) relies on new results that show that non-clausal closed tableaux in the Single Step Tableaux calculus [14, 21] can be simulated by refutations in the modal-layered resolution (MLR) calculus for \(\mathsf {SNF}_{ml}^{}\) clauses [25].

We have also developed a new collection of benchmark formulae that covers all 15 logics of the modal cube. The collection consists of classes of parameterised and therefore scalable formulae. It contains an equal number of satisfiable and unsatisfiable formulae for each logic and the satisfiability status of each formula is known in advance. So far extensive collections of benchmark formulae were only available for \({\mathsf {K}}\) with smaller collections available for \({\mathsf {KT}}\) and \({\mathsf {S4}}\). A key feature of the approach is that it uses the systematic modification of \({\mathsf {K}}\)-unsatisfiable formulae to obtain unsatisfiable formulae in other logics. Thus, we could obtain a more extensive collection by applying this approach to further collections of benchmark formulae for \({\mathsf {K}}\).

The evaluation we presented shows that on most of the 15 modal logics the combination of our reduction to \(\mathsf {SNF}_{ml}^{}\) with the MLR calculus does not perform as well as the global modal resolution (GMR) calculus, also implemented in . This contrasts with the evaluation in [29], where we only considered six logics and used a different collection of benchmarks. We believe that the new benchmark collection more clearly indicates weaknesses in the current approach, in particular, the reduction from \(\mathsf {SNF}_{sml}^{}\) to \(\mathsf {SNF}_{ml}^{}\). It is possible that the implementation of a calculus that operates directly on sets of \(\mathsf {SNF}_{sml}^{}\) clauses would perform considerably better as it avoids the repetition of clauses with different labels. However, it does so by using potentially infinite sets of labels which makes an implementation challenging. We intend to explore this possibility in future work.