Structural sharing and efficient proof-search in propositional intuitionistic logic

D. Galmiche and D. Larchey-Wendling

LORIA - Université Henri Poincaré Campus Scientifique, BP 239 Vandœuvre-lès-Nancy, France

Abstract. In this paper, we present a new system for proof-search in propositional intuitionistic logic from which an efficient implementation based on structural sharing is naturally derived. The way to solve the problem of formula duplication is not based on logical solutions but on an appropriate representation of sequents with a direct impact on sharing and therefore on the implementation. Then, the proof-search is based on a finer control of the resources and has a O(n log n)-space complexity. The system has the subformula property and leads to an algorithm that, for a given sequent, constructs a proof or generates a counter-model.

1 Introduction

In recent years there was a renewed interest in proof-search for constructive logics like intuitionistic logic (IL), mainly because of research in intuitionistic type theories and their relationships with programming through proof-search [7]. Nowadays, theorem provers are more often used into the formal development of software and systems and have to be integrated into various environments and large applications. Then, to provide a simple implementation of a logical calculus (and connected proof-search methods) in imperative programming languages like C or Java, we have to consider new techniques leading to the clarity of the implementation [8] but also to a good and efficient explicit management of formulae, considered here as resources. The potential support for user interfaces or for a natural parallelisation of the proof-search process could be expected. A recent work on efficient implementation of a theorem prover for Intuitionistic Propositional Logic (IPL) has emphasised the interest of finer control and management of the formulae involved in the proof-search, with an encoding of the sequents at the implementation step [2]. But to solve the problem of duplication of some formulae we need to reconsider the global problem of proof-search in this setting, knowing that a usable proposal is necessary for a good space complexity and an efficient implementation based on resources sharing. A logical solution based on the introduction of new variables and of some adequate strategies is given in [3]. Our goal in this paper is to propose a solution at a structural level (no new formulae and only modifications of the sequents structure) including a finer management of formulae (as resources). Therefore, we define, from an analysis of previous works, a new logical system, that has some similarities with the one of [3]. With such a system we can naturally derive, from the logical rules and a particular representation of sequents (with specific tree structures), some new rules that act on trees to perform proof-search. Moreover, these ideas can also be applied to a refutability system for IPL to generate counter-models in case of unprovability [5]. With such an approach the depth of the search tree is in both systems linearly bounded and the control on resources leads to an efficient implementation in imperative languages.

2 Proof-search in intuitionistic logic

We focus on IPL for which the LJ sequent calculus is a simple formulation having the subformula property. On the other hand, it lacks termination and thus implementing this calculus involves some kind of loop-checking mechanism to ensure the termination of computation. A solution is the use of the contractionfree sequent calculus LJT [1] that has the nice property that backward search does not loop. There exists other proposals for proof-search in IL based for instance on resolution [7], constraints [9] or skolemization [6]. Let us start to recall the main characteristics of the LJT system. It is is sound and complete w.r.t. provability in LJ and a backward search does not loop and always terminates [1]. For that, the left-implication rule of LJ is replaced by four rules depending on the form of the premiss of the principal formula. Then, the treatment of the implication is becoming finer and the termination is obtained from a well-founded ordering on sequents. Moreover the contraction rule is no longer a primitive rule but is nevertheless admissible. The corresponding multiconclusion calculus is also a good basis for a non-looping method to construct Kripke trees as counter-models for non-provable formulae of IPL [5]. It provides a calculus, called CRIP, in which refutations are inductively defined and Kripke counter-models can be extracted from these refutations. The rules of LJT are given in figure 1, X representing atomic formulae, A, B, G representing formulae and Γ being a multiset of formulae. This system provides a decision procedure in which the deductions (proofs) may be of exponential depth in the size of their endsequent. Moreover in rules like →-L_{3}, some formulae of the conclusion appear twice (duplication problem). We also observe that, for instance in the →-L_{3} rule, the premises are not smaller (in the usual meaning) than the conclusion, even if they are with a multiset ordering (see [1]). The LJT prover, implemented in Prolog, is based on an analytic approach where the size of the formulae decreases but a potential big number of subformulae might appear. One one has no explicit knowledge on the formulae used during the proof-search or on the depth of proofs. Moreover, LJT does not satisfy the subformula property: for instance, in rule →-L_{4}, the formula B → C is introduced in the left premise even if it is not a subformula of (A→B)→C. Some rules duplicate formulae as in rule →-L_{3} where C is duplicated and in rule →-L_{4} where B is duplicated. Therefore, the idea to share formulae naturally arises so that the duplication would be harmless in terms of space. But we have to know which are the formulae that might appear

Γ, X ⊢ X Id  _{Γ ⊢ T T}  _{Γ, F ⊢ G F}
\begin{matrix}Γ, A, B ⊢ G \\ Γ, A ∧ B ⊢ G \end{matrix} ∧-L  \begin{matrix}Γ ⊢ A & Γ ⊢ B \\ Γ ⊢ A ∧ B \end{matrix} ∧-R  \begin{matrix}Γ ⊢ A \\ Γ ⊢ A ∨ B \end{matrix} ∨-R_{1}
\begin{matrix}Γ ⊢ B \\ Γ ⊢ A ∨ B \end{matrix} ∨-R_{2}  \begin{matrix}Γ, A ⊢ G & Γ, B ⊢ G \\ Γ, A ∨ B ⊢ G \end{matrix} ∨-L \begin{matrix}Γ, A ⊢ B \\ Γ ⊢ A → B \end{matrix} →-R

\begin{matrix}\begin{matrix}Γ, X, B ⊢ G \\ Γ, X, X → B ⊢ G \end{matrix} →-L_{1} & \begin{matrix}Γ, A → (B → C) ⊢ G \\ Γ, (A ∧ B) → C ⊢ G \end{matrix} →-L_{2} \\ \begin{matrix}Γ, A → C, B → C ⊢ G \\ Γ, (A ∨ B) → C ⊢ G \end{matrix} →-L_{3} & \begin{matrix}Γ, B → C ⊢ A → B & Γ, C ⊢ G \\ Γ, (A → B) → C ⊢ G \end{matrix} →-L_{4} \end{matrix}

Fig. 1. The LJT calculus

during such backward proof-search. Then we have recently proposed an explicit management of the formulae (considered as resources) and a new proof-search method for LJT based on new concepts and results such as a new notion of subformula [2]. In the LG system, independently proposed in [3], the length of the deductions is linear bounded in terms of the size of the endsequent. A backward application of the rules gives rise to an O(n log n)-space decision algorithm for IPL. In this work, the strategy used to avoid the duplication of subformulae is different for the →-L_{3} and →-L_{4} rules: for the first one, it corresponds to add new propositional variables and to replace complex formulae by such new variables. For the second one, it forces the sequents to keep a convenient form in order to apply some transformations or reductions. In fact, in this system, the duplication problem is solved at a logical level by the introduction of new variables and the use of particular sequents [3]. But it is complicated and several implementation problems arise. Our aim, in this paper, is to propose an alternative (not logical but structural) solution based on a fine management of new structures appropriate for an efficient implementation. Let us mention the work of Weich [10] that is based on constructive proofs of the decidability of IPL by simultaneously constructing either a proof, taking up the approach of [3] or a counter-model refining the idea of [4]. His algorithm is faster than the refutability algorithm of [5]. When restricted to provability it coincides with the one of [3] including the same logical solution for the duplication problem. Our proposal is based on a new logical system that has some similarities with the formulations of LG dedicated to the implementation [3]. The duplication problem is in our case treated by a structural approach in which no new variable or formula is introduced and such that we only modify the structure of the sequents. It will lead to a more direct and clear implementation in imperative languages. The main characteristics coming from the use of appropriate sharing techniques are: no dynamic memory allocation, a finer control on the resources and a O(n log n)-space algorithm for provability. A similar approach can be applied to define and then implement an algorithm for refutability with the generation of counter-models in a same space complexity, i.e., with the depth of search tree being linearly bounded.

\begin{matrix}\begin{matrix}Γ^{⋆}, A, B ⊢ ■ \\ Γ^{⋆}, A ∧ B ⊢ ■ \end{matrix} [∧_{L}] & \begin{matrix}Γ^{⋆}, A ⊢ ■ & Γ^{⋆}, B ⊢ ■ \\ Γ^{⋆}, A ∨ B ⊢ ■ \end{matrix} [∨_{L}] \\ \begin{matrix}Γ^{⋆}, X, C ⊢ ■ \\ Γ^{⋆}, X, X → C ⊢ ■ \end{matrix} [X→] & Γ, X, X^{⋆} → C ⊢ ■ [X^{⋆}→] \\ \begin{matrix}Γ, A, B^{⋆} → C ⊢ ■ & Γ^{⋆}, C ⊢ ■ \\ Γ^{⋆}, (A → B) → C ⊢ ■ \end{matrix} [→→] & \begin{matrix}Γ, A, B^{⋆} → C ⊢ ■ \\ Γ, (A → B)^{⋆} → C ⊢ ■ \end{matrix} [→^{⋆}→] \\ \begin{matrix}Γ^{⋆}, A → (B → C) ⊢ ■ \\ Γ^{⋆}, (A ∧ B) → C ⊢ ■ \end{matrix} [∧→] & \begin{matrix}Γ, A^{⋆} → C ⊢ ■ & Γ, B^{⋆} → C ⊢ ■ \\ Γ, (A ∧ B)^{⋆} → C ⊢ ■ \end{matrix} [∧^{⋆}→] \\ \begin{matrix}Γ^{⋆}, A → C, B → C ⊢ ■ \\ Γ^{⋆}, (A ∨ B) → C ⊢ ■ \end{matrix} [∨→] & \begin{matrix}Γ, A^{⋆} → C, B → C ⊢ ■ \\ Γ, (A ∨ B)^{⋆} → C ⊢ ■ \end{matrix} [∨_{l}^{⋆}→] \\ _{Γ, X ⊢ X [Ax]} & \begin{matrix}Γ, A → C, B^{⋆} → C ⊢ ■ \\ Γ, (A ∨ B)^{⋆} → C ⊢ ■ \end{matrix} [∨_{r}^{⋆}→] \\ \begin{matrix}Γ, A, B ⊢ G \\ Γ, A ∧ B ⊢ G \end{matrix} [∧_{L}] & \begin{matrix}Γ, A ⊢ G & Γ, B ⊢ G \\ Γ, A ∨ B ⊢ G \end{matrix} [∨_{L}] \\ \begin{matrix}Γ, X, C ⊢ G \\ Γ, X, X → C ⊢ G \end{matrix} [X→] & \begin{matrix}Γ, A, B^{⋆} → C ⊢ ■ & Γ, C ⊢ G \\ Γ, (A → B) → C ⊢ G \end{matrix} [→→] \\ \begin{matrix}Γ, A → (B → C) ⊢ G \\ Γ, (A ∧ B) → C ⊢ G \end{matrix} [∧→] & \begin{matrix}Γ, A → C, B → C ⊢ G \\ Γ, (A ∨ B) → C ⊢ G \end{matrix} [∨→] \\ \begin{matrix}Γ ⊢ A & Γ ⊢ B \\ Γ ⊢ A ∧ B \end{matrix} [∧_{R}] & \begin{matrix}Γ ⊢ A \\ Γ ⊢ A ∨ B \end{matrix} [∨_{Rl}] \\ \begin{matrix}Γ, A ⊢ B \\ Γ ⊢ A → B \end{matrix} [→_{R}] & \begin{matrix}Γ ⊢ B \\ Γ ⊢ A ∨ B \end{matrix} [∨_{Rr}] \end{matrix}

Fig. 2. The SLJ-system

3 A new system for intuitionistic proof-search

We present in this section a new logical system, called SLJ, that leads to a natural use of sharing techniques on structures adapted to an efficient implementation in imperative languages. It is derived from the ideas of LJT [1] and of LG [3].

3.1 The SLJ system

The SLJ-system, that is given in figure 2, includes two kinds of sequents, like in [3]. We have the usual intuitionistic sequent Γ ⊢ A which is a multiset Γ of formulae forming the hypothesis together with a unique formula A called the conclusion. The intuitive meaning of a sequent is that the conclusion A logically follows from the hypothesis in Γ. Moreover, we have a second kind of sequent which we will call boxed sequent: Γ, α^{⋆} → C ⊢ ■ which intuitively means Γ, α → C ⊢ α. The special ■-notation indicates that the conclusion α is shared with the left side of an implication in the hypothesis: α → C. For example, in rule [→→], B is shared and not duplicated. There is a mark ⋆ to determine which formula is concerned. In this second kind of sequents, there is exactly one marked formula on the left of an implication of the hypothesis. We will denote Γ^{⋆} to point out the fact that Γ contains exactly one formula of type α^{⋆} → C. This will happen when this last formula is not the active one like in rule [X→] for example. This idea of marking α was introduced in [3] to avoid one particular kind of duplication of formula in LJT and is also useful for our purpose. It is important to notice that when we try to prove a boxed sequent Γ, α^{⋆} → C ⊢ ■, the sequents encountered upper in the proof are always boxed: only boxed sequents appear in the proof of an initial boxed sequent. The reader may also notice that the rules [∧_{L}], [∨_{L}], [X→], [→→], [∧→] and [∨→] are duplicated. There is one version for boxed sequents and another version for standard sequents. In the case of boxed sequents, the marked (or starred) formula is not active. We have chosen not to distinguish the names because only the nature of the sequent (boxed or not) differs for each pair of rules. On the contrary, if we compare the rules [→→] and [→^{⋆}→], then it appears that they are very different. In the case the marked formula is active, the rules do not have the same meaning at all. This system is very interesting because all the duplications appearing in LJT have been removed except in the rules [∨→], [∨_{l}^{⋆}→] and [∨_{r}^{⋆}→]. The problem of duplication in the rule (→-L_{4}) of LJT has then disappeared. We will see in section 4 that the last duplication cases can be addressed by changing the structure of sequent to represent sharing.

3.2 Kripke models

Kripke models are a very general model representation for logics like intuitionistic or modal logics. Here, we will adopt the same notation as in [10] for Kripke trees. A Kripke tree is a pair K = (S_{K}, [K_{1}, …, K_{p}]) where S_{K} is a finite set of logical variables and [K_{1}, …, K_{p}] is a finite list of Kripke trees. Moreover, we suppose that for each i, S_{K} ⊆ S_{K_{i}}. This monotony condition is typical to intuitionistic logic as opposed to modal logics for example. This is an inductive definition of Kripke trees and the base case is when the list [K_{1}, …, K_{p}] is empty, i.e. p = 0. In fact, Kripke trees are regular (oriented) trees with each node tagged with a set of variables that grows along the paths from the root to the leaves. We then introduce the notion of forcing. Let K = (S_{K}, [K_{1}, …, K_{p}]) be a Kripke tree and F be a logical formula. We say that K forces F and write K ⊨ F. The inductive definition is the following:

K ⊨ X iff X ∈ S_{K} K ⊨ A → B iff K ⊨ A implies K ⊨ B and ∀i, K_{i} ⊨ A → B
K ⊨ A ∧ B iff K ⊨ A and K ⊨ B K ⊨ A ∨ B iff K ⊨ A or K ⊨ B

The only difference with classical logic here is that the forcing of logical implication A → B is inherited in the sons K_{i} of K and so in all its subtrees. In fact, this inheritance is extended to all formulae with the following result, a proof of which can be found in [10].

Lemma 1. If F is a logical formula and K = (S_{K}, [K_{1}, …, K_{p}]) is a Kripke tree forcing F, i.e. K ⊨ F, then for all i, K_{i} ⊨ F.

Kripke trees are models of intuitionistic logic. Let A_{1}, …, A_{n} ⊢ B be a sequent, we say that a Kripke tree K is a model of A_{1}, …, A_{n} ⊢ B if K ⊨ A_{1} and … and K ⊨ A_{n} implies K ⊨ B. We will often write K ⊨ A_{1}, …, A_{n} ⊢ B.

Theorem 2 (Soundness). If Γ ⊢ A is provable in intuitionistic logic and K is a Kripke tree then K ⊨ Γ ⊢ A.

Models are very often used in a negative way to provide a synthetic argument to the unprovability of some formula or sequent. Therefore, we say that K is a counter-model of the sequent A_{1}, …, A_{n} ⊢ B if K ⊨ A_{1} and … and K ⊨ A_{n} and K ⊭ B. We write K ⊭ A_{1}, …, A_{n} ⊢ B. There is an constructive version of the completeness theorem, see [10] for example.

Theorem 3 (Completeness). Let Γ ⊢ A be a sequent, then either it is intuitionistically provable, or there exists a Kripke tree K such that K ⊭ Γ ⊢ A.

3.3 Completeness of SLJ

Before proving the theorem we have to precise how Kripke trees can model boxed sequents. K is a counter-model to Γ, α^{⋆} → C ⊢ ■ if K is a counter-model to Γ, α→C ⊢ α, so K⊨Γ, α→C and K⊭α. But we do not know whether K forces C or not at the level of K. However, if one of its sons K_{i} forces α then K_{i} also forces C. The completeness result for SLJ can be decomposed into two parts: one for boxed sequents and one for standard sequents. Here we only prove the part for boxed sequents. The other part is very similar. The reader is reminded that the following proofs are inspired from [5,10].

Theorem 4 (Soundness). If Γ, α^{⋆}→C ⊢ ■ is a provable sequent in SLJ, then Γ, α → C ⊢ α is intuitionistically provable (or provable in LJT).

To obtain this result, it is sufficient to show that all the boxed rules^{1} of SLJ are admissible. For example, let us explore the case of [∧^{⋆}→]. We have to prove that the following rule is admissible in IPL:

\begin{matrix}Γ, A → C ⊢ A & Γ, B → C ⊢ B \\ Γ, (A ∧ B) → C ⊢ A ∧ B \end{matrix}

From the premisses, we obtain Γ ⊢ (A → C) → A and Γ ⊢ (B → C) → B. The sequent (A → C) → A, (B → C) → B, (A ∧ B) → C ⊢ A ∧ B is also provable. By two applications of the (Cut) rule, we obtain Γ, Γ, (A ∧ B) → C ⊢ A ∧ B. We finally get the conclusion by application of the contraction rule. More details can be found in [3].

Theorem 5 (Completeness). Let Γ, α^{⋆} → C ⊢ ■ be a boxed sequent, either it admits a proof in SLJ, or it admits a Kripke tree counter-model.

The proof is done by induction on Γ, α → C, but it is not a simple induction on the size of Γ, α → C, see [1]. First, we point out the fact that some rules have the important invertibility property: any counter-model to one of the premisses is a counter-model to the conclusion. This is the case for the [∧_{L}], [∨_{L}], [X→],

1 Boxed rules are the rules of figure 2 for which the conclusion is a boxed sequent.

[X^{⋆}→], [→^{⋆}→], [∧→], [∧^{⋆}→] and [∨→] rules. Then if Γ has one of the following form,

\begin{matrix}Γ ≡ Δ, A ∧ B & Γ ≡ Δ, A ∨ B & Γ ≡ Δ, X, X → C \\ Γ ≡ Δ, (A ∨ B) → C & Γ ≡ Δ, (A ∧ B) → C \end{matrix}

one of the above rule can be applied. The induction hypothesis gives us either one proof for each premiss or else one counter-model to one of the premisses, and thus we either have a proof or a counter model of Γ, α^{⋆} → C ⊢ ■. This is also the case when α ≡ A → B, α ≡ A ∧ B or α ≡ X and X ∈ Γ. Then the problem is reduced to the following case:

Γ ≡ \{ \begin{matrix}X_{1}, …, X_{n}, Y_{1} → D_{1}, …, Y_{k} → D_{k}, \\ (A_{1} → B_{1}) → C_{1}, …, (A_{p} → B_{p}) → C_{p} \end{matrix}

with {X_{1}, …, X_{n}}∩{Y_{1}, …, Y_{k}} = ∅. Moreover, either α ≡ A∨B, or α ≡ X and X ∉ {X_{1}, …, X_{n}, Y_{1}, …, Y_{k}}. We will suppose that α ≡ A ∨ B for the rest of the proof — the other case is simpler. We introduce Δ_{i} = Γ −{(A_{i} →B_{i})→C_{i}}. Then, by induction hypothesis, either one of the Δ_{i}, A_{i}, B_{i}^{⋆} → C_{i}, α → C ⊢ ■ is provable, or there exists a counter-model for each of them. In the first case, suppose that Δ_{i_{0}}, A_{i_{0}}, B_{i_{0}}^{⋆} →C_{i_{0}}, α →C ⊢ ■ has a proof in SLJ. Then consider the rule

\begin{matrix}Δ_{i_{0}}, A_{i_{0}}, B_{i_{0}}^{⋆} → C_{i_{0}}, α → C ⊢ ■ & Δ_{i_{0}}, C_{i_{0}}, α^{⋆} → C ⊢ ■ \\ Γ, α^{⋆} → C ⊢ ■ \end{matrix} [→→]

This rule is right invertible: a counter-model of the second premiss is a countermodel of the conclusion. On the other hand, a proof of the second premiss would give a proof of Γ, α^{⋆} → C ⊢ ■. Thus, we obtain a proof or a counter-model of the conclusion. In the second case, for each i ∈ [1, p] let K_{i} be a counter-model of Δ_{i}, A_{i}, B_{i}^{⋆} → C_{i}, α → C ⊢ ■. Let us consider α ≡ A ∨ B.^{2} By induction hypothesis, either one sequent among Γ, A^{⋆} → C, B → C ⊢ ■ and Γ, A → C, B^{⋆} → C ⊢ ■ is provable, or we have two counter-models K_{A} and K_{B}. In the first subcase, we obtain a proof of Γ, (A ∨ B)^{⋆} → C ⊢ ■ applying [∨_{l}^{⋆}→] or [∨_{r}^{⋆}→]. In the second subcase, we define K = ({X_{1}, …, X_{n}}, [K_{1}, …, K_{p}, K_{A}, K_{B}]). It is only routine to check that K is a counter-model to Γ, α^{⋆} → C ⊢ ■. We now give some details of the proof. As X_{j} ∈ Δ_{i}, we get K_{i} ⊨ X_{j} and so X_{j} ∈ S_{K_{i}} for any j ∈ [1, n] and i ∈ {1, …, p, A, B}. Thus, K is a Kripke tree and it is simple to check that K ⊨ X_{1}, …, X_{n}, Y_{1} → D_{1}, …, Y_{k} → D_{k}, α → C. As K_{A} ⊭ A and K_{B} ⊭ B, we obtain K ⊭ α and then it remains to prove that K ⊨ (A_{j} → B_{j}) → C_{j} hold. For any i ∈ {1, …, p, A, B} − {j}, (A_{j} → B_{j}) → C_{j} is in the context (Δ_{i} or Γ) and so K_{i}⊨(A_{j}→B_{j})→C_{j}. Why does K_{j}⊨(A_{j}→B_{j})→C_{j} hold? Because we have K_{j} ⊨ A_{j} and K_{j} ⊨ B_{j} → C_{j}. Moreover K_{j} ⊭ B_{j} and also K_{j} ⊭ A_{j} → B_{j} and thus K ⊭ A_{j} → B_{j}. Finally, if K ⊨ A_{j} → B_{j} then K ⊨ C_{j}.

2 Remember we have supposed this but a complete proof would also consider the case α ≡ X and X ∉ {X_{1}, …, X_{n}, Y_{1}, …, Y_{k}}.

This completeness proof for the boxed fragment of SLJ also describes an algorithm that produces a proof or a counter-model out of a given (boxed) sequent. It can be effectively used to build counter-models.

4 Sharing techniques

In this section, we will present an alternative approach, w.r.t. [3], to address the problem of duplication of formulae during proof-search. It is not logical but structural: only the structure of sequents is modified, no new formula or variable is introduced. Looking at the SLJ-system, we can observe that a duplication occurs when the active formula is of type (A ∨ B) → C, and only in this case, as for example in the rule [∨→]. Hudelmaier proposed a way to bypass this problem for complexity reasons: he wanted the linear size of sequent to decrease strictly while applying rules of his system and put a restriction on C that is to be an atomic formula, a variable for example. But doing this, he had to introduce a new rule in the system so that any formula C could be replaced by a variable without modifying the meaning of the sequent:

\begin{matrix}Γ, A → X, X → C ⊢ G \\ Γ, A → C ⊢ G \end{matrix} [X new variable]

By this trick, the system assures that any duplication is done on a formula of size 1 and then has the property that the application of rules decreases the linear size of the sequent. That is why we say that the duplication problem is addressed on the logical side. We can see that the variable X represents the sharing of C between A → C and B → C by combining the two rules:

Γ, A → X, B → X, X → C ⊢ G

[∨→]

Γ, (A ∨ B) → X, X → C ⊢ G

[X new variable]

Γ, (A ∨ B) → C ⊢ G

But this method has the drawback of introducing some new formulae (A→X for example) during the proof-search. This could be a problem when we look for a resource-conscious implementation of proof-search. It may not be easy to allocate in advance all the formulae that could appear during the proof-search process. We propose an alternative approach that consists in encoding the sharing of C between A → C and B → C inside the sequent structure.

4.1 A structural solution

Usually, an intuitionistic sequent is a multiset (or set or list, depending on structural rules) of formulae, as hypothesis, together with a unique formula for the conclusion. Here, we will consider a new structure encoding the sharing. Sequent structure. The left part of sequents will have the structure of a forest (i.e. list of trees). Each tree represents a compound formula where sharing is taken into account. For this, the nodes of the trees are associated to subformulae of the initial sequent which will be called tags. Let l be a leaf in this tree, we denote by F_{0}, …, F_{l} the list of formulae encountered while following the path from the root of tag F_{0} to the leaf l tagged with F_{l}. Each tree T is associated a meaning, which

⟼ ∧ \begin{matrix}A_{3} → (A_{2} → A_{0}) \\ A_{1} → A_{0} \end{matrix}

Fig. 3. Meaning function is the logical formula _{⋀l} F_{l} →⋯→F_{0} where l ranges over the leaves of T . As usual, → is right associative and F_{l} → ⋯ → F_{0} means F_{l} → (⋯ → F_{0}). See the example in figure 3. There is an obvious map from formulae to trees F ⟼ that associates a formula F to one-node tree whose root is tagged with F. Rules. The rules are derived from the SLJ rules and the preceding meaning maps. They act on the leaves of the trees and there are two cases: the tree is a one-node tree or else the root is not a leaf. In the case of a one-node tree, ei-

\begin{matrix}…,  , … ⊢ … \\ …,  , … ⊢ … \end{matrix} [∨→]

Fig. 4. Tree decomposition rule ther the formula is an implication in which case the node is rewritten as a two-nodes tree (rule [→_{L}] in figure 5) or we apply left conjunction or disjunction rule to obtain one or two one-node trees. In the case the root is not a leaf, a formula F_{l} → (F_{l−1} → ⋯ → F_{0}) corresponds to the leaf l and thus to an left implication rule of SLJ. For example, if F_{l} is A∧B the leaf l is replaced by a two-nodes tree whose leaf is tagged with A and whose root is tagged with B like it appears in rule [∧→] of figure 5. We focus here on one of the rules that involves duplication. Considering the trees of figure 4, we see that the tree of the conclusion is associated to a formula of the shape ⋯ ∧ [(A ∨ B) → (C → ⋯ → R)] ∧ · · ·. Considering the rule [∨→] of SLJ, and the fact that ∧ can be exchanged with commas (,) on the left side of SLJ-sequents because of the rule [∧_{L}], we can convert this formula into ⋯ ∧ [A → (C → ⋯ → R) ∧ B → (C → ⋯ → R)] ∧ · · ·. The new formula exactly corresponds to the tree of the premise. It illustrates the method from which we derive the tree manipulation rules from SLJ-rules. We also notice how the duplication has been removed with the help of sharing. The node tagged with C is shared in the two paths leading to A and B. Finally, A and B which replace A ∨ B are subformulae. This fact is a general one, and all rules introduce only subformulae so that the tags of the trees are all subformulae of the formulae of the initial sequent. The it provides a subformula property (see section 4.2). It is important to point out that the sharing version of SLJ is not a simple implementation in terms of trees. In particular, we have previously seen that proving a boxed sequent only involves boxed sequents. This is no longer the case

, ⊢ ■  ⊢ 9
[→→]
⊢ 9
[∧→]
⊢ 9
[∨→]

⊢ 9

[→_{L}]

⊢ 9

Fig. 5. An example of proof-search

in the sharing tree version. The tree version of the rule [X→] might remove a whole subtree and this one might contain the marked (or starred) formula. In this case, the premiss cannot be a boxed sequent and we must reintroduce the marked formula as the conclusion of the premiss. An example. Considering figure 5, we aim to prove the sequent ((A ∧ B) ∨ (C → D)) → E ⊢ F. First we build the tree of the subformulae of this sequent. The nodes are given with numbers used to label the nodes of proof trees. The proofsearch tree is written bottom-up as usual. We start by translating the premiss into a forest (in this case, there is only one tree) and then we develop this forest following the rules for trees. Notice that only the leaves of the trees are concerned in those rules. Inner nodes are “asleep” until all the sons are “removed.” This point has some consequences when efficient implementation is taken into account (see section 5). Moreover a marked formula 6^{⋆} appears in the tree at the end of the proof-search. As for SLJ, there might be at most one marked formula in the forest, meaning that this formula is shared with the conclusion and in this case, the conclusion is boxed.

4.2 Properties of structural sharing

Structural sharing avoids the duplication of formulae. In fact, anytime a formula on a leaf is decomposed, it is always replaced by one or two leaves that are tagged with the subformulae of the tagging formula. Sometimes a part of the tree can be removed. Let us consider some results about complexity, subformula property and counter-models. If we measure the size of the forest by the sum of the size of each tagging formula, then the size of any premise of a rule is strictly smaller than the size of the conclusion. Moreover, the size of the initial forest is exactly the size of initial sequent in the usual sense.

Theorem 6. The depth of the proof-search tree is bounded by the size of the sequent (or forest) to prove.

This result is important and already obtained in [3], providing an O(n log n)- space decision procedure for intuitionistic logic. Here we focus on an efficient implementation of such a procedure, based on structural sharing. Another important point is that a tagging formula is always replaced by some of its direct subformulae.

Theorem 7. The tagging formulae occurring during the proof-search, as the forest gets decomposed, are subformulae of the initial sequent (or forest).

The consequence for implementation is significant. In fact, an occurrence of a formula A is always decomposed by the same rule, which ever the context. This only depends on the polarity^{3} of A as a subformula. It allows to do the allocation of space for subformulae before the proof-search starts, and not dynamically. In section 3.3, we sketched an algorithm to effectively build a counter-model when the proof-search fails, like what was already done in [10]. The proof can be very easily adapted to the sharing-trees version of the system. In fact, one can effectively build Kripke-trees that are strong counter models (see [10]) in case of the failure of the proof-search algorithm on sharing trees.

Theorem 8. The algorithm can produce proofs or counter-models and their depth is bounded by the size of the sequent to prove.

5 Implementation issues

The sharing tree version of the SLJ system is well suited for an efficient implementation in imperative languages. A proof-search algorithm requires a bounded memory space (depending on the size of the initial sequent) and it can be implemented without using dynamic memory allocation at all. Moreover, good choices are not obvious, especially in terms of time, if we aim to have a light use of resources. To define a good proof-search strategy is not an easy task and can depend on the kind of formulae. Its implementation could be difficult because it could involve too much administrative tasks like maintaining lists of formulae or even traversing lists at each point in the proof-search. A strategy has to take into account that some rules have the invertibility property. Moreover, in case the algorithm has to return counter-models, the strategies are restricted to those respecting the order in the completeness proof of section 3.3. For a given strategy, the program having a sequent (set of sharing trees) as input has to choose a leaf of the tree. Going through the tree to search for a particular kind of leaf is not a good solution and it is necessary to gather leaves by types. But this information has to be maintained when the proof rules are applied. To summarise, the basic resources are the sequent represented as a tagged tree of formulae and the conclusion (or starred formula if we have a boxed sequent). This information is completed with some administrative information so as to make these resources accessible in minimal time. The key-points are the following: the

3 This is the parity of the number of times a subformula occurs on the left of →.

leaves should be organised by types to have an efficient choice. It is especially important to avoid the traversal of leaves at each point of the proof-search; the application of rules should not involve too much administrative tasks otherwise the benefits of the added information would be null; the reverse application of rules is also concerned by this point because the non-invertibility of some rules implies some backtracking.

6 Conclusion

In this paper, we have presented a new system SLJ derived from ideas of LJT [1] and LG [3] which is proved sound and complete for IPL. It is an intermediate step towards an efficient implementation of IPL based on the concept of sharing trees. This system has very nice properties like the subformula property, a linear bound on the depth of proof-search and the ability to generate Kripke countermodels. In addition to the theoretical complexity results, our approach provides an effective and fine control of space and time resources, adapted to the design in imperative languages. A first implementation has been developed in C and the practical feasibility of the method has been confirmed. A possible extension of this work would be, as in [10], implementing the intuitionistic proof of the system based on sharing trees and mechanically extracting a (proved) algorithm from this proof.

References

1. R. Dyckhoff. Contraction-free sequent calculi for intuitionistic logic. Journal of Symbolic Logic, 57:795–807, 1992.

2. D. Galmiche and D. Larchey-Wendling. Formulae-as-resources management for an intuitionistic theorem prover. In 5th Workshop on Logic, Language, Information and Computation, WoLLIC’98, Sao Paulo, Brazil, July 1998.

3. J. Hudelmaier. An O(n log n)-space decision procedure for intuitionistic propositional logic. Journal of Logic and Computation, 3(1):63–75, 1993.

4. M. Ornaghi P. Miglioli, U. Moscato. Avoiding duplications in tableaux systems for intuitionistic and Kuroda logic. Logic Journal of the IGPL, 5(1):145–167, 1997.

5. L. Pinto and R. Dyckhoff. Loop-free construction of counter-models for intuitionistic propositional logic. In Behara and al., editors, Symposia Gaussiana, pages 225–232, 1995.

6. N. Shankar. Proof search in the intuitionistic sequent calculus. In 11th Conference on Automated DEduction, LNAI 607, pages 522–536, Saratoga Springs, June 1992.

7. T. Tammet. A resolution theorem prover for intuitionistic logic. In 13th Conference on Automated Deduction, LNAI 1104, pages 2–16, NJ, USA, 1996.

8. C. Urban. Implementation of proof search in the imperative programming language pizza. In Int. Conference TABLEAUX’98, LNAI 1397, pages 313–319, Oisterwijk, The Netherlands, May 1998.

9. A. Voronkov. Proof-search in intuitionistic logic based on constraint satisfaction. In Int. Workshop TABLEAUX’96, LNAI 1071, pages 312–327, Italy, 1996.

10. K. Weich. Decisions procedures for intuitionistic logic by program extraction. In Int. Conference TABLEAUX’98, LNAI 1397, pages 292–306, Oisterwijk, The Netherlands, May 1998.