CTL-RP: A Computational Tree Logic Resolution Prover

Similar documents
First-order resolution for CTL

Propositional and Predicate Logic - V

2.5.2 Basic CNF/DNF Transformation

A Tableau Calculus for Minimal Modal Model Generation

First-Order Theorem Proving and Vampire

Part 1: Propositional Logic

Labelled Superposition for PLTL. Martin Suda and Christoph Weidenbach

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

Comp487/587 - Boolean Formulas

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

Introduction to Logic in Computer Science: Autumn 2006

LOGIC PROPOSITIONAL REASONING

Deductive Systems. Lecture - 3

Propositional Logic Language

Propositional Logic: Models and Proofs

A Clausal Resolution Method for Branching-Time Logic ECTL +

King s Research Portal

Propositional Logic: Evaluating the Formulas

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester)

Advanced Topics in LP and FP

Part 1: Propositional Logic

A Modal-Layered Resolution Calculus for K

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either

6. Logical Inference

CS156: The Calculus of Computation

The Complexity of Computing the Behaviour of Lattice Automata on Infinite Trees

3 Propositional Logic

Tecniche di Verifica. Introduction to Propositional Logic

Warm-Up Problem. Is the following true or false? 1/35

Resolution for Predicate Logic

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

07 Equational Logic and Algebraic Reasoning

Decision Procedures for Satisfiability and Validity in Propositional Logic

Propositional Reasoning

KE/Tableaux. What is it for?

Mathematical Logic Propositional Logic - Tableaux*

Cooperation of Background Reasoners in Theory Reasoning by Residue Sharing

A Resolution Decision Procedure for the Guarded Fragment with Transitive Guards

Rewrite-Based Equational Theorem Proving With Selection and Simplification. Leo Bachmair Harald Ganzinger

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

Propositional Resolution

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

On the Complexity of the Reflected Logic of Proofs

Redundancy for rigid clausal tableaux

Syntax and Semantics of Propositional Linear Temporal Logic

Version January Please send comments and corrections to

Automata, Logic and Games: Theory and Application

CHAPTER 4 CLASSICAL PROPOSITIONAL SEMANTICS

Resolution for Predicate Logic

Tutorial 1: Modern SMT Solvers and Verification

Foundations of Artificial Intelligence

Cooperation of Background Reasoners in Theory Reasoning by Residue Sharing

Chapter 6: Computation Tree Logic

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P.

Description Logics. Deduction in Propositional Logic. franconi. Enrico Franconi

Foundations of Artificial Intelligence

Resolution In Propositional Logic

Temporal logics and explicit-state model checking. Pierre Wolper Université de Liège

Automated Synthesis of Tableau Calculi

Introduction to Logic in Computer Science: Autumn 2007

Syntax of FOL. Introduction to Logic in Computer Science: Autumn Tableaux for First-order Logic. Syntax of FOL (2)

Outline. Formale Methoden der Informatik First-Order Logic for Forgetters. Why PL1? Why PL1? Cont d. Motivation

A Resolution Method for Modal Logic S5

Propositional and Predicate Logic - II

Developing Modal Tableaux and Resolution Methods via First-Order Resolution

First-Order Logic. Chapter Overview Syntax

Herbrand Theorem, Equality, and Compactness

A brief introduction to Logic. (slides from

A New 3-CNF Transformation by Parallel-Serial Graphs 1

Closed Book Examination. Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. M.Sc. in Advanced Computer Science

Language of Propositional Logic

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

Classical First-Order Logic

Informal Statement Calculus

Exercises 1 - Solutions

Introduction to Artificial Intelligence Propositional Logic & SAT Solving. UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010

Chapter 4: Computation tree logic

Linear Temporal Logic and Büchi Automata

Hypersequent Calculi for some Intermediate Logics with Bounded Kripke Models

Chapter 3 Deterministic planning

First Order Logic: Syntax and Semantics

Reasoning in Description Logics with a Concrete Domain in the Framework of Resolution

The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna

Critical Reading of Optimization Methods for Logical Inference [1]

Propositional and Predicate Logic - IV

Logic: Propositional Logic (Part I)

Classical Propositional Logic

Resolution for mixed Post logic

Classical Propositional Logic

Intelligent Systems. Propositional Logic. Dieter Fensel and Dumitru Roman. Copyright 2008 STI INNSBRUCK

Tableau-based decision procedures for the logics of subinterval structures over dense orderings

On evaluating decision procedures for modal logic

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas.

SAT Solvers: Theory and Practice

Propositional Logic. Methods & Tools for Software Engineering (MTSE) Fall Prof. Arie Gurfinkel

Expressive number restrictions in Description Logics

Automated Reasoning in First-Order Logic

CHAPTER 10. Gentzen Style Proof Systems for Classical Logic

A Normal Form for Temporal Logics and its Applications in Theorem-Proving and Execution

Transcription:

1 -RP: A Computational Tree Logic Resolution Prover Lan Zhang a,, Ullrich Hustadt a and Clare Dixon a a Department of Computer Science, University of Liverpool Liverpool, L69 3BX, UK E-mail: {Lan.Zhang, U.Hustadt, CLDixon}@liverpool.ac.uk In this paper, we present a resolution-based calculus R,S for Computational Tree Logic () as well as an implementation of that calculus in the theorem prover -RP. The calculus R,S requires a transformation of an arbitrary formula to an equisatisfiable clausal normal form formulated in an extension of with indexed path formulae. The calculus itself consists of a set of resolution rules which can be used as the basis for an EXPTIME decision procedure for the satisfiability problem of. We give a formal semantics for the clausal normal form, provide proof sketches for the soundness and completeness of the resolution rules, discuss the complexity of decision procedure based on R,S, and present an approach to implementing the calculus R,S using first-order techniques. Finally, we give a comparison between -RP and a tableau theorem prover for. Keywords: Branching-time temporal logics, Resolution theorem proving 1. Introduction Temporal logic is considered an important tool in many different areas of Artificial Intelligence and Computer Science, including for example the specification and verification of concurrent and distributed systems for example [10,17,24]. Computational Tree Logic () [9] is a branchingtime temporal logic whose underlying model of time is a choice of possibilities branching into fu- * Authors are supported by EPSRC grant EP/D060451/1. ture. uses the path quantifiers A (for all paths) and E (for some path) and additionally each temporal operator must be paired with a path quantifier. For example, A ϕ means on all paths ϕ always holds. There are many important applications that can be represented and verified in such as digital circuit verification [10], analysis of real time and concurrent systems [24], etc. A range of model checking algorithms [8,10,18] as well as proof methods have been developed for. The main proof methods for are based on automata [15], resolution [5], and tableaux [2,14,25]. Here we present the first resolution theorem prover for, -RP, which implements an sound and complete clausal resolution calculus R,S. The calculus R,S consists of a number of socalled step and eventuality resolution rules that operate on a clausal normal form for. is designed in order to allow the use of classical first-order resolution techniques to implement the rules of the calculus. We take advantage of this fact in the development of our prover -RP which uses the first-order theorem prover SPASS. The rest of the paper is organised as follows. We first present the syntax and semantics of R,S in Section 2 and then the calculus R,S is presented in Section 3, followed by a sketched proof of its soundness and completeness and a discussion of termination and complexity. Section 4 discusses our approach to the implementation of the calculus R,S using first-order resolution techniques. In Section 5, we first provide a comparison between a related calculus [5] and our calculus R,S, and demonstrate the improvements of our calculus. Secondly, we experimentally compare -RP with a tableau theorem prover. Finally, conclusions are drawn in Section 7. 2. Syntax and semantics of In this paper, we use the syntax and semantics of introduced by Clarke and Emerson AI Communications ISSN 0921-7126, IOS Press. All rights reserved

2 L. Zhang et al. / -RP: A Computational Tree Logic Resolution Prover M, s i = true M, s i = false M, s i = p iff p L(s i ) for an atomic proposition p P PL M, s i = ϕ iff M, s i = ϕ M, s i = ϕ ψ iff M, s i = ϕ and M, s i = ψ M, s i = ϕ ψ iff M, s i = ϕ or M, s i = ψ M, s i = A ψ iff for every path χ si such that M, s i+1 = ψ M, s i = E ψ iff there exists a path χ si such that M, s i+1 = ψ M, s i = A(ϕ U ψ) iff for every path χ si there exists s j χ si such that M, s j = ψ and for every s k χ si, if i k < j then M, s k = ϕ M, s i = E(ϕ U ψ) iff there exists a path χ si and there exists s j χ si such that M, s j = ψ and for every s k χ si, if i k < j then M, s k = ϕ Fig. 1. The semantics of formulae in [9]. The language of is based on a set of atomic propositions P PL ; propositional constants, true and false, and boolean operators,,,, and ( and are associative and commutative); temporal operators (always in the future), (at the next moment in time), (eventually in the future), U (until), and W (unless); and path quantifiers A (for all future paths) and E (for some future path). The set of well-formed formulae of is inductively defined as follows. 1. true and false are formulae; 2. all atomic propositions in P PL are formulae; 3. if ϕ and ψ are formulae, then so are ϕ, (ϕ ψ), (ϕ ψ), (ϕ ψ), A ϕ, A ϕ, A ϕ, A(ϕ U ψ), A(ϕ W ψ), E ϕ, E ϕ, E ϕ, E(ϕ U ψ), and E(ϕ W ψ). Formulae of over P PL are interpreted in model structures, M = S, R, L, where S is a set of states; R is a total binary accessibility relation over S; and L : S 2 P PL is an interpretation function mapping each state to the set of atomic propositions true at that state. An infinite path χ si is an infinite sequence of states s i, s i+1, s i+2,... such that for every j, j i, (s j, s j+1 ) R. Informally, χ si is an infinite path starting from state s i. We inductively define a satisfaction relation = between a pair consisting of a structure M and a state s i S, and a formula as shown in Figure 1. In addition, we use the usual equivalences to define the semantics of, and other boolean operators, and the following equivalences for other temporal operators. A ϕ A(true U ϕ) E ϕ E(true U ϕ) A ϕ E ϕ E ϕ A ϕ A(ϕ W ψ) E( ψ U ( ϕ ψ)) E(ϕ W ψ) A( ψ U ( ϕ ψ)) A formula ϕ is valid, written = ϕ, iff for every model structure M and every state s M, M, s = ϕ. A formula ϕ is satisfiable, iff for some model structure M and some state s M, M, s = ϕ, and unsatisfiable otherwise. A model structure M such that ϕ is true at some state s M is called a model of ϕ. The satisfiability problem of is known to be EXPTIME-complete [9,13,14]. 3. R,S : A refined resolution calculus for Our clausal resolution calculus R,S for is based on, but not identical to, the resolution calculus in [5,7]. The calculus R,S requires arbitrary formulae to be transformed into a clausal normal form. The calculus itself consists of eight step resolution rules, two eventuality resolution rules and two rewrite rules. The calculus can be used as the basis for an EXPTIME decision procedure for the satisfiability problem of. 3.1. Normal form Our calculus R,S operates on formulae in a clausal normal form called Separated Normal Form with Global Clause for, denoted by SNF g. Separated Normal Form (SNF) was originally in-

L. Zhang et al. / -RP: A Computational Tree Logic Resolution Prover 3 M, s i = start iff s i = s 0 M, s i = E ψ ind M, s i = E ψ LC(ind) M, s i = E ψ LC(ind) M, s i = E(ϕ U ψ) LC(ind) iff there exists s S such that (s i, s ) [ind] and M, s = ψ iff there exists s j S such that (s i, s j ) [LC(ind)] and M, s j = ψ iff for every s j S, (s i, s j ) [LC(ind)] implies M, s j = ψ iff there exists s j S such that (s i, s j ) [LC(ind)] and M, s j = ψ and for every s k S with s k s j, if (s i, s k ) [LC(ind)] and (s k, s j ) [LC(ind)] then M, s k = ϕ M, s i = E(ϕ W ψ) LC(ind) iff M, s i = E ϕ LC(ind) or M, s i = E(ϕ U ψ) LC(ind) Fig. 2. The semantics of SNF g troduced for Propositional Linear Time Temporal Logic (PLTL) [16] and then extended to various other temporal logics including [5]. The language of SNF g clauses is defined over an extension of in which we label certain formulae with an index ind taken from a countably infinite index set Ind and it consists of formulae of the following form. A (start k j=1 m j) (initial clause) A (true k j=1 m j) (global clause) A ( n i=1 l i A k j=1 m j) (A-step clause) A ( n i=1 l i E k j=1 m j ind ) (E-step clause) A ( n i=1 l i A l) (A-sometime clause) A ( n i=1 l i E l LC(ind) ) (E-sometime clause) where k 0, n > 0, start is a propositional constant, l i (1 i n), m j (1 j k) and l are literals, that is atomic propositions or their negation and ind is an element of Ind. As all clauses are of the form A (P D) we often simply write P D instead. The formula A ( )l is called an A-eventuality and the formula E ( )l LC(ind) is called an E-eventuality. To provide a semantics for SNF g, we extend model structures S, R, L to S, R, L, [ ], s 0 where s 0 is an element of S and [ ] : Ind 2 (S S) maps every index ind Ind to a successor function [ind] which is a total functional relation on S and a subset of R, that is, for every s S, there exists only one state s S, (s, s ) [ind] and (s, s ) R. We extend [ ] to expressions of the form LC(ind) by defining [LC(ind)] = [ind], i.e. [LC(ind)] is the reflexive and transitive closure of [ind]. The semantics of SNF g is then defined as shown in Figure 2 as an extension of the semantics of defined in Section 2. The semantics of the remaining operators is analogous to that given previously but in the extended model structure S, R, L, [ ], s 0. 3.2. Transformation into SNF g We have defined a set of transformation rules which allows us to transform an arbitrary formula into an equi-satisfiable set of SNF g clauses, a complete description of which can be found in [28]. The transformation rules are similar to those in [5,16], but modified to allow for global clauses. Basically, we use the following techniques to transform formulae into SNF g. (In the formulae below, q, q 1, q 2, q 3 are atomic propositions; ϕ, ϕ 1, ϕ 2 are formulae.) Construct a clause set from which to start the transformation, that is, given a formula ϕ we start with the set τ(ϕ) = {A (start p, p simp(nnf(ϕ))}, where nnf computes the negation normal form of a formula and simp simplifies a formula using standard boolean and simplification rules. Introduce new indices into formulae with E path quantifiers, for instance, A (q E ϕ) A (q E ϕ ind ) where ind is a new index. A (q E ϕ) A (q E ϕ LC(ind) ) where {, } and ind is a new index. A (q E(ϕ 1 ϕ 2 )) A (q E(ϕ 1 ϕ 2 ) LC(ind) ) where { U, W } and ind is a new index. Rename complex subformulae by new atomic propositions, for instance,

4 L. Zhang et al. / -RP: A Computational Tree Logic Resolution Prover { A (q A p) A (q A ϕ) A (p ϕ) if ϕ is not a literal, and p is a new atomic proposition. A (q E ϕ LC(ind) { ) A (q E p LC(ind) ) A (p ϕ) if ϕ is not a literal, and p is a new atomic proposition. Remove combinations of temporal operators which are not allowed to appear in SNF g clauses, for instance, A (q 1 A q 2 ) { A (q1 q 2 p) A (p A (q 2 p)) where p is a new atomic proposition. A (q 1 E q 2 LC(ind) { ) A (q1 q 2 p) A (p E (q 2 p) ind ) where p is a new proposition. A (q 1 A(q 2 U q 3 )) A (q 1 q 3 (q 2 p)) A (p A (q 3 (q 2 p))) A (q 1 A q 3 ) where p is a new proposition. A (q 1 E(q 2 U q 3 ) LC(ind) ) A (q 1 q 3 (q 2 p)) A (p E (q 3 (q 2 p)) ind ) A (q 1 E q 3 LC(ind) ) where p is a new proposition. Theorem 1 Let ϕ be a formula, T be a set of SNF g clauses obtained from τ(ϕ) by exhaustive applications of our transformation rules. Then (i) ϕ is satisfiable iff T is satisfiable, (ii) the set of indices Ind(T) occurring in T is finite, and (iii) T can be computed in polynomial time. Proof (Sketch). For part (i) of the theorem we first prove that ϕ is satisfiable iff τ(ϕ) is satisfiable. We then prove by induction on the sequence of applications of our transformation rules that if a set of clauses T is obtained from a set of clauses T by a sequence of applications of one of our transformation rules, then T is satisfiable iff T is satisfiable. For part (ii) of the theorem we observe that the number of E path quantifiers in ϕ and τ(ϕ) is finite and the only three transformation rules which introduce new indices are the first three rules we have defined in Section 3.2. Each rule can be applied exactly once to a particular occurrence of an unindexed E path quantifier. Thus, there exists a one-to-one mapping between E path quantifiers in τ(ϕ) and indices in T and the set Ind(T) is finite. Finally, to prove part (iii) of the theorem, we establish how many times each transformation rule can be applied in total in the computation of T based on the number of boolean and temporal operators present in τ(ϕ). This gives us a linear upper bound on the number of applications of the transformation rules in the size of τ(ϕ). In addition, we show that each rule application only requires linear time in the size of the current set of clauses and that the size of each set of clauses T obtained from τ(ϕ) by a sequence of rule applications is linear in the size of τ(ϕ). A detailed proof of Theorem 1 can be found in [28]. 3.3. The clausal resolution calculus R,S The resolution calculus R,S consists of two types of resolution rules, the step resolution rules, SRES1 to SRES8, and the eventuality resolution rules, ERES1 and ERES2, as well as two rewrite rules, RW1 and RW2. Motivated by refinements of propositional and first-order resolution [4], we restrict the applicability of step resolution rules by means of an atom ordering and a selection function. An atom ordering for R,S is a well-founded and total ordering on the set P PL. The ordering is extended to literals by identifying each positive literal p with the singleton multiset {p} and each negative literal p with the multiset {p, p} and comparing such multisets of atoms by using the multiset extension of. Doing so, p is greater than p, but smaller than any literal q or q with q p. In this section, we consider conjunctions and disjunctions of propositional literals not to contain duplicate occurrences of the same literal, that is, the operators and are idempotent. We use false to denote the empty disjunction and true to denote the empty conjunction. A literal l is (strictly) maximal with respect to a propositional disjunction C iff for every literal l in C, l l (l l).

L. Zhang et al. / -RP: A Computational Tree Logic Resolution Prover 5 A selection function is a function S mapping every propositional disjunction C to a possibly empty subset S(C) of the negative literals occurring in C. If l S(C) for a disjunction C, then we say that l is selected in C. In the following presentation of the rules of, ind is an index, P and Q are conjunctions of literals, C and D are disjunctions of literals, and l is a literal. If l is a negative literal p, then l denotes the atomic proposition p. R,S SRES1 SRES2 SRES3 SRES4 SRES5 SRES6 SRES7 SRES8 P A (C l) Q A (D l) P Q A (C D) P E (C l) ind Q A (D l) P Q E (C D) ind P E (C l) ind Q E (D l) ind P Q E (C D) ind start C l start D l start C D true C l start D l start C D true C l Q A (D l) Q A (C D) true C l Q E (D l) ind Q E (C D) ind true C l true D l true C D A step resolution rule, SRES1 to SRES8, is only applicable if one of the following two conditions is satisfied: (C1) if l is a positive literal, then l must be strictly maximal with respect to C and no literal is selected in C l, and l must be selected in D l or no literal is selected in D l and l is maximal with respect to D; or (C2) if l is a negative literal, then l must be selected in C l or no literal is selected in C l and l is maximal with respect to C, and l must be strictly maximal with respect to D and no literal is selected in D l. Note that these two conditions are identical modulo the polarity of l. If l in C l and l in D l satisfy condition (C1) or condition (C2), then way say that l is eligible in C l and l is eligible in D l. The rewrite rules RW1 and RW2 are defined as follows: RW1 n i=1 q i A false true n i=1 q i RW2 n i=1 q i E false ind true n i=1 q i where n 1 and each q i, 1 i n, is a literal. The intuition of the eventuality resolution rule ERES1 below is to resolve an eventuality A l, which states that l is true on all paths, with a set of SNF g clauses which together, provided that their combined left-hand sides were true, imply that l holds on (at least) one path. ERES1 P E E l Q A l Q A( (P ) W l) where P E E l represents a set Λ E of SNF g clauses P 1 1 C1 1 P n 1 Cn 1. P 1 m 1 C 1 m 1 P n m n C n m n with each either being empty or being an operator in {A } {E ind ind Ind} and for every i, 1 i n, and ( m i j=1 Ci j ) l (1) ( m i j=1 Ci j ) ( n mi i=1 are provable. Furthermore, P = n i=1. j=1 P j i) (2) mi j=1 P j i.

6 L. Zhang et al. / -RP: A Computational Tree Logic Resolution Prover Conditions (1) and (2) ensure that the set Λ E of SNF g clauses implies P E E l. Note that the conclusion of ERES1 is not stated in normal form. To present the conclusion of ERES1 in normal form, we use a new atomic proposition w l A uniquely associated with the eventuality A l. Then the conclusion of ERES1 can be represented by the following set of SNF g clauses: {w A l A ( l ( m i b=1 P i b ) 1 i n} {true Q l ( m i b=1 P i b ) 1 i n} {true Q l w A l, wa l A ( l wa l )}. The use of a proposition w l A uniquely associated with the eventuality A l is important for the termination of our procedure. If we were to use a new proposition each time we need to transform the conclusion of an application of ERES1 into normal form, then even the repeated application of ERES1 to the same set of premises would lead to distinct sets of SNF g clauses as conclusion (which would also not be equivalent to each other or subsume each other). This in turn would mean that we could generate an infinite number of SNF g clauses during a derivation. In contrast, the use of atomic propositions uniquely associated with A-eventualities allows us to represent any resolvents by ERES1 using a fixed set of propositions depending only on the initial set of clauses, i.e., n different A-eventualities in the initial set of clauses require at most n new atomic propositions to represent resolvents by ERES1. Similar to ERES1, the intuition underlying the ERES2 rule is to resolve an eventuality E l LC(ind), which states that l is true on the path given by [LC(ind)], with a set of SNF g clauses which together, provided that their combined left-hand sides were true, imply that l holds on the same path. ERES2 P E (E l LC(ind) ) ind Q E l LC(ind) Q E( (P ) W l) LC(ind) where P E (E l LC(ind) ) ind represents a set Λ ind E of SNFg clauses P 1 1 C1 1 P n 1 Cn 1.. Pm 1 1 Cm 1 1 Pm n n Cm n n with each either being empty or being an operator in {A,E ind } and for every i, 1 i n, and ( m i j=1 Ci j ) l (3) ( m i j=1 Ci j ) ( n mi i=1 j=1 P j i) (4) are provable. Furthermore, P = n mi i=1 j=1 P j i. Again, conditions (3) and (4) ensure that the set Λ ind E of SNFg clauses implies the formula P E (E l LC(ind) ) ind. Also, as for ERES1, the conclusion of ERES2 is not in normal form. This time we use an atomic proposition w ind l uniquely associated with l LC(ind) to represent the resolvent of ERES2 as the following set of SNF g clauses: {w l ind E ( l ( m i b=1 P b i) ind 1 i n} {true Q l ( m i b=1 P b i) 1 i n} {true Q l w l ind, w l ind E ( l w l ind) ind }. As for ERES1, the use of atomic propositions uniquely associated with E-eventualities allows us to represent any resolvents by ERES2 using a fixed set of atomic propositions depending only on the initial set of clauses. The expensive part of applying ERES1 and ERES2 is finding sets of step and global clauses which can serve as premises for these rules, that is, for a given literal l stemming from some eventuality, to find sets of SNF g clauses Λ E, satisfying conditions (1) and (2), and Λ ind E, satisfying conditions (3) and (4). Such sets of SNF g clauses are also called E-loops in l and the formula n mi i=1 j=1 P j i is called a loop formula. Algorithms to find loops were first presented by Bolotov and Dixon in [6]. They define two loop search algorithms, called A-loop search algorithm and E-loop search algorithm. An A-loop search algorithm is not required for our calculus as an E-loop search algorithm is sufficient to find the premises for both ERES1 and ERES2. Therefore, we only present an E-loop search algorithm here. In Section 5 we will discuss in more detail why an A-loop search algorithm is not required in our setting, while Section 4 we present in more detail how the E-loop search algorithm can be implemented. The E-loop search algorithm makes use of the notion of merged clauses which is inductively defined as follows. Any global clause, A-step clause,

L. Zhang et al. / -RP: A Computational Tree Logic Resolution Prover 7 and E-step clause is a merged clause. If A 1 AB 1, A 2 AB 2, A 3 A B 3, A 4 A B 4, A 5 E B 5 ind, and A 6 E B 6 ind are merged clauses, then so are (A 1 A 2 ) A(B 1 B 2 ), (A 1 A 4 ) A (B 1 B 4 ), (A 1 A 6 ) E(B 1 B 6 ) ind, (A 3 A 4 ) A (B 3 B 4 ), (A 3 A 6 ) E(B 3 B 6 ) ind, and (A 5 A 6 ) E(B 5 B 6 ) ind. E-loop search algorithm: The algorithm takes as input a literal l, stemming either from an A-sometime clause Q A l or from an E-sometime clause Q E l LC(ind), and a set T of SNF g clauses among which we search for premises for the eventuality resolution rules. We assume the set T is saturated by step resolution, that is, rules SRES1 to SRES8. The algorithm proceeds as follows: 1. Search in T for all the clauses of the form X j l, X j A l, and X j E l ind. Assuming there are m 0 such clauses, we build the first node as follows: H 0 = m 0 j=0 X j Simplify H 0 using boolean simplification. If H 0 true a loop is found, we return true and the algorithm terminates. If H 0 false (which can only be the case if m 0 = 0), then no loop formula can be found and we return false. 2. Given a node H i, where i 0, build the next node H i+1 by looking in T for merged clauses of the form A j A (B j l) or A j E (B j l) ind such that B j H i is provable (in propositional logic). Assuming there are m i+1 such merged clauses, we build the node H i+1 as follows: H i+1 = m i+1 j=0 A j Simplify H i+1 using boolean simplification. 3. Repeat the previous step until one of the conditions below is provable (in propositional logic). (a) H i+1 true. A loop formula has been found. We return true and the algorithm terminates. (b) H i+1 false (i.e., m i+1 = 0). No loop formula can be found. We return false and the algorithm terminates. (c) H i H i+1. A loop formula has been found. We return H i+1 and the algorithm terminates. If we try to resolve an E-sometime clause Q E l LC(ind), then the input set T to the E-loop search algorithm consists of the set of all global and A-step clauses we currently have at our disposal plus all E-step clauses with index ind. If we try to resolve an A-sometime clause Q A l, then the input set T to the E-loop search algorithm consists of the set of all global, A-step clauses, and E-step clauses. An important step in the algorithm is the task of looking for merged clauses, which is again nontrivial. We will discuss this problem in more detail in Section 4. 3.4. Properties of SNF g and R,S We introduce some definitions before we discuss properties of R,S. A derivation from a set T of SNF g clauses by R,S is a sequence T 0, T 1, T 2,... of sets of clauses such that T = T 0 and T i+1 = T i R i where R i is a set of clauses obtained as the conclusion of the application of a resolution rule to premises in T i. A refutation of T (by R,S ) is a derivation from T such that form some i 0, T i contains a contraction. A derivation terminates iff either a contradiction is derived or if no new clauses can be derived by further application of resolution rules. The calculus R,S is sound and complete. We first show that R,S is sound. Theorem 2 (Soundness of R,S ) Let T be a set of SNF g clauses. If there is a refutation of T by, then T is unsatisfiable. R,S Proof. The soundness of SRES1 to SRES4, ERES1 and ERES2 has been established in [5]. So we only need to prove the soundness of SRES5 to SRES8, RW1 and RW2. Let T 0, T 1,..., T n be a derivation from a set of SNF g clause T = T 0 by the calculus R,S. We will show by induction over the length of the derivation that if T 0 is satisfiable, then so is T n. For T 0 = T, the claim obviously holds. Now, consider the step of the derivation in which we derive T i+1 from T i for some i 0. Assume T i is satisfiable and M = S, R, L, [ ], s 0 is a model structure satisfying T i.

8 L. Zhang et al. / -RP: A Computational Tree Logic Resolution Prover Assume A (true C l) and A (start D l) are in T i. Let T i+1 be obtained by an application of SRES5 to A (true C l) and A (start D l), i.e., T i+1 = T i {A (start C D)}. We show that M also satisfies T i+1. Consider an arbitrary state s S. If s is not s 0, then obviously M, s = start C D because start is false at the state s. Assume the state s is s 0. From M, s = A (true C l) and M, s = A (start D l) and the semantics of A, we obtain M, s = true C l and M, s = start D l. From the semantics of true, and start, we obtain M, s = C l and M, s = D l. As l and l can not both be true at state s in M, we conclude M, s = C D. As s is s 0, then from the semantics of start we have M, s = start C D. Since start C D holds in s 0 and all other states, from the semantics of A we conclude M, s = A (start C D). Thus the model structure M satisfies T i+1, T i+1 is satisfiable and SRES5 is sound. For rules SRES6 to SRES8, the proofs are analogous to that for SRES5. Regarding RW1, from the semantics of A and false we obtain that the formula A ( n i=1 Q i A false) is true iff A ( n i=1 Q i false) is true. This formula is propositionally equivalent to A ( n i=1 Q i) which in turn, by the semantics of and true, is equivalent to A (true n i=1 Q i). The proof for RW2 is similar. We give a sketch of the completeness proof for the calculus R,S (the full completeness proof can be found in [28]). Theorem 3 (Completeness of R,S ) If a set T of SNF g clauses is unsatisfiable, then T has a refutation using the resolution rules SRES1 to SRES8, ERES1 and ERES2 and the rewrite rules RW1 and RW2. Proof (Sketch). First, we construct a so-called labelled behaviour graph, a finite directed graph H = (N, E), for a set T of SNF g clauses and a finite set Ind of indices occurring in T, where N is a set of nodes and E is a set of ind-labelled edges. We call a node n N an ind-successor of a node n N, where ind Ind, iff there is an edge in E from the node n to the node n labelled with ind. Let V be a valuation of the propositions occurring in T. Let E A be a subset of the literals that occur on the right-hand side of A-sometime clauses in T and E E be a subset of {l LC(ind) Q E l LC(ind) T }. Then the triple n = (V, E A, E E ) is a node in H. Informally, E A contains those eventualities of A-sometime clauses that need to be satisfied either in the current node or some successor node. E E contains eventualities of E-sometime clauses that need to be satisfied either in the current node or some ind-successor node. We construct an edge from the node n = (V, E A, E E ) to the node n = (V, E A, E E ) labelled with the index ind, if the following three requirements are satisfied by n and n. First, V and V satisfy all A-step clauses (i.e., if V = ϕ and ϕ A ψ T, then V = ψ), E-step clauses related with ind (i.e., if V = ϕ and ϕ E ψ ind T, then V = ψ) and global clauses in T (i.e., if true ψ T, then V = ψ). Second, E A must exactly contain all unsatisfied eventualities in E A (i.e., if ψ E A and V = ψ, then ψ E A ) and A-eventualities triggered by V (i.e. if V = ϕ and ϕ A ψ T, then ψ E A ). Third, E E must exactly contain all unsatisfied eventualities labelled with ind in E E (i.e. if ψ LC(ind) E E and V = ψ then ψ LC(ind) E E ) and E-eventualities triggered by V (i.e. if V = ϕ and ϕ E ψ LC(ind) T, then ψ LC(ind) E E ). A node n = (V, E A, E E ) such that V satisfies all right-hand sides of initial clauses and global clauses and E A and E E only include the eventualities triggered by V is an initial node. We define the labelled behaviour graph for a set of SNF g clauses T as the set of nodes and edges reachable from the initial nodes. Such a labelled behaviour graph can be constructed whether T is satisfiable or not. To determine whether T is satisfiable and to be able to construct a model structure from a labelled behaviour graph, some nodes or subgraphs may have to be deleted. To this end we first need to define two types of subgraphs. Given a label ind Ind and a labelled behaviour graph (N, E), then a subgraph (N, E ) is an ind-labelled terminal subgraph for l LC(ind) of (N, E) iff N N and E E; and for every node n N and for every edge (n, ind, n ) E, n N and (n, ind, n ) E ; and for every node n = (V, E A, E E ) N, l LC(ind) E E and V = l.

L. Zhang et al. / -RP: A Computational Tree Logic Resolution Prover 9 Given a set of labels Ind and a labelled behaviour graph (N, E), a graph (N, E ) is a terminal subgraph for l of (N, E) iff N N and E E; and for every node n N there exists some index ind Ind such that for all edges (n,ind, n ) E, n N and (n, ind, n ) E ; and for every node n = (V, E A, E E ) N, the eventuality l E A and V = l. We can now define and motivate four deletion rules. First, a node without any outgoing edges must be removed because in a model structure every node must have successors. Second, a node that has no ind-labelled outgoing edges, for some ind Ind, must be removed because the semantics of indices in SNF g requires [ind] to be a function, i.e., a serial relation, for every ind Ind. Third, a terminal subgraph for an eventuality l must be removed because of the semantics of A l. Fourth, an ind-labelled terminal subgraph for an eventuality l LC(ind) must be removed because of the semantics of E l LC(ind). If we apply these four deletion rules to a labelled behaviour graph until no further nodes or subgraphs can be removed, then the resulting graph is a reduced labelled behaviour graph H red. We are able to prove that a set T of SNF g clauses is unsatisfiable if and only if its reduced labelled behaviour graph is empty, by constructing a model structure satisfying T from a nonempty reduced labelled behaviour graph for T and vice versa. We can also prove that the first and second deletion rule corresponds to a series of step resolution inferences apply SRES1 to SRES8 deriving clauses of the form P A false and Q E false ind, respectively. The rewrite rules RW1 and RW2 will replace these by the simpler clauses true P and true Q, respectively. We can show that removal of terminal subgraphs, i.e., the third deletion rule, and ind-labelled terminal subgraphs, i.e., the fourth deletion rule, corresponds to applications of ERES1 and ERES2, respectively. Therefore, if T is unsatisfiable, then H red is empty and the sequence of applications of the deletion rules which reduces H to an empty H red can be used to construct a refutation in our calculus. Theorem 4 Any derivation from a set T of SNF g clauses by the calculus R,S terminates. Proof. Let T be constructed from a set P of n atomic propositions and a set Ind of m indices. Then the number of SNF g clauses constructed from P and Ind is finite. We can have at most 2 2n initial clauses, 2 2n global clauses, 2 4n A- step clauses, m 2 4n E-step clauses, n 2 2n+1 A- sometime clauses, and m n 2 2n+1 E-sometime clauses. In total, there could be at most (m + 1)2 4n + (m n + n + 1)2 2n+1 different SNF g clauses. Any derivation from a set of SNF g clauses by the calculus R,S will terminate when either no more new clauses can be derived or a contradiction is obtained. Since there is only a bounded number of different SNF g clauses, one of these two conditions will eventually be true. Next we consider the complexity of R,S. We call a clause which is either an initial, a global, an A-step, or an E-step clause a determinate clause. based deci- Theorem 5 The complexity of a R,S sion procedure is EXPTIME. Proof. Assume a set of SNF g clauses is constructed from a set P of n propositions and a set Ind of m indices. The cost of deciding whether a step resolution rule can be applied to two determinate clauses is A = 4n 2 + 1 in the worst case. From the proof of Theorem 4, we know the number of determinate clauses is at most B = 2 2n + 2 2n + 2 4n + m 2 4n. Therefore, to naively compute a new clause from an application of some step resolution rule, we might need to look at C = B(B 1) 2 combinations of two clauses and the associated cost is (C A). Moreover, to decide whether the resolvent is a new clause or not, we need to compare the resolvent with at most B clauses and the cost is D = B (A+4n 2 ). In the worst case such that each combination generates a resolvent but it exists and only the last combination gives a new clause, to gain a new clause from an application of some step resolution rule, the complexity is of the order (C A D), that is, EXPTIME. To compute a new clause from an application of some eventuality resolution rule, the complexity depends on the complexity of the so-called loop search algorithm which computes premises for the eventuality resolution rules [6]. The loop search algorithm is a special case of that of the PLTL loop search algorithm [11] which has been shown to be in EXPTIME and we can show that the complexity of the loop search algorithm

10 L. Zhang et al. / -RP: A Computational Tree Logic Resolution Prover from [6] is also in EXPTIME. Since a new clause is produced by an application of either step resolution or eventuality resolution, the complexity of generating a new clause is of the order EXPTIME. According to the proof of Theorem 4, there can be at most (m+1)2 4n +(m n+n+1)2 2n+1 different SNF g clauses. Therefore, we conclude the complexity of the calculus R,S is of the order EXP- TIME. 4. Implementation Currently the mainstream of first-order theorem provers are utilising the first-order ordered resolution with selection calculus [4]. In order to reuse those highly refined theorem provers, we adopt an approach analogous to that used in [20] to implement a resolution calculus for PLTL to implement the calculus R,S and the associated decision procedure for. A formal description of the approach and related proofs are presented in detail in [28]. First, we transform all SNF g clauses except A-sometime clauses and E-sometime clauses into first-order clauses. Then we are able to use firstorder ordered resolution with selection to emulate step resolution. A and E-sometime clauses cannot be translated to first-order logic. Therefore, we continue to use the rules ERES1 and ERES2 for inferences with A- and E-sometime clauses, respectively, and use the loop search algorithm presented in Section 3.3 to find suitable premises for these rules. We utilise first-order ordered resolution with selection to perform the task of looking for merged clauses in the loop search algorithm and we compute the results of applications of the eventuality resolution rules in the form of first-order clauses. 4.1. Preliminaries of first-order ordered resolution with selection We introduce several necessary notions before we start, following their definition in [4]. Let F, P and V be three pairwise disjoint (countable) sets. The elements of F are called function symbols, the elements of P predicate symbols, and the elements of V variables. Each element of F and P is associated with an arity n N 0. The pair (F, P) is a signature. A term is either a variable or an expression f(t 1,...,t n ) where f is a function symbol of arity n and t 1,..., t n are terms. For a term t = f(t 1,...,t n ) the terms t 1,..., t n are called the arguments of t. A term is ground if it does not contain variables, i.e., it is an element of T(F, ). Let T(F, V) denote the set of all terms built from function symbols in F and variables in V. The depth dp(t) of a term is inductively defined as (i) if t is a variable or a constant then dp(t) = 1, and (ii) if t = f(t 1,..., t n ), then dp(t) = 1 + max({dp(t i ) 1 i n}). An atom is an expression p(t 1,...,t n ) where t 1,..., t n are terms in T(F, V) and p is a predicate symbol of arity n in P. A literal is an expression A (a positive literal) or A (a negative literal) where A is an atom. For a literal L = ( )p(t 1,...,t n ) the terms t 1,..., t n are the arguments of L. A literal is ground if all its arguments are ground. The depth dp(l) of a literal L = ( )p(t 1,...,t n ) is given by max({dp(t i ) 1 i n}) if the arity of p is greater than zero, and dp(l) = 0 otherwise. A first-order clause C = L 1... L n is a multiset of literals with variables implicitly assumed to be universally quantified. A subclause D of a clause C is a sub-multiset D of C. A strict subclause D of a clause C is a subclause of C not identical to C. The depth dp(c) of a clause C is given by max({dp(l) L C}) if C is non-empty, and dp(c) = 0 otherwise. We assume that the notions of a substitution, a most general unifier, an instance, etc, are defined in the usual way. A condensation Cond(C) of a clause C is a minimal subclause of C which is also an instance of it. A clause C is condensed if there exists no condensation of C which is a strict subclause of C. Note that the condensation Cond(C) of a clause C is either identical to C or is a strict subclause of C which is a factor of C and which makes C redundant according to the definition of redundancy we give below. An atom ordering is a well-founded, total ordering on ground atoms. For two non-ground atoms A and B we define A B if Aσ Bσ for all ground instances Aσ and Bσ. As for the propositional case, the ordering is extended to literals by identifying each positive literal p with the singleton multiset {p} and each negative literal p with the multiset {p, p} and comparing such multisets of first-order atoms by using the multiset

L. Zhang et al. / -RP: A Computational Tree Logic Resolution Prover 11 extension of. Also, the notion of a (strictly) maximal literal with respect to a clause C is again defined as in the propositional case. Finally, the multiset extension of the literal ordering induces an ordering on ground clauses. A selection function S assigns to each clause C a possibly empty set of occurrences of negative literals in C. If C is a clause, then the literals in S (C) are called selected. The resolution calculus R,S is parameterised by an atom ordering and a selection function S, and consists of the following two inference rules: Ordered resolution with selection where C A B D (C D)σ 1. σ is the most general unifier of A and B. 2. No literal is selected in C and Aσ is strictly -maximal with respect to Cσ. (We say that A is eligible in C A for the substitution σ.) 3. B is selected in B D or no literal is selected in D and Bσ is -maximal with respect to Dσ. (We say that B is eligible in B D for the substitution σ.) Ordered positive factoring with selection where C A B (C A)σ 1. σ is the most general unifier of A and B. 2. No literal is selected in C and Aσ is - maximal with respect to Cσ. Given a set N of clauses and a clause C, then C is redundant in N if for all ground substitutions σ there exist clauses C 1,..., C n, n 0, in N and ground substitutions σ j such that C 1 σ 1,..., C n σ n = Cσ and Cσ C i σ i for every i, 1 i n. A set N is saturated (up to redundancy) with respect to R,S if all clauses that can be derived by an application of the rules of R,S to non-redundant premises in N are either contained in N or else are redundant in N. For a set N 0 of clauses, a derivation from N 0 is a sequence of clause sets N 0, N 1,..., where for every i, i 0, N i+1 = N i {C} and C is derived by applying a R,S inference rule to premises in N i, or N i+1 = N i \ {C} and C is redundant in N i. A derivation N 0, N 1,... is a refutation (of N 0 ) if for some i, 0 i, N i contains the empty clause. We say a derivation N 0, N 1,... from N 0 terminates if for some i, 0 i, N i is saturated up to redundancy. A derivation N 0, N 1,... is fair if every clause C that can be deduced from non-redundant premises in the limit N = j k j N k is contained in some set N j. R,S is a sound and complete refutation calculus [4]: for a set of clauses N 0 and fair derivation N 0, N 1,... from N 0, N 0 is unsatisfiable iff the clause set j N j contains the empty clause. Furthermore, if for some i 0, N i is saturated up to redundancy, then N 0 is unsatisfiable iff N i contains the empty clause. 4.2. Representing determinate SNF g clauses as first-order clauses In order to represent every determinate SNF g clause by a first-order clause we uniquely associate every propositional variable p with a unary predicate symbol Q p. Besides these predicate symbols we assume that our first-order vocabulary includes a countably infinite set of variables x, y,..., a constant 0, a binary function symbol app, and for every ind Ind a constant s ind. The constant 0 represents the root s 0 S in an extended model structure M = S, R, L, [ ], while a constant s ind represents [ind]. The variables x and y quantify over states in M, and the variable s quantifies over the successor functions [ind] with ind Ind. The first-order atom Q p (x), represents that p holds at a state x, while Q p (0) represents that p holds at the state s 0. The first-order term app(s, x) represents the state resulting from the application of the successor function s to the state x, while app(s ind, x) represents the state resulting from the application of the successor function [ind] to the state x. Then the first-order atoms Q p (app(s, x)) and Q p (app(s ind, x)) represent that p holds at states app(s, x) and app(s ind, x), respectively. Finally, for a disjunction of propositional literals C = ( )p 0... ( )p n, let C (t), where t is

12 L. Zhang et al. / -RP: A Computational Tree Logic Resolution Prover term, denote the first-order clause ( )Q p0 (t)... ( )Q pn (t). We are then able to represent every initial, global, A-step and E- step clause Γ by a first-order clause Γ as follows: 1. An initial clause start C is represented by C (0) 2. A global clause true C is represented by C (x) 3. An A-step clause P A C is represented by P (x) C (app(s, x)) 4. An E-step clause P E C ind is represented by P (x) C (app(s ind, x)) Note that it is possible for C to be empty in an A-step clause P A C or an E-step clause P E C ind. In our calculus, such clauses are subject to the rewrite rules RW1 and RW2, and would both be replaced by the global clause true P. We see that in our first-order representation of determinate SNF g clauses, for an empty clause C, the SNF g clauses P A C, P E C ind, and true P all have the same representation, namely, P (x). Thus, on the first-order level, the rewrite rules RW1 and RW2 are superfluous. 4.3. Implementing step resolution The representation of determinate SNF g clauses by first-order clauses allows for all our step resolution rules to be implemented using the ordered first-order resolution with selection calculus presented in Section 4.1. To this end, we have to define the atom ordering and selection function on the first-order level in such a way that they mirror their definition on the propositional level. Regarding the first-order atom ordering, note that our signature only contains unary predicate symbols. Let be a propositional atom ordering. Then we allow to be any ground first-order atom ordering such that Q q (s) Q p (t) if (i) dp(s) > dp(t); or (ii) dp(s) = dp(t) and q p. According to this definition, lifted to the nonground level, we have Q w (app(s ind app(s ind, x), )) Q p (app(s ind, x)) Q q (x), for any predicate symbols Q p, Q q, Q w, and constants s ind and s ind, and Q q (app(s ind, x)) Q p (app(s ind, x)) Q q (x) Q p (x) provided q p. Regarding the first-order selection function S, we use the close correspondence between determine SNF g clauses and their first-order representation to define S as follows: 1. A literal l (0) is selected in C (0) by S iff l is selected by S in C; 2. A literal l (x) is selected in C (x) by S iff l is selected in C by S; 3. A literal l (app(s, x)) is selected in P (x) C (app(s, x)) by S, with C being non-empty, iff l is selected in C by S; 4. A literal l (app(s ind, x)) is selected in P (x) C (app(s ind, x)) by S, with C being non-empty, iff l is selected in C by S. There is one more complication that we need to overcome. In the case of SNF g clauses, we have made the simplifying assumption that the conjunctions and disjunctions of propositional literals occurring in these clauses do not contain duplicate occurrences of the same literals, thus avoiding the need for factoring inference rules in our calculus. For example, resolving two global clauses Γ 1 = true p q and Γ 2 = true p q simply results in Γ 3 = true q. However, for first-order clauses we have followed the definition of clauses as multisets of first-order literals. Thus, resolving Γ 1 = Q p (x) Q q (x) with Γ 2 = Q p (x) Q q (x) results in Q q (x) Q q (x), which is not identical to Γ 3 = Q q (x). To eliminate this mismatch, we require that on the first-order level all clauses are kept in condensed form, that is, every first-order clauses C is replaced by its condensation Cond(C). In our example, we have Cond(Q q (x) Q q (x)) = Q q (x) = Γ 3. We are then able to establish the following correspondence between R,S inferences on determinate SNF g clauses and R,S inferences on their first-order representation. Theorem 6 Let and S be an atom ordering and selection function, respectively, for R,S and let and S be a corresponding atom ordering and a corresponding selection function, respec-

L. Zhang et al. / -RP: A Computational Tree Logic Resolution Prover 13 An application of SRES2 P E (C l) ind Q A (D l) P Q E (C D) ind where l is eligible in C l and l is eligible in D l can be emulated by the following inference using ordered resolution with selection P (x) C (app(s ind, x)) Q l (app(s ind, x)) Q (y) D (app(z, y)) Q l (app(z, y)) Cond( P (x) Q (x) C (app(s ind, x)) D (app(s ind, x))) where the definition of and S ensures that Q l (app(s ind, x)) and Q l (app(z, y)) are both eligible in their respective clauses for the substitution σ. Fig. 3. Emulating SRES2 inferences in first-order logic An application of SRES3 P E (C l) ind Q E (D l) ind P Q E (C D) ind where l is eligible in C l and l is eligible in D l can be emulated by the following inference using ordered resolution with selection P (x) C (app(s ind, x)) Q l (app(s ind, x)) Q (y) D (app(s ind, y)) Q l (app(s ind, y)) Cond( P (x) Q (x) C (app(s ind, x)) D (app(s ind, x))) where the definition of and S ensures that Q l (app(s ind, x)) and Q l (app(s ind, y)) are both eligible in their respective clauses for the substitution σ. Note that Q l (app(s ind, x)) and Q l (app(s ind, y)) are only unifiable if ind = ind. Fig. 4. Emulating SRES3 in first-order logic tively, for R,S. Let Γ 1 and Γ 2 be two determinate SNF g. Then a determinate clause Γ 3 is derivable from Γ 1 and Γ 2 by SRES1 to SRES8 in R,S iff there exists a clause C derivable from Γ 1 and Γ 2 by R,S such that Γ 3 is a condensation of C. Proof (Sketch). Our definition of S and ensures that there is a one-to-one correspondence between eligible literals in determinate SNF g clauses and eligible literals in the first-order representation of these clauses. This allows us to show that for any inference by SRES1 to SRES8 there is a corresponding inference by R,S. Figures 3, 4 and 5 show this relationship for inferences by SRES2, SRES3 and SRES7. In addition, we have to show that, provided we keep first-order clauses in condensed form, R,S does not allow additional inferences which do not have a correspondence by SRES1 to SRES8. This is partly achieved by the representation of determinate clauses itself and first-order unification. For example, we cannot resolve the unit clause Q q (0), representing start q, with the unit clause Q q (app(s, x)), representing true A q, because the two literals do not unify. In addition, it is again the atom ordering and the selection function S which prevent certain inferences. For example, we cannot resolve Q q (0) with the literal Q q (x) in Q q (x) Q p (app(s, x)), representing q A p, as Q q (x) is not eligible in this clause: Condition (i) in the definition of ensures that Q p (app(s, x))σ Q q (x)σ for any substitution σ and S is defined in such a way that Q q (x) is not selected. Finally, condensation ensures that the ordered factoring with seleciton rule of R,S is not applicable.

14 L. Zhang et al. / -RP: A Computational Tree Logic Resolution Prover An application of SRES7 true C l Q E (D l) ind Q E (C D) ind where l is eligible in C l and l is eligible in D l can be emulated by the following inference using ordered resolution with selection C (x) Q l (x) Q (y) D (app(s ind, y)) Q l (app(s ind, y)) Cond( Q (y) C (app(s ind, y)) D (app(s ind, y))) where the definition of and S ensures that Q l (x) and Q l (app(s ind, y)) are both eligible in their respective clauses for the substitution σ. Fig. 5. Emulating SRES7 in first-order logic This establishes the desired one-to-one correspondence between inferences by SRES1 to SRES8 and inferences by R,S. 4.4. Implementing eventuality resolution To implement the eventuality resolution rules ERES1 and ERES2, we will need to augment a first-order theorem prover with an implementation of the E-loop search algorithm defined in Section 3.3. Figure 6 shows the pseudocode for the implementation of this algorithm in our prover - RP. The procedure eres takes as input a set T of determinate clauses, which we assume to be saturated under the step resolution rules SRES1 to SRES8 and the rewrite rules RW1 and RW2, and a A-sometime clause or E-sometime clause C. As stated in Section 3.3, if C is an A-sometime clause Q A l, then the loop search algorithm considers all global, A-step clauses, and E-step clauses in T, while if C is an E-sometime clause Q E l LC(ind), then the loop search we try to resolve an E-sometime clause algorithm considers all global, A-step clauses, all E-step clauses with index ind in T. Lines 5 to 9 of our algorithm implement this case distinction and store the set of clauses that needs to be considered in a set SOS. The main part of the algorithm, lines 12 to 25, consists of a loop in which we construct a sequence of formulae H 1 (x), H 0 (x), H 1 (x),... until one of the three termination conditions is satisfied: (a) if H i (x) is equivalent to true, then we use the procedure eresolvent to return the resolvents for C and the loop true (lines 17 and 18); (b) if H i (x) is equivalent to false, then no loop can be found and we return the empty set of resolvents (lines 19 and 20); (c) if H i (x) is equivalent to H i 1 (x), then we again use the procedure eresolvent to return the resolvents for C and the loop H i (x) (line 21 and 22). Line 13 to 16 deal with the construction of the formula H i (x) for the current index i. Recall from Section 3.3 that to construct H i, we need to look for merged clauses A j A (B j l) or A j E (B j l) ind such that B j H i 1 (or, equivalently, A B j A H i 1 ). To do so, we construct a set of goal clauses Goals with each clause containing the literal Q l (app(s,x)), the first-order representation of A l and a disjunct from H i 1 (app(s, x)), the first-order representation of A H i 1. When trying to prove these goal clauses using the clauses in SOS, all newly derived clauses of depth one or less would be the first-order representations of the A j s that we look for. To make it easier to identify newly derived clauses, we add a literal ls(x), where ls is a new unary predicate symbol, to each of the goal clause. As there are no negative occurrences of ls(x) in SOS, ls(x) occurs in all clauses derived from our goal clauses. In Figure 6, line 13 constructs the goal clauses, line 14 calls the resolution sos procedure to saturate SOS Goals using a set of support strategy, line 15 collects all newly derived clauses of depth one or less from the saturated set using the literal ls(x) to identify newly derived clauses, and, finally, line 16 computes H i (x). The following example illustrates how our implementation of the loop search algorithm works. The set T consists of the three SNF g clauses a A l, b A l, and a a ind and we are looking for a loop in l. The first-order representation of these clauses is given by