* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download A Uniform Proof Procedure for Classical and Non
Quantum logic wikipedia , lookup
History of logic wikipedia , lookup
Law of thought wikipedia , lookup
Propositional formula wikipedia , lookup
Intuitionistic type theory wikipedia , lookup
Combinatory logic wikipedia , lookup
First-order logic wikipedia , lookup
Mathematical logic wikipedia , lookup
Quasi-set theory wikipedia , lookup
Structure (mathematical logic) wikipedia , lookup
Interpretation (logic) wikipedia , lookup
Natural deduction wikipedia , lookup
Propositional calculus wikipedia , lookup
Modal logic wikipedia , lookup
Accessibility relation wikipedia , lookup
Curry–Howard correspondence wikipedia , lookup
A Uniform Proof Procedure for Classical and Non-Classical Logics Jens Otten? Christoph Kreitz Fachgebiet Intellektik, Fachbereich Informatik Technische Hochschule Darmstadt Alexanderstr. 10, 64283 Darmstadt, Germany {jeotten,kreitz}@intellektik.informatik.th-darmstadt.de Abstract. We present a proof procedure for classical and non-classical logics. The proof search is based on the matrix-characterization of validity where an emphasis on paths and connections avoids redundancies occurring in sequent or tableaux calculi. Our uniform path-checking algorithm operates on arbitrary (non-normal form) formulae and generalizes Bibel’s connection method for classical logic and formulae in clause-form. It can be applied to intuitionistic and modal logics by modifying the component for testing complementarity of connected atoms. Besides a short and elegant path-checking procedure we present a specialized string-unification algorithm which is necessary for dealing with non-classical logics. 1 Introduction Non-classical logics are used extensively in various branches of AI and Computer Science as logics of knowledge and belief, logics of programs, and for the specification of distributed and concurrent systems. In many of these applications there is a need for automated proof search. For classical predicate logic theorem provers based on resolution [14, 17], the connection method [4, 5, 8, 3], or the tableaux calculus [2, 1] have demonstrated that formal reasoning can be automated well. Recently Wallen [15, 16] and Ohlbach [10] have extended the classical characterizations of logical validity on which the above proof methods are based into characterizations of logical validity for intuitionistic and various modal logics. These characterizations avoid the notational redundancies contained in natural deduction or sequent calculi for these logics and thus provide a theoretical foundation for developing proof procedures for a rich variety of non-classical logics. In this paper we present a proof procedure which allows a uniform treatment of classical, intuitionistic, and modal logics. It is based on a unified representation of Wallen’s matrix characterizations and generalizes Bibel’s connection method [4, 5] for classical predicate logic accordingly. In order to keep the general methodology of the latter – following connections when investigating paths through a given formula – unchanged we had to take into account a considerable extension of the notion of complementarity which strongly depends on the logic under consideration. Whereas in the classical case two atomic formulae are complementary if they have different polarity but can be unified by some term-substitution, for non-classical logics also the prefixes of the two atomic formulae (i.e. descriptions of their position in the formula tree) have to be unifiable. Thus in addition to the usual term-unification our method requires a special string-unification for making two prefixes identical. The absence of normal-forms for most non-classical logics also makes it necessary to deal with a nested matrix instead of a clause-form. For ? Supported by the Adolf Messer Stiftung In G. Görz, S. Hölldobler, ed., KI-96: Advances in Artificial Intelligence, LNAI 1137, pp. 307–319, Springer Verlag, 1996. this purpose we had to extend the notions of actual clauses and active paths which guide the search for a classical matrix-proof in normal-form. The resulting proof procedure is based on ideas originally developed for a generalized connection based proof method for intuitionistic logic [11]. It consists of a connection driven algorithm which checks the complementarity of all paths through a given formula and uses a component for testing complementarity. The latter depends on the underlying logic and is based on the string-unification procedure developed in [12]. This modular design allows us to treat a rich variety of logics in a uniform and simple way. Our paper is organized as follows. In section 2 we resume fundamental concepts and provide uniform matrix characterizations of logical validity for classical, intuitionistic and various modal logics. In section 3 we introduce the concepts which are used for guiding the proof search and present our uniform procedure. In section 4 we discuss explicit methods for testing complementarity in various logics, particularly the specialized string-unification algorithm. We conclude with a few remarks on possible extensions. 2 Matrix Characterizations of Logical Validity After describing some basic notations we shall present a matrix-characterization of validity for classical logic pioneered by Bibel [5] and explain the modifications which are necessary for extending this characterization to intuitionistic and various modal logics. We refer to [16] for detailed explanations. 2.1 Preliminaries We assume the reader to be familiar with the language of classical and modal firstorder logic. To get a uniform notation we firstly define formula trees, polarities, types, and multiplicities. Definition 1 (Formula Tree, Positions, Labels). A formula tree is the representation of a formula as a tree. Each node is marked with a unique name, its position (denoted by a0 , a1 , . . .). By Pos we denote the set of all positions in the formula tree. The mapping lab(u) assigns to each position u ² Pos in the tree its label . A position labeled with an atom is called an atomic position. The tree ordering < ⊆Pos × Pos is the (partial) ordering on the positions in the formula tree, i.e. ai <aj if (and only if) the position ai is shown below aj in the formula tree. Example 1. Figure 1 shows the formula tree for F1 ≡ ∀xP x⇒P a∧P b. It is, e.g., lab(a0 ) = ‘⇒’, lab(a4 ) = ‘P a’, a1 <a2 and a0 <a4 . P x a2 6 P a a4 k ∀x a1 3 ∧ a3 y : ⇒ a0 P b a5 P 1 x a2 (φ) P 0 a a4 (ψ) k 6 γ 1 ∀ x a1 (φ) y α : β ∧ 0 3 P 0 b a5 (ψ) a3 ⇒0 a0 (ψ) Fig. 1. Formula tree for F1 (in the right tree nodes are marked with polarity/types) Remark. Note that each subformula of a given formula corresponds to exactly one position in its formula tree, e.g. ∀xP x corresponds to the position a1 . Definition 2 (Polarity, Types). 1. The polarity of a position is determined by the label and polarity of its (direct) predecessor in the formula tree. The root-position has polarity 0. 2. The principal type of a position is determined by its label and polarity. Atomic positions have no principal type. 3. The intuitionistic type of a position is determined by its label and polarity. Only certain positions (atoms, ⇒, ¬, ∀) have an intuitionistic type. Polarities and types of positions are defined in table 1. For example, a position labeled with ⇒ and polarity 1 has principal type β and intuitionistic type φ. Its successor positions have polarity 0 and 1, respectively. principal type α sucessor polarity principal type β sucessor polarity (A ∧ B)1 A1 , B 1 (A ∧ B)0 A0 , B 0 (A ∨ B)0 A0 , B 0 (A ∨ B)1 A1 , B 1 (A⇒B)0 A1 , B 0 (A⇒B)1 A0 , B 1 (¬A)1 A0 (¬A)0 A1 principal type γ (∀xA)1 (∃xA)0 principal type δ (∀xA)0 (∃xA)1 sucessor polarity A1 A0 sucessor polarity A0 A1 1 0 0 principal type ν (2A) (3A) principal type π (2A) (3A)1 1 0 sucessor polarity A A sucessor polarity A0 A1 intuitionistic type φ intuitionistic type ψ (¬A)1 (¬A)0 (A⇒B)1 (A⇒B)0 (∀xA)1 (∀xA)0 P 1 (P is atomic) P 0 (P is atomic) Table 1. Polarity, principal type and intuitionistic type of positions Example 2. The formula tree for F1 where each position is marked with its polarity and principal type is given in figure 1. The positions a1 and a2 have intuitionistic type φ, positions a0 , a4 and a5 have intuitionistic type ψ. Remark. For a given formula we denote the sets of positions of type α, β, γ, δ, ν, π, φ, and ψ by α, β , Γ , ∆, ν , Π, Φ, and Ψ . A multiplicity encodes the number of distinct instances of subformulae to be considered during the proof search. Definition 3 (Multiplicities). 1. The first-order multiplicity µQ : Γ → IN , 2. the intuitionistic multiplicity µJ : Φ → IN , and 3. the modal multiplicity µM : ν → IN assigns each position of type γ, φ and ν, respectively, a natural number. Remark. By F µ we denote an indexed formula, i.e. a formula and its multiplicity. We consider multiple instances of subformulae according to the multiplicity of its corresponding position in the formula tree and extend the notion of tree ordering accordingly. The new nodes in the formula tree get new positions but inherit the polarity and types from their source positions. Example 3. The formula tree for F1 with µQ (a1 )=2 is shown in figure 2.2 Remark. For technical reasons we replace free variables in atomic formulae by their quantifier positions. Thus γ- and δ-positions appear in atomic formulae. 2 Adopting Bibel’s notion of multiplicity (instead of Wallen’s) we copy the positions of type γ, φ or ν instead of their successors. P 1 a1 a2 (φ) γ P 1 a6 a7 (φ) γ ∀1 x a1 (φ) i α ∀1 x a6 (φ) 6 y P 0 a a4 (ψ) 6 1 α k : β ∧ 0 a3 P 0 b a5 (ψ) 3 " P 0a P 1 a1 P 1 a6 # P 0b ⇒0 a0 (ψ) Fig. 2. Formula tree and matrix for F1µ and µQ (a1 )=2 2.2 Classical Logic To resume the characterization for classical logic [4, 5] we introduce the concepts of paths and connections. For the first-order (classical) logic it is further necessary to define the notion of a first-order substitution and the reduction ordering. Definition 4 (Matrix,Path,Connection). 1. In the matrix(-representation) of a formula F we place the components of subformulae of principal type α side by side whereas components of subformulae of principal type β are placed one upon the other. Furthermore we omit all connectives and quantifiers. 2. A path through a formula F is a subset of the atomic positions of its formula tree; it is a horizontal path through the matrix representation of F . 3. A connection is a pair of atomic positions labeled with the same predicate symbol but with different polarities. Example 4. The matrix for F1 ≡∀xP x⇒P a∧P b is given in figure 2. There are two paths through F1 , namely {a2 , a7 , a4 } and {a2 , a7 , a5 } ({P a1 , P a6 , P a} and {P a1 , P a6 , P b} in the notation of labels). The paths contain the connections {a2 , a4 }, {a7 , a4 } and {a2 , a5 }, {a7 , a5 }, respectively. Definition 5 (First-order Substitution, Reduction Ordering). 1. A first-oder substitution σQ : Γ → T assigns to each position of type γ a term t ² T (the set of all terms) where again variables in t are replaced by positions of type γ and δ.3 A connection {u, v} is said to be σQ -complementary iff σQ (lab(u))=σQ (lab(v)). σQ induces a relation <Q ⊆ ∆ × Γ in the following way: if σQ (u) = t, then v<Q u for all v ² ∆ occuring in t. 2. A reduction ordering ¢:= (< ∪<Q )+ is the transitive closure of the tree ordering < and the relation <Q . A first order substitution σQ is said to be admissible iff the reduction ordering ¢ is irreflexive. Example 5. σQ = {a1 \a, a6 \b} is a first-order substitution for F1 . The induced reduction ordering is the tree ordering and irreflexive. Therefore σQ is admissible. Theorem 6 (Characterization for Classical Logic [5]). A (first-order) formula F is classically valid, iff there is a multiplicity µ:=µQ , an admissible first-order substitution σ:=σQ and a set of σ-complementary connections such that every path through F µ contains a connection from this set. Example 6. Let µQ be the multiplicity of example 3 and σQ = {a1 \a, a6 \b} be a first-order substitution. Then {{a2 , a4 }, {a6 , a5 }} is a σQ -complementary set of connections and every path through F1µ contains a connection from this set. Therefore F1 is classically valid. 3 We consider substitutions to be idempotent, i.e. σ(σ) = σ for a substitution σ. 2.3 Intuitionistic Logic We shall now explain the extensions which are necessary to make the above characterization of validity applicable to intuitionistic logic. We define J-prefixes, intuitionistic substitutions and J-admissibility. Definition 7 (J-Prefix). Let u1 <u2 < . . . <un =u be the elements of Ψ ∪ Φ that dominate the atomic position u in the formula tree. The J-prefix preJ (u) of u is defined as preJ (u) := u1 u2 . . . un . Example 7. For the formula F1µ we obtain preJ (a2 )=a0 A1 A2 , preJ (a7 )= a0 A6 A7 , preJ (a4 )=a0 a4 and preJ (a5 )=a0 a5 .4 Definition 8 (Intuitionistic/Combined Substitution, J-Admissibility). 1. An intuitionistic substitution σJ : Φ → (Φ ∪ Ψ )∗ assigns to each position of type φ a string over the alphabet (Φ ∪ Ψ ). An intuitionistic substitution σJ induces a relation <J ⊆ (Φ ∪ Ψ ) × Φ in the following way: if σJ (u)=p, then v<J u for all characters v occuring in p. 2. A combined substitution σ:=(σQ , σJ ) consists of a first-order substitution σQ and an intuitionistic substitution σJ . A connection {u, v} is σ-complementary iff σQ (lab(u))=σQ (lab(v)) and σJ (preJ (u))=σJ (preJ (v)). The reduction ordering ¢:=(<∪<Q ∪<J )+ is the transitive closure of <, <Q and <J . 3. A combined substitution σ=(σQ , σJ ) is said to be J-admissible iff the reduction ordering ¢ is irreflexive and the following condition holds for all u ² Γ and all v ² ∆ occuring in σQ (u): σJ (preJ (u))=σJ (preJ (v))q ∗ for some q ∗ ² (Φ ∪ Ψ )∗ . Example 8. For the formula F1µ the combined substitution σ = (σQ , σJ ) where σQ = {a1 \a, a6 \b} and σJ = {A1 \ε, A2 \a4 , A6 \ε, A7 \a5 } is J-admissible.5 Then {{a2 , a4 }, {a6 , a5 }} is a set of σ-complementary connections. Theorem 9 (Characterization for Intuitionistic Logic [16]). A formula F is intuitionistically valid, iff there is a multiplicity µ := (µQ , µJ ), a J-admissible combined substitution σ = (σQ , σJ ), and a set of σ-complementary connections such that every path through F µ contains a connection from this set. Example 9. For F1 let µ=(µQ , µJ ) be a multiplicity, where µQ (a1 )=2 and µJ (a1 ) = µJ (a2 ) = 1, and σ the combined substitution of example 8. Concerning example 8 the formula F1 is intuitionistically valid. 2.4 Modal Logics We shall now describe the extensions which are necessary to make the characterization of validity applicable to the modal logics D, D4, S4, S5 and T. We will define M-prefixes, modal substitutions and L-admissibility. Definition 10 (M-Prefix). Let u1 <u2 < . . . <un <u be the elements of ν ∪Π that dominate the atomic position u in the formula tree. The M-prefix preM (u) of u is defined as preM (u) := u1 u2 . . . un for the modal logics D, D4, S4 and T, and as preM (u) := un for S5 (preM (u) := ε, if n=0 for D, D4, S4, S5, and T). Example 10. Consider F2 ≡2∀xP x ⇒ 2∀y3P y and its formula tree in figure 3. As M-prefixes we get preM (a3 )=A1 and preM (a7 ) =a4 A6 (preM (a7 )=A6 for S5). 4 5 Positions of type φ (and ν) play the role of variables and are written in capital letters. By ε we denote the empty string. P 0 a5 a7 306a6 (ν) P 1 a2 a3 ∀1 a6 2 a2 ∀0 a6 5 a5 216 a1 (ν) y :2 0 ⇒ a0 6a 0 4 (π) T D D4 S4 S5 – – – – – σM (preM (u))= σM (preM (u))= – σM (preM (v))q σM (preM (v))q ∗ ·varying σM (preM (u)) = σM (preM (v)) accessibility |σM (u)|≤1 |σM (u)|=1 |σM (u)|≥1 – – domain \ L ·constant ·cumulative Fig. 3. Formula tree for F2 Table 2. Domain/accessibility conditions for modal logics Definition 11 (Modal/Combined Substitution, L-Admissibility). 1. A modal substitution σM : ν → (ν ∪ Π)∗ induces a relation <M ⊆ (ν ∪ Π) × ν as follows: if σM (u)=p, then v<M u for all characters v occuring in p. 2. A connection {u, v} is σ-complementary, where σ:=(σQ , σM ) is a combined substitution, iff σQ (lab(u))=σQ (lab(v)) and σM (preM (u))=σM (preM (v)). The reduction ordering ¢ is defined as ¢:= (< ∪<Q ∪ <M )+ . 3. Let L be a modal logic such as D, D4, S4, S5 or T. A combined substitution σ = (σQ , σM ) is said to be L-admissible iff the reduction ordering ¢ is irreflexive, for all u ² Γ the domain condition (for all v ² Γ ∪∆ occuring in σQ (u), for some q ² ν ∪Π∪{ε}, q ∗ ² (ν ∪Π)∗ ) and the accessibility condition holds (see table 2). Example 11. Let σi =(σQ , σM i ) for i=1, 2, 3 where σQ ={a2 \a5 }, σM 1 ={A1 \a4 A6 }, σM 2 ={A1 \a4 , A6 \ε} and σM 3 ={A1 \a4 , A6 \a4 }. The only path through F2 consists of the connection {a3 , a7 }. This connection is σi -complementary in D, D4, S4, T (for i=1, 2) and S5 (for i=3). σ1 is D4- and S4-admissible for constant and cumulative domains, σ2 is S4- and T-admissible for constant, cumulative and varying domains, σ3 is S5-admissible for constant, cumulative and varying domains. Theorem 12 (Characterization for Modal Logics [16]). Let L be one of the modal logics D, D4, S4, S5 or T. A formula F is valid in the modal logic L, iff there is a multiplicity µ := (µQ , µM ), a L-admissible combined substitution σ = (σQ , σM ), and a set of σ-complementary connections such that every path through F µ contains a connection from this set. Example 12. For F2 let µ = (µQ , µM ), where µQ (a2 ) = µM (a1 ) = µM (a6 ) = 1, and σi (for i=1,2,3) the combined substitutions as defined in example 11. The formula F2 is valid in D4, S4, S5 and T for the constant and cumulative domain and valid in S4, S5 and T for the varying domain. 3 A Uniform Proof Search Procedure According to the above matrix characterization the validity of a formula F can be proven by showing that all paths through the matrix representation of F contain a complementary connection. In this section we describe a general path checking algorithm which is driven by connections instead of the logical connectives. Once a complementary connection has been identified all paths containing this connection are deleted. This is similar to Bibel’s connection method for classical logic [5] but without necessity for transforming the formula into any normal form. The algorithm avoids the notational redundancies occurring in sequent or analytic tableaux based proof procedures. Our technique can also be used for proof search in various non-classical logics where no normal form exists. Based on the matrix characterization we only have to modify the notion of complementarity while leaving the path checking algorithm unchanged. 3.1 Definitions and Notation Before introducing the algorithm we specify some basic definitions and notations which allow a very short, elegant, and uniform presentation. We define α-/β-related positions, active goals, active paths, proven subgoals and provable subgoals. Definition 13 (α-related, β-related). 1. Two positions u and v are α-related , denoted u∼α v, iff u6=v and the greatest common ancestor of u and v, wrt. the tree ordering <, is of principal type α. 2. Two positions u and v are β-related , denoted u∼β v, iff u6=v and the greatest common ancestor of u and v, wrt. the tree ordering <, is of principal type β. Remark. If two atoms are α-related they appear side by side in the matrix of a formula, whereas they appear one upon the other if they are β-related. Example 13. Let F3 ≡ S ∧ (¬(T ⇒R)⇒P )⇒(¬((P ⇒Q) ∧ (T ⇒ R))⇒¬¬P ∧ S) with the matrix of F3 in figure 4.6 Then, e.g., S 1 ∼α T 0 , R1 ∼α T 1 , P 1 ∼β T 0 or T 1 ∼β Q0 . T0 S1 R1 P1 P̃ 1 Q0 S0 T 1 R0 P0 Fig. 4. Matrix of the formula F3 Definition 14 (α-/β-related for a Set of Positions). 1. A position u and a set of positions S are α-related (u∼α S) if u∼α v for all v²S. 2. A position u and a set of positions S are β-related (u∼β S) if u∼β v for all v²S. Example 14. For the F3 we obtain, e.g., T 1 ∼α {R0,S 1,R1 } and T 0 ∼β {R1,P 1 }. The following definitions and lemmas always hold for a given (possibly indexed) formula F . By A we denote the set of all atomic positions in the formula F . Definition 15 (Subpath, Subgoal). 1. A subpath P ⊆ A is a set of atomic positions with u∼α (P \{u}) for all u ² P. 2. A subgoal C ⊆ A is a set of atomic positions with u∼β (C \{u}) for all u ² C. Remark. A subpath is a, possible uncompleted, “horizontal path” through a matrix; a subgoal is a, possible uncompleted, “vertical path” through a matrix. Example 15. For F3 , e.g., P1 ={S 1 , T 1 , P 0 }, P2 ={S 1 , R1 , S 0 } and P3 ={T 0 , T 1 , R0 } are subpaths, C1 ={T 0 }, C2 ={Q0 , T 1 } and C3 ={S 1 } are subgoals. For a valid formula F every path through F has to contain a complementary connection (i.e. every path has to be complementary). The proof procedure described afterwards are based on the notion of “active path” and “proven subgoal”. Definition 16 (Active Goal, Active Path, Proven Subgoal). An active goal is a tuple (P, C) consisting of a subpath P and a subgoal C with u∼α P for all u ² C. We call P an active path and C a proven subgoal . 6 In the following we use the labels instead of the (atomic) positions themselves. To distinguish the two atoms P 1 one atom is marked with a tilde (˜). During proof search the active path will specify those paths which are just being investigated for complementarity. All paths which contain the active path P and additionally one element u of the proven subgoal will already have been proven complementary, since it has been shown that they contain a complementary connection (which may have occured within an extension of P ∪ {u}). Example 16. For the formula F3 , e.g., (P1 , C1 ), (P2 , C2 ) and (P3 , C3 ) are active goals. P1 , P2 and P3 are active paths, C1 , C2 and C3 are proven subgoals. Definition 17 (Open Subgoal). An open subgoal C 0 ⊆ A with respect to an active goal (P, C) is a set of atomic positions, such that u∼α P and u∼β C for all u ² C 0 and there is no v ² A with v 6 ² C 0 , v∼α P and v∼β C. An open subgoal together with the active path specifies paths which include the active path but still have to be tested for complementarity. If all paths including the active path and one element of the open subgoal are proved successfully for complementarity then all paths containing the active path are complementary. Note that there may be more than one open subgoal for a given active goal. Example 17. For F3 the set {R1 , P 1 } is an open subgoal wrt. the active goal (P1 , C1 ) (example 16); the empty set ∅ is the only subgoal wrt. (P2 , C2 ) or (P3 , C3 ). Lemma 18 (Paths). A subpath P ⊆ A is a path iff there is no u ² A with u∼α P. Proof of the lemma. A path is a “complete horizontal path” through a matrix. u t Definition 19 (Provable Goal). An active goal (P, C) is called provable with respect to a formula F , iff there is an open subgoal C 0 wrt. (P, C), such that for all u ² C 0 all paths P 0 through F with P ∪ {u} ⊆ P 0 are complementary. Lemma 20 (Empty Open Subgoal). Let (P, C) an active goal such that there is no u ² A with u∼α P and u∼β C. Then (P, C) is provable. Proof of the lemma. If there is no u ² A so that u∼α P and u∼β C, then C 0 =∅ is the only open subgoal wrt. (P, C) (definition 17). Since the open subgoal C 0 wrt. (P, C) is empty, the active goal (P, C) is provable (definition 19). u t Proposition 21 (Provable Goal). Let (P, C) be an active goal and there is an open subgoal C 0 wrt. (P, C) with C 0 6=∅. (P, C) is provable, iff there is a complementary connection {A, Ā} with A∼α P and A∼β C, such that 1. Ā ² P or 2. Ā∼α (P ∪ {A}) and the active goal (P ∪ {A}, {Ā}) is provable and the active goal (P, C ∪ {A}) is provable. Lemma 22 (Provability of (∅, ∅)). Let F be a formula. The active goal (∅, ∅) wrt. F is provable, iff every path through F is complementary. Proof of the lemma. (∅, ∅) is provable iff there is an open subgoal C 0 6=∅ such that every path P 0 with {u} ⊆ P 0 and u ² C 0 is complementary. Since every path through F contains an u ² C 0 (lemma 18, definition 17) they are all complementary. u t Theorem 23 (Validity of a Formula). A formula F is valid in classical logic (intuitionistic logic/modal logic L) iff there is a multiplicity µ and an admissible (J -admissible/L-admissible combined) substitution σ such that the active goal (∅, ∅) wrt. F µ is provable. Proof of the theorem. Follows from lemma 22 and the characterizations of validity for classical, intuitionistic, and modal logics (theorems 6,9, and 12). u t 3.2 The Algorithm We now represent the proof procedure for classical (C), intuitionistic (J ) and the modal logics D, D4, S4, S5 and T. It consists of the uniform path-checking algorithm and a complementarity test which will be described in the next section. Let F be a (first-order) formula, µ a multiplicity, σ a substitution, and F µ an indexed formula. Furthermore let Aµ be the set of atomic positions in the formula tree for F µ and ∼α and ∼β the relations α- and β-related. The main function ProofL (F ) in figure 5 gets an additional parameter L where L ² {C, J , D, D4, S4, S5, T} specifies the logic L under consideration. It returns true iff the formula F is valid in the corresponding logic. Function ProofL (F ) Input: first-order formula F Output: true, if, and only if, F is valid in the L-logic begin ProofL ; m := 0; repeat (m) m := m+1; InitializeL (µ, σ); µ valid := SubproofL (F , ∅, ∅); until valid=true; return true; end ProofL . Fig. 5. Function ProofL (F ) The function ProofL (F ) first initializes the multiplicity µ and the (combined) substitution σ according to table 3. After that the function SubproofL is invoked on the initial subgoal (∅, ∅). If it returns false the multiplicity is increased stepwisely, until the function Subproof returns true.7 C J D, D4, S4, S5, T L multiplicity µ µ(u):=m, ∀u ² Γ µ(u):=m, ∀u ² Γ ∪ Φ µ(u):=m, ∀u ² Γ ∪ ν substitution σ σ:=∅ σ:=(∅, ∅) σ:=(∅, ∅) (m) Table 3. InitializeL (µ, σ) The function SubproofL (F µ , P, C) in figure 6 implements the test wether the active goal (P, C) is provable with respect to F µ . Note that all variables except for the set of atomic positions Aµ and the (combined) substitution σ are local. Within SubproofL a function ComplementaryL (F µ , A, Ā, σ 0 , σ) is used, which returns true iff the connection {A, Ā} in the (indexed) formula F µ is complementary under a (combined) substitution σ in the logic L taking into account the substitution σ 0 computed so far. In this case the substitution σ is returned. ComplementaryL depends on the peculiarities of each logic (see section 4). Lemma 24 (Correctness and Completeness of SubproofL ). The function SubproofL (F µ , P, C) returns true if the active goal (P, C) is provable with respect to F µ ; otherwise it returns false. Proof of the lemma. The function SubproofL uses the statements for a provable goal made in lemma 20 and proposition 21. u t 7 This technique of stepwise increasing the multiplicity is obviously not very efficient. In an efficient implementation the multiplicity for each suitable position is determined individually during the path-checking process (as in the usual connection method). Function SubproofL (F µ , P, C) Input: indexed formula F µ , active path P⊆Aµ , proven subgoals C⊆Aµ Output: true, if (P, C) wrt. F µ is provable; false, otherwise begin SubproofL ; if there is no A ² Aµ where A∼α P and A∼β C then return true; E := ∅; σ 0 := σ; repeat select A ² Aµ where A∼α (P∪E) and A∼β C; if there is no such A then return false; E := E ∪ {A}; D := ∅; valid := false; noconnect := false; repeat µ 0 select Ā ² Aµ where Ā 6 ² D and ComplementaryL (F , A, Ā, σ , σ) and (1.) Ā ² P or (2.) Ā∼α (P∪{A}); if there is no such Ā then noconnect := true else D := D ∪ {Ā} if Ā ² P then valid := true else valid := SubproofL (F µ , P∪{A}, {Ā}); if valid=true then valid := SubproofL (F µ , P, C∪{A}); until valid=true or noconnect=true; until valid=true; return true; end SubproofL . Fig. 6. Function SubproofL (F µ , P, C) Theorem 25 (Correctness and Completeness of ProofL ). The function ProofL (F ) returns true, iff the formula F is L-valid. Proof of the theorem. ProofL uses the relation between the validity of F wrt. logic L and the provability of the active goal (∅, ∅) wrt. F µ (theorem 23) and searches for a suitable multiplicity µ. The theorem thus follows from lemma 24. u t Remark. Our algorithm is not a decision procedure, i.e. for an invalid formula it will not terminate. Note that the propositional part of each logic under consideration is decidable whereas in the first-order case there are no decision procedures. 4 Complementarity in Classical and Non-Classical Logics Matrix characterizations of validity are based on the existence of admissible (combined) substitutions that render a set of simultaneously complementary connections such that every path contains a connection from this set. In our path-checking algorithm we have to ensure that after adding a connection to the current set there still is an admissible substitution under which all connections are complementary. For this purpose we invoke ComplementaryL which implements a complementarity test for two atoms and depends on the particular logic. Whereas in the classical logic term-unification and a test for irreflexivity of the reduction ordering suffices to compute an admissible substitution, we need an additional string-unification algorithm to unify prefixes in the case of intuitionistic and modal logic. After explaining the complementarity test for classical logic we extend it to intuitionistic logic and present details of the string-unification algorithm. We then deal with D, D4, S4, S5 and T which can be treated in a uniform way. 4.1 Classical Logic C In C two atoms are complementary if they can be unified under a term-substitution and the induced reduction ordering is irreflexive. For the former well-known unification algorithms [14, 9] compute a most general unifier which leads to the firstorder substitution. For the latter efficient algorithms testing the acyclicity of a directed graph can be used. ComplementaryC succeeds and returns σQ iff the two conditions in table 4 hold (term_unify(s, t) expresses term unification of s and t and results together with σQ 0 in the substitution σQ ). C term unification term_unify(σQ 0 (lab(A)), σQ 0 (lab(Ā))) ; σQ reduction ordering ¢:= (< ∪<Q )+ is irreflexive Table 4. Function ComplementaryC (F µ , A, Ā, σQ 0 , σQ ) 4.2 Intuitionistic Logic J For intuitionistic logic the complementarity test additionally requires that the prefixes of two connected atoms can be unified. For this purpose we use a specialized string unification (T-String-Unification) T_string_unifyJ (p, q), described below, which succeeds if the prefixes p and q can be unified and leads altogether the substitution σJ . To guarantee admissibility the extended reduction ordering has to be irreflexive and an ‘additional condition’ has to be fulfilled. If all the properties of table 5 hold the function ComplementaryJ succeeds and returns (σQ , σJ ). J term unification term_unify(σQ 0 (lab(A)), σQ 0 (lab(Ā))) ; σQ string unification T_string_unifyJ (σJ 0 (preJ (A)), σJ 0 (preJ (Ā))) ; σJ ∗ additional condition |σJ (preJ (v))|≤|σJ (preJ (u))| (J) reduction ordering ¢:= (< ∪<Q ∪<J )+ is irreflexive (<J induced by σε ◦σJ ) (J) σε (w):=ε for all w ² Φ, ◦ is the composition of substitutions; * must hold for all u ² Γ and all v ² ∆ occuring in σQ (u). Table 5. Function ComplementaryJ (F µ , A, Ā, (σQ 0 , σJ 0 ), (σQ , σJ )) T-String-Unification To unify the prefixes of two connected atoms we use a specialized string unification which respects the restrictions on the prefix strings p and q: no character is repeated either in p nor in q and equal characters only occur within a common substring at the beginning of p and q. This restriction allows us to give an efficient algorithm computing a minimal set of most general unifiers. Similar to the ideas of Martelli and Montanari [9] rather than by giving a recursive procedure we consider the process of unification as a sequence of transformations of an equation. We start with a given equation Γ = {p=q} and an empty substitution σ = ∅ and stop with an empty set Γ = ∅ and a substitution σ representing an idempotent most general unifier. Each transformation step replaces a tuple Γ, σ by a modified tuple Γ 0 , σ 0 . The algorithm is described by transformation rules which can be applied nondeterministically. The set of most general unifiers consists of the results of all successfully finished transformations. For technical reasons we divide the right part q of the equation into two parts q1 |q2 , i.e. we start with {p = q1 |q2 }, {}. Definition 26 (Transformation Rules for J ). Let V be a set of variables, C a set of constants, and V 0 a set of auxiliary variables with V ∩ V 0 =∅. The set of transformation rules for J is defined in table 6. R1. R2. R3. R4. R5. R6. R7. R8. R9. R10. {ε = ε|ε}, σ {ε = ε|t+ }, σ {Xs = ε|Xt}, σ {Cs = ε|V t}, σ {V s = z|ε}, σ {V s = ε|C1 t}, σ {V s = z|C1 C2 t}, σ {V s+ = ε|V1 t}, σ {V s+ = z + |V1 t}, σ {V s = z|Xt}, σ → → → → → → → → → → {}, σ {t+ = ε|ε}, σ {s = ε|t}, σ {V t = ε|Cs}, σ {s = ε|ε}, {V \z}∪σ {s = ε|C1 t}, {V \ε}∪σ {s = ε|C2 t}, {V \zC1 }∪σ {V1 t = V |s+ }, σ {V1 t = V 0 |s+ }, {V \z + V 0 }∪σ {V s = zX|t}, σ (V 6=X, and s=ε + + or t6=ε or X ² C) + s, t and z denote (arbitrary) strings and s , t , z a non-empty string. X, V, V1 , C, C1 and C2 denote single characters with X ² V ∪ C ∪ V 0 , V, V1 ² V ∪ V 0 (with V 6=V1 ), and C, C1 , C2 ² C. V 0 ² V 0 is a new variable which does not occur in the substitution σ computed so far. Table 6. Transformation Rules for Intuitionistic Logic (and Modal Logic S4) By modifying the set of transformation rules we are also able to treat the modal logics D, D4, S5 and T (see [12] for details). Our algorithm is much simpler and considerably more efficient than other string unification algorithms developed so far. Ohlbach’s algorithm [10], e.g., does not compute a minimal set of unifiers. In general the number of most general unifiers is finite but may grow exponentially with respect to the length of the unified strings. 4.3 Modal Logics The modal logics also require T-string-unification. We have developed such procedures in [12] by considering the accessibility condition for each particular logic L.8 T_string_unifyL (p, q) computes the most general unifier for p and q with respect to the accessibility condition for L. This leads to the substitution σM . For the cumulative and varying domain variants also the domain condition has to be taken into account. In table 7 we have summarized all conditions that have to be tested. ComplementaryL succeeds, if all conditions in the row for L hold. D D4 S4 S5 T L term unification term unify(σQ 0 (lab(A)), σQ 0 (lab(Ā))) ; σQ string unification T string unifyL (σM 0 (preM (A)), σM 0 (preM (Ā))) ; σM domain condition · constant – ×9 – – – · cumulative∗ |V |≤|U |≤|V |+1 |V |≤|U | |V |≤|U | – |V |≤|U |≤|V |+1 · varying∗ |U 0 |=|V 0 | |U |=|V | |U 0 |=|V 0 | uniS5 ; σM |U 0 |=|V 0 | + ∗ reduction ordering ¢:= (< ∪<Q <M ) is irreflexive (<M induced by σM ) (M ) (M ) U := σM (preM (u)), V := σM (preM (v)), U 0 := σε ◦ σM (preM (u)), V 0 := σε ◦ σM (preM (v)), (M ) σε (w):=ε for all w ² ; * must hold for all v ² Π (v ² ∪Π for varying domains) occuring in σQ (u); ν ν (M ) ∗ uniS5 ∼ =T_string_unifyS5 (σM (preM (u)), σM (preM (v))); σM :=σε ◦σM for D,S4,S5,T / σM for D4. Table 7. Function ComplementaryL (F µ , A, Ā, (σQ 0 , σM 0 ), (σQ , σM )) 8 9 For S4 the algorithm for intuitionistic logic (T string unifyJ ) suffices. We do not deal with the constant domain of D4 since there is need for additional search when computing the modal substitution σM . 5 Conclusion We have presented a uniform proof procedure for classical and some non-classical logics which is based on a unified representation of matrix characterizations of logical validity for these logics. It consists of a connection-driven general path-checking algorithm for arbitrary formulae and a component for checking the complementarity of two atomic formulae according to the peculiarities of a particular logic. By presenting appropriate components for classical logic, intuitionistic logic, and the modal logics D, D4, S4, S5, and T we have demonstrated that our procedure is suited to deal with a rich variety of logics in a simple and efficient way. The algorithm has been implemented in Prolog in order to allow practical experiments. In the future we intend to elaborate optimizations like a decision procedure for the propositional case, efficiency improvements like a dynamic increase of the multiplicities instead of a global one, and to provide a C-implementatuion to allow realistic comparisons. Furthermore we intend to investigate extensions of our procedure to additional logics such as (fragments of) linear logic and other non-classical logics for which a matrix characterization can be developed. References 1. B. Beckert and J. Posegga. leanTAP : lean, tableau-based theorem proving. Proc. CADE-12, LNAI 814, 1994. 2. E. W. Beth. The foundations of mathematics. North–Holland, 1959. 3. W. Bibel, S. Brüning, U. Egly, T. Rath. Komet. Proc. CADE-12, LNAI 814, pp. 783–787. 1994. 4. W. Bibel. On matrices with connections. Jour. of the ACM, 28, p. 633–645, 1981. 5. W. Bibel. Automated Theorem Proving. Vieweg, 1987. 6. M. C. Fitting. Intuitionistic logic, model theory and forcing. North–Holland, 1969. 7. G. Gentzen. Untersuchungen über das logische Schließen. Mathematische Zeitschrift, 39:176–210, 405–431, 1935. 8. R. Letz, J. Schumann, S. Bayerl, W. Bibel. Setheo: A high-performance theorem prover. Journal of Automated Reasoning, 8:183–212, 1992. 9. A. Martelli and Ugo Montanari. An efficient unification algorithm. ACM TOPLAS, 4:258–282, 1982. 10. H. J. Ohlbach. A resolution calculus for modal logics. Ph.D. Thesis, Universität Kaiserslautern, 1988. 11. J. Otten, C. Kreitz. A connection based proof method for intuitionistic logic. Proc. 4th TABLEAUX Workshop, LNAI 918, pp. 122–137, 1995. 12. J. Otten, C. Kreitz. T-String-Unification: Unifying Prefixes in Non-Classical Proof Methods. Proc. 5th TABLEAUX Workshop, LNAI 1071, pp. 244–260, 1996. 13. J. Otten. Ein konnektionenorientiertes Beweisverfahren für intuitionistische Logik. Master’s thesis, TH Darmstadt, 1995. 14. J. A. Robinson. A machine-oriented logic based on the resolution principle. Jour. of the ACM, 12(1):23–41, 1965. 15. L. Wallen. Matrix proof methods for modal logics. IJCAI-87 , p. 917–923. 1987. 16. L. Wallen. Automated deduction in nonclassical logic. MIT Press, 1990. 17. L. Wos et. al. Automated reasoning contributes to mathematics and logic. Proc. CADE-10 , LNCS 449, pp. 485–499, 1990. This article was processed using the LaTEX macro package with LLNCS style