# VINTE: An Implementation of Internal Calculi for Lewis’ Logics of Counterfactual Reasoning

## Abstract

We present VINTE, a theorem prover for conditional logics for counterfactual reasoning introduced by Lewis in the seventies. VINTE implements some internal calculi recently introduced for the basic system \(\mathbb {V}\) and some of its significant extensions with axioms \(\mathbb {N}\), \(\mathbb {T}\), \(\mathbb {C}\), \(\mathbb {W}\) and \(\mathbb {A}\). VINTE is inspired by the methodology of Open image in new window and it is implemented in Prolog. The paper shows some experimental results, witnessing that the performances of VINTE are promising.

## 1 Introduction

Conditional logics are extensions of classical logic by a *conditional* operator Open image in new window. They have a long history [11], and recently they have found an interest in several fields of AI and knowledge representation. Just to mention a few (see [1] for a complete bibliography), they have been used to reason about prototypical properties, to model belief change [8], to reason about access control policies [5], to formalize epistemic change in a multi-agent setting [2, 4]. Conditional logics can also provide an axiomatic foundation of nonmonotonic reasoning [9]: here a conditional Open image in new window is read “normally, if *A* then *B*”.

In early seventies, Lewis proposed a formalization of conditional logics in order to represent a kind of hypothetical reasoning that cannot be captured by the material implication of classical logic [10]. His original motivation was to formalize counterfactuals, that is to say, conditionals of the form “if *A* were the case then *B* would be the case”, where *A* is false. The family of logics studied by Lewis is semantically characterized by sphere models, a particular kind of neighbourhood models introduced by Lewis himself. In Lewis’ terminology, a *sphere* denotes a set of worlds; in sphere models, each world is equipped with a nested system of such spheres. From the viewpoint of the given world, inner sets represent the “most plausible worlds”, while worlds belonging only to outer sets are considered as less plausible. In order to treat the conditional operator, Lewis takes as primitive the comparative plausibility connective \( \preccurlyeq \): a formula \(A \preccurlyeq B\) means “*A* is at least as plausible as *B*”. The conditional Open image in new window can be then defined as “*A* is impossible” or “\(A \wedge \lnot B\) is less plausible than \(A \wedge B\)”. However, the latter assertion is equivalent to the simpler one “\(A \wedge \lnot B\) is less plausible than *A*”^{1}.

In previous works [6, 16] we have introduced internal, standard, cut-free calculi for most logics of the Lewis family, namely logics \( \mathbb {V}\), \( \mathbb {V}\mathbb {N}\), \( \mathbb {V}\mathbb {T}\), \( \mathbb {V}\mathbb {W}\), \( \mathbb {V}\mathbb {C}\), \( \mathbb {V}\mathbb {A}\) and \( \mathbb {V}\mathbb {N}\mathbb {A}\). Here we describe a Prolog implementation of the invertible calculi \( {\mathcal {I}_{\mathcal {L}}^{\mathsf {i}}} \) introduced in [6]. The program, called VINTE, gives a decision procedure for the respective logics, and it is inspired by the methodology of Open image in new window [3]. The idea is that each axiom or rule of the sequent calculi is implemented by a Prolog clause of the program. The resulting code is therefore simple and compact: the implementation of VINTE for \(\mathbb {V}\) consists of only 3 predicates, 21 clauses and 57 lines of code. We provide experimental results by comparing VINTE with the following theorem provers for conditional logics: CondLean [12], GoalD\(\mathcal {U}\)CK [13] and NESCOND [14, 15], and we show that the performances of VINTE are quite promising. The program VINTE, as well as all the Prolog source files, are available for free usage and download at http://193.51.60.97:8000/vinte/.

## 2 Lewis’ Conditional Logics

We consider the *conditional logics* defined by Lewis in [10]. The set of *conditional formulae* is given by \( \mathcal {F}{::}= p \mid \bot \mid \mathcal {F}\rightarrow \mathcal {F}\mid \mathcal {F}\preccurlyeq \mathcal {F}, \) where \(p \in \mathcal {V}\) is a propositional variable. The other boolean connectives are defined in terms of \(\bot ,\rightarrow \) as usual. Intuitively, a formula \(A \preccurlyeq B\) is interpreted as “*A* is at least as plausible as *B*”.

*sphere semantics*:

### Definition 1

A *sphere model* (or *model*) is a triple Open image in new window, consisting of a non-empty set *W* of elements, called *worlds*, a mapping Open image in new window, and a propositional valuation Open image in new window. Elements of Open image in new window are called *spheres*. We assume the following conditions: for every Open image in new window we have \(\alpha \ne \emptyset \), and for every Open image in new window we have \(\alpha \subseteq \beta \) or \(\beta \subseteq \alpha \). The latter condition is called *sphere nesting*.

The valuation Open image in new window is extended to all formulae by: Open image in new window; Open image in new window; Open image in new window. For \(w \in W\) we also write \(w \Vdash A\) instead of Open image in new window. As for spheres, we write \( \alpha \Vdash ^{\forall }A \) meaning \( \forall x \in \alpha . x \Vdash A\) and \( \alpha \Vdash ^{\exists } A \) meaning \( \exists x \in \alpha . x \Vdash A \)^{2}. Validity and satisfiability of formulae in a class of models are defined as usual. *Conditional logic*\(\mathbb {V}\) is the set of formulae valid in all sphere models.

*normality*: for all \( w \in W\) we have Open image in new window;*total reflexivity*: for all \( w \in W\) we have Open image in new window;*weak centering*: normality holds and for all Open image in new window we have \(w \in \alpha \);*centering*: for all \( w \in W\) we have Open image in new window;*absoluteness*: for all \( w,v \in W\) we have Open image in new window^{3}.

Lewis’ logics and axioms.

## 3 Internal Calculi for Conditional Logics

*blocks*of the form \(\left[ A_1, \ldots , A_m \vartriangleleft A \right] \), with \( A_1, \ldots , A_m, A \) formulas, representing disjunctions of \(\preccurlyeq \)-formulas. A

*sequent*is a tuple \(\varGamma \Rightarrow \varDelta \), where \(\varGamma \) is a multiset of conditional formulae, and \(\varDelta \) is a multiset of conditional formulae and blocks. The

*formula interpretation*of a sequent is given by:As usual, given a formula \(G \in \mathcal {L}\), in order to check whether

*G*is valid we look for a derivation of \(\Rightarrow G\). Given a sequent \(\varGamma \Rightarrow \varDelta \), we say that it is derivable if it admits a

*derivation*, namely a tree whose root is \(\varGamma \Rightarrow \varDelta \), every leaf is an instance of \(\mathsf {init}\) or \(\bot _L\) or \(\top _R\), and every non-leaf node is (an instance of) the conclusion of a rule having (an instance of) the premises of the rule as children.

The calculus \({\mathcal {I}_{\mathbb {V}}^{\mathsf {i}}} \) and its extensions.

In [6] it is shown that:

### Theorem 1

The calculi \({\mathcal {I}_{\mathcal {L}}^{\mathsf {i}}} \) are sound and complete for the respective logics.

In [6] it has been also shown that the calculi \({\mathcal {I}_{\mathcal {L}}^{\mathsf {i}}}\) can be used in a decision procedure for the logic \(\mathcal {L}\) as follows. Since contractions and weakenings are admissible we may assume that a derivation of a duplication-free sequent (containing duplicates neither of formulae nor of blocks) only contains duplication-free sequents: whenever a (backwards) application of a rule introduces a duplicate of a formula already in the sequent, it is immediately deleted in the next step using a backwards application of weakening. While officially our calculi do not contain the weakening rules, the proof of admissibility of weakening yields a procedure to transform a derivation with these rules into one without. Since all rules have the subformula property, the number of duplication-free sequents possibly relevant to a derivation of a sequent is bounded in the number of subformulae of that sequent, and hence enumerating all possible loop-free derivations of the above form yields a decision procedure for the logic.

### Theorem 2

Proof search with the blocking technique above for a sequent \( \varGamma \Rightarrow \varDelta \) in calculus \( {\mathcal {I}_{\mathcal {L}}^{\mathsf {i}}} \) always comes to an end in a finite number of steps.

As usual, in order to implement such a decision procedure, we have to control the application of the rules to avoid the introduction of duplicated sequents. Concerning the rule \(\preccurlyeq _L^\mathsf {i}\), the principal formula \(A \preccurlyeq B\) is copied into the premisses, then we have to avoid that, in a backward application of the rule, such formula is redundantly applied by using the same block \(\left[ \varSigma \vartriangleleft C \right] \). Since no rule, with the exception of \(\mathsf {jump}\), remove formulas from blocks, we allow a backward application of \(\preccurlyeq _L^\mathsf {i}\) to a sequent \(\varGamma , A \preccurlyeq B \Rightarrow \varDelta , \left[ \varSigma \vartriangleleft C \right] \) if neither \(\left[ B, \varSigma \vartriangleleft C \right] \) nor \(\left[ \varSigma ' \vartriangleleft C \right] \), where \(B, \varSigma \subset \varSigma '\) belong to \(\varDelta \), and neither \(\left[ \varSigma \vartriangleleft A \right] \) nor \(\left[ \varSigma ' \vartriangleleft A \right] \), where \(\varSigma \subset \varSigma '\) belong to \(\varDelta \). Similarly for the \(\mathsf {com}^\mathsf {i}\) rule, which can be applied backward to blocks \(\left[ \varSigma _1 \vartriangleleft A \right] \) and \(\left[ \varSigma _2 \vartriangleleft B \right] \) if neither \(\left[ \varSigma _1, \varSigma _2 \vartriangleleft A \right] \) nor \(\left[ \varSigma _1, \varSigma _2 \vartriangleleft B \right] \) are introduced redundantly in the premisses. For rules like \(\mathsf {W}^\mathsf {i}\), whose premisses contain the principal formula, we just need to check whether the formulas introduced in the premisses by a backward application of the rule already belong to such premisses or not. In the first case, the application of the rule is blocked. As an example, if \(\mathsf {W}^\mathsf {i}\) is applied to \(\Rightarrow \left[ A \vee B \vartriangleleft C \right] \), then the premiss is \(\Rightarrow \left[ A \vee B \vartriangleleft C \right] , A \vee B\), that becomes \((*) \ \Rightarrow \left[ A \vee B \vartriangleleft C \right] , A, B\) after an application of the rule \(\vee _R\). The rule \(\mathsf {W}^\mathsf {i}\) can be further applied to \((*)\), since \(A \vee B\) does not belong to the right-hand side of the sequent, then obtaining the premiss \(\Rightarrow \left[ A \vee B \vartriangleleft C \right] , A, B, A \vee B\), and at this point neither \(\mathsf {W}^\mathsf {i}\) nor \(\vee _R\) can be further applied.

## 4 Design of VINTE

In this section we present a Prolog implementation of the internal calculi \( {\mathcal {I}_{\mathcal {L}}^{\mathsf {i}}} \) recalled in Sect. 3. The program, called VINTE (\(\mathbb {V}\): INTernal calculi and Extensions), is inspired by the “lean” methodology of Open image in new window, even if it does not follow its style in a rigorous manner. The program comprises a set of clauses, each one of them implements a sequent rule or axiom of \( {\mathcal {I}_{\mathcal {L}}^{\mathsf {i}}} \). The proof search is provided for free by the mere depth-first search mechanism of Prolog, without any additional ad hoc mechanism.

*B*already belongs to \(\varGamma \). Another auxiliary predicate, memberOrdSet, is then invoked in lines 5 and 6 in order to implement the decision procedure described at the end of Sect. 3: Prolog ordsets are used in order to deal with the equivalence of lists where formulas occur in different orders. Since the rule is invertibile, Prolog cut \(\mathtt{!}\) is used in line 6 to eventually block backtracking. The \(\mathsf {jump}\) rule is implemented as follows:

This is the only non invertible rule, and a backtracking point is introduced by the choice of the block \(\left[ \varSigma \vartriangleleft A \right] \) in \(\varDelta \) to which apply the rule.

## 5 Performance of VINTE

All the above mentioned theorem provers take into account conditional logics based on the *selection function semantics* [11], namely conditional logic CK and extensions with axioms ID, MP, CEM, CSO, that are weaker than the ones considered by VINTE, then the experimental results are only partially significant and only aim at conjecturing that the performance of VINTE is promising.

We have performed two kinds of experiments: 1. we have tested the four provers on randomly generated formulas, fixing different time limits; 2. we have tested VINTE for system \(\mathbb {V}\mathbb {N}\) and NESCOND over a set of valid formulas in the logic CK, therefore also valid in \(\mathbb {V}\mathbb {N}\) [10].

Concerning 1 (Table 3), we have tested the four provers over 2000 random sequents with 20 formulas built from 7 different atomic variables and with a high level of nesting (10): both VINTE and NESCOND are able to answer in all cases within 1 s, whereas CondLean 3.1 is not able to conclude anything in 55 cases over 1000. Performance of GoalD\(\mathcal {U}\)CK is even worse, since it fails to answer in 174 cases. The differences seem much more significant when considering sequents with more formulas (100) and with a higher level of nesting (20): with a time limit of 5 ms, GoalD\(\mathcal {U}\)CK is faster than CondLean 3.1 and NESCOND, since it is not able to answer only in 136 cases over 1000, against 173 timeouts of CondLean 3.1 and 479 timeouts of NESCOND. VINTE is able to answer again in all cases, and only NESCOND is also able to complete all the tests, when the time limit is extended to 1 s. We have repeated the above experiments by considering implementations of VINTE for extensions of \(\mathbb {V}\), obtaining the results summarized in Table 4.

Number of timeouts over 1000 random sequents using VINTE for \(\mathbb {V}\).

Number of timeouts of VINTE for extensions of \(\mathbb {V}\) (average of different systems) over 1000 random sequents.

Concerning 2, we have considered 76 valid formulas obtained by translating K valid formulas provided by Heuerding in conditional formulas: \(\Box A\) is replaced by Open image in new window^{4}, whereas \(\diamond A\) is replaced by Open image in new window. We have compared the performance of VINTE, implementation for \(\mathbb {V}\mathbb {N}\), with those of NESCOND, the best prover among those taken into account for conditional logics based on the selection function semantics [15]. As expected, the performance of NESCOND is still significantly better than those of VINTE: fixing a time limit of 1ms, NESCOND is able to check the validity of the considered formula in the 86 % of cases, whereas VINTE is able to answer only in the 11 % of cases. However, VINTE is able to reach a percentage of successes of 37 % by extending the time limit to 1 s, and over 60% in 3 s (even if, in this last case, NESCOND is not able to answer only in 2 cases over 76). Obviously, this result is justified by the fact that VINTE supports stronger systems of conditional logics with respect to NESCOND, which is specifically tailored for CK and all the proposed results are restricted to such weaker system supported by both provers.

## 6 Conclusions and Future Issues

We have presented VINTE, a theorem prover implementing internal calculi for Lewis’ conditional logics introduced in [6]. Our long term project is to develop both calculi and theorem provers for the whole family of Lewis’ logics. One further step in this direction is represented by the hypersequent calculi for containing both uniformity (all worlds have the same set of accessible worlds) and total reflexivity presented in [7]. Notice that an implementation of *hypersequent* calculi is an interesting task in itself.

We also aim at improving the performances of VINTE by implementing standard refinements and heuristics. We also intend to extend VINTE to handle countermodel generation for unprovable formulas. Last, as mentioned in the previous section, we are currently developing a set of benchmarks for VINTE for a more detailed analysis of the performances of the theorem prover.

## Footnotes

- 1.
It is worth noticing that in turn the connective \(\preccurlyeq \) can be defined in terms of Open image in new window.

- 2.
Employing this notation, satisfiability of a \( \preccurlyeq \)-formula in a model becomes the following: \(x \Vdash A\preccurlyeq B \) iff for all Open image in new window. \( \alpha \Vdash ^{\forall } \lnot B \) or \( \alpha \Vdash ^{\exists } A \).

- 3.
It is worth noticing that absoluteness can be equally stated as

*local absoluteness*: Open image in new window it holds Open image in new window. - 4.
It is worth noticing that this translation introduces an exponential blowup.

### References

- 1.Alenda, R., Olivetti, N., Pozzato, G.L.: Nested sequent calculi for normal conditional logics. J. Log. Comput.
**26**(1), 7–50 (2016)MathSciNetCrossRefMATHGoogle Scholar - 2.Baltag, A., Smets, S.: The logic of conditional doxastic actions. Texts Log. Games
**4**, 9–31 (2008). Special Issue on New Perspectives on Games and InteractionMathSciNetGoogle Scholar - 3.Beckert, B., Posegga, J.: leanTAP: lean tableau-based deduction. J. Autom. Reason.
**15**(3), 339–358 (1995)CrossRefMATHGoogle Scholar - 4.Board, O.: Dynamic interactive epistemology. Games Econ. Behav.
**49**(1), 49–80 (2004)MathSciNetCrossRefMATHGoogle Scholar - 5.Genovese, V., Giordano, L., Gliozzi, V., Pozzato, G.L.: Logics in access control: a conditional approach. J. Log. Comput.
**24**(4), 705–762 (2014)MathSciNetCrossRefMATHGoogle Scholar - 6.Girlando, M., Lellmann, B., Olivetti, N., Pozzato, G.L.: Standard sequent calculi for Lewis’ logics of counterfactuals. In: Michael, L., Kakas, A. (eds.) JELIA 2016. LNCS, vol. 10021, pp. 272–287. Springer, Cham (2016). doi:10.1007/978-3-319-48758-8_18 CrossRefGoogle Scholar
- 7.Girlando, M., Lellmann, B., Olivetti, N., Pozzato, G.L.: Hypersequent calculi for Lewis’ conditional logics with uniformity and reflexivity. In: Nalon, C., Schmidt, R.A. (eds.) TABLEAUX 2017. LNCS (LNAI), vol. 10501, pp. 131–148. Springer, Cham (2017)Google Scholar
- 8.Grahne, G.: Updates and counterfactuals. J. Log. Comput.
**8**(1), 87–117 (1998)MathSciNetCrossRefMATHGoogle Scholar - 9.Kraus, S., Lehmann, D., Magidor, M.: Nonmonotonic reasoning, preferential models and cumulative logics. Artif. Intell.
**44**(1–2), 167–207 (1990)MathSciNetCrossRefMATHGoogle Scholar - 10.Lewis, D.: Counterfactuals. Blackwell, Hoboken (1973)MATHGoogle Scholar
- 11.Nute, D.: Topics in Conditional Logic. Reidel, Dordrecht (1980)CrossRefMATHGoogle Scholar
- 12.Olivetti, N., Pozzato, G.L.: CondLean 3.0: improving condlean for stronger conditional logics. In: Beckert, B. (ed.) TABLEAUX 2005. LNCS (LNAI), vol. 3702, pp. 328–332. Springer, Heidelberg (2005). doi:10.1007/11554554_27 CrossRefGoogle Scholar
- 13.Olivetti, N., Pozzato, G.L.: Theorem proving for conditional logics: condlean and goalduck. J. Appl. Non-Class. Log.
**18**(4), 427–473 (2008)CrossRefMATHGoogle Scholar - 14.Olivetti, N., Pozzato, G.L.: NESCOND: an implementation of nested sequent calculi for conditional logics. In: Demri, S., Kapur, D., Weidenbach, C. (eds.) IJCAR 2014. LNCS (LNAI), vol. 8562, pp. 511–518. Springer, Cham (2014). doi:10.1007/978-3-319-08587-6_39 Google Scholar
- 15.Olivetti, N., Pozzato, G.L.: Nested sequent calculi and theorem proving for normal conditional logics: the theorem prover NESCOND. Intelligenza Artificiale
**9**(2), 109–125 (2015)CrossRefGoogle Scholar - 16.Olivetti, N., Pozzato, G.L.: A standard internal calculus for Lewis’ counterfactual logics. In: Nivelle, H. (ed.) TABLEAUX 2015. LNCS, vol. 9323, pp. 270–286. Springer, Cham (2015). doi:10.1007/978-3-319-24312-2_19 CrossRefGoogle Scholar