Proof Manipulations for Logic Programming Proof Systems Tatjana Lutovac
James Harland
Department of Computer Science Royal Melbourne Institute of Technology GPO Box 2476V, Melbourne, 3001, AUSTRALIA
[email protected],
[email protected]
Abstract. Logic programs consist of formulas of mathematical logic and various proof-theoretic techniques can be used to design and analyse execution models for such programs. In this paper we present some initial work on the problem of making systematic the design of logic programming languages. In particular, we identify and discuss several key properties of proofs. A important aspect of this examination is a a more precise specification of sequent calculi inference rules in order to study permutation properties, which are key aspect of the design of logic programming systems. We also show how this specification can be used to manipulate proofs, as well as to establish properties of sets of inference rules. In addition we describe how Boolean expressions can be used to detect unused formulae in a proof, which is important for debugging purposes.
Keywords: sequent calculi, logic programming, search strategies, substructural logic.
1 Introduction It is well known that logic programming may be thought of as the application of the techniques of mathematical logic to programming tasks. Logic programs may be considered as collections of formulas and their computation may be identified as searching for proofs: given a program P and a goal G we attempt to satisfy G by searching for a proof of P ! G using the inference rules of a given logic. There have been various proof-theoretic approaches to the design of logic programming languages [1, 2, 5, 7, 12, 16, 21] and a corresponding variety of languages implemented (Prolog [24], Lolli[12], LinLog[1], Prolog[20], Forum[18], Lygon[26], among others). However, despite many similarities in such analyses, the issue of a criterion for the identification of logic programming languages remains problematic. The most common proof-theoretic characterisation of logic programming languages is via goaldirected proofs [17]. In particular, logic programming languages are identified by the finding fragments of the logic for which the strategy of searching only for goal-directed proofs is complete. The properties of such proofs have been thoroughly investigated for various fragments of first and higher-order intuitionistic logic (for Horn clauses and for a generalisation of them known as hereditary Harrop formulas [17]), as well as for fragments of classical logic [19, 8] and linear logic [12, 1, 2, 21].
These analyses exhibit many points of similarity, as well as some specific points of difference, which can generally be traced to particular inference rules and their properties. For example, linear logic inherits a number of the properties of the classical inference rules (and in some cases, the very rules themselves); however, the lack of arbitrary contraction rules in linear logic significantly changes the overall analysis from that of classical logic.1 Also, the determination of an appropriate notion of goal-directed proof in the presence of presence of multiple-conclusioned sequents is not obvious, and there are a number of different approaches to this issue[21, 12, 18, 19], which include restricting attention to a single-conclusioned version, requiring “don’t care” nondeterminism in the choice of goal formula (as in Forum[18]) or allowing “don’t know” nondeterminism in such choice (as in Lygon[21, 11]). It should also be noted that single-conclusioned and multiple-conclusioned systems for the same logic (such as LJ and LM for intuitionistic logic) can lead to different logic programming languages [9]. Thus when seeking to extend such an analysis to a new logic, it is important to be able to isolate the critical properties of the set of inference rules, i.e. to determine which properties may be specific to the inference rules in question, and which are common to previously analysed systems. In addition, it should be noted that the completeness of goal-directed proofs, whilst important, is not generally sufficient; often further properties are imposed on proofs. A common such property is requiring proofs to be simple [16], i.e. all occurrences of the left implication rule must have the right-hand premise being an axiom. As discussed and analysed in [27], there are a number of other such properties of proofs which desirable in a logic programming system (such as the existential property, lack of contraction in succedents, etc.), some of which follow from the completeness of goal-directed proofs (e.g. the existential property), and some of which do not (e.g. the completeness of simple proofs). In this paper we present some initial work on the problem of making systematic the design of logic programming languages. In particular, we identify and discuss several key properties of proofs. A important aspect of this examination is a a more precise specification of sequent calculi inference rules in order to study permutation properties (which are generally used, in one form or another, to prove the completeness properties of goal-directed proofs and simple proofs). Whilst such analyses for classical logic [3, 13] and linear logic [4, 5] are well-known, it is not difficult to find inference rules which cannot be analysed by these methods, such as the one below.
` ;
` }
;
; ; ?Æ
Whilst this is a combination of the } and contraction rules for linear logic, similar rules can be found in LM (see, for example, [25]), a multiple-conclusioned system for intuitionistic logic. We also discuss the detection of unnecessary part of a proof; this knowledge is particularly useful when composing programs (and hence proofs) and for debugging purposes. 1
In fact, the lack of general contraction in linear succedents actually simplifies the analysis of goals.
We may thus consider this work as an initial requirements analysis of the properties of proofs of interest to logic programming. It is envisaged that the results of this analysis can then be implemented and utilized by means of an automated proof assistant such as Twelf [22, 23], possibly in conjunction with constraint logic programming techniques [15].
2 Properties of Proofs Computation, in the context of logic programming, is proof search: for a given program and goal, computation determines whether or not the goal is provable. However, this process involves more than just the existence or non-existence of the proof, as usually it is desired to extract some kind of extra information from the proof (if one exists). Such properties of a proof include, among others, identification of the strategy applied (where more than one strategy is applicable), recognition of families of proofs which contain a common structure, finding all possible proofs as well as proofs which lead to different answers, generating answer substitution for the (existentially quantified) variables of the goal, minimisation of unnecessary parts of the proof, distribution of formulae amongst the multiplicative branches, and recognition of “unused” formulae. Hence, it is not simply a matter of finding a proof, but of providing the appropriate “contextual” information about provability. Here we illustrate some ideas about extracting information from proofs through examples in linear logic. Example 1: Minimisation of unnecessary parts of a proof When a goal succeeds, and hence a proof is found, it is often useful to have some information about the reasons for its success (such as the calculation of an answer substitution). It can also be useful to know whether there are any redundant parts of the proof. We restrict our attention to goal formulas i.e. for a given program we concentrate on detection of unused formulas of a given provable goal. For example, consider the provable sequent p ` q; >. Note that there is no meaningful information that can be extracted from the proof, apart from the presence of >. However, for a sequent such as p ` p; > the > is clearly redundant, and hence it is useful to be able to deduce this. For a more detailed example, consider the proof below.
p`p ` >; t
R r`r p ` p >; t }L r}p ` r; t; > p r}p `?r; t; > p ?R R r}p `?r; t; ((> p) q) s ` s !L }R !s ` s r}p `?r}t; ((> p) q)
R !s; r}p `?r}t; ((> p) q ) s }R !s; r}p ` (?r}t) } (((> p) q ) s) As we have ` >; t is a subproof of this proof, t is an unused subformula of the goal. Such a formula can be omitted or replaced with another formula. Also, due to the choice
of formula for the R rule, q is unused as well. Hence we may think of the underlined parts of the goal
r}t) } (((> p) q) s)
(?
as necessary parts of the goal, in that the search process establishes that
r } ((> p) s)
(?
succeeds, and hence deducing the success of G . Furthermore, we can refine this process 0 by omitting > and ?, resulting in the goal G = r}(p s) . 0 In this way the computation process finds a goal G which contains no connective, 0 0 no ? connective and no constant >, such that both P ` G and G ` G are provable. This may be thought of the calculation an interpolant goal G 0 from P and G. Note that the transformation from G to G 0 does not alter the search strategy used, in that the order of application of the rules is not changed.
r`r p`p s ` s !L }L !s ` s r}p ` r; p
R !s; r}p ` r; p s }R !s; r}p ` r } (p s) This goal G 0 can be thought of as a representative of a family of goals whose derivations, for the given program, will require no effort to establish. For the above example, the obligatory part 2 of the goal is r } (p s) while a general template for successful goals based on G could be ( [?℄
r [}}℄ ) }
>
( (( [
℄
p) [4℄)
s
)
where } and 4 are arbitrary formulas, and [ ℄ denotes parts of the original goal that can be omitted. Example 2: Unused formulas in the R rule
`
i
;
R
i = 1; 2)
` 1 2; An important property of the R rule: is that one of the formulas 1 and 2 does not appear in the premise of the rule. So, in a completed proof tree, for every application of the R rule such a subformula is a candidate to be omitted (as irrelevant) from the proof. Thus subformulas p and ?q are eligible for elimination respectively from the proofs D1 and D2 below. The “new” goals are f?r}?q; sg and f?r}p; sg. Their computational truth, from the given program, will require no effort to establish - we need just to omit boxed inferences: 2
i.e., the minimal information which must be present in the goal
(
s`s s ` s
L
!
!
wL ? Æt ` s s; r}p ; ? Æ t ` r; q; s wR R s; r}p ; ? Æ t ` r; p q; s }R s; r}p ; ? Æ t ` r} p q ; s s; !(r}p);
!
!
!(
)
!(
)
!(
)
?
!
!(
)
!(
)
?
!
!(
)
!(
)
?
?
?
(
? )
t`t p ` p; ? t `?t ?R r ` r W !L ? Æ t; p ` p; ?t Æ L !s; r ` r !L ?R !s; r ` ?r !(? Æ t); p ` p; ?t }L !s; !(? Æ t); r}p ` ?r; p; ?t !L !s; !(? Æ t); !(r}p) ` ?r; p; ?t R !s; !(r}p); !(? Æ t) ` ?r; p?q; ?t }R !s; !(r}p); !(? Æ t) ` ?r}(p?q ); ?t
Example 3: Possible answer substitutions In some situations (different) witnesses can be recognised by the analysis of the structure of a sequent to be proved. In the following proofs the answer substitution is directly connected with the formula choice for the rule and vice versa.
q (b) } (> Æ s) ` > > R s`s ÆL p(a) ` p(a) q (b) } (> Æ s); (> Æ s) ` s }L q (b) } (> Æ s); p(a)}(> Æ s) ` p(a); s 9R q (b) } (> Æ s); p(a) } (> Æ s) ` 9x p(x); s R q (b) } (> Æ s); p(a) } (> Æ s) ` 9x p(x) 9y q (y ); s s`s p(a) } (> Æ s) ` > > R ÆL q (b) ` q (b) p(a) } (> Æ s); (> Æ s) ` s }L q (b) } (> Æ s); p(a)}(> Æ s) ` q (b); s 9R q (b) } (> Æ s); p(a) } (> Æ s) ` 9y q (y ); s R q (b) } (> Æ s); p(a) } (> Æ s) ` 9x p(x) 9y q (y ); s
For the sequent !p(a); q (b); (8z )(q (z ) Æ p(z )) ` 9x p(x) a simple inspection of its structure indicates a and b as potential answers for x. An analysis of the proof (recalling that in the step () the formula p(b) must be used in this subproof) eliminates a as answer for x, and so there are no proofs which provide answer substitution x a.
p(b) ` p(b) p a ; p(b) ` p(b) w!l 9R q (b) ` q (b) !p(a); p(b) ` 9x p(x) ÆL !p(a); q (b); q (b) Æ p(b) ` 9x p(x) 8 L !p(a); q (b); 8z q (z ) Æ p(z ) ` 9x p(x) ! ( )
3 Proof Manipulations for Extracting Information There have been various proof manipulations which enable extraction of information from a proof, and which are, therefore, a necessary tool in the analysis of logic programming systems. In this section we discuss two proof manipulations of particular interest: permutations, and procedures for detection and elimination of unused formulas.
3.1 Permutations
The permutation of two adjacent inference rules of a given proof is reversing their order in the proof but without disturbing the rest of the proof (modulo some duplication of some proof branches and a renaming of certain free variables) as a result of which we get a proof equivalent to the given one: .. ..
.. ..
.. ..
.
.. ` a; ; d; ` b;
` ; d; a; } . ` ; d; a b; ; } ` }d; a; ` b;
` }d; a . b; ; () ` }d; a . b; ; .. .
.. .
In going from the left poof above to the right one, we say that the rule } is permuted down past the rule (or conversely that the rule is permuted up past the } rule). Permutations are essential proof manipulations. The dynamics of the proof that results from the permutation analysis clearly has a strong influence on the operational semantics of the resulting logic programming language. For example, Lygon[26] is based on the search strategy that some permutations of right-hand side rules will lead to a proof, whereas Forum[18] is based on the search strategy that any permutation of righthand rules will lead to a proof. Here we give a brief overview of some applications of permutations in a logic programming context. The permutation properties of the inference rules of a given logical fragment have a direct impact on the definition of proof search strategies which deal with the order of inference rules. Such properties can be used to either prove that, for a given set of inference rules, a given search strategy will find all possible proofs, or construct an example of a provable sequent which can not be proved with that strategy. Strategies which pass this test may be amenable to further analysis, such as minimising the amount of branching in the proof, or delaying certain choices until the optimum amount of information is available. For example, consider the problem of multiple answers. A logic program for which there are many proofs of the same goal (and hence there are goals which return the same answer substitution many times) is generally considered to be somewhat deficient. Different proofs are generally only considered interesting if they lead to different answers.
For example, consider the sequent p(a); 8yq (y ) ` p(y ); q (b) ` 9xp(x) in intuitionistic logic. All uniform proofs3 can be classified into two groups, depending on the answer substitution for x. A representative of each class is below (the others are variations, depending on the order of application of the rules !L, wL and 8L). 3
A uniform proof [17] of a sequent P ` G means a goal-directed proof, in a sense that the goal G is decomposed uniformly, based only on its structure and without reference to the program
P , until atomic goals are reached. The program is only consulted when atomic goals are to be proved.
p(b) ` p(b) Ax Ax q (b) ` q (b) p(a); p(b) ` p(b) wL !L p(a); q (b) ! p(b); q (b) ` p(b) 8 L p(a); 8yq (y ) ! p(y ); q (b) ` p(b) p(a); 8yq (y ) ! p(y ); q (b) ` 9xp(x) 9R
p(a) ` p(a) Ax p(a); q (b) ` p(a) wL wL p(a); 8yq (y ) ! p(y ); q (b) ` p(a) p(a); 8yq (y ) ! p(y ); q (b) ` 9xp(x) 9R
Clearly, the question of finding all proofs which lead to different answers have some overlap with the question of finding all equivalent proofs modulo inference permutations. Since proofs from the same equivalence class lead to the same answer, it is sufficient to generate just one of them, which than will be representative for the whole class. Note also that some non-uniform permutations may also be useful. In the first exb are not obvious at the time the rule is ample above, the reasons for choosing x applied: .. ..
p(a); 8yq (y ) ! p(y ); q (b) ` p(b) p(a); 8yq (y ) ! p(y ); q (b) ` 9xp(x) 9R This substitution arises from the formulas 8yq (y ) ! p(y ); q (b). If asked by a user to explain why that substitution was generated, an implementation could choose to produce the permutation below, which is not uniform, but demonstrates the origin of the substitution more directly, as indicated by the step ().
p(b) ` p(b) Ax p(a); p(b) ` p(b) wL Ax 9R q (b) ` q (b) p(a); p(b) ` 9xp(x) ` L p(a); q (b) ` p(b); q (b) ` 9xp(x) 8 L p(a); 8yq (y ) ` p(y ); q (b) ` 9xp(x)
( )
The problem of permutation analysis is not new ([3, 13, 5]. However, there are some inference rules of interest which cannot be analysed by the existing framework. One 0 such situation is illustrated by the example below, where } presents a mix of } and w 0 rules from linear logic, and where the possible permutation of ? and } in the outlined subproof can not be detected using the existing definitions ([13] or Definitions 2.1-2.4 of [5]): .
` ;
` }
0
; ; ; ?Æ
schema-rule
0
}
.. ..
` A; A; B; ` A; B; 0 } ` A}0 B; ; A ?
?
A; B; 0 } `?A; ?A}0 B; ; ?A ? `?A}0 B; ; ?A ?
?
?
?
` A;
?
)
=
.. .
?
It is our contention that a more precise specification of the structure of sequent calculus rules is needed, as it is proposed by the following definition (we assume, for simplicity, one-sided inference systems, i.e. that the antecedents are always empty):
Definition 1 The structure of sequent calculus inference rules: An active formula of rule I is a formula in a premise, that does not exist in the conclusion. The active part of the i-th premise of an inference I (denoted by AiI ) is the (possibly empty) multiset of its active formulas. A quasi-active formula of an inference I is a formula occurrence whose presence in a premise is necessary (but not sufficient4 ) for the rule application, and which is copied unchanged into the conclusion of the rule. The quasi-active part of the i-th premise of an inference I (denoted by QAiI ) is the (possibly empty) multiset of its quasi-active formulas. A principal formula of rule I is a formula occurrence of a conclusion that does not exist in premise(s) and that is a result of the disappearance of some active formulas of I . The principal part of an inference I (denoted by PI ) is the (possibly empty) multiset of its principal formulas. A formula occurrence of rule I that does not exist in a premise and that is not a principal formula, is called an extra formula. The extra part of an inference I (denoted by EI ) is the (possibly empty) multiset of its extra formulas. The context of the i-th premise of an inference I (denoted by CIi ) is the (possibly empty) multiset - complement of its active and quasi-active part. The above definition is illustrated through examples in the Table below:
`
`
`
;
A1 A2 QA1 QA2
P
E
mix
` A; ` B;
` A B; ; A ` A; ` B; & ` A&B; A ` A; ` A? ; ut ` ; A ` ` ; ?F w? `?F; ?F; ? `?F; ?F
C1 C2
B
A B
B
A&B
A?
?F ?F
According to the context of premises and conclusion, binary rules can be distinguished as: multiplicative rules where the context of each premise is copied unchanged into the conclusion (rules ; mix; ut in above table); strong additive rules where the context of each premise and of the conclusion are identical (rule &). Note that there are also weak additive rules where some part of the context of the premise and of the conclusion are identical. Given this definition, the problem is then to determine when two inferences can be permuted, and, if so, whether the resulting (sub)proof has the same premises and conclusion as the original. Note that it is possible for two inferences to be permuted, but for the latter condition not to hold. 4
except for the exchange rule
We thus arrive at the following definition: Definition 2 (permutation position) Two inferences I and J of a given proof in which J directly follows I in are: 1. in the weak permutation position iff AJ ; QAJ ContextI ; QAI 2. in the strong permutation position iff 9k 2 f1; 2g AJ ; QAJ ContextkI ; QAkI and (AJ 6 ContextkI ) ) (AJ nContextkI EJ ) The value k = 1 corresponds to strong-left while k = 2 to strong-right permutation position. Note that for a unary rule I the strong permutation position implies the strongleft position (k = 1) only. For example, in the first of the following proofs, the and } rules are in the weak permutation position only, because A} ; QA} = fa? ; b? g Context ; QA = fa? ; b? ; g and the active formulas of the } rule (formulas a? and b? ) belong to different premises of the rule. In the second proof, the active formulas of the } rule belong to same premise of the rule, and hence the rules are, at the same time, in the weak and strong permutation position.
` a; a?
` b; b? w ` ; b; b?
? ?
` a; a?
?
?
` a b; a ; ; b } ` b?}a?; a b; weak perm pos. for and }
` b; b? w ` ; b; b?
? ?
?
?
` a b; a ; ; b ` b?} ; a b; a?
?
?
?
}
?
strong and weak permutation pos. for
and }
We can then show how these notions can be used to determine when inferences can be permuted. In particular, two inferences must be in the strong permutation position in order to be permuted. The strong permutation position takes into account more carefully the distribution of formulas from AJ ; QAJ between the multiset ContextI ; QAI . The demand AJ ; QAJ ContextkI ; QAkI interrupts further analysis in the situation where active and/or quasiactive formulas of J belong to different premises of I. Such a situation can not be “recognised” in the weak permutation position: i)
ii)
` a; a? ` b; b?
` a b; a?; b? } ` a?}b?; a b weak (6) strong)
rules not permutable
iii)
` b; b? ` a; a? ` ; b; b? w ` a b; a?; ; b? } ` b?} ; a b; a? strong () weak)
?
?
?
?
rules permutable
.. ..
` A; B; C ` A; B; C D } ` A}B; C D strong (, weak) rules permutable
The condition (AJ 6 ContextkI ) ) (AJ nContextkI EJ ) ensures that the situations in which quasi-active formula(s) of upper inference I , which has(have) been “consumed” by lower J (i.e. used as the active formulae(s) for J ) are acceptable (for
the further permutation analysis) iff such formula(s) can be restored again through the extra part EJ (in that way it(they) remains available for I , after the eventual reversing 0 of the order of I and J ). As an example, consider rule } which presents a mix of } and w rules from linear logic:
` ;
` }
0
; ; ; ?Æ
schema-rule
0
}
.. ..
` A; A; B; ` A; B; 0 } ` A}0 B; ; A ?
?
?
?
?
?
.. ..
` A; A; B; ` A; A}0 B; ; A ) ` A}0 B; ; A ?
?
=
?
?
?
?
?
0
}
?
The notion of strong permutation position is suitable for the analysis of possible permutations in a given proof i.e. when we have the concrete instances of a given inference rule. Such permutations and inference movements in a given proof are essential for rearranging proofs to satisfy or obey particular strategies. It also helps us to detect other proofs of a given sequent which differ only in the order of inference rules. The notion of weak permutation position is suitable for recognition of non-permutable rules in a given proof tree, as well as for recognition of pairs of schema-rules which represent rules that can never be permutable. Also, because of its simplicity, can be used during the applications of particular strategies for bottom-up construction of proofs (for the choice of formula to be decomposed next). In [5] Galmiche and Perrier also use the notion of permutation position (Definition 3.1. and Definition 3.2 of [5] ) as a precondition for the further checking of permutabilities of given rules. According to our specification of inference rules, GalmichePerrier’s condition (“the principal part of upper rule I is disjoint of the active part of the premise of lower rule J ” (condition ), Definition 3.1 of [5]) corresponds to the condition AJ ; QAJ ContextI . It is shown in [14] that in the absence of quasiactive formulae, the Galmiche-Perrier condition corresponds to the weak permutation position, and this condition is similarly more suitable for analysis on the level of given schema-rules than for the possible permutations of a given proof. Given these notions, it is then not hard to show that two inferences which are in the strong permutation position are always permutable, as well as to determine conditions under which the two (sub)proofs have the same premises and conclusion. However, these results are rather lengthy to state, and hence are beyond the scope of this paper. Full details, including formal statements and proofs of these and other results may be found in [14]. 3.2 Detection and Elimination of Unused Formulas In order to facilitate theoretical analysis as well as systematic mechanical implementations, we propose a formal account for detection of unused formulas originated from formula choices for the R rule. Our technique for doing this is to extend some sequent calculus rules with Boolean constraints and to attach certain Boolean expressions to some formulas in the proof tree, in the manner of [10].
Definition 3 A Boolean expression e is determined by the following grammar: e = j 1 j x j x ^ y , where x; y range over Boolean variables. A B-pair is a pair of Boolean expressions, denoted as [e1 ; e2 ℄. We denote by ( )[e1 e2 ℄ the labelling of a formula with a B-pair [e1 ; e2 ℄. We denote by L(F ) the set of all B-pairs attached to formula F. 0
The rules of the sequent calculus are extended to include the relationships between B-pairs i.e. their Boolean variables. The rules R; w?R; ?R; and &R additionally contain side constraints on B-pairs. A right arrow ! , besides the inference name, points to the side constraint(s).
premise(s)
on lusion
rule-name
premise(s)
on lusion
! side constraint(s)
rule-name
"
Below we present the right inference rules which have side constraint(s). For notational simplicity a lack of labels of a formula, simultaneously in the conclusion and the premises, in any of the proposed rules, implies that the labels currently applicable to the formula are not changed. For example, the R rule does not alter the B-pairs attached (if any) to the formulas in ; and . In the rules ?R and &R, the labels from the conclusion are duplicated with the new names (this is similar to what happens in practice with bound variables).
` ; R ! x; y ; ;8 x ;y 2 L x ;y ; ` [ ℄; ` ; R ! x; y ; ;8 x ;y 2 L x ;y ; ` [ ℄; ` ; ` ; w R ! 8 x ; y 2 L x ; y ` 1 ; 2 ; R ! 8 x ; y 2 L x ; y x ^ x ; y ^ y 1 2 1 2 ` ; where 1 and 2 rename each x ; y 2 L to x 1 ; y 1 and x 2 ; y 2 respectively ` ; ; R " ` ; where L ; ` ; 1 ; ` ; 2 ; R ! 8 x ; y 2 L x ; y x ^ x ; y ^ y 1 2 1 2 ` ; ; where L ; and 1 and 2 rename each x ; y 2 L to x 1 ; y 1 and x 2 ; y 2 respectively (
)
(
)
x;y
x;y
?
?
?
[
?
i
[
i
i℄
(
) [
i
i ℄ = [1 1℄
[
℄ = [1 0℄
[
i
i℄
(
) [
i
i ℄ = [1 1℄
i℄
(
[
[
?
i
&
i℄
) =
i ℄ = [1 1℄
i
(
(
(
&
) [
i℄
i
?
?
(
℄ = [0 1℄
?
?
?
[
) [
)
[
i℄ = [
i
i
i ℄
[
i℄
(
i
i
i ℄
i
i ℄
i
) =
[
[
i
i
i℄
(
) [ )
i℄ = [
i
[
i
i ℄
i
i
[
i
i
i ℄
i ℄
Possible values that a B-pair [xi ; yi ℄ allocated to a formula F1 F2 can obtain are: [1; 0℄, [0; 1℄, [0; 0℄, [1; 1℄. Value [1; 0℄ (respectively [0; 1℄) indicates that formula F1 (respectively F2 ) is unused upwards from the proof step where the assignment took place. Value [0; 0℄ denotes that there is no unused subformulas of F1 F2 while value [1; 1℄ implies that the whole formula F1 F2 is unused upwards from the proof step where the assignment took place.
The rules R and w?R assign, through side constraints, the value(s) to the B-pairs. The formula choice for the R rule is reflected in the state of the B-pair of the principal formula as well as the B-pairs allocated to the subformula deleted by the rule. The rule w?R assigns the value [1; 1℄ to the B-pair of every subformula of the form which is being deleted. The side constraints for the rules &R and ?R are logical links between the B-pairs of context formulas in the premises and conclusion. It is possible for unused premises formulas of an &R inference to be different. For example, consider derivations D1 and D2 mentioned in the Example 2 of section 2. They disagree on unused formulas, so the proof below has no unused formulas:
s; !(r}p);
!
D1 D2 ? Æ t ` r} p q ; s
!(
)
?
(
? )
R
t
&
&?
Hence, in calculating the conclusion’s unused formulas, the side constraint for &R must “insist” on the conjunction of the premise’s unused formulas. Similarly, for a
?R inference we need to co-ordinate unused formulas of the two copies of the copied formula. Informally, the algorithm for detection of unused formulas includes the labelling of a sequent to be proved, and than simultaneous (bottom-up) construction of a proof tree and maintaining of B-pairs and side constraints. The success of a proof construction involves passing (in top-down direction) through side constraints and calculating the final values of B-pairs. 5 For example, the application of the above algorithm on the sequent
s; d}(r p)
` d ps ; ?
(
)
p r)
q s
((
)
results in the computation illustrated above. To save space, we denote d}(r p) as F1 , d (p s) as F2 , and (p r) q as F3 . The B-pairs that appear at the root of the proof tree receive the following values: [x; y ℄ = [1; 0℄; [x1 ; y1 ℄ = [1; 0℄; [x1 ; y1 ℄ = [1; 0℄. Hence, for the given goal the underlined (sub)formulas are irrelevant. ?
s; d}(r p)
` d
q s r`r p`p
R " r; p ` p r +
L " d`d r p ` p r + }L " F1 ` d; p r R ! [x1 ; y1 ℄ = [1; 0℄ + F1 ` d; F3[ 1 1 ℄ s`s + R " + s ` p s [ 2 2 ℄ R F1 ` d; F3[ 1 1 ℄ + +
R " + s; F1 ` F2[ 2 2 ℄ ; F3[ 1 1 ℄ + R ! [x; y℄ = [1; 0℄ + [ 2 2℄ [ 1 1℄ [ ℄ + s; F ` F ; F s 1 2 3 [x2; y2 ℄ = [0; 1℄ ?
(
p
s ; )
p r)
((
)
(
)
x ;y
(
)
x ;y
x ;y
?
x ;y
x ;y
(
?
x ;y
x ;y
)
x;y
The new proof tree can be easily constructed by omitting the R inferences: 5
Note that, in the example below, values of B-pairs are boxed.
[x; y℄ = [1; 0℄ [x1 ; y1 ℄ = [1; 0℄
+ arrows correspond to this part of the algorithm. The final
r`r p`p r; p ` p r R d`d r p ` p r L }L d } r p ` d; p r ?R s`s d } (r p) ` ?d; p r
R s; d}(r p) ` ?d s; p r
4 Conclusions and Future Work We have proposed a more detailed specification of inference rules, in order to enable a more precise analysis of their permutation properties. We have also shown how Boolean expressions can be used to extract information about the necessary and unnecessary formulas in a proof. Note that it is straightforward to implement this latter technique using constraint logic programming techniques [15]. Given that computation in the logic programming context is proof search, an interesting question that arises is to determine what can be inferred from a failed proof attempt. The traditional answer for logic programmers is abduction; rather than merely reporting an answer of “no” to a query, a specification (usually in the form of a set of formulae) of the necessary changes to the program is given, which, if carried out, would enable the original goal to succeed. In proof-theoretic terms, we can consider such a transformation to be one which takes a partial proof D(i.e. , a derivation in which some leaves are not axioms) to a completed proof which retains (at least relatively) the order of inference rules of D and whose conclusion contains the conclusion of D. This is achieved by the replacement of each non-axiom leaf ` S with a proof of ` S; (where
is possibly empty multiset of formulas dependent on S and on the structure of inference rules of a given proof system) and then by, eventually, adaptation of subproof below ` S . For example, consider the partial proof below and its resulting adaption, which has inserted some intermediate steps (inserted inferences are boxed).
` a; a? Ax ` a; b? ` a; a? b? ` a b; a? b? } ` a b } a ? b?
?
?(
&
(
)
(
&
)
)
?(
)
&
&
&
` a; a? Ax ` b; b? Ax
` a; a? Ax w ` a; b?; a? b ` a; a?; a? b ` a; b?; a? b ` a; a? b?; a? b ` a b; a? b?; a? b } ` a b } a ? b? ; a? b
7!
&
?(
&
(
)
(
&
)
?(
) ?(
)
)
If we allow interpretation of a non-axiom leaf ` S as a hypothesis of, say, a proof D then the above transformation is known as hypothesis elimination [2]. In general, elimination of a hypothesis ` H from a proof is the problem of searching for a proof (without any hypotheses) of hypothesis ` H, which will replace it in . For decidable proof systems it is clear that we can always find at least one such proof, if it exists, by determining whether or not ` H is provable. The situation is more complicated when a hypothesis
` H (or H2 ` H1 ) is an unprovable sequent, or the proof system is not decidable. In such situations the problem is to find the simplest proof (without hypotheses) whose conclusion incorporates H (H1 ; H2 ) . Clearly this process depends on the hypothesis itself, as well as on the structure of inference rules of a given proof system. Andreoli and Pareschi have given such a procedure for one fragment of propositional classical logic [2]. Developing general methods for hypothesis elimination is research still in progress. The key point is to determine the minimal extension sufficient to provide provability of a given unprovable sequent. The example below points out some possible extensions and additions of the unprovable sequent ` p; q in different logics: classical logic:
p ` p Ax w p ` p; q
two-sided linear logic:
Ax p ` p Ax q ` q } p}q ` p; q
` p; q; > >
0
` p; q
The development of such a method would form an integral part of a suite of tools which could be used to analyse both successful and unsuccessful proof attempts, and thus form the basis of a proof-theoretic programming environment for logic programming systems.
References 1. Andreoli J.-M. Logic Programming with focusing proofs in linear logic, Journal of Logic and Computation, 2:3:297-347, 1992. 2. J.M. Andreoli, R. Pareschi Logic programming with sequent systems: A linear Logic Approach., in P.Schroder-Heister ed., Proceedings of Workshop to Extensions of Logic Programming 1-30, Tubingen, 1989. Published as by Springer-Verlag as Lecture Notes in Artificial Intelligence 475. 3. Curry H., The permutability of rules in the classical inferential calculus, Journal of Symbolic Logic 17:245-248, 1952. 4. Galmiche D. Canonical Proofs for Linear Logic Programming Frameworks, in A. Momigliano and M. Ornaghi, ed., Proof-Theoretical Extensions of Logic Programming 210, Post-Conference Workshop for ICLP’94, Santa Margherita Ligure, Italy, June 1994. 5. Galmiche D. and Perrier G. On proof normalisation in Linear Logic, Theoretical Computer Science 135:67-110, 1994. 6. Girard J.-Y. Proof-nets: the Parallel syntax for Proof-theory, Logic and Algebra, Marcel Dekker, New York, 1995. 7. Harland J. A Proof-theoretic Analysis of Goal-directed Provability, Journal of Logic and Computation 4:1:69-88, 1994. 8. Harland J. On Goal-Directed Provability in Classical Logic, Computer Languages 23:24:161-178, 1997. 9. Harland J., Lutovac T., Winikoff M. Goal-Directed Proof Search in Multiple-Conclusioned Intuitionistic Logic, Proceedings of the First International Conference on Computational Logic 254-268, London, July, 2000. 10. Harland J., Pym D., Resource-distribution via Boolean constraints (extended abstract), Proceedings of the International Conference on Automated Deduction (CADE-14) 222-236, W.
0
11.
12. 13. 14.
McCune (ed.), Townsville, July, 1997. Published by Springer-Verlag as Lecture Notes in Computer Science 1249. Harland J., Pym D., Winikoff M. Programming in Lygon: An Overview, Proceedings of the International Conference on Algebraic Methodology and Software Technology (AMAST) 391-405, M. Wirsing and M. Nivat (eds.), July, 1996. Published by Springer-Verlag as Lecture Notes in Computer Science 1101. Hodas J.S. and Miller D. Logic programming in a Fragment of Intuitionistic Linear Logic, Journal of Information and Computation 110:2:327-365, 1994. Kleene S.C. Permutability of Inferences in Gentzen’s Calculi LK and LJ, Memoirs of the American Mathematical Society 10:1-26, 1952. Lutovac T., Harland J. Towards the Automation of the Design of Logic Programming Languages, Technical Report TR-97-30, Department of Computer Science, RMIT University, 1997. http://www.cs.rmit.edu.au/ jah/publications/permstr.ps.gz. Marriot, K., Stuckey, P. Programming with Constraints, MIT Press, 1998. Miller D. A logical analysis of modules in logic programming, Journal of Logic Programming 6:79-108, 1989. ˇ cedrov A. Uniform proofs as a Foundation for Logic Miller D., Nadathur G., Pfenning F., Sˇ Programming, Annals of Pure and Applied Logic 51:125-157, 1991. Miller D. Forum: A multiple-conclusion specification-logic, Theoretical Computer Science 165:1:201-232, 1996. Nadathur G. Uniform Provability in Classical Logic, Journal of Logic and Computation 8:2:209-230, 1998. Nadathur G. and Miller D. An overview of Prolog, In Kenneth A. Bowen and Robert A. Kowalski, editors, Fifth International Logic Programming Conference 810-827, Seattle, Washington, August 1988. Published by MIT Press. Pym D., Harland J. A Uniform Proof-theoretic Investigation of Linear Logic Programming, Journal of Logic and Computation, 4:2:175-207, 1994. Frank Pfenning and Carsten Sch¨urmann, Twelf — a meta-logical framework for deductive systems, H. Ganzinger, editor, Proceedings of the 16th International Conference on Automated Deduction (CADE-16), pages 202–206, Trento, Italy, July 1999. Published by Springer-Verlag as Lecture Notes in Artificial Intelligence 1632. Carsten Sch¨urmann, Automating the Meta-Theory of Deductive Systems, PhD thesis, Carnegie-Mellon University, 2000. Sterling L., Shapiro E. The Art of Prolog, MIT Press, 1986. Wallen L.A. Automated Proof Search in Non-classical Logic, MIT Press, 1990. Winikoff M., Harland J. Implementing the Linear Logic Programming Language Lygon, Proceedings of the International Logic Programming Symposium 66-80, Portland, Oregon, December, 1995. Winikoff M., Logic Programming with Linear Logic, PhD Thesis, Department of Computer Science, The University of Melbourne, March, 1997.
15. 16. 17. 18. 19. 20.
21. 22.
23. 24. 25. 26.
27.