On the Complexity of Elementary Modal Logics
Modal logics are widely used in computer science. The complexity of modal satisfiability problems has been investigated since the 1970s, usually proving results on a case-by-case basis. We prove a very general classification for a wide class of relev…
Authors: Edith Hemaspa, ra, Henning Schnoor
On the Complexit y of Elemen tary Mo dal Logics ? Edith Hemaspaandra and Henning Sc hno or Departmen t of Computer Science, Rochester Institute of T ec hnology , Ro c hester, NY 14623, U.S.A. eh@cs.rit.edu, hs@cs.rit.edu Abstract. Mo dal logics are widely used in computer science. The complexit y of mo dal satisfiability problems has b een inv estigated since the 1970s, usually proving results on a case-b y-case basis. W e pro ve a v ery general classification for a wide class of relev an t logics: Many imp ortan t sub classes of mo dal logics can b e obtained b y restricting the allow ed mo dels with first-order Horn formulas. W e show that the satisfiabilit y problem for each of these logics is either NP-complete or PSP ACE-hard, and exhibit a simple classification criterion. F urther, we prov e matching PSP ACE upp er bounds for many of the PSP ACE-hard logics. 1 In tro duction Mo dal logics hav e prov en to b e a v aluable to ol in mathematics and computer science. The tra- ditional uni-mo dal logic enric hes the prop ositional language with the op erator ♦ , where ♦ ϕ is in terpreted as ϕ p ossibly holds . The usual semantics in terpret modal formulas o v er graphs, where ♦ ϕ means “there is a successor w orld where ϕ is true.” In addition to their mathemat- ical interest, mo dal logics are widely used in practical applications: In artificial intelligence, mo dal logic is used to model the knowledge and b eliefs of an agent, see e.g. [BZ05]. Mo dal log- ics also can b e applied in cryptographic and other proto cols [FHJ02,CDF03,HMT88,LR86]. F or man y sp ecific applications, there exist tailor-made v ariants of mo dal logics [BG04]. Due to the v ast num b er of applications, complexity issues for mo dal logics are very relev ant, and hav e b een examined since Ladner’s seminal w ork [Lad77]. Dep ending on the application, mo dal logics with different prop erties are studied. F or example, one might wan t the formula ϕ = ⇒ ♦ ϕ to b e an axiom—if something is true, then it should b e considered p ossible. Or ♦♦ ϕ = ⇒ ♦ ϕ —if it is p ossible that ϕ is possible, then ϕ itself should b e p ossible. Classical results [Sah73] show that there is a close corresp ondence b etw een mo dal logics defined by axioms and logics obtained by restricting the class of considered graphs. Requiring the axioms mentioned ab ov e corresp onds to restricting the classes of graphs to those whic h are reflexive or transitiv e, resp ectively . Determining the complexity of a given mo dal logic, defined either by the class of considered graphs or via a mo dal axiom system, has b een an active line of research since Ladner’s results. In particular, the complexity classes NP and PSP ACE ha ve b een at the cen ter of attention. Most complexity results hav e b een on a case-by-case basis, pro ving results for indi- vidual logics b oth for standard modal logics and v ariations lik e temp oral or h ybrid log- ics [HM92,Ngu05,SC85]. Examples of more general results include Halp ern and R ˆ ego’s pro of that logics including the ne gative intr osp e ction axiom, which corresp onds to the Euclidean graph prop ert y , hav e an NP-complete satisfiability problem [HR07]. In [SP06], Schr¨ oder and P attinson sho w a w a y to prov e PSP ACE upp er b ounds for mo dal logics defined by mo dal ax- ioms of mo dal depth 1. In [Lad77], Ladner prov ed PSP ACE-hardness for all logics for which ? Supp orted in part by NSF grants CCR-0311021 and IIS-0713061, a F riedrich Wilhelm Bessel Researc h Award, and the DAAD postdo c program. 2 Edith Hemaspaandra and Henning Schnoor reflexiv e and transitive graphs are admissible mo dels. In [Spa93], Hemaspaandra sho wed that all normal logics extending S4.3 ha ve an NP-complete satisfiability problem, and work on the Guar de d F r agment has shown that some classes of modal logics can b e seen as a decidable fragmen t of first-order logic [AvBN98]. While these results give hardness or upp er bounds for classes of logics, they do not pro vide a full case distinction identifying al l “easy” or “hard” cases in the considered class. W e achiev e such a result: F or a large class of mo dal logics containing many important represen tatives, we identify al l cases which hav e an NP-complete satisfiability problem, and sho w that the satisfiability problem for al l other non-trivial logics in that class is PSP ACE- hard. Hence these problems a void the infinitely man y complexit y classes betw een NP and PSP ACE, many of which hav e natural complete problems arising from logical questions. T o our kno wledge, such a general result has not b een achiev ed b efore. T o describ e the considered class of mo dal logics, note that man y relev ant prop erties of mo dal mo dels can b e expresse d by first-order form ulas: A graph is transitive if its edge- relation R satisfies the clause ∀ xy z ( xRy ∧ y Rz = ⇒ xRz ) and symmetric if it satisfies ∀ xy ( xRy = ⇒ y Rx ). Many other graph prop erties can b e defined using similar formulas, where the presence of a certain pattern of edges in the graph forces the existence of another. Analogously to prop ositional logic, w e call conjunctions of such clauses universal Horn for- mulas . Many relev an t logics can b e defined in this wa y: All examples form [Lad77] fall into this category , as w ell as logics ov er Euclidean graphs. W e study the following problem: Giv en a universal Horn form ula ˆ ψ , what is the com- plexit y of the mo dal satisfiabilit y problem ov er the class of graphs defined by ˆ ψ ? The main results of this pap er are the follo wing: First, w e iden tify all cases which give a satisfiabilit y problem solv able in NP (which then for ev ery nontrivial logic is NP-complete), and show that all other cases are PSP ACE-hard. Second, w e prov e a generalization of a “tree-lik e mo del prop erty ,” and use it to obtain PSP ACE upp er b ounds for a large class of logics. As a corollary , we pro v e that Ladner’s classic hardness result is “optimal” in the class of logics defined by univ ersal Horn form ulas. A further corollary is that in the univ ersal Horn class, all logics whose satisfiabilit y problem is not PSP ACE-hard already ha ve the “p olynomial-size mo del prop ert y ,” whic h is only one of several known wa ys to prov e NP upp er b ounds for modal logics. V arious work w as done on restricting the syntax of the mo dal formulas b y restricting the prop ositional op erators [BHSS06], the nesting degree and num b er of v ariables [Hal95] or considering mo dal formulas in Horn form [CL94]. While these results are ab out restricting the syntax of the modal formulas, the current work studies different semantics of mo dal logics, where the seman tics are sp ecified b y Horn formulas. The organization of the pap er is as follows: In Section 2, we introduce terminology and generalize classic complexit y results. Section 3 then establishes techniques to restrict the size of mo dels for modal formulas, which are imp ortan t to ols for the NP-membership later. Section 4 contains the main results of the pap er ab out universal Horn form ulas. After intro- ducing them in Section 4.1 and proving their relationship to homomorphisms in Section 4.2, w e pro ve NP-results for sp ecial cases of Horn formulas in Sections 4.3 and 4.4. Using these results, Section 4.5 then prov es our main dic hotomy result, which is Corollary 4.29. The remainder of the paper establishes PSP ACE upp er b ounds for man y of the PSP ACE-hard logics. An imp ortan t to ol for these pro ofs is introduced in Section 4.6, where we show a tree-like mo del property for all PSP ACE-hard logics defined b y universal Horn formu- las. Section 4.7 con tains our PSP ACE-algorithm, which generalizes many previously known algorithms for mo dal logics. Finally , Section 4.8 obtains a series of corollaries, proving the ab o v e-mentioned optimalit y result for Ladner’s hardness condition, and exhibiting a n umber On the Complexity of Elemen tary Mo dal Logics 3 of cases to which our PSP ACE-algorithm can b e applied. The pap er closes with a summary and op en questions in Section 5. 2 Preliminaries 2.1 Basic concepts and notation Mo dal logic is an extension of propositional logic. A mo dal formula is a prop ositional form ula using v ariables, the usual logical symbols ∧ , ∨ , ¬ , and a unary operator ♦ . (A dual op erator is often considered as well, this can be regarded as abbreviation for ¬ ♦ ¬ .) A model for a mo dal formula is a set of connected “worlds” with individual prop ositional assignments. T o be precise, a fr ame is a directed graph G = ( W, R ) , where the vertices in W are called “w orlds,” and an edge ( u, v ) ∈ R is interpreted as v is “considered possible” from u . A mo del M = ( G, X , π ) consists of a frame G = ( W, R ) , a set X of prop ositional v ariables and a function π assigning each v ariable x ∈ X a subset of W , the set of worlds in which x is true. W e say the mo del M is b ase d on the frame ( W , R ). If F is a class of frames, then a mo del is an F -mo del if it is based on a frame in F . With | M | w e denote the num b er of w orlds in the mo del M . F or a w orld w ∈ W , w e define when a form ula φ is satisfie d at w in M (written M , w | = φ .) If φ is a v ariable x, then M , w | = φ if and only if w ∈ π ( x ). As usual, M , w | = φ 1 ∧ φ 2 if and only if M , w | = φ 1 and M , w | = φ 2 , and M , w | = ¬ φ iff M , w 6| = φ . F or the mo dal op erator, M , w | = ♦ φ if and only if there is a world w 0 ∈ W such that ( w , w 0 ) ∈ R and M , w 0 | = φ . logic name graph prop erty form ula definition K All graphs K ( ˆ ϕ taut ) T reflexive K ( ˆ ϕ refl ) B symmetric K ( ˆ ϕ symm ) K4 transitiv e graphs K ( ˆ ϕ trans ) S4 transitiv e and reflexiv e K ( ˆ ϕ trans ∧ ˆ ϕ refl ) S5 equiv alence relations K ( ˆ ϕ trans ∧ ˆ ϕ refl ∧ ˆ ϕ symm ) T able 1. Common mo dal logics W e no w describe a wa y to define classes F of frames by prop ositional form ulas. The fr ame language is the first-order language containing (in addition to the prop ositional op erators ∧ , ∨ , and ¬ ) the binary relation R . The relation R is interpreted as the edge relation in a graph. Semantics are defined in the obvious w ay , for example, a graph satisfies the formula ˆ ϕ trans := ∀ x, y , z ( xRy ) ∧ ( y Rz ) = ⇒ ( xRz ) if and only if it is transitive. In order to separate mo dal form ulas from first-order formulas, we use ˆ . to denote the latter, i.e., ˆ ϕ is a first-order form ula, while φ is a mo dal form ula. A mo dal logic usually is defined as the set of the formulas prov able in it. Since a formula is satisfiable iff its negation is not prov able, w e can define a logic b y the set of form ulas satisfiable in it. F or a first-order formula ˆ ϕ o ver the frame language, w e define the logic K ( ˆ ϕ ) as the logic in which a mo dal formula φ is satisfiable if and only if there is a mo del M and a w orld w ∈ M such that the frame which M is based on satisfies the first-order formula ˆ ϕ (we simply write M | = ˆ ϕ for this), and M , w | = φ . Such a logic is called elementary . In the case that ˆ ϕ is a universal formula (i.e., ev ery v ariable in ˆ ϕ is universally quantified at the b eginning of the formula), w e call these logics universal elementary . In this wa y , many 4 Edith Hemaspaandra and Henning Schnoor of the classic examples of mo dal logics can b e expressed: In addition to the formula ˆ ϕ trans defined ab o ve, let ˆ ϕ refl := ∀ w ( w Rw ) , and let ˆ ϕ symm := ∀ x, y ( xRy ) = ⇒ ( y Rx ). Finally , let ˆ ϕ taut b e some tautology ov er the frame language, for example let ˆ ϕ taut := ∀ x ( xRx ) = ⇒ ( xRx ). T able 1 in tro duces some common mo dal logics and ho w they can b e expressed in our framew ork. F or a formula ˆ ϕ ov er the frame language, w e consider the following problem: Pr oblem: K ( ˆ ϕ )- SA T Input: A mo dal formula φ Question: Is φ satisfiable in a mo del based on a frame satisfying ˆ ϕ ? As an example, the problem K ( ˆ ϕ trans ) − SA T is the problem to decide if a giv en mo dal form ula can b e satisfied in a transitive frame, and therefore is the same as the satisfiability problem for the logic K4 . It is imp ortan t to note that in the problem K ( ˆ ϕ )- SA T , regard the form ula ˆ ϕ is fixed. It is also in teresting to study the uniform v ersion of the problem, where w e are given a first-order formula ˆ ϕ o v er the frame language and a modal formula ψ, and the goal is to determine whether there exists a graph satisfying b oth. This problem obviously is PSP ACE-hard (this easily follows from Ladner’s Theorem 2.4, in fact, the problem is undecidable). In this pap er, we study the complexity b eha vior of fixe d mo dal logics. When interested in complexit y results for modal logic, the prop ert y of having “small mo dels” is often crucial, as these lead to a satisfiability problem in NP, as long as the class of frames considered is reasonably w ell-b eha ved. Definition 2.1. A mo dal lo gic KL has the p olynomial-size mo del prop ert y , if ther e is a p olynomial p, such that for every KL -satisfiable formula φ, ther e is a KL -mo del M and a world w ∈ M such that M , w | = φ, and | M | ≤ p ( | φ | ) . The follo wing standard observ ation is the basis of our NP-containmen t pro ofs: Prop osition 2.2. L et ˆ ϕ b e a first-or der formula over the fr ame language, such that K ( ˆ ϕ ) has the p olynomial-size mo del pr op erty. Then K ( ˆ ϕ ) - SA T ∈ NP . Pr o of. This easily follo ws from the literature, since for a given graph and a fixed first-order sen tence ˆ ϕ, it can b e chec ked in p olynomial time if the graph satisfies ˆ ϕ . Also, it can b e v erified in p olynomial time if a mo del satisfies a mo dal formula. Hence, the obvious guess- and-v erify approach works for NP-containmen t. Since mo dal logic is an extension of prop ositional logic, the satisfiabilit y problem for every non-trivial mo dal logic is NP-hard. Therefore, proving the p olynomial-size mo del prop ert y yields an optimal upp er complexity b ound for the satisfiabilit y problem for mo dal logics. 2.2 Ladner’s Theorem and Applications In the seminal pap er [Lad77], Ladner show ed PSP ACE-con tainment and PSP ACE-hardness for a v ariety of mo dal logics. In particular, he prov ed that the satisfiability problem for any logic b et ween K and S4 is PSP A CE-hard. In order to state Ladner’s result, we introduce the concept of extensions of a logic, and how it relates to mo dal logics defined by first-order form ulas. F or a mo dal logic KL , an extension of KL is a mo dal logic KL 0 suc h that every formula whic h is v alid (a tautology) in KL is also v alid in KL 0 , or equiv alently such that every formula that is KL 0 -satisfiable is also KL -satisfiable. As an example, ev ery logic that w e consider is an extension of K , and S4 is an extension of K4 . In the case of elementary logics, this is related to an implication of the corresp onding first-order-formulas. In the follo wing, when we say that a formula ˆ ϕ o ver the frame language implies a formula ˆ ψ o ver the frame language, then w e mean that every graph which is a mo del of ˆ ϕ also satisfies ˆ ψ . On the Complexity of Elemen tary Mo dal Logics 5 Prop osition 2.3. L et ˆ ϕ and ˆ ψ b e first-or der formulas over the fr ame language, and let K ( ˆ ϕ ) and K ( ˆ ψ ) b e the c orr esp onding elementary mo dal lo gics. If ˆ ϕ implies ˆ ψ , then K ( ˆ ϕ ) is an extension of K ( ˆ ψ ) . Pr o of. Let φ b e a mo dal formula which is v alid in K ( ˆ ψ ). Then ¬ φ is not K ( ˆ ψ )-satisfiable. No w assume that ¬ φ is K ( ˆ ϕ )-satisfiable. Then there exists a mo del M and a w orld w ∈ M suc h that M , w | = ¬ φ and M is a K ( ˆ ϕ )-mo del, i.e., M | = ˆ ϕ . Since ˆ ϕ implies ˆ ψ , w e know that M | = ˆ ψ , and therefore M is a K ( ˆ ψ )-model. Therefore, ¬ φ is K ( ˆ ψ )-satisfiable, a contradiction. Therefore we know that ¬ φ is not K ( ˆ ϕ )-satisfiable, and hence φ is v alid in K ( ˆ ϕ ). Therefore, it follo ws that K ( ˆ ϕ ) is an extension of K ( ˆ ψ ). Note that the conv erse of Prop osition 2.3 do es not hold. F or example, consider the form ulas ˆ ϕ 1 = ∃ x ( xRx ) , and ˆ ϕ 2 = ∀ x ( xRx ) ∨ ( xRx ). Then ˆ ϕ 2 is a tautology and ˆ ϕ 1 is not, in particular, we know that ˆ ϕ 2 do es not imply ˆ ϕ 1 . But the logics K ( ˆ ϕ 1 ) and K ( ˆ ϕ 2 ) are easily seen to b e identical (and both identical to K ). In particular, they are extensions of eac h other. Ladner’s main result can b e stated as follows: Theorem 2.4 ([Lad77]). 1. The satisfiability pr oblems for the lo gics K , K4 , and S4 ar e PSP ACE -c omplete, and S5 - SA T is NP -c omplete. 2. L et KL b e a mo dal lo gic such that S4 is an extension of KL . Then KL - SA T is PSP ACE - har d. Ladner’s pro of for Theorem 2.4 sho ws some additional results, which we will giv e as a series of corollaries. The construction from Ladner’s proof can b e mo dified to prov e the following result as w ell: Corollary 2.5. L et ˆ ϕ b e a formula over the fr ame language which is satisfie d in every symmetric tr e e or in every r eflexive and symmetric tr e e. Then K ( ˆ ϕ ) - SA T is PSP ACE -har d. Ev en though the proof is just a minor v ariation of Ladner’s pro of, w e give the en tire construction for completeness. W e mention where the adjustmen ts for the symmetric case are. Pr o of. The result follows from a sligh t mo dification of Ladner’s proof for the hardness result in Theorem 2.4. W e follow the presen tation of [BdR V01], where Ladner’s theorem can be found as Theorem 6.50. The pro of shows a reduction from the ev aluation problem for quantified Boolean formulas, QBF . The main strategy is to create from a quan tified form ula χ a mo dal formula φ suc h that in an y satisfying mo del for φ, a complete “quan tifier tree” for the quantifier blo c k of χ can b e found, i.e., a tree where for each existen tially quantified v ariable, one v alue is chosen, and for univ ersally quantified v ariables, b oth alternatives true and false are ev aluated. Let χ = Q 1 p 1 . . . Q m p m θ ( p 1 , . . . , p m ) b e a quantified Bo olean formula, where Q i ∈ {∀ , ∃} , and θ is a prop ositional formula. F rom this w e construct a mo dal formula φ, in which v ariables p 1 , . . . , p m and q 1 , . . . , q m app ear. The p i corresp ond directly to the v ariables of the prop ositional formula, and the q i mark the level of the node in the mo dal mo del: As men tioned, a mo del M for the formula φ is essentially a quan tifier tree, and hence each node has a unique level in M . The construction will ensure that (up to the depth of the mo del that we care ab out) q i is true in a state if and only if the state is on level i in the mo del. 6 Edith Hemaspaandra and Henning Schnoor The v ariables p i express the v alues of the v ariables in the quantifier tree, where the v alue of p i is only regarded as “defined” from lev el i on wards (obviously , these v ariables also ha ve v alues in other levels, but the v alues in these levels are not of in terest to us). F or constructing the formula which forces the quan tifier tree, we first in tro duce t wo macros. The macro B i requires the mo del to “split” at level i : B i := q i → ♦ ( q i +1 ∧ p i +1 ) ∧ ♦ ( q i +1 ∧ p i +1 ) . The effect of the formula B i is that if it is required to b e true in level i, then each no de in lev el i m ust hav e t wo different successors in the next level, setting the v ariable p i +1 to true in one of them, and to false in the other. Therefore w e can use this macro to force the “branc hing” of the quantifier tree in the levels corresponding to universal v ariables: if p i +1 is a universally quantified v ariable, then the macro B i ensures that both p ossible truth v alues for p i +1 are ev aluated. When forcing the quan tifier tree, we also need to ensure that truth v alues for the v ariables p i are prop erly propagated to “lo wer lev els” in the tree. F or this, we use the follo wing macro (and this is the only p oin t in which our construction differs from the pro of giv en in [BdR V01]): S i := (( p i → (( q i +1 ∨ · · · ∨ q m ) → p i )) ∧ ( p i → (( q i +1 ∨ · · · ∨ q m ) → p i ))) . This formula forces the truth v alue of p i to b e propagated “down” the tree from those lev els on where w e actually regard the v alue of p i as set, i.e., from the level i on. Note that a no de v can only hav e a successor in which ( q i +1 ∨ · · · ∨ q m ) holds if its own lev el is at least i, and hence we restrict the v alues of p i in exactly those parts of the tree where it is regarded as defined. W e now give the construction of the form ula ϕ, which as mentioned is identical to the one used in Ladner’s pro of, with the exception that our macro S i is different. The form ula ϕ is the conjunction of the following formulas (here, m ψ is an abbreviation for a . . . | {z } m ψ , and ( m ) ψ is a shorthand for ψ ∧ 1 ψ ∧ 2 ψ ∧ · · · ∧ m ψ ): ( i ) q 0 ( ii ) ( m ) ( q i → V i 6 = j q j ) (0 ≤ i ≤ m ) ( iiia ) ( m ) ( q i → ♦ q i +1 ) (0 ≤ i < m ) ( iiib ) V { i | Q i = ∀} i B i ( iv ) ( m ) S i (0 , ≤ i < m ) ( v ) m ( q m → θ ) The construction works as follows: With form ula ( i ) , w e give the start of the mo del and define the world w in whic h ϕ is satisfied to ha ve the lev el 0. F ormula ( ii ) requires eac h no de whic h is reac hable in at most m steps from w to ha v e a w ell-defined lev el (or none). F ormulas ( iiia ) and ( iiib ) require each level i to b e follow ed by lev el i + 1 , and in the case that the i th quantifier is ∀ , form ula ( iiib ) requires the corresp onding branc hing of the quan tifier tree. F ormula ( iv ) then forces the truth v alues of the p i to b e “sen t down” the tree, as describ ed earlier. F ormula ( v ) finally requires that the prop ositional formula θ is true for all p ossible truth assignmen ts to p 1 , . . . , p m generated b y the quantifier tree. Ladner’s construction for the PSP ACE upp er b ound for the logic K also rev eals the follo wing. The main idea b ehind this corollary is that any mo del for some mo dal formula can be transformed into a strict tree by “unrolling.” A muc h more general version of this result will b e prov en later as Theorem 4.33. On the Complexity of Elemen tary Mo dal Logics 7 Corollary 2.6. A mo dal formula is K -satisfiable if and only if it c an b e satisfie d in a strict tr e e. Corollary 2.6 shows that we only need to apply our formulas to trees—as long as our first order formula do es not “say anything” ab out trees, the generated logic is the same as K , although these logics do not necessarily hav e the same set of mo dels. Corollary 2.7. L et ˆ ϕ b e a first-or der formula over the fr ame language such that ˆ ϕ is sat- isfie d in every strict tr e e. Then the satisfiability pr oblem for K ( ˆ ϕ ) is PSP ACE -c omplete. Pr o of. This follo ws immediately from Corollary 2.6 and Theorem 2.4, since every mo dal form ula is K -satisfiable if and only it is K ( ˆ ϕ )-satisfiable. F or our complete classification in Theorem 4.17, we need a hardness result whic h is a sligh t v ariation of Ladner’s hardness result for all logics b et w een K and S4 . How ev er, the pro of is merely a closer insp ection of Ladner’s construction. In addition to the already mentioned graph prop erties, w e define a generalization of transitivit y . F or a natural num b er k , w e sa y that a graph G is k -transitiv e, if ev ery pair of vertices ( u, v ) in G such that there is a k -step path from u to v in G is connected with an edge. It is easy to see that a graph is transitiv e if and only if it is 2-transitive, and a transitiv e graph is also k -transitiv e for ev ery k ∈ N . F or a set S ⊆ N , we say that a graph is S -transitive if it is k -transitive for every k ∈ S . Theorem 2.8. L et ˆ ψ b e a first-or der formula over the fr ame language such that one of the fol lowing c ases applies: – ˆ ψ is satisfie d in every strict tr e e, – ˆ ψ is satisfie d in every r eflexive tr e e, – ther e is a set S ⊆ N such that ˆ ψ is satisfie d in every S -tr ansitive tr e e, – ˆ ψ is satisfie d in every symmetric tr e e, – ˆ ψ is satisfie d in every tr e e which is b oth r eflexive and symmetric, – ther e is a set S ⊆ N such that ˆ ψ is satisfie d in every tr e e which is b oth r eflexive and S -tr ansitive. Then K ( ˆ ψ ) - SA T is PSP ACE -har d. Note that for the cases not including symmetry , the result “almost” follo ws directly from Ladner’s Theorem 2.4. It do es not follow directly , since w e only require that our first-order form ulas are satisfied in S -transitive tr e es , but nothing ab out arbitrary S -transitive graphs. Nev ertheless, the result for this case follows directly from Ladner’s pro of. Pr o of. First consider the cases in which symmetry do es not o ccur. Now the result follo ws directly from Ladner’s pro of: Ladner pro ves PSP ACE-hardness with a reduction from QBF . F rom a quan tified Bo olean formula χ, he constructs a mo dal form ula φ such that the following holds: 1. If χ is true, then there is a mo dal mo del M and a world w ∈ M such that M is a strict tree, and M , w | = φ . Moreov er, adding any num b er of reflexive or transitiv e edges in M preserv es the fact that M , w | = φ . 2. If χ is false, then φ is not K -satisfiable. 8 Edith Hemaspaandra and Henning Schnoor It is immediate that this reduction also pro ves the desired hardness result for K ( ˆ ψ ) : First assume that χ is true. Then, by the ab o ve, the mo del M , w satisfies φ, and is a tree. If w e close this mo del under the reflexiv e and/or S -transitive closures, then by the ab ov e this still is a mo del for φ . Since ˆ ψ is satisfied in every reflexive and/or S -transitive tree, this is a K ( ˆ ψ )-model for φ, and hence φ is K ( ˆ ψ )-satisfiable. On the other hand, if χ is false, then φ is not K -satisfiable, and therefore not K ( ˆ ψ )-satisfiable. No w the cases inv olving symmetry follow from Corollary 2.5. As this section indicated, trees are an important sub class of mo dal mo dels. And in fact, a go o d in tuition to read this pap er is to alwa ys think of the graphs we deal with as “near- trees,” i.e., trees with additional edges. 3 Ab out Mo dal Mo dels NP-results in this pap er are sho wn with the explicit construction of small mo dels for a giv en form ula. W e therefore in tro duce some notation on graphs. F or a graph G, the set of v ertices of G is denoted with vertices ( G ) , and edges ( G ) is the set of its edges. As usual, a homomorphism from a graph G 1 to a graph G 2 is a function preserving the edge relation. A strict tr e e is a tree in the usual sense, i.e., a directed, acyclic, connected graph which has a ro ot w from which all other vertices can b e reached. W e now define notation to describ e paths in graphs. Note that we often iden tify mo dal mo dels and their frames, when the prop ositional assignments are clear from the context or not imp ortan t for our arguments. Definition 3.1. L et G b e a gr aph, w, v ∈ G vertic es, and i ∈ N . We write G | = w i − → v if in G, ther e is a p ath of length i fr om w to v . A dditional ly, G | = w 0 − → w for al l w ∈ G . We also say that w is a i -step pr e de c essor of v , and v is a i -step suc- c essor of w in G, if G | = w i − → v . The maximal depth of w ∈ G is define d as maxdepth G ( w ) := max n i | ∃ w 0 ∈ G, G | = w 0 i − → w o . Similarly, the maximal height of w ∈ G is maxheight G ( w ) := max n i | ∃ w 0 ∈ G, G | = w i − → w 0 o . Note that the maximal depth and maximal height of no des can b e (countably) infinite, ev en in finite graphs. The next definition is a restriction on graphs which is very natural for mo dal logics: for deciding whether M , w | = φ holds for some mo dal M , a world w ∈ M , and a mo dal formula φ, it is ob vious that only the worlds which are reac hable from w are imp ortan t. Definition 3.2. L et G b e a gr aph, and let w ∈ G . The gr aph G w is obtaine d fr om G by r estricting G to the worlds which c an b e r e ache d fr om w . 3.1 In v arian ts Pro ving the p olynomial-size mo del prop ert y for some logic is usually done starting with an arbitrary mo del for a giv en modal form ula and building a smaller mo del out of it, whic h still satisfies the mo dal formula. How ever, we also need to ensure that the new mo del still satisfies the conditions of the logic under consideration. Therefore, we need results that allo w us to perform mo difications on our mo dels and leav e the mo dal and the first-order prop erties in v arian t. The first result in this w ay concerns the first-order asp ect of the frames for univ ersal formulas: On the Complexity of Elemen tary Mo dal Logics 9 Theorem 3.3. L et G and G 0 b e gr aphs, and let n b e a natur al numb er. The fol lowing c onditions ar e e quivalent: 1. Every universal first-or der formula (with at most n variables) satisfie d by G 0 is also satisfie d by G, 2. Every existential first-or der formula (with at most n variables) satisfie d by G is also satisfie d by G 0 , 3. F or e ach finite V ⊆ G (such that | V | ≤ n ), ther e exists a functions f : V → G 0 such that for u, v ∈ V , it holds that uRv iff f ( u ) R 0 f ( v ) . Pr o of. 1 ↔ 2 Let ∃ x 1 . . . ∃ x n ˆ ϕ ( x 1 , . . . , x n ) be an existen tial first-order form ula o ver the frame language whic h holds in G, and assume that it do es not hold in G 0 . In this case, the negation of the formula holds in G 0 , i.e., G 0 | = ∃ x 1 . . . ∃ x n ˆ ϕ ( x 1 , . . . , x n ). This is equiv a- len t to G 0 | = ∀ x 1 . . . ∀ x n ˆ ϕ ( x 1 , . . . , x n ) , which is a univ ersal first-order form ula ov er the frame language. Hence by the prerequisites, w e kno w that G | = ∀ x 1 . . . ∀ x n ˆ ϕ ( x 1 , . . . , x n ) , whic h is a contradiction. 2 → 1 Analogously to the ab o ve. 2 → 3 W e construct a function f : V → G 0 with the desired prop erties. Let | V | = n, and let V = { x 1 , . . . , x n } . W e construct an existen tial first-order formula ˆ ψ = ∃ x 1 , . . . , ∃ x n ^ ( x i ,x j ) ∈ R x i Rx j ∧ ^ ( x i ,x j ) / ∈ R x i Rx j . Ob viously , ˆ ψ has n v ariables, and G obviously is a mo del for ˆ ψ , it follows that G 0 | = ˆ ψ . Therefore, there are x 0 1 , . . . , x 0 n suc h that ( x i , x j ) ∈ R if and only if ( x 0 i , x 0 j ) ∈ R 0 . Define f ( x i ) := x 0 i . This function obviously meets the criteria: Let ( x i , x j ) ∈ R . Then x i Rx j is a clause in ˆ ψ . Therefore for the v alues x 0 i and x 0 j c hosen b y the existential quantifiers, ( x 0 i , x 0 j ) ∈ R must hold. Since f ( x i ) = x 0 i and f ( x j ) = x 0 j , the claim follows. F or the condition R ( x i , x j ) , the pro of is the same. 3 → 2 Let such a function f exist for every V ⊆ G with | V | ≤ n . Let ˆ ψ := ∃ x 1 , . . . , ∃ x n ˆ ϕ be a first-order existential formula, let n b e the num b er of v ariables in ˆ ψ , and let G | = ˆ ψ . W e sho w that G 0 | = ˆ ψ . Since G | = ˆ ψ , there are x 1 , . . . , x n ∈ G such that ˆ ϕ ( x 1 , . . . , x n ) holds in G . This implies that ˆ ϕ ( f ( x 1 ) , . . . , f ( x n )) holds in G 0 . Therefore, G 0 | = ˆ ψ . Note that while the function f required to exist in the conditions of the abov e theo- rem shares some prop erties with an isomorphism, it is not required to b e injective. The follo wing is an imp ortan t sp ecial case, whic h immediately follows from this observ ation and Theorem 3.3: Prop osition 3.4. L et G b e a gr aph, ˆ ϕ a universal first-or der formula over the fr ame lan- guage such that G | = ˆ ϕ . Then for every sub gr aph G 0 of G, it holds that G 0 | = ˆ ϕ . F or a mo dal model, a restriction of the mo del is a restriction of the graph, where the prop ositional assignment for the remaining worlds is unc hanged. W e now consider restric- tions which are “compatible” with the mo dal properties of the formulas in question. The follo wing lemma describ es a standard w ay to reduce the num b er “relev ant” of successors to w orlds in mo dels. This is an application of the more general idea of b ounded morphisms, whic h we will encounter in Section 4.6. F or a mo dal formula φ, sf ( φ ) denotes the set of its subform ulas. With md ( φ ) , w e denote the modal depth of a form ula φ, i.e., the m aximal nesting degree of the mo dal op erator ♦ in φ . 10 Edith Hemaspaandra and Henning Schnoor Lemma 3.5. L et φ b e a mo dal formula, and let M , w | = φ . L et M 0 b e a r estriction of M such that the fol lowing holds: 1. w ∈ M 0 , 2. for al l u ∈ M 0 , and al l ψ ∈ sf ( φ ) such that M , u | = ♦ ψ, ther e is some v ∈ M 0 such that ( u, v ) is an e dge in M , and M , v | = ψ . Then M 0 , w | = φ . Lemma 3.5 immediately follows from the following Lemma. The version stated in Lemma 3.5 is the one we almost exclusiv ely use, hence we stated this simpler v ersion ex- plicitly . W e now prov e a slightly more general result, which also takes into accoun t that for a mo dal formula, worlds which are not reachable on a path with at most the length of the mo dal depth of the formula, are irrelev ant. Lemma 3.6. L et φ b e a mo dal formula, and let M , w | = φ . L et M 0 b e a r estriction of M such that the fol lowing holds: 1. w ∈ M 0 , 2. for al l u ∈ M 0 , and al l ψ ∈ sf ( φ ) , such that M , u | = ♦ ψ and ther e exists an i ∈ N such that M | = w i − → u and 1 + i + md ( ψ ) ≤ md ( φ ) , ther e is some v ∈ M 0 such that ( u, v ) is an e dge in M , and M , v | = ψ . Then M 0 , w | = φ . Pr o of. W e show the following claim: Let χ ∈ sf ( φ ) , i ∈ N , and u ∈ M 0 suc h that M | = w i − → u, and i + md ( χ ) ≤ md ( φ ) , then M , u | = χ if and only if M 0 , u | = χ . F or χ = φ, u = w , and i = 0 , this implies the Lemma, since w is an element of M 0 b y definition. W e sho w the claim by induction on χ . If χ is a v ariable, then this holds trivially , since M 0 is a restriction of M and therefore, propositional assignments are not c hanged. The induction step for propositional op erators is trivial. Therefore, assume that χ = ♦ ψ for some ψ ∈ sf ( φ ) , suc h that the claim holds for ψ . Now let u, i meet the prerequisites of the claim, i.e., let i + md ( χ ) ≤ md ( φ ) , and let M | = w i − → u . First assume that M , u | = χ . Since χ = ♦ ψ , it follows that md ( χ ) = md ( ψ ) + 1 , and hence i + 1 + md ( ψ ) ≤ md ( φ ). Since M , u | = ♦ ψ , the prerequisites of the Lemma therefore imply that there is a w orld v ∈ M 0 suc h that ( u, v ) is an edge in M , and M , v | = ψ . Since M | = w i − → u, it follo ws that M | = w i +1 − → v . By the induction hypothesis, we know that M 0 , v | = ψ . Since M 0 is a restriction of M , ( u, v ) is an edge in M 0 as well, and therefore we conclude that M 0 , u | = ♦ ψ , i.e., M 0 , u | = χ . F or the other direction, assume that M 0 , u | = χ . Therefore, there is a no de v ∈ M 0 suc h that M 0 , v | = ψ , and ( u, v ) is an edge in M 0 . Since M | = w i − → u, we know that M | = w i +1 − → v holds as well, and since md ( ψ ) = md ( χ ) − 1 , from the induction hypothesis w e conclude that M , v | = ψ . Since ( u, v ) is an edge in M as well, it therefore follo ws that M , u | = ♦ ψ , i.e., M , u | = χ, concluding the pro of. The follo wing easy prop osition sho ws how Lemma 3.6 can b e applied: Prop osition 3.7. L et KL b e a universal elementary lo gic, let φ b e a mo d al formula, and let M , w | = φ, wher e M is a KL -mo del. Then ther e is a KL -mo del M 0 which is a r estriction of M , which is r o ote d at w , and wher e every world c an b e r e ache d fr om w in at most md ( φ ) steps, and M 0 , w | = φ . On the Complexity of Elemen tary Mo dal Logics 11 Pr o of. The model M 0 is obtained by simply remo ving all worlds from M which cannot b e reac hed from w in at most md ( φ ) steps. Due to Prop osition 3.4, M 0 is still a KL -mo del. W e no w show that M 0 , w | = φ holds, by proving that M 0 satisfies the conditions of Lemma 3.6. By definition, since w can b e reached from w in 0 steps, we know that w ∈ M 0 . Hence let u ∈ M 0 , and let ψ ∈ sf ( φ ) , and let M , u | = ♦ ψ , such that M | = w i − → u for some i such that 1 + i + md ( ψ ) ≤ md ( φ ). Since M , u | = ♦ ψ , we know that there is a world v ∈ M suc h that M , v | = ψ , and ( u, v ) is an edge in M . It follows that M | = w i +1 − → u . Since 1 + i + md ( ψ ) ≤ md ( φ ) , and md ( ψ ) ≤ md ( φ ) , w e kno w that i + 1 ≤ md ( φ ) , and hence w e kno w that v is an element of M 0 . Therefore, M 0 satisfies the conditions of Lemma 3.6, and therefore the lemma implies that M 0 , w | = φ, as claimed. 3.2 Restrictions As men tioned, our NP-con tainmen t results are obtained b y proving the polysize mo del prop- ert y and applying Prop osition 2.2. The polynomial mo dels are obtained by restricting arbi- trary mo dels to p olynomial size. W e will now sho w some restrictions whic h we can mak e in an y model, showing that w e can assume certain parts of the mo del to b e only p olynomial in size. Lemma 3.8. L et c ∈ N . Then for any mo dal formula φ and any M , w | = φ, ther e is a submo del M 0 of M such that M 0 , w | = φ and the fol lowing holds: n v ∈ M 0 | maxdepth M 0 ( v ) < c o ≤ ( c + 1) · | φ | c . Pr o of. F or each w orld u in M , let F u := { ψ ∈ sf ( φ ) | M , u | = ♦ ψ } . F or eac h u, let W u b e a subset of the 1-step successors of u in M such that for ev ery ψ ∈ F u , there is a world v ∈ W u suc h that ( u, v ) is an edge in M , and M , v | = ψ , and | W u | ≤ | F u | . Now define M 0 := { w } , and for eac h i ∈ N , let M i +1 := S v ∈ M i W v . Finally , define M 0 to b e the restriction of M to S i ∈ N M i . T o show that M 0 , w | = φ, w e prov e that M 0 satisfies the conditions of Lemma 3.5. Ob viously , M 0 is a restriction of M and w ∈ M 0 ⊆ M . Therefore, let u b e a world from M 0 , and let ψ b e a subformula of φ suc h that M , u | = ♦ ψ . Since u ∈ M 0 , there is some i such that u ∈ M i . Since M , u | = ♦ ψ , we know that ψ ∈ F u , and hence there is a w orld v ∈ W u suc h that M , v | = ψ , and ( u, v ) is an edge in M . It follows that v ∈ W u ⊆ M i +1 ⊆ M 0 , and hence M 0 satisfies the conditions of Lemma 3.5 as claimed. No w let A := n v ∈ M 0 | maxdepth M 0 ( v ) < c o . It remains to show the cardinality b ound for A . It is ob vious that A ⊆ ∪ c i =0 M i , since for ev ery i, every vertex in M i +1 has a predecessor in M i , and hence inductively , every vertex in M i has an i -step predecessor in M 0 . Ob viously , | M 0 | = 1 , and | M i +1 | ≤ | M i | · | sf ( φ ) | . Therefore, | M i | ≤ | sf ( φ ) | i for all i ∈ N . No w, due to the ab ov e, | A | ≤ |∪ c i =0 M i | ≤ ( c + 1) · | sf ( φ ) c | . Since | sf ( φ ) | ≤ | φ | , the claim follo ws. By construction, the model M 0 giv en in the pro of of the ab o ve lemma is coun table. Hence w e obtain the following corollary: Corollary 3.9. L et KL b e a universal elementary lo gic. Then every KL -satisfiable formula φ is satisfiable in a c ountable KL -mo del. Mor e over, every KL -mo del satisfying φ at a no de w c ontains a c ountable KL -submo del satisfying φ at the no de w . 12 Edith Hemaspaandra and Henning Schnoor The following lemma shows that it is sufficien t to restrict the num b er of those vertices in the mo del which ha ve a minimal height in the graph. In combination with Lemma 3.8, this sho ws that we only need to b e concerned ab out vertices whic h hav e b oth a certain num ber of predecessors, and a certain num b er of successors. W e already saw in Prop osition 3.7 that w e are only interested in ro oted graphs. In such graphs, Lemmas 3.8 and 3.10 can b e seen as limiting the num ber of v ertices near the “top” or the “b ottom” of the model. This is useful, b ecause in graphs satisfying some universal form ula, often sp ecial cases can o ccur in these regions of the graph. These lemmas sho w that w e do not need to lo ok to o closely at these exceptions. Lemma 3.10. L et c ∈ N b e a c onstant. Then for any mo dal formula φ and any M , w | = φ, ther e is a submo del M 0 of M such that M 0 , w | = φ, and for which the fol lowing holds: | M 0 | ≤ f n v ∈ M 0 | maxheight M 0 ( v ) ≥ c o , wher e f ( n ) = ( n + 1) · (1 + | φ | ) c . Pr o of. Let A := n v ∈ M | maxheigh t M ( v ) ≥ c o , i.e., the set of no des in M which hav e a c -step successor. W e no w define a sequence of submodels of M : Let M 0 := ∅ , M 1 := A ∪ { w } , and for i ≥ 1 , let M i +1 b e defined as follows: – M i ⊆ M i +1 , – F or every u ∈ M i \ M i − 1 , and each ψ ∈ sf ( φ ) suc h that M , u | = ♦ ψ , add one world v from M to M i +1 suc h that ( u, v ) is an edge in M and M , v | = ψ . No w let M 0 b e the restriction of M to the w orlds in M c +1 . W e show that M 0 , w | = φ, b y sho wing that it satisfies the conditions of Lemma 3.5. By definition, w ∈ M 1 ⊆ M 0 . Hence let u ∈ M 0 , ψ ∈ sf ( φ ) , and let M , u | = ♦ ψ . Since u ∈ M 0 , there exists a minimal i suc h that u ∈ M i . First assume that i = c + 1. By construction, for every relev an t j, every no de in M j +1 \ M j has a 1-step predecessor in M j \ M j − 1 , and hence, inductively , the no de u ∈ M c +1 \ M c is a c − 1-step successor of a no de x in M 2 \ M 1 . Since M , u | = ♦ ψ , w e kno w that u has a successor in M . This implies that x has a c -step successor in M , and hence x ∈ A, which is a contradiction, since x ∈ M 2 \ M 1 , and A ⊆ M 1 . Therefore, w e know that i ≤ c . By construction, there is a world v in M i +1 ⊆ M 0 suc h that ( u, v ) is an edge in M , and M .v | = ψ . Therefore, the mo del M 0 satisfies the conditions of Lemma 3.5, and therefore w e conclude that M 0 , w | = φ . By definition, it holds that | M 1 | ≤ | A | + 1 , and for i ≥ 1 , | M i +1 | ≤ | M i | (1 + | sf ( φ ) | ). Since | M 0 | = | M c +1 | , this implies that | M 0 | ≤ ( | A | + 1) · (1 + | sf ( φ ) | ) c ≤ ( | A | + 1) · (1 + | φ | ) c , as claimed. The main purpose of Lemmas 3.8 and 3.10 is the follo wing: If for a modal logic KL , there is a constant c, suc h that ev ery KL -satisfiable form ula has a model in whic h we can restrict the n umber of no des which hav e b oth a c -step predecessor and a c -step successor, then Lemmas 3.8 and 3.10 can b e used to show the p olynomial mo del prop ert y for KL . This idea plays a crucial role in the pro of of our main NP-containmen t result, Theorem 4.13, and is formalized in the follo wing corollary: Corollary 3.11. L et KL b e a universal elementary mo dal lo gic such that ther e exists a c onstant c ∈ N such that ther e is a p olynomial p such that for al l KL -satisfiable formulas φ, ther e is a KL -mo del M and a world w ∈ M such that M , w | = φ, and On the Complexity of Elemen tary Mo dal Logics 13 n u ∈ M | maxdepth M ( w ) ≥ c and maxheight M ( w ) ≥ c o ≤ p ( | φ | ) . Then KL has the p olynomial-size mo del pr op erty, and KL - SA T ∈ NP . Note that the function p is only required to b e p olynomial in its argument | φ | , and not in the v alue c, which is a constan t dep ending only on the logic, and not on the form ula. Pr o of. Let φ b e a KL -satisfiable formula, and let M b e a KL -model and w ∈ M meeting the prerequisites of the corollary . By Lemma 3.8, there is a submo del M 0 of M such that M 0 , w | = φ, and n v ∈ M 0 | maxdepth M 0 ( v ) < c o ≤ ( c + 1) · | φ | c . Therefore, since the conditions required in the prerequisites of the corollary are inv ariant under further restrictions of the mo del, assume without loss of generalit y that M already satisfies this condition. No w let M = T ∪ C ∪ B , where T := n v ∈ M | maxdepth M ( v ) < c o , C := n v ∈ M | maxdepth M ( v ) ≥ c and maxheight M ( v ) ≥ c o , B := n w ∈ M | maxheight M ( c ) < c o . Note that T and B are not necessarily disjoin t ( T contains the no des with only small depth at the “ t op” of the mo del, C represents the “ c en ter” of the mo del, and B is the “ b ottom.”). By the prerequisites of the corollary , we can assume that | C | ≤ p ( | φ | ) , and by the ab o v e we know that | T | ≤ ( c + 1) · | φ | c . No w let A := n v ∈ M | maxheigh t M ( v ) ≥ c o . It follo ws that A ⊆ T ∪ C, and hence | A | ≤ | T | + | C | ≤ ( c + 1) · | φ | c + p ( | φ | ) . By Lemma 3.10, there is a submodel M 0 of M such that M 0 , w | = φ and | M 0 | ≤ ( | A | + 1) · (1 + | φ | ) c , and hence by the ab o ve we hav e that | M 0 | ≤ (( c + 1) · | φ | c + p ( | φ | ) + 1) · (1 + | φ | ) c (note that the cardinality of the size A defined with resp ect to the submo del M 0 is b ounded b y the cardinality of the original set A ). Since p is a p olynomial and c is a constant only dep ending on the logic KL , this is a p olynomial size b ound in | φ | , and therefore w e ha ve pro ven the p olynomial-size mo del prop erty . By Proposition 3.4, M 0 is a KL -model. The complexit y result now follows from Prop osition 2.2. 4 Univ ersal Horn F orm ulas W e no w consider a syn tactically restricted case of univ ersal first order formulas, namely Horn form ulas. Many well-kno wn logics can b e expressed in this wa y . 4.1 Definitions Usually , a Horn clause is defined as a disjunction of literals of which at most one is p ositiv e. If a p ositiv e literal occurs, then the clause can be written as an implication, since x 1 ∨ · · · ∨ x n ∨ y is equiv alent to x 1 ∧ · · · ∧ x n = ⇒ y . If no positive literal occurs, then the clause ( x 1 ∨ · · · ∨ x n ) can b e written as x 1 ∧ · · · ∧ x n = ⇒ false . Since in the context of the frame language, an atomic prop osition is of the form ( xRy ) , the following is the natural version of Horn clauses for our purp oses: 14 Edith Hemaspaandra and Henning Schnoor Definition 4.1. A universal Horn clause is a formula of the form ( x 1 Rx 2 ) ∧ · · · ∧ ( x k − 1 Rx k ) = ⇒ ( x i Rx j ) , or of the form ( x 1 Rx 2 ) ∧ · · · ∧ ( x k − 1 Rx k ) = ⇒ false , wher e al l (not ne c essarily distinct) variables ar e implicitly universal ly quantifie d. A universal Horn formula is a conjunction of univ ersal Horn clauses. With universal Horn form ulas, many of the usually considered graph properties can be expressed, lik e transitivity , symmetry , euclidicit y , etc. In the follo wing definition, we sho w how univ ersal Horn clauses can b e represented as graphs. Definition 4.2. L et ˆ ϕ b e a universal Horn clause. – The prerequisite graph of ˆ ϕ , denote d with prereq ( ˆ ϕ ) , c onsists of the variables app e aring on the left-hand side of the implic ation ϕ, wher e ( x 1 , x 2 ) is an e dge if the clause ( x 1 Rx 2 ) app e ars. – If ˆ ϕ is a universal Horn clause wher e the right-hand side of the implic ation in ˆ ϕ is R ( x, y ) , then the conclusion edge of ˆ ϕ , denote d with conc ( ˆ ϕ ) , is the e dge ( x, y ) . If the right-hand side of the implic ation is false , then conc ( ˆ ϕ ) is the empty set. 4.2 Univ ersal Horn Clauses and Homomorphisms The definition of the prerequisite graph and the conclusion edge of a universal horn formula establishes a one-to-one corresp ondence b et ween univ ersal Horn clauses and their represen- tation as graphs. These definitions allow us to relate truth of a Horn clause to homomorphic images of the in volv ed graphs: Prop osition 4.3. 1. L et ˆ ϕ b e a universal Horn clause with conc ( ˆ ϕ ) = ( x, y ) . A gr aph G satisfies ˆ ϕ if and only the fol lowing holds: F or every homomorphism α : prereq ( ˆ ϕ ) ∪ { x, y } → G , ( α ( x ) , α ( y )) is an e dge in G. 2. L et ˆ ϕ b e a universal Horn clause such that conc ( ˆ ϕ ) = ∅ . Then a gr aph G satisfies ˆ ϕ is and only if ther e is no homomorphism α : prereq ( ˆ ϕ ) → G. Pr o of. 1. Let prereq ( ˆ ϕ ) = ( x 1 Rx 2 ) ∧ · · · ∧ ( x n − 1 Rx n ) , where all v ariables are im- plicitly univ ersally quantified. First assume that G | = ˆ ϕ, and let α : prereq ( ˆ ϕ ) ∪ { x, y } → G be a homomorphism. Due to the definition of prereq ( ˆ ϕ ) , there are edges ( x 1 , x 2 ) , . . . , ( x n − 1 , x n ) in prereq ( ˆ ϕ ). Since α is a homomor- phism, this implies that ( α ( x 1 ) , α ( x 2 )) , . . . , ( α ( x n − 1 ) , α ( x n )) are edges in G . Hence the no des α ( x 1 ) , . . . , α ( x n ) , α ( x ) , α ( y ) satisfy the formula R ( α ( x 1 ) , α ( x 2 )) ∧ · · · ∧ R ( α ( x n − 1 ) , α ( x n )). Therefore, the no des { α ( v ) | v ∈ prereq ( ˆ ϕ ) ∪ { x, y }} satisfy the pre- requisites of the clause ˆ ϕ . Since G | = ˆ ϕ, this implies that ( α ( x ) , α ( y )) is an edge in G. No w for the other direction, assume that G fulfills the homomorphism prop ert y , and let V AR ˆ ϕ = { x 1 , . . . , x n } . Let a 1 , . . . , a n b e nodes in G satisfying the prerequisite clause of ˆ ϕ, i.e., if ( x i 1 , x i 2 ) is a clause in prereq ( ˆ ϕ ) , then ( a i 1 , a i 2 ) is an edge in G . Then ob viously the function α mapping the v ariable x i to the no de a i , is a homomorphism from prereq ( ˆ ϕ ) to G . By the prerequisites, we know that ( α ( x ) , α ( y )) is an edge in G . Hence, G satisfies the form ula ˆ ϕ . 2. Analogous. There is a natural corresp ondence b et ween implications of these form ulas and graph homomorphisms. On the Complexity of Elemen tary Mo dal Logics 15 Prop osition 4.4. 1. L et ˆ ϕ 1 and ˆ ϕ 2 b e universal Horn clauses such that ther e exists a homomorphism α : prereq ( ˆ ϕ 1 ) → prereq ( ˆ ϕ 2 ) , which maps the c onclusion e dge of ˆ ϕ 1 to the c onclusion e dge of ˆ ϕ 2 . Then ˆ ϕ 1 implies ˆ ϕ 2 . 2. L et ˆ ϕ 1 and ˆ ϕ 2 b e universal Horn clauses such that conc ( ˆ ϕ 1 ) = conc ( ˆ ϕ 2 ) = ∅ , and let α : prereq ( ˆ ϕ 1 ) → prereq ( ˆ ϕ 2 ) b e a homomorphism. Then ˆ ϕ 1 implies ˆ ϕ 2 . Pr o of. 1. Let conc ( ˆ ϕ 1 ) = ( x, y ) , then by the prerequisites it follows that conc ( ˆ ϕ 2 ) = ( α ( x ) , α ( y )). No w let G b e a graph such that G | = ˆ ϕ 1 , and let β : (prereq ( ˆ ϕ 2 ) ∪ { α ( x ) , α ( y ) } ) → G b e a homomorphism. By Prop osition 4.3, it suffices to sho w that ( β ( α ( x )) , β ( α ( y ))) is an edge in G . Since α and β are homomorphisms, β ◦ α : prereq ( ˆ ϕ 1 ) → G is a homomorphism as w ell. Since G | = ˆ ϕ 1 , Prop osition 4.3 im- plies that ( β ( α ( x )) , β ( α ( y ))) is an edge in G, as claimed. 2. Let G b e a graph such that G | = ˆ ϕ 1 . Due to Prop osition 4.3, to sho w that G | = ˆ ϕ 2 , it suffices that there is no homomorphism β : prereq ( ˆ ϕ 2 ) → G . Hence assume that suc h a homomorphism exists. Then β ◦ α is a homomorphism from prereq ( ˆ ϕ 1 ) in to G, which is a con tradiction to Prop osition 4.3, since G | = ˆ ϕ 1 . 4.3 Imp ortan t Sp ecial Cases W e now consider sp ecial cases of Horn clauses, which will b e central for the logics having satisfiabilit y problems in NP. The following definition captures the case where the v ariables in the conclusion edge ha ve a common predecessor in the prerequisite graph, but there is not necessarily a direct path b et ween them. Using results about graphs satisfying generalizations of form ulas of this type, we will b e able to show all of the NP-containmen t results that the pro of of the later classification theorem, Theorem 4.17, dep ends on. Definition 4.5. L et ˆ ϕ k → l b e the formula ( w Rx 1 ) ∧ ( x 1 Rx 2 ) ∧ · · · ∧ ( x k − 1 Rx k ) ∧ ( w Ry 1 ) ∧ ( y 1 Ry 2 ) ∧ · · · ∧ ( y l − 1 Ry l ) = ⇒ ( x k Ry l ) , wher e al l variables ar e universal ly quantifie d (and in the c ase that x 0 or y 0 app e ar in the formula, we r eplac e them with w ). w x 1 x 2 y 1 y 2 y 3 y 4 Fig. 1. Example clause ˆ ϕ 2 → 4 In Figure 1, w e present the graph representation of the formula ˆ ϕ 2 → 4 . The graph prop ert y describ ed by these formulas is easy to see: Prop osition 4.6. L et G b e a gr aph, and let k , l ∈ N . Then G | = ˆ ϕ k → l if and only if for any no des w , x k , y l ∈ G, if G | = w k − → x k and G | = w l − → y l , then ( x k , y l ) is an e dge in G. This definition generalizes several well-kno wn examples—in par- ticular, a graph is reflexiv e if and only if it satisfies ˆ ϕ 0 → 0 , symmetry is expressed with ˆ ϕ 1 → 0 , and transitivit y with ˆ ϕ 0 → 2 . Finally , a graph is Euclidean iff it satisfies ˆ ϕ 1 → 1 . Therefore, this notation allo ws us to capture many interesting graph prop erties, and it is not surpris- ing that generalizations of this idea are the main ingredients for our p olynomial size mo del proofs. W e start with looking at some prop erties and implications of formulas of the form ˆ ϕ k → l . Lemma 4.7. L et 1 ≤ k, l ∈ N , and let G b e a gr aph such that G | = ˆ ϕ k → l . 16 Edith Hemaspaandra and Henning Schnoor 1. G | = ˆ ϕ l + k − 1 → l + k . 2. If l = k + 1 , then for any i ≥ k , G | = ˆ ϕ i → i +1 . 3. Ther e is some k 0 ≥ 1 such that G | = ˆ ϕ i → i +1 for al l i ≥ k 0 . Pr o of 1. Let w b e some no de in G, suc h that G | = w l + k − 1 − → x l + k − 1 , and G | = w l + k − → y l + k , and let the (not necessarily distinct) intermediate v ertices be denoted with x i , y i . Since ˆ ϕ k → l holds in G , this implies that there is an edge ( y k , x l ). By choice of no des, G | = x l k − 1 − → x l + k − 1 . Combining these, w e obtain a path of length k from y k to x l + k − 1 . On the other hand, G | = y k l − → y k + l . Since ˆ ϕ k → l holds in G , it follows that there is an edge from x l + k − 1 to y l + k , pro ving that ˆ ϕ l + k − 1 → l + k holds in G . 2. Clearly it suffices to show G | = ˆ ϕ k +1 → k +2 , the claim for arbitrary i follows inductiv ely . Let w, x j , y j b e chosen suc h that w = x 0 = y 0 , and there are edges ( x j , x j +1 ) and ( y j , y j +1 ). W e need to sho w that there is an edge ( x k +1 , y k +2 ) . Since G | = ˆ ϕ k → k +1 , it follows that ( y k , x k +1 ) is an edge in G . Since there ob viously is a path of length k − 1 from y 1 to y k , it follows that there is a path of length k from y 1 to x k +1 . Since there also is a path of length k + 1 from y 1 to y k +2 , it follows that there is an edge ( x k +1 , y k +2 ) in G , whic h concludes the pro of. 3. This follows immediately from the ab o ve: from p oints 1 and 2 , it follows that the claim holds for k 0 := l + k − 1 . w x 1 x 2 y 1 y 2 y 3 y 4 s t 1 t 2 u 1 u 2 u 3 Fig. 2. More general form ula The formula ˆ ϕ k → l is supp osed to capture the case where the v ariables in the conclusion edge of a universal Horn clause ha ve a common predecessor. But not all of these cases are cov ered with this formula. The abov e Figure 1 is a graph- ical representation of what the implication ˆ ϕ 2 → 4 do es. But what if this is only a subgraph of the prerequisite graph? In a more general case, the no de w and the no des x k , y l will hav e more predecessors and successors. Figure 2 gives an example of a more general form ula. W e will now see that this form ula can b e “simplified.” This simplification is not an equiv alent transformation of the formula, but w e construct a new for- m ula which is implied b y the original one. The one-sided implication suffices to show man y of the results we need. The simpler form ula is presented in Figure 3. It is easy to see that every graph which satisfies the for- m ula display ed in Figure 2 also satisfies the form ula from Figure 3. This follo ws directly from Prop osition 4.4, since the prerequisite graph from Figure 2 can obviously b e mapp ed homomorphically to the prerequisite graph from Figure 3 (the homomorphism α is defined as α ( t 1 ) := x 2 , α ( s ) := u 2 , α ( u 3 ) := w , and maps the other no des to the ones with the same lab els). Hence, if w e can show NP-containmen t for all univ ersal elemen tary mo dal logics extending the one defined b y the later form ula, this puts the logic defined by the original form ula into NP as well. On the Complexity of Elemen tary Mo dal Logics 17 w x 1 x 2 y 1 y 2 y 3 y 4 t 2 u 1 u 2 Fig. 3. Simpli- fied form ula An y univ ersal Horn clause whic h can be mapped on to a tree can b e em b edded in a graph with certain prop erties, namely the prop erties of the formula we no w define. Due to Corollary 2.7, it is natural that tree- lik e homomorphic images of our universal Horn formulas are of in terest to us. These formulas capture the generalizations of ˆ ϕ k → l men tioned ab ov e, where w e demand that the no des w , x k , y l ha ve a sufficien t num b er of predecessors or successors. W e again use the representation of Horn clauses as graphs. Definition 4.8. F or k , l, p, q , r ∈ N , the formula ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r is define d as the universal Horn clause displaye d in Figur e 4. It should be noted that the notation ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r suggests that w, y , x can b e compared to natural num b ers, but what is meant in that notation is simply that the num b er of predecessors (successors, resp.) of w , x k , y l can b e compared to p, q , and r , resp ectively . Hence, if w e use “natural names” for the vertices, i.e. we ha ve v ertices w = x 0 , x 1 , . . . , and w = y 0 , y 1 , . . . , then this ensures that the vertices up to x q , y r , and w p exist. When pro ving that this formula holds in a graph, we will usually rely on the notation provided in Figure 4, and assume that there are no des w p , . . . , w 0 = w = x 0 = y 0 , x 1 , . . . , x q , x 1 , . . . , y r with edges as seen in Figure 4, i.e., most of the time we do not mention the homomorphism explicitly . x q w x 1 x 2 . . . x k y 1 y 2 y 3 . . . y l . . . y r . . . w p . . . w 1 Fig. 4. The formula ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r The formula ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r can b e seen to b e only a slight gener- alization of the formulas ˆ ϕ k → l w e already considered, as exhibited b y the following prop osition: Prop osition 4.9. L et G b e a gr aph, and let k , l , p, q , r ∈ N . Then G | = ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r if and only if the fol lowing c ondition holds: F or any no des w , x k , y l ∈ G, such that w has a p -step pr e de c essor, x has a q − k -step suc c essor and y has an r − l -step suc c essor, G | = w k − → x k and G | = w l − → y l , it fol lows that ( x k , y l ) is an e dge in G. The ab o v e prop osition immediately implies the follo wing: Prop osition 4.10. L et G | = ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r , and let G 0 b e the r e- striction of G to the set C := n w ∈ G | maxdepth G ( w ) ≥ p, maxheight G ( w ) ≥ max( q − k , r − l ) o , then G 0 | = ϕ k → l . This Proposition is one of the reasons why Corollary 3.11 is im- p ortan t: W e can use it together with Prop osition 4.10 to restrict our atten tion to the vertices in the “middle” of the graph, and then talk ab out the formula ˆ ϕ k → l instead of ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r . This is the general approac h for our NP-containmen t pro ofs, although some technical difficulties remain, as w e will see in the pro of of Theorem 4.13. There ob viously is a close relationship b et ween formulas of the form ˆ ϕ k → l and form ulas of the form ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r . In particular, this relationship allo ws the “lifting” of implications, as is sho wn in the following easy lemma. 18 Edith Hemaspaandra and Henning Schnoor Lemma 4.11. L et p, q , r, k , l , k 0 , l 0 ∈ N , and let ˆ ϕ k → l imply ˆ ϕ k 0 → l 0 . Then ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r im- plies ˆ ϕ k 0 → l 0 w ≥ p 0 ,x ≥ q 0 ,y ≥ r 0 , wher e p 0 := p, q 0 := k 0 + max( q − k , r − l ) , r 0 := l 0 + max( q − k , r − l ) . Pr o of. Let G be a graph satisfying ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r . Let w , x i , y i b e the nodes in the graph connected as the nodes in the prerequisite graph of ˆ ϕ k 0 → l 0 w ≥ p 0 ,x ≥ q 0 ,y ≥ r 0 . Let G 0 b e the graph G restricted to the set of vertices which hav e a p -step predecessor, and max( q − k , r − l )- step successor in G . Then, by c hoice of no des, and Prop ositions 4.9 and 4.6, it follows that G 0 | = ˆ ϕ k → l . Hence, due to the prerequisites, we know that G | = ˆ ϕ k 0 → l 0 . In particular, since the no des w, x i , y i satisfy the prerequisite graph of ˆ ϕ k 0 → l 0 w ≥ p 0 ,x ≥ q 0 ,y ≥ r 0 , we kno w that w , x k , y l ∈ G 0 . Hence, it follows that ( x k , y l ) is an edge in G 0 , and therefore it is an edge in G, as claimed. W e need three more implications b et ween formulas of this kind for our later NP-results: Lemma 4.12. L et p, q , r, k ∈ N , k ≥ 2 , and let G b e a gr aph. 1. If G | = ˆ ϕ k → 0 , then G | = ˆ ϕ 0 → k 2 . 2. If G | = ˆ ϕ k → 0 w ≥ p,x ≥ q ,y ≥ r , then G | = ˆ ϕ k − 1 → k 3 w ≥ p 0 ,x ≥ q 0 ,y ≥ r 0 , wher e p 0 := p, q 0 := k − 1 + max( q − k , r ) , r 0 := k 3 + max( q − k , r ) . 3. L et k ∈ N . Then ˆ ϕ 0 → k implies ˆ ϕ 0 → k 2 . Pr o of. Let w p , . . . , w = x 0 , . . . , w = y 0 , . . . b e no des in the graph fulfilling the prerequisite graph of the resp ectiv e form ulas. 1. By the ˆ ϕ k → 0 -prop ert y , it is clear that ( y k , y 0 ) , ( y 2 k , y k ) , . . . , ( y k 2 , y ( k − 1) · k ) are edges in G . Hence, G | = y k 2 k − → w . Again due to the prop ert y , it follows that ( w , y k 2 ) is an edge in G, as required. 2. Consider the subgraph G 0 := G ∩ { w , x 1 , . . . , x k − 1 , y 1 , . . . , y k 3 } . By choice of p 0 , q 0 , r 0 , ev ery no de in G 0 has a p -step predecessor, a q − k -step successor, and an r -step successor in G . Hence, G 0 | = ˆ ϕ k → 0 . Due to part 1 , this implies that G 0 | = ˆ ϕ 0 → k 2 . Hence, in G 0 there are edges ( w , y k 2 ) , ( y k 2 , y 2 k 2 ) , . . . , ( y ( k − 1) · k 2 , y k 3 ). Therefore, due to the ˆ ϕ k → 0 -prop ert y , it follows that ( y k 3 , w ) is an edge in G 0 . Hence, it follows that G | = y k 3 k − → x k − 1 . The ˆ ϕ k → 0 -prop ert y implies that ( x k − 1 , y k 3 ) is an edge, as required. 3. This follo ws from Lemma 4.20, since k -transitivity implies k + k · ( k − 1) = k 2 -transitivit y . 4.4 NP upp er complexit y b ounds In this section, w e pro ve NP-con tainment results for logics defined b y univ ersal Horn clauses. W e sho w that “most” of the logics of the form K ( ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r ) giv e rise to a satisfiability problem in NP. It is comparably easy to show that a logic of the form K ( ˆ ϕ k → k +1 ) leads to a satisfiabilit y problem in NP, by carefully “copying” vertices and adding the correct neigh b ors. How ever, On the Complexity of Elemen tary Mo dal Logics 19 while this pro cess leads to a mo del which still satisfies ˆ ϕ k → k +1 , it do es not give the desired result that the problem can be solv ed in NP for all universal Horn logics whic h are extensions of K ( ˆ ϕ k → k +1 ). In order to prov e this, our mo del-manipulations must b e consistent with the conditions of Theorem 3.3. In the proof of the following theorem, we construct a small model using only restriction. Note that the proof for this theorem is the only o ccasion where we actually prov e the p olynomial-size mo del prop ert y by explicitly constructing the mo del. All further NP-results mak e use of Theorem 4.13, by showing that the logic in question is an extension of one of the logics that this theorem deals with. F or example, the logic K4B satisfies the conditions of this Theorem. It is therefore a central theorem for our complexity classification. The pro of relies on one later result, namely the second case of Theorem 4.33. How ever, the pro of for this case of Theorem 4.33 do es not rely on any facts about the classification algorithm studied later. In the following, a graph G with ro ot w is w -canonical if for every no de x ∈ G, if G | = w i − → x and G | = w j − → x, then i = j . Note that this do es not mean that ev ery no de x is reachable on only one path from the ro ot, but that all paths from the ro ot w to x ha ve the same length. W e say that a graph G is c anonic al if it is w -canonical for a ro ot w of G . It is easy to see that a graph is canonical if and only if it can b e homomorphically mapp ed onto a strict line. Theorem 4.13. L et ˆ ϕ b e a universal Horn formula implying ˆ ϕ k → k +1 w ≥ p,x ≥ q ,y ≥ r for some k , p, q , r ∈ N , k ≥ 1 . Then K ( ˆ ϕ ) has the p olynomial-size mo del pr op erty, and K ( ˆ ϕ ) - SA T ∈ NP . Pr o of. Due to Prop osition 2.2, it suffices to prov e the p olynomial-size mo del prop ert y for K ( ˆ ϕ ) . Hence, let φ be a K ( ˆ ϕ )-satisfiable mo dal form ula, and, follo wing Prop osition 3.7, let M b e a K ( ˆ ϕ )-mo del with ro ot w such that M , w | = φ . Define maxline to b e the maximal length of a strict line on which ˆ ϕ is satisfied, and maxline to b e zero in the case that ˆ ϕ is satisfied on every strict line (note that due to Prop osition 3.4, if ˆ ϕ is satisfied on the strict line of length i, then it is also satisfied on the strict line of length i − 1). This n umber is ob viously a constant dep ending only on ˆ ϕ . If ˆ ϕ is satisfied on every strict line, w e can, due to Theorem 4.33, assume that M is w -canonical. Note that we will w ork with restrictions of the mo del during the course of the pro of—since any restriction of a canonical graph having the same ro ot is still canonical, the submo dels w e consider later are canonical as w ell. No w, define A := n v ∈ M | maxdepth M ( v ) ≤ p + k + 2 o ∪ { w } , S := n v ∈ M | maxheigh t M ( v ) ≥ max( q − k , r − k − 1) o , C := ( M \ A ) ∩ S. The set C contains all the no des in M which hav e “enough” predecessors and successors to ensure that the formula ˆ ϕ k → k +1 w ≥ p,x ≥ q ,y ≥ r giv es us all the necessary edges that w e are interested in. T o b e more precise, we show the following fact: F act 1 F or al l i ≥ 0 , it holds that C | = ˆ ϕ i → i +1 . Pr o of. It suffices to show the claim for i = 1. The result for arbitrary i then follows from Lemma 4.7, and the observ ation that ˆ ϕ 0 → 1 is true in any graph. Hence, w e show C | = ˆ ϕ 1 → 2 : Let w 0 , x 1 , y 1 , y 2 b e vertices from C , such that they satisfy the prerequisites of ˆ ϕ 1 → 2 , i.e., let ( w 0 , x 1 ) , ( w 0 , y 1 ) , and ( y 1 , y 2 ) b e edges in M . Since w 0 ∈ C , w e know that w 0 has a k − 1- step predecessor w 00 , which in turn has a p -step predecessor. Due to the edges mentioned 20 Edith Hemaspaandra and Henning Schnoor ab o v e, it obviously holds that M | = w 00 k − → x 1 , and M | = w 00 k +1 − → y 2 . Since b oth x 1 and y 2 are elemen ts of C, they ha ve the required n umber of successors, and therefore, since M | = ˆ ϕ k → k +1 w ≥ p,x ≥ q ,y ≥ r , Prop osition 4.9 implies that ( x 1 , y 2 ) is an edge in M , as claimed. Due to Lemma 3.8, we can assume, without loss of generality , that | A | is p olynomially b ounded (in the length of φ ). W e can additionally assume, again due to Lemma 3.8, that the num b er of no des v with maxdepth M ( v ) ≤ p + k + 3 is also restricted b y a p olynomial. Due to Prop osition 3.7, we can also assume that every world in M can b e reached from w in md ( φ ) steps. Therefore, w e can choose a set G ⊆ M with the following prop erties: – G is p olynomially b ounded, – G ⊆ C, – for every node u ∈ A and every v ∈ C such that ( u, v ) is an edge in M , and ev ery subform ula ψ of φ such that M , v | = ψ , there is a no de v 0 ∈ G such that ( u, v 0 ) is an edge in M , and M , v 0 | = ψ , – ev ery no de in C can b e reached on a path from some no de in G . Additionally , if ϕ is satisfied on every strict line, every no de in C can b e reac hed from some no de in G on a path of length at most md ( φ ) . Suc h a set can b e chosen with an application of the tec hnique used to pro ve Lemma 3.8: F act 2 A set G c an b e chosen with the pr op erties ab ove. Pr o of. First consider the case that ˆ ϕ is satisfied on ev ery strict line. In this case, since M is w -canonical, we know that A is exactly the set of vertices on the first p + k + 2 levels of M (the i -th level is the set of vertices v in M such that M | = w i − → v . Note that a canonical graph can only hav e one root). Since M is w -canonical, we can simply choose G to b e the set of those no des at level p + k + 3 in the mo del M which are also e lemen ts of C . Since in a canonical mo del M , for each no de v maxdepth M ( v ) is exactly the level of v in M , this is a set of p olynomial size, and every path from w to a no de in C passes through G . F urther, ev ery successor v ∈ C of a no de u ∈ A is trivially a member of G . Since ev ery no de in M can b e reached from the ro ot w in at most md ( φ ) steps, the claim follo ws. No w consider the case where ˆ ϕ is not satisfied on ev ery strict line. F or each w orld u ∈ M , let F u := { ψ ∈ sf ( φ ) | M , u | = ♦ ψ } , and let W u b e a subset of successors of u in M such that for every ψ ∈ F u , there is a w orld v ∈ W u suc h that ( u, v ) is an edge in M , M , v | = ψ , and | W u | ≤ | sf ( φ ) | . If it is p ossible to choose v ∈ C, then do so. Define M 0 := { w } , and for each i ∈ N , let M i +1 := ∪ u ∈ M i W u \ ∪ i j =0 M j No w define M 0 to be the restriction of M to the w orlds in ∪ i ∈ N M i . W e show that M 0 , w | = φ by proving that M 0 satisfies the conditions of Lemma 3.5. By construction, we know that w ∈ M 0 . Now let u ∈ M 0 , and let ψ b e a subformula of φ with M , u | = ♦ φ . Then φ ∈ F u , and therefore there is a world v ∈ W u with M , u | = φ . Since u ∈ M 0 , there is some i with u ∈ M i . It follo ws that W u ⊆ ∪ i +1 j =0 M j ⊆ M 0 , and hence v ∈ M 0 as claimed. Since M 0 is a restriction of M , we know that M 0 also is a K ( ˆ ϕ )-mo del, and inherits all size restrictions on submo dels that we hav e already established. Therefore, w e can, without loss of generalit y , assume that M 0 = M . No w define G := ∪ p + k +3 i =0 M i ∩ C . By the pro of of Lemma 3.8, since p + k + 3 is a constant, w e conclude that G is p olynomial in | φ | . By construction, G ⊆ C . W e prov e that every no de u ∈ C can b e reac hed on a path from a no de in C . F or ev ery u ∈ M , there exists a sequence of no des w = u 0 , u 1 , . . . , u n = u suc h that for all relev ant i, u i +1 ∈ W u i , ( u i , u i +1 ) is an edge in M , and u i ∈ M i \ ∪ i − 1 j =0 M i . Let t b e minimal such that u t ∈ C . Since w / ∈ C , it follo ws that t ≥ 1 , and we kno w that suc h a t exists, since u n = u ∈ C . It suffices to pro ve that On the Complexity of Elemen tary Mo dal Logics 21 u t ∈ G . Since u t ∈ C, it remains to prov e that u t ∈ ∪ p + k +3 i =0 M i . Assume that this is not the case, from the ab o v e it then follows that t ≥ p + k + 4. By c hoice of no des, we know that u p + k +3 has a p + k + 3-step predecessor, and since u p + k +3 is a predecessor of u, u p + k +3 also has a max(( q − k ) , ( r − k − 1))-step successor. Since u p + k +3 ∈ M p + k +3 \ M 0 , w e know that u p + k +3 6 = w , therefore it follows that u p + k +3 ∈ C , a contradiction to the minimality of t. No w, let u ∈ A, and let there b e some v ∈ C such that ( u, v ) is an edge in M , and M , v | = ψ for some ψ ∈ sf ( φ ). Since u ∈ A, we know that u = w or u does not hav e a p + k + 3-step predecessor, and hence u ∈ M i for some i ≤ p + k + 2. By construction of M i +1 , there is some w orld v 0 ∈ ∪ i +1 j =0 M j whic h satisfies the requiremen ts, since the successors are c hosen to b e from C if p ossible. Since v 0 ∈ ∪ i +1 j =0 M j ∩ C ⊆ G, this prov es that G indeed satisfies the conditions. F or every g ∈ C , we define M C g to b e the set M g ∩ C . Obviously , M C g is a graph with ro ot g , and is a restriction of C (recall that M g is the restriction of M to all vertices reachable from g on a directed path). Hence, Prop osition 3.4 and F act 1 immediately imply the following: F act 3 L et g ∈ C . Then M C g is a gr aph with r o ot g such that M C g | = ˆ ϕ i → i +1 for al l i ≥ 0 . F or any g ∈ C and i ∈ N , we define L g i := n v ∈ M C g | M | = g i − → v o . W e observe the follo wing fact: F act 4 L et g ∈ C , i ∈ N , x ∈ L g i , and y ∈ L g i +1 . Then ( x, y ) is an e dge in M . Pr o of. This immediately follows from F act 3 and the definition of L g i : By definition, it follo ws that C | = g i − → x, and C | = g i +1 − → y . F rom F act 1, we know that C | = ˆ ϕ i → i +1 , and hence there is an edge ( x, y ) in C as claimed. Graphs fulfilling the form ula ˆ ϕ 1 → 2 are “la yered:” Whenev er there are nodes x and y such that there is a path of length i from the ro ot to i, and of length i + 1 to the node y , then there is an edge b et ween x and y . F rom the definition, it is obvious that for an y subgraph X of C with ro ot g , that X is canonical, if for every pair of natural num b ers i 6 = j, it follows that L g i ∩ L g j ∩ X = ∅ . W e make a distinction b et ween those elemen ts in G which lead to a canonical graph, and those which do not. In light of Lemma 3.6, it is natural that we do not need to lo ok at the en tire graph, but can ignore no des whic h do not hav e “short” paths from the ro ot of the graph leading to it. F or a natural num ber b, we say that X is b -c anonic al , if for all 0 ≤ i < j ≤ b it holds that L g i ∩ L g j ∩ X = ∅ . W e define the follo wing: G can := g ∈ G | M C g is md ( φ ) -canonical , G non − can := g ∈ G | M C g is not md ( φ ) -canonical . It is ob vious that G = G can + G non − can . F or each g ∈ G non − can , let i ( g ) , j ( g ) denote natural n umbers, and let n ( g ) denote some no de suc h that n ( g ) ∈ L g i ( g ) ∩ L g j ( g ) , with 0 ≤ i ( g ) < j ( g ) ≤ md ( φ ) , and i ( g ) is minimal with these prop erties. In particular, observe that i ( g ) and j ( g ) are p olynomial in | φ | . W e no w show that for g ∈ G non − can , the graph M C g \ M C n ( g ) still has ro ot g , unless it is empty . It particular, this means that it makes sense to ask if these graphs are md ( φ )- canonical. 22 Edith Hemaspaandra and Henning Schnoor F act 5 L et g ∈ G non − can , such that M C g \ M C n ( g ) is not empty. Then M C g \ M C n ( g ) has r o ot g . Pr o of. Assume that this is not the case, i.e., that there is some v ∈ M C g \ M C n ( g ) , and in this graph, there is no path from g to v . Since v is an element of M C g , a path from g to v exists in the original mo del M . Let g → v 1 → · · · → v i → v b e this path. Since the path do es not exist in the graph M C g \ M C n ( g ) , it follows that one of the v j m ust b e an element of M C n ( g ) . Since there is a path from this v j to v , it follows that v is an element of M C n ( g ) as well, whic h is a con tradiction. The no des n ( g ) can b e seen as “minimal non-canonical p oints” in M C g . The following mak es this more precise: F act 6 L et g ∈ G non − can . Then M C g \ M C n ( g ) is md ( φ ) -c anonic al. Pr o of. Due to F act 5, w e know that M C g \ M C n ( g ) has root g , and b y definition this graph is a subset of C . Assume that it is not md ( φ )-canonical. Then there exist natural num b ers i 1 < i 2 ≤ md ( φ ) , and some no de v ∈ L g i 1 ∩ L g i 2 \ M C n ( g ) . Due to the minimality of i ( g ) , it follo ws that i ( g ) ≤ i 1 , and hence i ( g ) < i 2 . In particular, it follows by induction on F act 4 that there is a path from n ( g ) ∈ L g i ( g ) to v ∈ L g i 2 , i.e., v ∈ M C n ( g ) . This is a contradiction. As our next connectivit y result, we show the following: F act 7 L et g ∈ G non − can , and let x ∈ L n ( g ) i 1 , y ∈ L n ( g ) i 2 , wher e i 1 and i 2 ar e natur al numb ers such that i 2 ≡ i 1 + 1 mo d ( j ( g ) − i ( g )) . Then ( x, y ) is an e dge in M . Pr o of. Since n ( g ) ∈ L g i ( g ) ∩ L g j ( g ) and j ( g ) > i ( g ) , by induction on F act 4 we know that M | = n ( g ) j ( g ) − i ( g ) − → n ( g ) , and obviously this implies that for ev ery m ultiple of j ( g ) − i ( g ) , a path of that length exists in M from n ( g ) to n ( g ) itself. Now assume that i 2 = i 1 + 1 + j ( j ( g ) − i ( g )) for some in teger j . W e mak e a case distinction: Case 1: j ≥ 0 The ab ov e implies that M | = n ( g ) i 1 + j ( j ( g ) − i ( g )) − → x, and by c hoice of j, w e also know that M | = n ( g ) i 1 + j ( j ( g ) − i ( g ))+1 − → y . Since all of the inv olved no des are elements of C, and from F act 1 we know that C | = ˆ ϕ l → l +1 for all l ≥ 0 , this implies that there is an edge from x to y in M , as claimed. Case 2: j < 0 By choice of i 1 , we know that M | = n ( g ) i 1 − → x . By choice of j, the ab o ve and since − j is p ositiv e, we also know that M | = n ( g ) i 1 − j ( j ( g ) − i ( g ))+ j ( j ( g ) − i ( g ))+1 − → y . Hence the existence of the edge ( x, y ) again follows from F act 1. W e therefore hav e the following structure of the mo del M : By definition, M = A ∪ C ∪ M \ S, and by choice of G, every no de in C can b e reac hed on a path from a node in G . Therefore, C = ∪ g ∈ G M C g , and hence M can b e written as the union of sub-graphs as follo ws: M = A ∪ [ g ∈ G can M C g |{z} md ( φ ) − canonical ∪ [ g ∈ G non-can ( M C g \ M C n ( g ) ) | {z } md ( φ ) − canonical ∪ [ g ∈ G non-can M C n ( g ) ∪ ( M \ S ) . Recall that the set G is polynomial in | φ | . Due to Corollary 3.11, it suffices to restrict the “middle part” of this equation, i.e., the comp onen ts except A and M \ S, to p olynomial On the Complexity of Elemen tary Mo dal Logics 23 size in order to obtain the desired polynomial mo del. In order to do this, we will now prov e further connectivit y results for the sub-mo dels M C n ( g ) . It is important to note that due to Prop osition 3.4, all of these submo dels inherit all of the prop erties of their resp ectiv e sup er- mo dels which can b e expressed b y a universal first order formula. The idea b ehind the construction is the following: F or each no de in the original mo del, w e add enough successors in our new mo del to ensure that the new model satisfies the conditions of Lemma 3.6. F or the md ( φ )-canonical submo dels, w e know that we can stop adding no des at depth md ( φ ) , since other no des cannot b e reached on a shorter path from the ro ot. F or the non- md ( φ )-canonical submodels, w e cannot do this, but we also do not need to: Due to F act 7, w e hav e “circular” edges, hence we know that no des in a “lo w” level also are in a “high” lev el. F or the construction, let G can = { g 1 , . . . , g n } , and let G non − can = { g n +1 , . . . , g n + m } , F or 1 ≤ i ≤ m, define g n + m + i := n ( g n + i ) (note that in this case, by definition g n + i is a member of G non − can ). F or 1 ≤ i ≤ n + 2 m, define N i := M C g i , if 1 ≤ i ≤ n, M C g i \ M C n ( g i ) , if n + 1 ≤ i ≤ n + m, M C g i , if n + m + 1 ≤ i ≤ n + 2 m. Note that by definition and F act 5 it follo ws that N i is a graph which is either empty or has root g i . It also follows from the abov e that for 1 ≤ i ≤ n + m, the graph N i is md ( φ )-canonical. Since the union ov er all N i is the same as the union ov er all M C g (for all g ∈ G ), it follows that M = A ∪ [ 1 ≤ i ≤ n +2 m N i ∪ ( M \ S ) . Note that n + 2 m is polynomial in | φ | , since G is. W e need one helpful fact ab out the non- md ( φ )-canonical N i -mo dels: F act 8 L et i ∈ { n + m + 1 , . . . , n + 2 m } , i.e., let N i b e not md ( φ ) -c anonic al. Then N i = ∪ j ( g i − m ) − i ( g i − m ) j =0 L g i j . Pr o of. The inclusion ⊇ is obvious, since N i = M C g i . F or the inclusion ⊆ , let u ∈ N i . Since, b y definition, g i = n ( g i − m ) , and hence N i = M C n ( g i − m ) , there is a minimal j ∈ N suc h that u ∈ L n ( g i − m ) j . If j ≤ j ( g i ) − i ( g i ) , then the claim holds. Therefore, assume that j > j ( g i − m ) − i ( g i − m ) , and thus j 0 := j − ( j ( g i − m ) − i ( g i − m )) > 0. Since L n ( g i − m ) j 6 = ∅ , w e also know that L n ( g i − m ) j 0 − 1 6 = ∅ , therefore let v ∈ L n ( g i − m ) j 0 − 1 . By definition, it holds that j = ( j 0 − 1) + 1 + ( j ( g i − m ) − i ( g i − m )) , and in particular, j ≡ ( j 0 − 1) + 1 mo d ( j ( g i − m ) − i ( g i − m )). By F act 7, we kno w that there is an edge from v ∈ L n ( g i − m ) j 0 − 1 to u ∈ L n ( g i − m ) j . This implies, b y definition, that u ∈ L n ( g i − m ) j 0 , and by minimality of j, w e know that j ≤ j 0 , and hence j ( g i − m ) − i ( g i − m ) ≤ 0 , i.e., j ( g i − m ) ≤ i ( g i − m ) , a con tradiction. W e now define a series of mo dels M i for 0 ≤ i ≤ n + 2 m, which, step by step, integrate “enough” vertices of the original mo del M to ensure that the form ula φ still holds, but restrict the size to a p olynomial. As the induction start, we define M 0 := A . F or i ≥ 1 , the construction is as follo ws: – Add ev ery world from M i − 1 to M i , 24 Edith Hemaspaandra and Henning Schnoor – add g i to M i , – If 1 ≤ i ≤ m + n, i.e., if N i is md ( φ )-canonical, then for eac h 0 ≤ j ≤ md ( φ ) + maxline + 1 , and each formula ψ ∈ sf ( φ ) : if there is a world v ∈ L g i j suc h that M , v | = ψ , then add one of these worlds into M i . – If n + m + 1 ≤ i ≤ n + 2 m, i.e., if N i is not md ( φ )-canonical, then for each 0 ≤ j ≤ j ( g ) − i ( g ) + 1 , and each formula ψ ∈ sf ( φ ) , p erform the following: • If there is a world v ∈ L g i j suc h that M , v | = ψ , then add one of these worlds v in to M i . • If there is a w orld u which has b een added into one of the md ( φ )-canonical submodels in the step ab o ve, and there is a successor v ∈ L g i j of u such that M , v | = φ, then add one of these worlds v in to M i . By construction, since j ( g ) and i ( g ) are polynomial in | φ | for each g ∈ G non − can , and | sf ( φ ) | ≤ | φ | , there are only p olynomially many worlds in M n +2 m . W e no w define M 0 to b e the mo del M n +2 m ∪ ( M \ S ). Then the set of w orlds in M 0 whic h hav e max( q − k , r − k − 1)- step successor and a p + k + 3-step predecessor is p olynomially b ounded, since this is a subset of M n +2 m . Hence, due to Corollary 3.11, it suffices to show that M 0 , w | = φ in order to exhibit a mo del of φ which is p olynomial in size. In order to prov e this, we sho w that M 0 satisfies the conditions of Lemma 3.6. Since w ∈ A by definition and M 0 = A, w is an elemen t of M 0 b y definition. Therefore, let u b e an elemen t of M 0 , and let ψ b e a subform ula of φ, such that M , u | = ♦ ψ , and let a b e a natural num b er such that M | = w a − → u, and 1 + a + md ( ψ ) ≤ md ( φ ). It suffices to show that there is a w orld v ∈ M 0 suc h that M , v | = ψ , and ( u, v ) is an edge in M . Since M , u | = ♦ ψ , there is a world v 0 ∈ M , such that ( u, v 0 ) is an edge in M , and M , v 0 | = ψ . There are sev eral cases to consider. If v 0 ∈ A, then by the construction of M 0 , v 0 is an elemen t of M 0 as well. Hence we can choose v to b e v 0 . If u ∈ A, and v 0 / ∈ A, then it holds that either v 0 ∈ C or v 0 / ∈ S . If v 0 / ∈ S, then we kno w that v 0 ∈ M 0 , and we can choose v = v 0 . Hence assume that v 0 ∈ C . In this case, by c hoice of G, there is a world v 00 ∈ G, suc h that M , v 00 | = ψ , and ( u, v 00 ) is an edge in M . Since G ⊆ M 0 , we can c ho ose v = v 00 . If u ∈ M \ S, then v 0 ∈ M \ S holds as w ell. Therefore, it remains to consider the case u, v 0 ∈ C . First, assume that there is no i ∈ { 1 , . . . , n + 2 m } suc h that u, v 0 ∈ N i . Since u ∈ C, it follows that u ∈ N i for some i . Since v 0 / ∈ N i , N i m ust b e md ( φ )-canonical, since all other N i con tain all successors from C to no des in N i . It follows that u ∈ M C g i , and therefore v ∈ M C g i holds as well. Since v 0 / ∈ N i , there is a non- md ( φ )-canonical submo del N j suc h that v 0 ∈ N j = M C n ( g j − m ) , and hence, due to F act 8, there is some j 0 ∈ { 0 , . . . , j ( n ( g j − m )) − i ( n ( g j − m )) } such that v 0 ∈ L n ( g j − m ) j 0 . In this case, a node v fulfilling the requirements has b een added to the model M 0 due to the last condition in the construction. Now assume that there is some i ∈ { 1 , . . . , n + 2 m } , suc h that u, v 0 ∈ N i . If it is p ossible to c ho ose this i in such a wa y that N i is not md ( φ )-canonical, then w e do so. In particular, since ( u, v 0 ) is an edge in M , there is some natural num b er j suc h that u ∈ L g i j , and v 0 ∈ L g i j +1 . If it is only p ossible to c ho ose an i leading to a md ( φ )-canonical mo del N i , then choose i and j in suc h a w ay that j is minimal with this prop ert y . W e make a case distinction. Case 1: i ∈ { n + m + 1 , . . . , n + 2 m } , i.e., N i is not canonical. By F act 8, due to the minimalit y of j, we know that j ≤ j ( g i − m ) − i ( g i − m ). No w, since u ∈ L g i j and v 0 ∈ L g i j +1 , it follo ws that j + 1 ≤ j ( g i − m ) − i ( g i − m ) +1. Hence, by construction there is a v ∈ L g i j +1 ∩ M 0 , suc h that M , v | = ψ , and due to F act 4, there is an edge ( u, v ) in M . On the Complexity of Elemen tary Mo dal Logics 25 Case 2: i ∈ { 1 , . . . , n + m } , i.e., N i is md ( φ ) -canonical. If j + 1 ≤ md ( φ ) + maxline + 1 , then, due to the construction of M 0 , a w orld v from L g i j +1 satisfying ψ was added in the construction, and due to F act 4, ( u, v ) is an edge in M . Therefore, assume that j + 1 > md ( φ ) + maxline + 1 , i.e., j ≥ md ( φ ) + maxline + 1. Since N i is md ( φ )-canonical, we know that u cannot b e reached from g i with a path shorter than md ( φ ) steps. Due to the choice of i and j, we also kno w that u do es not app ear in a non- md ( φ )-canonical submo del (otherwise, since the non- md ( φ )-canonical submo dels are successor-closed there w ould be a non- md ( φ )-canonical submodel N i con taining both u and v 0 , and we would hav e c hosen this), and that in eac h md ( φ )-canonical submo del where u app ears, it has depth of at least md ( φ ) + 1. If ˆ ϕ is satisfied on every strict line, we kno w that ev ery no de from C can be reac hed from an elemen t in G with at most md ( φ ) steps, which is a contradiction. No w consider the case that ˆ ϕ is not satisfied on every strict line. Since in the md ( φ )- canonical submo dels, strict lines having the length of the depth of the submo del app ear, and ˆ ϕ is satisfied in M , we know that these submo dels cannot ha ve depth of more than maxline . Therefore, we know that j + 1 ≤ maxline , a con tradiction. Hence, w e know that M 0 , w | = φ, concluding the proof of Theorem 4.13. W e will now show that Theorem 4.13 implies NP-results for a n umber of related logics. The follo wing theorem shows that mo dal logics for classes of frames whic h fulfill a natural generalization of the Euclidean property hav e the p olynomial-size mo del prop ert y , and hence can b e solved in NP. Note that the case k = l = 1 of Corollary 4.14 follows from the main result of [HR07]. Our results and theirs are incomparable: They achiev e the NP-result for al l normal mo dal logics extending what in our notation is K ( ˆ ϕ 1 → 1 ) , where our results only hold for logics defined b y universal Horn clauses (although the pro of of Theorem 4.13 in most cases giv es the NP-result for all extensions of the logic which are defined b y un iversal formulas ov er the frame language—the only exception is the case where the graph formula is satisfied on ev ery strict line, note that this case needed sp ecial treatmen t in the pro of of Theorem 4.13, and relies on the tree-like prop erty for these logics prov en later in Theorem 4.33). W e ac hieve NP-results for man y logics which are not extensions of K ( ˆ ϕ 1 → 1 ) , but do not prov e these results for all extensions of these logics. With the preceding theorem and the results on the implication for formulas of the form ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r , w e obtain the following corollary: Corollary 4.14. L et ˆ ϕ b e a universal Horn formula implying ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r for some k , l , p, q , r ∈ N , such that one of the fol lowing c onditions holds: – 1 ≤ k , l. – l = 0 and k ≥ 2 . Then K ( ˆ ϕ ) has the p olynomial-size mo del pr op erty, and K ( ˆ ϕ ) - SA T ∈ NP . Pr o of. First assume that 1 ≤ k , l . Lemma 4.7 shows that ˆ ϕ k → l implies ˆ ϕ k 0 → k 0 +1 for some k 0 ≥ 1. F rom Lemma 4.11, we conclude that ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r implies ˆ ϕ k 0 → k 0 +1 w ≥ p 0 ,x ≥ q 0 ,y ≥ r 0 for some natural num bers p 0 , q 0 , and r 0 . Therefore, ˆ ϕ also implies ˆ ϕ k 0 → k 0 +1 w ≥ p 0 ,x ≥ q 0 ,y ≥ r 0 , and due to Theo- rem 4.13, K ( ˆ ϕ ) has the p olynomial-size mo del prop ert y and K ( ˆ ϕ )- SA T ∈ NP . F or the case l = 0 and k ≥ 2 , observ e that due to Lemma 4.12, K ( ˆ ϕ ) is also an extension of K ( ˆ ϕ k − 1 → k 3 w ≥ p 0 ,x ≥ q 0 ,y ≥ r 0 ) for some constan ts p 0 , q 0 , r 0 . Due to the prerequisites, it holds that 1 ≤ k − 1 ≤ k 3 − 2. Hence, the result follows from the case ab ov e. 26 Edith Hemaspaandra and Henning Schnoor Corollary 4.14 co vers all cases obtained from formulas of the form ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r where w e p ossibly could exp ect the p olynomial size prop erty to hold: The requirement demanding that k ≥ 2 is crucial, since the form ula ˆ ϕ 1 → 0 is satisfied in an y symmetric graph, and hence satisfiabilit y problems for the corresp onding logics are PSP A CE-hard due to Corollary 2.5. Additionally , logics defined by formulas of the form ˆ ϕ 0 → k are PSP ACE-hard as well: This form ula is satisfied in ev ery reflexive, transitive graph, and therefore the complexity result follo ws from Theorem 2.8. W e therefore hav e prov en that for Horn formulas defined b y these single clauses, as so on as they are not satisfied in v arious combinations of strict, transitive, reflexiv e, and symmetric trees, they already imply the p olynomial-size mo del prop ert y . Up to now, w e only considered the effect of a single universal Horn clause. How ev er, there are many cases where the logics defined by individual formulas hav e a PSP ACE- hard satisfiability problem, but the complexit y of the problem for logic defined by their conjunction drops to NP. A well-kno wn example for such a case is the mo dal logic K4B , whic h is the logic ov er graphs which are b oth symmetric and transitiv e. On their own, b oth of these prop erties lead to PSP ACE-hard logics, but their conjunction gives a logic whic h is in NP. In our notation, it can easily b e seen that K4B = K ( ˆ ϕ 1 → 0 ∧ ˆ ϕ 0 → 2 ). F or this concrete example and man y generalizations, the following Theorem gives this result. Theorem 4.15. L et k ≥ 2 ∈ N , and let p 1 , q 1 , r 1 , p 2 , q 2 , r 2 ∈ N . L et ˆ ϕ b e a universal Horn formula such that ˆ ϕ implies ˆ ϕ 1 → 0 w ≥ p 1 ,x ≥ q 1 ,y ≥ r 1 ∧ ˆ ϕ 0 → k w ≥ p 2 ,x ≥ q 2 ,y ≥ r 2 . Then K ( ˆ ϕ ) has the p olynomial size mo del pr op erty, and K ( ˆ ϕ ) - SA T ∈ NP . Pr o of. W e first prov e that ˆ ϕ 1 → 0 ∧ ˆ ϕ 0 → k implies ˆ ϕ 1 → ( k − 1) k if k is odd, and ˆ ϕ 2 → ( k − 1) k 2 if k is ev en. Let G b e a graph satisfying ˆ ϕ 1 → 0 ∧ ˆ ϕ 0 → k , and let w = x 0 , x 1 ( , x 2 if k is even) and w = y 0 , . . . , y ( k − 1) k ( , . . . , y ( k − 1) k 2 if k is even) b e no des in G such that ( x i , x i +1 ) and ( y i , y i +1 ) are edges for all relev an t i . First, let k be o dd. Since G | = ˆ ϕ 1 → 0 , it follo ws that G is symmetric. By applying the ˆ ϕ 0 → k -prop ert y k − 1 times, we get a path of length k − 1 from w to y ( k − 1) k . Hence, since ( x 1 , w ) is an edge, it follows that G | = x 1 k − → y ( k − 1) k , and due to the ˆ ϕ 0 → k -prop ert y , this implies that ( x 1 , y ( k − 1) k ) is an edge as required. No w let k b e ev en. Since k ≡ 0 mo d 2 , and k ≥ 2 , the symmetry of G ensures that there is a path of length k from w to x 2 . Hence, there is an edge ( w, x 2 ) , and due to the symmetry of G, an edge ( x 2 , w ). By ( k − 1) applications of the ˆ ϕ 0 → k 2 -prop ert y , we know that G | = w k − 1 − → y ( k − 1) k 2 . Hence, we conclude that G | = x 2 k − → y ( k − 1) k 2 , and another application of the ˆ ϕ 0 → k -prop ert y giv es the edge ( x 2 , y ( k − 1) k 2 ) , as required. F or the NP-result, observ e that ˆ ϕ 1 → 0 w ≥ p 1 ,x ≥ q 1 ,y ≥ r 1 ∧ ˆ ϕ 0 → k w ≥ p 2 ,x ≥ q 2 ,y ≥ r 2 implies ˆ ϕ 1 → 0 w ≥ p,x ≥ q ,y ≥ r ∧ ˆ ϕ 0 → k w ≥ p,x ≥ q ,y ≥ r , where p = max( p 1 , p 2 ) , q = max( q 1 , q 2 ) , and r = max( r 1 , r 2 ). Due to the ab o v e and Lemma 4.11, we know that this form ula implies ˆ ϕ 1 → ( k − 1) k w ≥ p 0 ,x ≥ q 0 ,y ≥ r 0 for some p 0 , q 0 , r 0 if k is o dd, and it implies ˆ ϕ 2 → ( k − 1) k 2 w ≥ p 00 ,x ≥ q 00 ,y ≥ r 00 for some p 00 , q 00 , r 00 if k is even. F urther, if k is o dd, then it follows that k ≥ 3. Hence, ( k − 1) k ≥ 6. If k is ev en, then, since k ≥ 2 , we know that ( k − 1) k 2 ≥ 4 , and in b oth cases the NP result follows from Corollary 4.14. Theorem 4.15 concludes our results ab out logics defined by sp ecific Horn formulas. W e no w hav e collected all to ols required to prov e the main result of the pap er, the complexity classification of satisfiabilit y problems for logics defined by universal Horn formulas. 4.5 The Main Result: A Di c hotom y for Horn F ormulas In this section, we show a dichotom y theorem, whic h classifies the complexity of the sat- isfiabilit y problem for logics of the form K ( ˆ ψ ) , where ˆ ψ is a conjunction of universal Horn On the Complexity of Elemen tary Mo dal Logics 27 clauses, into solv able in NP and PSP ACE-hard. The classification is given in the form of the algorithm Horn-Classifica tion presented in Figure 5. In order to explain the algorithm, w e need some more definitions. F or a set typ es-list ⊆ refl , symm , trans k | k ∈ N , we say that a graph G satisfies the conditions of typ es-list if it has the corresp onding prop erties, i.e., if refl ∈ typ es-list , then G is required to b e reflexiv e, if symm ∈ typ es-list , then G is required to b e symmet- ric, and if trans k ∈ typ es-list , then G is required to b e k -transitiv e. A typ es-list -tree is a graph which can b e obtained from a strict tree T by adding exactly those edges required to make it satisfy the conditions of typ es-list (note that this is a natural closure op erator). Similarly , a typ es-list -line is the typ es-list -closure of a strict line. Finally , for a universal Horn clause ϕ, let typ es-list − T hom ˆ ϕ denote the pairs ( α, T ) such that T is a typ es-list -tree, and α : prereq ( ˆ ϕ ) → T is a homomorphism. Intuitiv ely , due to Prop osition 4.3, this is the set of typ es-list -trees ab out which the clause ˆ ϕ makes a statement, along with the corre- sp onding homomorphisms. W e first define the cases of universal Horn clauses leading to NP-con tainment of the satisfiability problem: Definition 4.16. L et ˆ ϕ b e a universal Horn clause, and typ es-list ⊆ refl , symm , trans k | k ∈ N . We say that ( ˆ ϕ, typ es-list ) satisfies the NP-case , if one of the fol lowing o c curs: 1. conc ( ˆ ϕ ) = ( x, y ) for x 6 = y ∈ prereq ( ˆ ϕ ) , and ther e is ( α, T ) ∈ typ es-list- T hom ˆ ϕ such that ther e is no dir e cte d p ath c onne cting α ( x ) and α ( y ) in T , 2. typ es-list- T hom ˆ ϕ 6 = ∅ , and conc ( ˆ ϕ ) = ∅ or the vertic es fr om conc ( ˆ ϕ ) ar e differ ent and not c onne cte d with an undir e cte d p ath in prereq ( ˆ ϕ ) (this also applies if x or y do not app e ar in prereq ( ˆ ϕ ) ) 3. conc ( ˆ ϕ ) = ( x, y ) for x, y ∈ prereq ( ˆ ϕ ) , and ther e is a homomorphism α : prereq ( ˆ ϕ ) → L, wher e L is the typ es-list-line ( x 1 , . . . , x n ) , and ther e ar e i, j such that 1 ≤ i ≤ j − 2 such that α ( x ) = x j and α ( y ) = x i . 4. conc ( ˆ ϕ ) = ( x, y ) for x, y ∈ prereq ( ˆ ϕ ) , and ther e exist typ es-list-lines L 1 = ( x 0 , . . . , x n 1 ) and L 2 = ( y 0 , . . . , y n 2 ) and homomorphisms α 1 : prereq ( ˆ ϕ ) → L 1 , α 2 : prereq ( ˆ ϕ ) → L 2 , such that α 1 ( x ) = x i 1 , and α 1 ( y ) = x i 1 − 1 , α 2 ( x ) = y i 2 , and α 2 ( y ) = y i 2 + k , wher e k ≥ 2 . W e no w define the prop erties of Horn clauses which do not lead to NP-containmen t of the satisfiabilit y problems on their o wn. Recalling Section 2.2, it is natural that clauses whic h are satisfied in ev ery reflexive, transitive, or symmetric tree are among these. This is captured by the following definitions: If ˆ ϕ is a universal Horn clause with conc ( ˆ ϕ ) = ( x, y ) for x = y or x, y ∈ prereq ( ˆ ϕ ) , w e say that ( ˆ ϕ, typ es-list ) satisfies the r eflexive c ase , if x = y or for every ( α, T ) ∈ typ es-list − T hom ϕ suc h that ( α ( x ) , α ( y )) is not an edge in T , it holds that α ( x ) = α ( y ). ( ˆ ϕ, typ es-list ) satisfies the tr ansitive c ase for k ∈ N , if it do es not satisfy the reflexiv e case, and for every ( α , T ) ∈ typ es-list − T hom ˆ ϕ suc h that ( α ( x ) , α ( y )) is not an edge in T , there is a path from α ( x ) to α ( y ) in T , and there is some ( α, T ) ∈ typ es-list - T hom ˆ ϕ suc h that there is no edge ( α ( x ) , α ( y )) , and α ( y ) is exactly k levels b elo w α ( x ) in T . Finally , ( ˆ ϕ, typ es-list ) satisfies the symmetric c ase if it do es not satisfy the reflexiv e of the transitiv e case, and for ev ery ( α, T ) ∈ typ es-list - T hom ˆ ϕ suc h that ( α ( x ) , α ( y )) is not an edge in T , there is an edge ( α ( y ) , α ( x )) in T . W e can no w state the classification theorem—the pro of will follo w from the individual results in this section. Note that the algorithm as stated can not be implemen ted directly , since it uses tests of the form if a given first-order formula is satisfied in certain infinite classes of graphs, and chec ks if certain elemen ts are presen t in the infinite set typ es-list − T hom ˆ ϕ . Ho wev er, we b elieve that size-restrictions for the structures actually required to look at can b e prov en, and hence the algorithm hop efully can b e implemen ted to giv e a deterministic 28 Edith Hemaspaandra and Henning Schnoor decision pro cedure. How ev er, the main usage of the algorithm is to show more general classification theorems, as w e will see in Corollary 4.29. Theorem 4.17. L et ψ b e a c onjunction of universal Horn clauses. Then the c omplexity of K ( ψ ) - SA T is c orr e ctly determine d by Horn-Classifica tion . A first look at the algorithm in Figure 5 rev eals that it is obviously necessary to prov e that the c hoices that the algorithm has to mak e alw ays can b e made: in the relev ant situations, at least one of the “reflexive,” “transitive,” or “symmetric” conditions o ccurs. How ev er, b efore starting with the pro of, w e explain the general idea of the algorithm and giv e an example for a logic whic h Horn-Classifica tion pro ves to hav e a satisfiability problem in NP. 1: typ es-list := ∅ 2: while not done do 3: if every clause in ˆ ψ is satisfied on every typ es-list -tree then 4: K ( ˆ ψ )- SA T is PSP A CE-hard 5: end if 6: Let ˆ ϕ b e a clause in ˆ ψ not satisfied on every typ es-list -tree 7: if ( ˆ ϕ, typ es-list ) satisfies the NP-case then 8: K ( ˆ ψ ) has the p olynomial-size model prop ert y , and K ( ˆ ψ )- SA T ∈ NP . 9: else 10: conc ( ˆ ϕ ) = ( x, y ) for x = y or x, y ∈ prereq ( ˆ ϕ ) 11: if ( ˆ ϕ, typ es-list ) satisfies the reflexive case then 12: typ es-list := typ es-list ∪ { refl } 13: else if ( ˆ ϕ, typ es-list ) satisfies the transitive case for k ≥ 2 then 14: typ es-list := typ es-list ∪ ˘ trans k ¯ 15: else if ( ˆ ϕ, typ es-list ) satisfies the symmetric case then 16: typ es-list := typ es-list ∪ { symm } 17: end if 18: end if 19: if for some k, ˘ symm , trans k ¯ ⊆ typ es-list then 20: K ( ˆ ψ ) has the p olynomial-size model prop ert y , and K ( ˆ ψ )- SA T ∈ NP . 21: end if 22: end while Fig. 5. The algorithm Horn-Classifica tion In the v ariable typ es-list , the algorithm maintains a list of implications of the formula ψ . F or example, Horn-Classifica tion puts refl into typ es-list if it detects the formula ψ to require a graph satisfying it to be “near-reflexiv e” (meaning, reflexiv e in all no des with sufficien t heigh t and depth). Similarly , symm ∈ typ es-list means that ˆ ψ requires a graph to b e “near-symmetric,” and trans k ∈ typ es-list means that ˆ ψ requires a graph to b e “near- k - transitiv e” (this will b e made precise in Lemma 4.27). If at one p oin t Horn-Classifica tion detects that a clause ˆ ϕ satisfies one of the NP- conditions, then this means that the clause ˆ ϕ, in addition with the requiremen ts k ept in typ es-list , implies a graph-prop erty which leads to the p olynomial-size mo del prop erty . It is w ell-known that the mo dal logic ov er the class of frames which are b oth transitive and sym- metric has a satisfiabilit y problem in NP. Generalizing this, when Horn-Classifica tion detects that ˆ ψ requires “near-symmetry” and “near- k -transitivity ,” this also leads to the p olynomial-size mo del prop ert y and thus to NP-mem b ership of the satisfiabilit y problem, applying Theorem 4.15. On the Complexity of Elemen tary Mo dal Logics 29 f s x d a e b c y t Fig. 6. Example formula As an example, let ˆ ϕ b e the universal Horn clause with prerequisite graph as shown in Fig- ure 6, with conc ( ˆ ϕ ) = ( x, y ) , and let ˆ ψ b e the Horn formula having ˆ ϕ as its only conjunct. The algorithm Horn-Classifica tion starts with typ es-list = ∅ , and hence in its first itera- tion, chec ks if ˆ ϕ is satisfied in every strict tree. This is not the case, as Figure 7 shows (here, w e simply marked each note with the names of the vertices which are preimages of the homomorphism): This is a homomorphic image of prereq ( ˆ ϕ ) as a strict line (whic h in particular is a strict tree), in which the images of x and y are not connected with an edge. Therefore, ˆ ϕ is not satisfied in this line, and hence not in every strict tree. Ho wev er, it is clear that if we wan t to map prereq ( ˆ ϕ ) in to a strict tree, then all the v ertices b et ween s and t must b e “pairwise identified,” just like in Figure 7. b, f s x, d x, d a, e a, e b, f c, y c, y t Fig. 7. Homomorphic image as strict line Therefore the transitiv e case is satis- fied, and the figure sho ws that this is true for k = 3 (among p ossibly others). Hence Horn-Classifica tion adds the ele- men t trans 3 to typ es-list . Next it chec ks if ˆ ϕ is satisfied in ev ery trans 3 -tree. This again is not the case, and the homomorphic image of prereq ( ˆ ϕ ) as a trans 3 -line in Figure 8 sho ws that ˆ ϕ satisfies NP-condition 3 (we only included those lines added by the trans 3 -closure that are required for our function to be a homomorphism). Therefore, the logic K ( ˆ ϕ ) has the p olynomial-size mo del property , and its satisfiability problem is in NP. This example demonstrates that in the run of Horn-Classifica tion , a clause ˆ ϕ can meet differen t cases dep ending on the con ten t of the v ariable typ es-list : In the situation that typ es-list = ∅ , the clause ˆ ϕ satisfies the transitive case, but when typ es-list = trans 3 , this is no longer the case. f s x d a e b c y t Fig. 8. Homomorphic image as ˘ trans 3 ¯ -line As mentioned ab o ve, the first fact that we need to prov e ab out Horn-Classifica tion is that it is w ell-defined, that is, the case distinction betw een the “reflexive,” “transitive” and “symmetric” cases is complete. Lemma 4.18. Horn-Classifica tion is wel l-define d: in al l r elevant situations, at le ast one of the “r eflexive,” “tr ansitive,” and “symmetric” c ases o c curs. Pr o of. Assume that the algorithm is not well-defined, and let ˆ ψ b e an instance for whic h the algorithm b eha vior is unsp ecified. Let ˆ ϕ b e a clause for which none of the NP-conditions and none of the reflexive, transitiv e, and symmetric conditions hold. Let typ es-list be as determined b y Horn-Classifica tion when encoun tering ˆ ϕ. Since the algorithm only chooses ˆ ϕ if ˆ ϕ is not satisfied on every typ es-list -tree, we know that due to Proposition 4.3, there is some ( α, T ) ∈ typ es-list − T hom ˆ ϕ . Now assume that 30 Edith Hemaspaandra and Henning Schnoor conc ( ˆ ϕ ) = ∅ or conc ( ˆ ϕ ) = ( x, y ) for x 6 = y , and x, y do not b oth app ear in prereq ( ˆ ϕ ). Then NP-condition 2 is satisfied, and we hav e a contradiction. Therefore we kno w that ˆ ϕ is a universal Horn clause such that conc ( ˆ ϕ ) = ( x, y ) for some v ariables x, y such that x = y or x, y ∈ prereq ( ˆ ϕ ) Since the reflexive case do es not apply , we kno w that x 6 = y , and hence x, y ∈ prereq ( ˆ ϕ ) . Since NP-condition 1 do es not apply , we know that for every ( α, T ) ∈ typ es-list − T hom ˆ ϕ , there is a directed path connecting α ( x ) and α ( y ) . Since the transitive case do es not apply , we know that there is some ( α, T ) ∈ typ es-list − T hom ˆ ϕ in which there is no path from α ( x ) to α ( y ). W e therefore know, by the ab o ve, that there is a path from α ( y ) to α ( x ) in T . Hence, T is not symmetric. Since T is a typ es-list -tree, w e know that symm / ∈ typ es-list . Since there is a path from α ( y ) to α ( x ) in T but not vice versa, we know that α ( x ) 6 = α ( y ) , and since there is a path from α ( y ) to α ( x ) in the (p ossibly reflexiv e and/or S -transitiv e for some set S ) tree T , this implies that α ( x ) is on a low er level in T than α ( y ). Let k denote the difference in levels b etw een α ( x ) and α ( y ) , then k ≥ 1. By mapping T into a typ es-list - line L 1 = ( x 0 , . . . , x n 1 ) with the homomorphism β assigning each vertex u the elemen t x i , where i is the lev el of u in T , we can, using the homomorphism α 1 := β ◦ α, map prereq ( ˆ ϕ ) homomorphically in to L 1 in suc h a wa y that α 1 ( x ) = x i , and α 1 ( y ) = x i − k , where i denotes the lev el of α ( x ) in T . If k ≥ 2 , then the line L 1 satisfies NP-condition 3 , a contradiction. Therefore, we know that k = 1 , and thus α 1 and L 1 satisfy NP-condition 4. Since ˆ ϕ also do es not satisfy the symmetric case, we know that there is some ( α, T ) ∈ typ es-list - T hom ˆ ϕ suc h that there is no edge ( α ( x ) , α ( y )) and no edge ( α ( y ) , α ( x )) in T . By NP-condition 1 , w e know that there is a directed path connecting α ( x ) and α ( y ) in T . Since symm / ∈ typ es-list , and T is a typ es-list -tree, we know that T is not symmetric. If refl ∈ typ es-list , and T is a typ es-list -tree, this implies that T is reflexive, and hence α ( x ) 6 = α ( y ). If refl / ∈ typ es-list , then we know that, since symm also is not an element of typ es-list , that no no de in T is connected to itself with a directed path, and therefore we also know that α ( x ) 6 = α ( y ). Now assume that there is a path from α ( y ) to α ( x ) in T . Then the shortest of these paths must ha ve length k ≥ 2 (since there is no edge ( α ( y ) , α ( x )) and therefore w e can map T (and therefore prereq ( ˆ ϕ )) homomorphically into a line L 1 as in the case ab o ve, where the distance of the image of α ( x ) and α ( y ) is k , and since α ( y ) is mapp ed to a predecessor of α ( x ) , this line satisfies NP-condition 3 , a con tradiction. Therefore we kno w that in T , there is a directed path from α ( x ) to α ( y ). Since ( α ( x ) , α ( y )) is no e dge in T , w e know that the shortest of these paths m ust hav e length ≥ 2. Since T is not symmetric, this implies that α ( y ) must b e on a lo wer level in T than α ( x ) , and the difference in levels is ≥ 2. Similarly , to the ab o ve, we can construct a typ es-list -line L 2 = ( x 0 , . . . , x n 2 ) and a homomorphism β : T → L 2 , such that for v ∈ T , if i is the lev el of v in T , then β ( v ) = x i . Let α 2 denote the homomorphism β ◦ α . Due to the choice of k and the definition of β , we know that α 2 ( x ) = x i , and α 2 ( y ) = x i + k for some i, and hence α 2 and L 2 satisfy NP-condition 4. Since ab o v e, we already constructed α 1 and L 1 satisfying NP-condition 4 , this implies that ˆ ϕ satisfies NP-condition 4 , a con tradiction. Also note that in the transitiv e case, a k ≥ 2 can alwa ys b e c hosen: Since b y construction of the algorithm, ˆ ϕ is not satisfied on every typ es-list -tree, there is some ( α, T ) such that ( α ( x ) , α ( y )) is not an edge in T . Since the reflexiv e case do es not apply , we can choose ( α, T ) in such a wa y that α ( x ) 6 = α ( y ). Due to the transitiv e case, there is a path from α ( x ) to α ( y ) in T , and hence the shortest of these paths m ust ha ve length of at least 2 , hence the difference of levels is at least 2 (we know that even if symm ∈ typ es-list , α ( y ) must b e b elow α ( x ) in T , otherwise NP-condition 3 would apply). On the Complexity of Elemen tary Mo dal Logics 31 No w that we know that Horn-Classifica tion is well-defined, w e show that it alwa ys comes to a halt and hence, generates an answer—this is not immediate: Note that in the example formula from Figure 6 disc ussed ab o v e, w e already saw that it is p ossible for the algorithm to revisit a clause. Therefore one might consider it p ossible for the algorithm to rep eatedly add the same elemen t to the v ariables typ es-list without coming to a halt, or the list typ es-list to grow infinitely . In order to show that this do es not happ en, we prov e a b ound on the num b er of the elements that can be added into this list during the run of the algorithm. A first helpful tool to show this is the following Prop osition, which sa ys that there are no “redundan t” transitivity conditions which get added to typ es-list . Prop osition 4.19. L et trans k b e adde d to the variable typ es-list by Horn-Classifica tion . Then typ es-list did not imply k -tr ansitivity b efor e adding trans k . Pr o of. Assume that typ es-list already implied trans k . Since trans k is added by Horn-Classifica tion , there is a clause ˆ ϕ with conclusion edge ( x, y ) for x, y ∈ prereq ( ˆ ϕ ) whic h satisfies the transitive condition for k at this p oin t of the algorithm’s run. Therefore, there is some ( α, T ) ∈ typ es-list - T hom ˆ ϕ suc h that ( α ( x ) , α ( y )) is not an edge in T , and α ( y ) is exactly k lev els b elow α ( x ). Since by the assumption the conditions of typ es-list already imply k -transitivit y , the k -step path from α ( x ) to α ( y ) implies that ( α ( x ) , α ( y )) is an edge in T , a contradiction. No w that w e know that transitivity conditions whic h were already implied by the con- ditions present in typ es-list do not get added to the list, there is a clear strategy how w e can pro ve that typ es-list do es not gro w infinitely: W e first prov e just how man y transitivity conditions are implied by the conditions in typ es-list , and then show that from a certain p oin t on, ev erything that will b e added to typ es-list b y Horn-Classifica tion already is implied. In order to prov e this, we need some technical results ab out implications of v arious forms of S -transitivity . Lemma 4.20. L et k 1 , k 2 ∈ N . Then { k 1 , k 2 } -tr ansitivity implies ( k 2 + l · ( k 1 − 1)) -tr ansitivity for al l l ≥ 0 . Pr o of. W e sho w the claim by induction on l . F or l = 0 , this holds trivially , since { k 1 , k 2 } - transitivit y b y definition implies k 2 -transitivit y . No w assume that it holds for l , let G b e some graph which is { k 1 , k 2 } -transitiv e, and let u 0 , . . . , u k 2 +( l +1) · ( k 1 − 1) b e no des in G suc h that ( u i , u i +1 ) is an edge for all relev ant i . W e need to show that ( u 0 , u k 2 +( l +1)( k 1 − 1) ) is an edge in G . Since b y the induction hypothesis, { k 1 , k 2 } -transitivit y implies ( k 2 + l · ( k 1 − 1))- transitivit y , we kno w that G is ( k 2 + l · ( k 1 − 1))-transitive. Therefore there is an edge ( u 0 , u k 2 + l · ( k 1 − 1) ) in G . By choice of u i , there is a ( k 1 − 1)-step path from u k 2 + l · ( k 1 − 1) to u k 2 +( l +1) · ( k 1 − 1) . Therefore there is a k 1 -step path from u 0 to u k 2 +( l +1) · ( k 1 − 1) , and since G is k 1 -transitiv e, this implies that ( u 0 , u k 2 +( l +1) · ( k 1 − 1) ) is an edge in G, as required. Lemma 4.21. L et m, k 1 , e 1 , d ∈ N such that ( k 1 − 1) = e 1 · d . Then { k 1 , m, m + d, . . . , m + ( e 1 − 1) · d } -tr ansitivity implies ( m + l · d ) -tr ansitivity for al l l ≥ 0 . Pr o of. Let l = p · e 1 + r for some p, r ∈ N , r < e 1 . Then m + l · d = m + ( p · e 1 + r ) · d = m + r · d + pe 1 · d = m + r · d + p ( k 1 − 1). Since r < e 1 , we know that { k 1 , m, m + d, . . . , m + ( e 1 − 1) · d } - transitivit y implies ( m + r · d )-transitivit y . By Lemma 4.20, w e kno w that { k 1 , m + r · d } - transitivit y implies ( m + r · d + p ( k 1 − 1))-transitivit y , and since k 1 -transitivit y is obviously implied b y the prerequisites, this prov es the Lemma. 32 Edith Hemaspaandra and Henning Schnoor Lemma 4.22. L et ( k 1 − 1) = e 1 · d, and let n 0 , . . . , n e 1 − 1 ∈ N such that n i ≡ n j mo d d, and for i 6 = j, n i 6≡ n j mo d ( k 1 − 1) . Then ther e exists some m ∈ N such that m ≡ n i mo d d such that { k 1 , n 0 , . . . , n e 1 − 1 } -tr ansitivity implies ( m + l · d ) -tr ansitivity for al l l ≥ 0 . Pr o of. Let S := { k 1 , n 0 , . . . , n e 1 − 1 } , and let n i = a i · ( k 1 − 1) + n 0 i , where n 0 i < k 1 − 1. Due to Lemma 4.20, { k 1 , n i } -transitivit y implies ( n i + l · ( k 1 − 1))-transitivity for all l ≥ 0. Therefore we can choose a := max { a 0 , . . . , a e 1 − 1 } , and we know that S -transitivity implies ( a · ( k 1 − 1) + n 0 i )-transitivit y . Since for all l, n i + l · ( k 1 − 1) is equiv alent to n i mo dulo k 1 − 1 and modulo d (since d divides k 1 − 1), we can assume without loss of generality that n i = a · ( k 1 − 1) + n 0 i for all 0 ≤ i ≤ e 1 − 1. Let n 0 i = t i · d + r, where r < d . Suc h num b ers t i exist, since n i ≡ n j mo d d for all i, j . Since n 0 i < k 1 − 1 , we know that t i · d + r < k 1 − 1 = e 1 · d, and therefore t i ≤ e 1 − 1 for all 0 ≤ i ≤ e 1 − 1 . Define m := a · ( k 1 − 1) + r . Note that since d divides k 1 − 1 , this implies that m ≡ r mo d d . F or the n i it holds that n i = a · ( k 1 − 1) + n 0 i , and again, since d divides k 1 − 1 , w e hav e that n i ≡ n 0 i mo d d . Now since n 0 i = t i · d + r, it follows that n 0 i is equiv alen t to r mo dulo d, and hence m and n i are equiv alent modulo d for all i . No w note that n i − m = a · ( k 1 − 1) + n 0 i − a · ( k 1 − 1) − r = n 0 i − r = t i · d + r − r = t i · d. Therefore, since S -transitivity implies n i -transitivit y for all i, we kno w that S -transitivity implies ( m + t i · d )-transitivity for all i . Since t i ≤ e 1 − 1 , and for i 6 = j, it also holds that t i 6 = t j (otherwise it would follo w that n 0 i = n 0 j and hence n i = n j , a contradic- tion), it follows that { t 0 , . . . , t e 1 − 1 } = { 0 , . . . , e 1 − 1 } . W e therefore know that for each i ∈ { 0 , . . . , e 1 − 1 } , S -transitivit y implies ( m + i · d )-transitivity , and since k 1 ∈ S, the claim follo ws from Lemma 4.21. The following lemma is the final of our results ab out implied transitivit y conditions. Its technical formulation hides the fact that the statemen t of the lemma is actually rather natural. As an example, consider the case where k 1 = 5 , and k 2 = 7. Then gcd( k 1 − 1 , k 2 − 1) = 2 , and then the lemma sa ys that there is some o dd num b er m suc h that for all odd n umbers m + 2 · l , { 5 , 7 } -transitivity implies ( m + 2 · l )-transitivity . The key idea is that then, once trans 5 and trans 7 are elements of typ es-list , we know that due to Prop osition 4.19, Horn-Classifica tion do es not add any more trans k -conditions to typ es-list an ymore for o dd k s which are greater than or equal to m . Therefore there are only finitely man y o dd k s such that Horn-Classifica tion can add trans k from this p oint on. If Horn-Classifica tion w ould add an infinite n umber of trans k -conditions, then one of them must therefore b e one where k is even. Assume that this already happ ens with k 3 , i.e., that k 3 is an even num b er. Then k 3 − 1 is odd, and therefore the greatest common divisor of k 1 − 1 , k 2 − 1 , and k 3 − 1 is 1. By the lemma, w e therefore kno w that there is some m suc h that { 5 , 7 , k 3 } -transitivit y implies m 0 -transitivit y for all m 0 ≥ m, and then Horn-Classifica tion can only add trans k -conditions for k ≤ m 0 , and this is only a finite num b er of p ossibilities. Thus we know that Horn-Classifica tion must stop adding transitivit y conditions at some p oin t. With the ab o ve pro of-strategy in mind, it is clear that the statement of the fol- lo wing lemma is crucial in restricting the num b er of trans k -conditions added by Horn-Classifica tion . Lemma 4.23. L et k 1 , . . . , k n ∈ N , and let d := gcd(( k 1 − 1) , . . . , ( k n − 1)) . Then ther e exists some m ∈ N such that m ≡ 1 mod d and { k 1 , . . . , k n } -tr ansitivity implies ( m + l · d ) - tr ansitivity for al l l ≥ 0 . On the Complexity of Elemen tary Mo dal Logics 33 Pr o of. Let S = { k 1 , . . . , k n } . W e sho w the claim inductiv ely on n . If n = 1 , then d = k 1 − 1 , and by Lemma 4.20, { k 1 , k 1 } -transitivit y implies ( k 1 + l · ( k 1 − 1))-transitivity for all l ≥ 0 , hence the claim follo ws with m = k 1 . Since we need the case n = 2 explicitly in the induction, w e prov e it individually . Hence let n = 2 , and let ( k i − 1) = e i · d, where gcd( e 1 , e 2 ) = 1. F rom Lemma 4.20, w e know that { k 1 , k 2 } -transitivit y implies k 1 + i · ( k 2 − 1) = i · k 2 + k 1 − i - transitivit y for all i ≥ 0. Now note that for all 0 ≤ i ≤ e 1 − 1 : i · k 2 + ( k 1 − i ) = i · ( k 2 − 1) + ( k 1 − 1) + 1 = i · e 2 · d + e 1 · d + 1 = d · ( i · e 2 + e 1 ) + 1 =: n i . Due to Lemma 4.22, it suffices to show that all of these n i are equiv alen t to 1 mo dulo d, and for 0 ≤ i < j ≤ e 1 − 1 , n i 6≡ n j mo d ( k 1 − 1). It is obvious that all n i are equiv alent to 1 mo dulo d . Now assume that there are 0 ≤ i < j ≤ e 1 − 1 such that n i ≡ n j mo d ( k 1 − 1). Then the follo wing holds: d · ( j · e 2 + e 1 ) + 1 ≡ d · ( i · e 2 + e 1 ) + 1 mo d ( k 1 − 1) d · ( j · e 2 + e 1 ) − d ( i · e 2 + e 1 ) ≡ 0 mo d ( k 1 − 1) d · ( j · e 2 − i · e 2 ) ≡ 0 mo d ( k 1 − 1) d · e 2 · ( j − i ) ≡ 0 mo d ( k 1 − 1) d · e 2 · ( j − i ) = t · d · e 1 for some t e 2 · ( j − i ) = e 1 · t e 2 · ( j − i ) ≡ 0 mo d e 1 j − i ≡ 0 mo d e 1 , since gcd( e 1 , e 2 ) = 1 This is a con tradiction, since due to the abov e, we kno w that 0 < j − i ≤ e 1 − 1. This completes the pro of for the case n = 2 . No w inductiv ely assume that the lemma holds for n ≥ 2. Let d 0 := gcd( k 1 − 1 , . . . , k n − 1). Recall that d = gcd( k 1 − 1 , . . . , k n +1 − 1). W e first show that d = gcd( k n +1 − 1 , d 0 ) , which is a standard fact from num b er theory . Obviously , d divides b oth k n +1 and d 0 , and hence d | gcd( k n +1 − 1 , d 0 ). On the other hand, let g be a common divisor of k n +1 − 1 and d 0 . Since g divides d 0 , g is also a divisor of k 1 − 1 , . . . , k n − 1 , and since g divides k n +1 − 1 , it is a common divisor of all k i − 1. Therefore, g | d . In particular, this holds for g = gcd( k n +1 − 1 , d 0 ) , and therefore gcd( k n +1 − 1 , d 0 ) | d . Since the other direction holds due to the ab o ve, w e hav e sho wn that d = gcd( k n +1 − 1 , d 0 ) . Due to the induction hypothesis, we kno w that there is a natural num b er m 0 suc h that m 0 ≡ 1 mod d 0 , and for all l 0 ≥ 0 , S -transitivity implies ( m 0 + l 0 · d 0 )-transitivit y . Let m 0 = q · d 0 + 1 , and let l 0 b e a natural num b er such that gcd( q + l 0 , k n +1 − 1) = 1. Then, b y choice of m 0 , w e know that S -transitivity implies ( m 0 + l 0 · d 0 )-transitivit y . Let e := gcd( m 0 + l 0 · d 0 − 1 , k n +1 − 1). Since S -transitivity also implies k n +1 -transitivit y , we know from the case n = 2 that there exists a natural num ber m such that m ≡ 1 mod e, and for all l ≥ 0 , S -transitivity implies ( m + l · e )-transitivity . In order to pro ve the lemma, it therefore suffices to sho w that e = d . It holds that e = gcd( m 0 + l 0 · d 0 − 1 , k n +1 − 1) = gcd( q · d 0 + 1 + l 0 · d 0 − 1 , k n +1 − 1) = gcd(( q + l 0 ) · d 0 , k n +1 − 1) . Since d is a divisor of d 0 and of k n +1 − 1 , it follows that d | e . On the other hand, e is a common divisor of ( q + l 0 ) · d 0 and k n +1 − 1. Since gcd( q + l 0 , k n +1 − 1) = 1 , w e know that e divides d 0 . Since e also divides k n +1 − 1 , this implies that e is a divisor of gcd( d 0 , k n +1 − 1) = d . Therefore e | d and d | e, and hence we hav e prov en that e = d, as claimed. 34 Edith Hemaspaandra and Henning Schnoor W e can now prov e that there are only finitely many additions of the form trans k during the algorithm’s run, using the argumen ts from the discussion b efore Lemma 4.23: Lemma 4.24. L et ˆ ψ b e a universal Horn formula. Then Horn-Classifica tion , on input ˆ ψ , only adds finitely many c onditions of the form trans k to typ es-list . Pr o of. Assume that this is not the case. Due to Prop osition 4.19, we know that each added trans k -elemen t is not implied by the previous elements, in particular, no element is added t wice. Hence there is an infinite sequence ( k n ) n ∈ N suc h that all trans k n are added to typ es-list , they are added in this order, and for n 6 = m, we hav e k n 6 = k m . F or n ∈ N , let d n := gcd( k 1 − 1 , . . . , k n − 1). Then d n is ob viously decreasing, and b ounded by 1. Therefore, the sequence conv erges, i.e., there is some d, n 0 ∈ N suc h that d n = d for all n ≥ n 0 . Due to Lemma 4.23, we know that there is some m suc h that { k 1 , . . . , k n 0 } -transitivit y implies ( m + l · d )-transitivity for all l ≥ 0 , and m ≡ 1 mo d d . Since the sequence ( k n ) n ∈ N is infinite and no element is rep eated, there is some n ≥ n 0 suc h that k n ≥ m . Since gcd( k 1 − 1 , . . . , k n 0 − 1 , . . . , k n − 1) = d n = d, we know that d divides k n − 1. Therefore, let k n = d · p + 1. Since m ≡ 1 mo d d, let m = d · q + 1. Since k n ≥ m, w e know that p ≥ q . Hence it follows that k n = d · p + 1 = d ( p − q + q ) + 1 = d · ( p − q ) + d · q + 1 = d · ( p − q ) + m. Due to the choice of m and since p − q ≥ 0 , we therefore kno w that { k 0 , . . . , k n 0 } - transitivit y implies k n -transitivit y . This is a contradiction to Prop osition 4.19, since k n is added after k 0 , . . . , k n 0 . Therefore, there are only finitely many elemen ts of the form trans k added b y the algorithm. Since we hav e now restricted the n umber of elements trans k added to typ es-list , we can pro ve that the algorithm halts on any input. Lemma 4.25. Horn-Classifica tion always halts. Pr o of. Assume that it do es not halt for an instance ˆ ψ . Due to Lemma 4.24, we know that there are only finitely many elements of the form trans k whic h are added to typ es-list b y Horn-Classifica tion . Since the only other elements which can b e added to typ es-list are refl and symm , this implies that there are only finitely many elements of any type which are added to typ es-list . Now let typ es-list b e as determined by the algorithm. Since the size of typ es-list is b ounded and the v ariable nev er shrinks, this is well-defined. Since the algorithm do es not halt, we know that there is a clause ˆ ϕ in ˆ ψ whic h is not satisfied in ev ery typ es-list -tree, and ˆ ϕ do es not satisfy any of the 4 NP-conditions. Th us there is some ( α, T ) ∈ typ es-list − T hom ˆ ϕ suc h that ˆ ϕ is not satisfied in T . Since we already show ed that Horn-Classifica tion is well-defined, and none of the NP-cases applies (otherwise the algorithm w ould come to a halt), we know that one of the reflexiv e, transitiv e, or symmetric cases applies. In particular, conc ( ˆ ϕ ) = ( x, y ) , and x = y or x, y ∈ prereq ( ˆ ϕ ) and ( α ( x ) , α ( y )) is not an edge in T . If one of the cases corresp onding to an elemen t not in typ es-list applies, then this leads to an enlargement of typ es-list , a contradiction to the c hoice of typ es-list . Hence one of the cases corresp onding to one of the elements already in typ es-list applies. W e make a case distinction: Case 1: the reflexiv e case applies. In the case that x = y , the clause is trivially satisfied in the reflexiv e graph T . Assume that x 6 = y . In this case, α ( x ) = α ( y ). But since refl ∈ typ es-list , and ( α, T ) ∈ typ es-list − T hom ˆ ϕ , w e know that T is a reflexiv e tree. Hence, the edge ( α ( x ) , α ( y )) exists in T , a contradiction. On the Complexity of Elemen tary Mo dal Logics 35 Case 2: the transitiv e case applies for some k. In this case, there is a path of length k from α ( x ) to α ( y ) in T . But since trans k ∈ typ es-list , and ( α, T ) ∈ typ es-list − T hom ˆ ϕ , w e know that T is a k -transitiv e tree. Hence, the edge ( α ( x ) , α ( y )) exists in T , a con tradiction. Case 3: the symmetric case applies. In this case, there is an edge from α ( y ) to α ( x ) in T . But since symm ∈ typ es-list , and ( α, T ) ∈ typ es-list − T hom ˆ ϕ , we know that T is a symmetric tree. Hence, the edge ( α ( x ) , α ( y )) exists in T , a contradiction. Since w e hav e a contradiction in each case, this completes the pro of. No w that w e kno w that the algorithm is b oth well-defined and comes to a halt, it remains to pro ve its correctness. The case in which the algorithm states PSP ACE-hardness is easily seen to b e correct: Lemma 4.26. If for a universal Horn formula ˆ ψ , Horn-Classifica tion states that K ( ˆ ψ ) - SA T is PSP ACE -har d, then this is true. Pr o of. The only p ossibilit y for the algorithm to state that the problem is PSP A CE-hard is when the WHILE-lo op do es not discov er any clauses ˆ ϕ anymore which are not satisfied in ev ery typ es-list -tree, and typ es-list do es not con tain b oth symm and trans k for any k ∈ N . Since each clause ˆ ϕ in ˆ ψ is satisfied in every typ es-list -tree, this implies that the conjunction ˆ ψ is also satisfied in each typ es-list -tree. Hence one of the following cases o ccurs: – ˆ ψ is satisfied in every strict tree (if typ es-list = ∅ ), – ˆ ψ is satisfied in every reflexive tree (if typ es-list = { refl } ), – there is a set S ⊆ N such that ˆ ψ is satisfied in ev ery S -transitive tree (if typ es-list = trans k | k ∈ S ), – ˆ ψ is satisfied in every symmetric tree (if typ es-list = { symm } ), – ˆ ψ is satisfied in every tree which is b oth reflexive and symmetric (if typ es-list = { refl , symm } ), – there is a set S ⊆ N suc h that ˆ ψ is satisfied in ev ery tree which is both reflexive and S -transitive (if typ es-list = refl , trans k | k ∈ S ). In eac h of these cases, the hardness result follows directly from Theorem 2.8. W e are now in terested in the NP-cases. W e first show that if Horn-Classifica tion adds one of the requirements symm , refl , or trans k for some k to the list typ es-list , then the form ula ˆ ψ requires any graph G satisfying ˆ ψ to hav e the corresp onding prop ert y (except for v ertices with insufficien t depth or heigh t in the graph). More precisely , w e sho w the follo wing Lemma: Lemma 4.27. L et ˆ ψ b e a universal Horn formula, and let typ e ∈ refl , symm , trans k | k ∈ N b e adde d to typ es-list by Horn-Classifica tion on in- put ˆ ψ . Then the fol lowing holds: – If typ e = symm , then ˆ ψ implies ˆ ϕ 1 → 0 w ≥ p,x ≥ p,y ≥ p for some p ∈ N , – If typ e = refl , then ˆ ψ implies ˆ ϕ 0 → 0 w ≥ p,x ≥ p,y ≥ p for some p ∈ N , – If typ e = trans k , then ˆ ψ implies ˆ ϕ 0 → k w ≥ p,x ≥ p,y ≥ p for some p ∈ N . Pr o of. Inductively assume that all v alues added b efore typ e (if any) were “correct” in the sense that they satisfy the conditions of the lemma. Let the conten t of the v ariable typ es-list directly b efore adding typ e b e denoted with pr ev-typ es-list . Let ˆ ϕ be the clause in ˆ ψ for 36 Edith Hemaspaandra and Henning Schnoor whic h typ e was added. Then, by the construction of the algorithm, w e kno w that ˆ ϕ satisfies the case in the algorithm corresp onding to typ e , it particular, conc ( ˆ ϕ ) = ( x, y ) for some v ariables x = y or x, y ∈ prereq ( ˆ ϕ ). First assume that x, y ∈ prereq ( ˆ ϕ ) . W e also know that ˆ ϕ is not satisfied in ev ery pr ev-typ es-list -tree. Hence, let ( α, T ) ∈ pr ev-typ es-list − T hom ˆ ϕ suc h that ( α ( x ) , α ( y )) is not an edge in T . This must exist due to Prop osition 4.3. By construction of Horn-Classifica tion , in the case that typ e = refl , w e hav e that α ( x ) = α ( y ) , and in the case that typ e = trans k , we can choose ( α, T ) in such a wa y that α ( y ) is is k lev els below α ( x ) in T . Finally , in the case that typ e = symm , w e kno w that there is an edge ( α ( y ) , α ( x )) in T . Since the reflexive condition do es not apply , w e can choose ( α, T ) in such a wa y that α ( x ) 6 = α ( y ) , and since symm / ∈ pr ev-typ es-list , this implies that α ( x ) is in a low er level of T than α ( y ). Since all additions b efore typ e were correct, w e know that all the types in pr ev-typ es-list ha ve b een added correctly , i.e., w e can assume that there is some p such that – If symm ∈ pr ev-typ es-list , then ˆ ψ implies ˆ ϕ 1 → 0 w ≥ p,x ≥ p,y ≥ p for some p ∈ N , – If refl ∈ pr ev-typ es-list , then ˆ ψ implies ˆ ϕ 0 → 0 w ≥ p,x ≥ p,y ≥ p for some p ∈ N , – If trans k ∈ pr ev-typ es-list , then ˆ ψ implies ˆ ϕ 0 → k w ≥ p,x ≥ p,y ≥ p for some p ∈ N . W e can use the same v alue p for all form ulas here b y taking the maxim um, since clearly , ˆ ϕ k → l w ≥ p,x ≥ q ,y ≥ r implies ˆ ϕ k → l w ≥ p 0 ,x ≥ q 0 ,y ≥ r 0 if p 0 ≥ p, q 0 ≥ q, and r 0 ≥ r . Now let L = ( x 0 , . . . , x n ) b e the homomorphic image of T under the homomorphism δ as a pr ev-typ es-list -line, where δ assigns eac h v ∈ T the no de x i , with i b eing the level of v in T . Let α ( x ) b e in the a th lev el of T , and let α ( y ) b e in the n − b th level of T (where n is the heigh t of T ). Due to the construction of δ, we know that δ ( α ( x )) = x a , and δ ( α ( y )) = x n − b . First note that: – If typ e = refl , then α ( x ) = α ( y ) , and hence δ ( α ( x )) = δ ( α ( y )). It follows that n = a + b. – If typ e = trans k , then by c hoice of T , α ( y ) is exactly k levels b elo w x in T , and therefore w e know that a + b + k = n . – If typ e = symm , then, since symm / ∈ pr ev-typ es-list , we kno w that in L, w e only ha ve edges b et ween non-decreasing nodes. Since the symmetric case applies, we know that ( α ( y ) , α ( x )) is an edge in T . Since α ( x ) 6 = α ( y ) , α ( x ) is at a lo wer level than α ( y ) in T , and it follows that a > n − b . If a > n − b + 2 , then it follo ws that the line L satisfies NP-condition 3 , a con tradiction. Therefore we know that a = n − b + 1 . W e now sho w that ˆ ψ implies ˆ ϕ 0 → 0 w ≥ a + b + p,x ≥ a + b + p,y ≥ a + b + p if typ e = refl , ˆ ψ implies ˆ ϕ 0 → k w ≥ a + b + p,x ≥ a + b + p,y ≥ a + b + p + k if typ e = trans k , ˆ ψ implies ˆ ϕ 1 → 0 w ≥ a + b + p,x ≥ a + b + p +1 ,y ≥ a + b + p if typ e = symm . F or this, let G b e a graph such that G | = ˆ ψ , by induction we know that the nodes of G which hav e b oth a p -step predecessor and a p -step successor satisfy the conditions of pr ev-typ es-list . T o pro ve the claim, let u, v b e elements of G which ha v e b oth an a + b + p -step predecessor and an a + b + p -step successor, and u = v if typ e = refl , There is a k -step path in G from u to v if typ e = trans k , There is an edge ( v , u ) in G if typ e = symm . In order to prov e the lemma, we need to prov e that ( u, v ) is an edge in G . Since G | = ˆ ψ , and ˆ ϕ is a clause in ˆ ψ , it suffices to prov e that there is a homomorphism γ : prereq ( ˆ ϕ ) → G On the Complexity of Elemen tary Mo dal Logics 37 suc h that γ ( x ) = u and γ ( y ) = v . Then there is an edge ( u, v ) in G due to Prop osition 4.3. Since δ ◦ α : prereq ( ˆ ϕ ) → L is a homomorphism and δ ◦ α ( x ) = x a and δ ◦ α ( y ) = x n − b , it suffices to sho w that there is a homomorphism β : L → G such that β ( x a ) = u and β ( x n − b ) = v . Then the homomorphism γ := β ◦ δ ◦ α satisfies the necessary conditions. Let w b e an a -step predecessor of u in G such that w has a p -step predecessor in G, and let t b e a b -step successor of v in G which has a p -step successor in G . Both must exist due to the choice of u, v . Additionally , if typ es = symm and therefore ( v , u ) is an edge in G, c ho ose w to b e an a − 1-step predecessor of v (in which case it is also a a -step predecessor of u ), and in this case also let t to b e a b − 1-step successor of u (in which case it is also a b -step successor of v ). No w, define y 0 := w , and let y 1 , . . . , y n from G b e c hosen in such a wa y that y a = u, y n − b = v , and y n = t, and for all relev ant i, ( y i , y i +1 ) is an edge in G . This is p ossible since u and v satisfy the conditions corresp onding to typ e : – If typ e = refl , w e know that n − b = a, and u = v . Hence the no des y i can b e chosen satisfying the demanded conditions b y choosing y 0 , . . . , y a to b e the nodes on the a -step- path from w to u = v , and y n − b , . . . , y n to b e the no des on the b -step path from u = v to t. – If typ e = trans k , we know that n = a + b + k, and we can choose y 0 , . . . , y a to b e the no des on the path from w to u, y a , . . . , y n − b to denote the k -step path from u to v (whic h exists due to the choice of u and v ), and y n − b , . . . , y n b e the nodes on the b -step path from v to t. – If typ e = symm , then by the ab ov e w e know that a = n − b + 1 , and we know that there is an edge ( v , u ) in G . W e also kno w that in this case, w is an a − 1-step predecessor of v . Hence we can c ho ose the no des in the following wa y: Let y 0 , . . . , y a − 1 = y n − b b e c hosen as the no des on the a − 1-step path from w to v , and let y n − b +1 = y a , . . . , y n b e the no des on the b − 1-step path from u to t . Since ( v , u ) is an edge in G, this gives the edge ( y n − b , y a ) whic h is required since n − b + 1 = a. W e no w construct the homomorphism β : for eac h relev ant i, let β ( x i ) := y i . Then by con- struction, β ( x a ) = u and β ( x n − b ) = v . Hence it remains to pro v e that β is a homomorphism. Since L is a pr ev-typ es-list -line, let L strict b e a strict line such that L is the pr ev-typ es-list - closure of L strict . Since ( y i , y i +1 ) is an edge in G for all relev ant i, it follows that β : L → G is a homomorphism. Since ev ery y i has a p -step successor and a p -step predecessor in G, we kno w that the subgraph { y 0 , . . . , y n } satisfies the conditions from pr ev-typ es-list , and since L is the pr ev-list-typ es -closure of L strict , this implies that for every edge present in L, the images of the corresp onding vertices are also connected with an edge in G, and hence β is indeed a homomorphism, finishing the proof of the lemma for the case that x, y ∈ prereq ( ˆ ϕ ) . No w assume that x / ∈ prereq ( ˆ ϕ ) or y / ∈ prereq ( ˆ ϕ ) , and therefore x = y . Since there ob viously is a homomorphism α : prereq ( ˆ ϕ ) → T for some pr ev-typ es-list -tree T , the clause ˆ ϕ forces every no de in a graph containing a typ es-list -line of sufficient length to b e reflexiv e. Since due to the induction hypothesis, we know that every model of ψ of sufficient depth con tains arbitrary long pr ev-typ es-list -lines, this concludes the pro of for the remaining case x = y . Due to Lemma 4.27, we kno w that the list typ es-list maintained b y Horn-Classifica tion is sensible, and we are now in a p osition to prov e that the NP-cases claimed b y the algorithm are correct as well. Lemma 4.28. L et ˆ ψ b e a universal Horn formula. If Horn-Classifica tion states that K ( ψ ) has the p olynomial-size mo del pr op erty and K ( ˆ ψ ) - SA T is in NP , then this is true. 38 Edith Hemaspaandra and Henning Schnoor Pr o of. There are tw o p ossibilities for the algorithm to claim the p olynomial-size mo del prop ert y , and hence NP-mem b ership. First let us assume that for some k ≥ 2 , b oth symm and trans k w ere added to typ es-list . In this case, due to Lemma 4.27, we kno w that there is some p ∈ N such that ˆ ψ implies b oth ˆ ϕ 0 → k w ≥ p,x ≥ p,y ≥ p and ˆ ϕ 1 → 0 w ≥ p,x ≥ p,y ≥ p . Hence Theorem 4.15 implies b oth the p olynomial-size mo del prop erty of the logic K ( ˆ ψ ) and the NP-membership of its satisfiabilit y problem. The second case in which Horn-Classifica tion claims the NP-result is if it detects a clause ˆ ϕ whic h satisfies one of the conditions 1 − 4. W e know by Lemma 4.27, that for each elemen t from typ es-list , the formula ˆ ψ implies a formula of the corresp onding type. Hence w e can assume that there is a natural n umber p, suc h that the set of vertices in G whic h ha ve b oth a p -step predecessor and a p -step successor satisfy the conditions from typ es-list . W e make a case distinction. ˆ ϕ satisfies NP -condition 1 . In this case, we know that conc ( ˆ ϕ ) = ( x, y ) for some x 6 = y ∈ prereq ( ˆ ϕ ) , and that there is a pair ( α, T ) ∈ typ es-list − T hom ˆ ϕ suc h that there is no directed path connecting α ( x ) and α ( y ) in T . Note that we can assume symm / ∈ typ es-list , since otherwise ev ery pair of v ertices in T would b e connected with a directed path. First assume that it is p ossible to choose T and α in such a wa y that α ( x ) 6 = α ( y ). In this case, since T is a tree, we know that α ( x ) and α ( y ) ha ve a common predecessor w in T . Let w b e a common predecessor which is “minimal,” i.e., no no de in a low er lev el than w is a common predecessor. W e construct a typ es-list − tree T 0 as a homomorphic image of T via the homomorphism β as follo ws: Let n b e the heigh t of the tree T , and let x 0 , . . . , x n b e a typ es-list -line such that every element in T is mapped on its corresponding level in L, except the no des on the path from w to α ( x ) (excluding w ) and the successors of α ( x ). Let s b e the lev el of w in T , i.e., let α ( w ) = x s . Let w + k and w + l b e the levels of α ( x ) and α ( y ) in T , since there is no directed path connecting α ( x ) and α ( y ) , it follows that k , l > 0. Now in tro duce no des y s +1 , . . . suc h that ( x s , y s +1 ) is an edge, and ( y i , y i +1 ) is an edge for every relev ant i, and map the path from w to α ( x ) and the successors to α ( x ) to the “branch” y s +1 , . . . (add as many of these no des as the “branch” of T requires). Now close the construction under the typ es-list -condition, and call the tree obtained in this wa y T 0 . Since T 0 is the “canonical homomorphic image” of T , it is again a typ es-list -tree, and in T 0 , there is a path of length k from β ( w ) to β ( α ( x )) and a path of length l from β ( w ) to β ( α ( y )). Let ˆ ϕ 0 b e the clause with prerequisite graph T 0 and conclusion edge ( β ( α ( x )) , β ( α ( y ))). Since β ◦ α is a homomorphism, w e know from Prop osition 4.4 that ˆ ϕ implies ˆ ϕ 0 . In tuitively , ˆ ϕ 0 is the typ es-list -closure of a clause of the form ˆ ϕ k → l w ≥ s,x ≥ q ,y ≥ n , with q chosen according to the height of the tree T and the length of the branch containing α ( x ) (without loss of generality , w e assume that the branch containing α ( x ) do es not contain the deep est no de in the tree). W e no w show that ˆ ψ = ⇒ ˆ ϕ k → l w ≥ s + p,x ≥ q + p,y ≥ n + p , the complexity result then follo ws from Corollary 4.14. Hence, let G b e a graph such that G | = ˆ ψ , and let u and v b e v ertices in G such that u and v hav e a predecessor w 0 , and w 0 has a s + p -step predecessor, u has a q + p − k - step successor, and v has an n + p − l -step successor, and there is a k -step path from w 0 to u, and an l -step path from w 0 to v . Then, since these vertices satisfy the conditions of typ es-list b y Lemma 4.27, we can homomorphically map the prerequisite graph of T 0 in to G via the homomorphism γ such that γ ( β ( w )) = w 0 , γ ( β ( α ( x ))) = u, and γ ( β ( α ( x ))) = v . The edges required in order for γ to b e a homomorphism exist b ecause of the paths of the corresp onding lengths connecting w , u, and v , and b ecause all of the relev ant nodes in G satisfy the typ es-list -conditions. Hence, by Prop osition 4.3, we kno w that ( u, v ) is an edge in G, as required to sho w. On the Complexity of Elemen tary Mo dal Logics 39 Therefore, assume that it is not possible to c ho ose ( α, T ) in suc h a w ay that α ( x ) 6 = α ( y ) , i.e., assume that in every ( α, T ) ∈ typ es-list − T hom ˆ ϕ , α ( x ) and α ( y ) are connected with a directed path or are identical. Since ˆ ϕ satisfies the first NP-condition, we know that there is a pair ( α, T ) ∈ typ es-list − T hom ˆ ϕ suc h that there is no directed path connecting α ( x ) and α ( y ) in T , and hence α ( x ) = α ( y ) , and this no de is irreflexive in T . In particular, we know that refl is not an element of typ es-list . W e also kno w that symm / ∈ typ es-list , since otherwise, ev ery no de in the connected graph T w ould b e connected to any other with a directed path ( T obviously is not the irreflexiv e singleton, since α ( x ) 6 = α ( y )). No w define β to be T ’s canonical homomorphic mapping to a typ es-list -line L = ( x 0 , . . . , x n ) , it then follo ws that β ( α ( x )) = β ( α ( y )) = x i for some i . Since x and y are different no des in prereq ( ˆ ϕ ) , we can mo dify this line as follows: W e introduce a new no de y i whic h is a “neighbor” to x i , i.e., a no de which is connected to all predecessors and all successors of x i . Call this line L 0 . Note that since typ es-list only contains v ariations of transitivit y , there is no condition requiring that x i is a reflexiv e no de. Since we connected y i to all successors and predecessors of x i , the line L 0 still satisfies all conditions from typ es-list , and x i and y i are not connected with an edge in L 0 . W e now construct a homomorphism γ : prereq ( ˆ ϕ ) → L 0 , b y defining γ ( z ) = β ( α ( z )) for all z 6 = y , and γ ( y ) = y i . Since the inv olved no des are irreflexiv e and β ◦ α is a homomorphism, and y i has all edges that x i has, we kno w that γ is a homomorphism. Let ˆ ϕ 0 b e the universal Horn clause with prerequisite graph L 0 , and conclusion edge ( x i , y i ). The homomorphism γ and Prop osition 4.4 show that ˆ ϕ implies ˆ ϕ 0 . Note that the clause ˆ ϕ 0 requires the following: F or ev ery pair of no des ( x 0 , y 0 ) in a graph G satisfying the conditions of typ es-list whic h hav e a common predecessor w 0 and a common successor z 0 with sufficien t heigh t and depth, there is an edge connecting x 0 and y 0 . Since b y Lemma 4.27, every graph satisfying ˆ ψ also satisfies the requirements from typ es-list for no des with sufficien t depth and height, we can apply ˆ ϕ 0 to nodes of sufficien t depth and heigh t in every such graph. x i − 1 x 1 . . . x i − 1 x i y i x i +1 . . . x n v 1 v 2 Fig. 9. The homomorphism for the pro of that C is symmetric Let G b e a graph satisfying ψ , and let C be the set of no des in G which ha ve sufficient height and depth to b e able to apply the conditions of ˆ ϕ 0 . W e show that C is reflexiv e, transi- tiv e, and symmetric. Note that since G satisfies ψ , and ˆ ϕ is a clause in ˆ ψ implying ˆ ϕ 0 , we kno w that G satisfies ˆ ϕ 0 as w ell. W e first show that C is reflexive. Let v be a no de in C . Since v satisfies the conditions of b oth x i and y i in the line L 0 , and since L 0 = prereq ( ˆ ϕ ) 0 and G satisfies ˆ ϕ 0 , w e know that there is an edge ( v , v ) in G, and hence v is reflexiv e. F or symmetry , let there b e no des v 1 , v 2 ∈ C such that ( v 1 , v 2 ) is an edge in G . By the ab o ve, we kno w that b oth of these no des are reflexive, and in particular hav e un b ounded height and depth in G . Therefore, we can map the predecessor graph of ˆ ϕ 0 , i.e., the line L 0 to these no des in such a wa y that for j < i, x i is mapp ed to v 1 , y i is mapp ed to v 1 , and all x j for j ≥ i are mapped to v 2 . Since in L 0 , all edges go from v ariables with low er indexes to v ariables 40 Edith Hemaspaandra and Henning Schnoor with higher indexes, in this wa y w e hav e constructed a homomorphism from prereq ( ˆ ϕ 0 ) to C, suc h that the conclusion edge ( x i , y i ) of ˆ ϕ 0 is mapp ed to the pair ( v 2 , v 1 ). Hence, by Prop osition 4.3, and since G satisfies ˆ ϕ 0 , we know that there must b e an edge ( v 2 , v 1 ) in C , as required. x i − 1 x 1 . . . x i − 1 x i y i x i +1 . . . x n s t u Fig. 10. The homomorphism for the pro of that C is transitiv e Finally , we show that C is transi- tiv e. F or this, assume that ( s, t ) and ( t, u ) are edges in C . Since w e already pro ved symmetry for C , we know that in this case, ( t, s ) and ( u, t ) are also edges. W e can again construct a ho- momorphism mapping all elements of L 0 to t, except mapping x i to s and y i to u . Since the no des s, t, and u are reflexiv e in C by the abov e, and there is no edge ( x i , y i ) or ( y i , x i ) in L, this is a homomorphism. Since G satisfies ϕ 0 , Prop osition 4.3 shows that ( s, u ) is an edge in C, as claimed. In particular, since C is reflexive, symmetric, and transitive, this means that C | = ˆ ϕ 1 → 1 . Since C is defined as the no des which hav e some sufficient depth and height p in the graph, and C | = ˆ ϕ 1 → 1 , it follows that G | = ˆ ϕ 1 → 1 w ≥ p,x ≥ p,y ≥ p for some p, and hence ψ = ⇒ ˆ ϕ 1 → 1 w ≥ p,x ≥ p,y ≥ p . Therefore, K ( ψ ) is a logic extending K ( ˆ ϕ 1 → 1 w ≥ p,x ≥ p,y ≥ p ) , and therefore the complexity result as w ell as the p olynomial-size mo del prop erty follow from Corollary 4.14. ˆ ϕ satisfies NP -condition 2 . By the prerequisites, since ˆ ϕ is not satisfied on every typ es-list -tree, we can homomorphically map prereq ( ˆ ϕ ) onto a typ es-list -line. First assume that conc ( ˆ ϕ ) is empt y . Then an y graph G satisfying the conditions of typ es-list which has a line of more than this length do es not satisfy the clause ˆ ϕ . Since every graph satisfying ˆ ψ also satisfies ˆ ϕ and the conditions of typ es-list for no des of sufficient depth and height, ev ery graph satisfying ˆ ψ of sufficient depth and heigh t do es not satisfy ˆ ϕ, and hence not ˆ ψ . This implies that graphs satisfying ˆ ψ can only b e of depth limited b y a constan t, and hence Lemma 3.8 immediately implies the p olynomial-size mo del prop ert y . Therefore assume that conc ( ˆ ϕ ) = ( x, y ) for v ariables x, y , and assume that x, y are not connected with an undirected path in prereq ( ˆ ϕ ). Since x and y lie in different connected com- p onen ts of the underlying directed graph consisting of prereq ( ˆ ϕ ) ∪ conc ( ˆ ϕ ) , and prereq ( ˆ ϕ ) can b e homomorphically mapp ed into a typ es-list -line, the “left side” of the implication ˆ ϕ is satisfied by any pair of vertices ( u, v ) in a graph satisfying the typ es-list -conditions of suffi- cien t depth and heigh t. Therefore, the subgraph C containing all no des with sufficient height and depth forms a universal subgraph, and the NP-result follows b y the same reasoning as in Case 1 . ˆ ϕ satisfies NP -condition 3 . In this case, it follo ws by the same reasoning as in Lemma 4.27 that any graph satisfying ˆ ψ also needs to satisfy the form ula ˆ ϕ k → 0 w ≥ p,x ≥ p,y ≥ p for some p and some k ≥ 2. Hence the complexity result follows from Corollary 4.14. ˆ ϕ satisfies NP -condition 4 . Again, with the pro of of Lemma 4.27 it can easily b e seen that ˆ ψ implies form ulas ˆ ϕ 1 → 0 w ≥ p,x ≥ p,y ≥ p and ˆ ϕ 0 → k w ≥ p,x ≥ p,y ≥ p for some k ≥ 2 and some natural n umber p . Therefore the NP-result follows from Theorem 4.15. On the Complexity of Elemen tary Mo dal Logics 41 The preceding Lemmas hav e established that Horn-Classifica tion is well-defined, alw ays comes to a halt, and in each case pro duces the correct result. Hence, we hav e prov en Theorem 4.17. This theorem and its pro of now yield an interesting Corollary: Corollary 4.29. L et ˆ ψ b e a universal Horn formula. If one of the fol lowing c ases applies: – ˆ ψ is satisfie d in every strict tr e e, – ˆ ψ is satisfie d in every r eflexive tr e e, – ˆ ψ is satisfie d in every S -tr ansitive tr e e for some S ⊆ N , – ˆ ψ is satisfie d in every symmetric tr e e, – ˆ ψ is satisfie d in every symmetric and r eflexive tr e e, – ˆ ψ is satisfie d in every S -tr ansitive and r eflexive tr e e for some S ⊆ N , then K ( ˆ ψ ) - SA T is PSP ACE -har d and K ( ˆ ψ ) do es not have the p olynomial-size mo del pr op erty. In al l other c ases, K ( ˆ ψ ) has the p olynomial-size mo del pr op erty and K ( ˆ ψ ) - SA T ∈ NP . Pr o of. W e know b y Theorem 4.17 that Horn-Classifica tion correctly determines the complexit y of the problem K ( ˆ ψ )- SA T . By the algorithm, it is obvious that the only arising cases are PSP ACE-hard and NP. F rom the proof of Lemma 4.26, we know that the PSP ACE- cases all satisfy the statement of the corollary , and Theorem 2.8 shows that in these cases, w e alwa ys hav e PSP ACE-hardness. Finally note that all of our NP-pro ofs also give the p olynomial-size mo del prop ert y , and all PSP ACE-hardness proofs als o show that this prop ert y do es not apply . 4.6 T ree-like mo dels for Horn logics In Section 4.5, w e hav e shown that logics defined b y universal Horn formulas ha ve a sat- isfiabilit y problem whic h is solv able in NP, or is PSP ACE-hard. W e no w show a tree-like mo del prop erty for these logics, which w e will put to use in the next section by concluding PSP ACE-mem b ership for a broad class of these logics. Recall that Corollary 2.6 stated the tree-lik e mo del prop ert y for the mo dal logic K : Ev ery K -satisfiable formula has a tree-like mo del which also is a K -model (which is easy , since every model is a K -mo del). What we w ant to show is that a logic K ( ˆ ψ ) , where ˆ ψ is a univ ersal Horn form ula satisfied on ev- ery reflexive/symmetric/ S -transitive tree, has the following prop ert y: Every mo dal formula whic h has a K ( ˆ ψ )-model also has a K ( ˆ ψ )-model whic h is “nearly” the reflexive/symmetric/ S - transitiv e closure of a strict tree. In order to pro ve this result, we first recall from the liter- ature the concept of a b ounded morphism, whic h allo ws us to prov e mo dal equiv alence of mo dels. Definition 4.30 ([BdR V01]). L et T and M b e mo dal mo dels, and let f : T → M b e a function. Then f is a b ounded morphism if the fol lowing holds: (i) F or al l w ∈ T , w and f ( w ) satisfy the same pr op ositional variables, (ii) f is a homomorphism, (iii) if ( f ( u ) , v 0 ) is an e dge in M , then ther e is some v ∈ T such that ( u, v ) is an e dge in T and f ( v ) = v 0 . The most imp ortant feature of bounded morphisms is that they lea ve the mo dal prop- erties of the in volv ed mo dels inv ariant: Prop osition 4.31 (Prop osition 2.14 from [BdR V01]). L et T and M b e mo dal mo dels, and let f : T → M b e a b ounde d morphism. Then for e ach mo dal formula φ and for e ach w ∈ T , it holds that T , w | = φ if and only if M , f ( w ) | = φ. 42 Edith Hemaspaandra and Henning Schnoor With b ounded morphisms, we can no w prov e that our logics hav e “tree-like” models. W e first recall a standard result from the literature ab out the logic K : Prop osition 4.32 (Prop osition 2.15 from [BdR V01]). L et M , w | = φ such that M is r o ote d at w . Then ther e exists a tr e e-like mo del T and a surje ctive b ounde d morphism f : T → M . W e no w generalize this result to univ ersal Horn logics, and “tree-lik e” models. W e already kno w from Corollary 4.29 that for each universal Horn formula ˆ ψ for which the logic K ( ˆ ψ ) has a satisfiabilit y problem whic h cannot b e solv ed in NP, the form ula ˆ ψ is satisfied on ev ery tree which additionally is closed under reflexivity , S -transitivity and/or symmetry . W e no w sho w that a v ersion of the “con verse” is also true: Not only are all of these trees mo dels for the corresp onding logics, but for every mo dal formula satisfiable in such a logic, we can find a mo del which is “almost” such a tree. The reason for the “almost” is that our Horn form ulas usually will not imply a property lik e S -transitivity , but only S -transitivity for no des at a certain depth in the graph, as sho wn in Lemma 4.27. W e will see in Sections 4.7 and 4.8, that the characterization of the inv olved mo dels can b e used to obtain PSP ACE upp er b ounds for a wide class of logics. Theorem 4.33. 1. L et ˆ ψ b e a universal Horn formula such that Horn-Classifica tion r eturns PSP ACE -har d on input ˆ ψ . L et typ es-list b e as determine d by Horn-Classifica tion on input ˆ ψ . Sinc e the algorithm determines the lo gic to b e PSP ACE -har d, this is wel l-define d. Then for every mo dal formula φ which is K ( ˆ ψ ) -satisfiable, ther e exists a K ( ˆ ψ ) -mo del T and a world w ∈ T such that T , w | = φ and ther e is a strict tr e e T strict such that T and T strict have the same set of vertic es, and edges ( T strict ) ⊆ edges ( T ) ⊆ edges ( typ es-list ( T strict )) , wher e typ es-list ( T strict ) denotes the typ es-list-closur e of T strict . 2. L et ˆ ψ b e a universal Horn formula such that ˆ ψ is satisfie d on every strict line. Then for every mo dal formula φ which is K ( ˆ ψ ) -satisfiable, ther e exists a K ( ˆ ψ ) -mo del T and a world w ∈ T such that T , w | = φ, and T is w -c anonic al. Pr o of. W e pro ve b oth claims with nearly the same construction, indicating when differences are required. Since φ is K ( ˆ ψ )-satisfiable, there is a K ( ˆ ψ )-model M and a world w ∈ M such that M , w | = φ . F or the first claim, let typ es-list be as determined by Horn-Classifica tion when started on input ˆ ψ . Since the algorithm do es not return NP , we kno w that typ es-list ⊆ { refl , symm } or typ es-list ⊆ refl , trans k | k ∈ N . Since the second NP-condition do es not apply , we kno w that for an y clause ˆ ϕ in ˆ ψ suc h that there is a homomorphism α : prereq ( ˆ ϕ ) → T for some typ es-list -tree T , that conc ( ˆ ϕ ) = ( x, y ) for some v ariables x, y with x = y or x, y ∈ prereq ( ˆ ϕ ) . F or the second claim, we show that for every clause ˆ ϕ in ψ , if ˆ ϕ is not satisfied in every w -canonical graph, then conc ( ˆ ϕ ) 6 = ∅ . Obviously , the prerequisite graph of such a clause ˆ ϕ can b e mapp ed into some w -canonical graph, and therefore also into its image L as a strict line. Since ˆ ψ is satisfied on every strict line, so is ˆ ϕ, and hence conc ( ˆ ϕ ) 6 = ∅ , since otherwise, the clause w ould b e unsatisfied on L, a contradi ction. F or both claims, due to Prop osition 3.7, we can assume that M is rooted at w . F rom Prop osition 4.32, we kno w that there is a mo del T 0 whic h is a strict tree, and a surjectiv e b ounded morphism f : T 0 → M . Let T strict := T 0 . Let w T denote the ro ot of T 0 . The strict tree T 0 is trivially w T -canonical. On the Complexity of Elemen tary Mo dal Logics 43 W e define a sequence of mo dels ( T n ) n ∈ N suc h that for each n ∈ N , it holds that when we are pro ving the first claim: 1. vertices ( T n ) = vertices ( T 0 ) , 2. edges ( T strict ) ⊆ edges ( T n ) ⊆ edges ( typ es-list ( T strict )) , 3. f : T n → M is a homomorphism. In the case of the second claim, w e exchange the second p oin t with “ T n is w T -canonical.” Note that due to Corollary 3.9, we can assume that the model M is coun table. The pro of of Proposition 4.32 from [BdR V01] then constructs a mo del T 0 whic h is also coun table. Hence assume that T 0 is a countable mo del. Now let ( e n ) n ∈ N b e a surjective enumeration of vertices ( T 0 ) × vertices ( T 0 ) , i.e., of all p ossible edges in the inv olved trees. The construction of our mo del is as follo ws: F or n = 0 , the model T 0 from ab o v e obviously satisfies the conditions, since every b ounded morphism is also a homomorphism. F or n ≥ 0 , we make a case distinction: – If ev ery clause in ˆ ψ is satisfied in T n , then let T n +1 := T n . – Otherwise, let ˆ ϕ n +1 b e a clause from ˆ ψ which is not satisfied in T n suc h that conc ( ˆ ϕ n +1 ) = ( x n +1 , y n +1 ) for v ariables x n +1 , y n +1 , and let α n +1 : prereq ( ˆ ϕ n +1 ) ∪ { x n +1 , y n +1 } → T n b e a homomorphism such that ( α n +1 ( x n +1 ) , α n +1 ( y n +1 )) is not an edge in T n . This m ust exist by Prop osition 4.3, since by the ab o v e, the case conc ( ˆ ϕ n +1 ) = ∅ cannot o ccur. Cho ose ˆ ϕ n +1 , α n +1 in suc h a wa y that the pair ( α n +1 ( x n +1 ) , α n +1 ( y n +1 )) has a minimal index in the sequence ( e n ). No w let T n +1 b e defined with v ertex set vertices ( T n ) , edge set edges ( T n ) ∪ { ( α n +1 ( x n +1 ) , α n +1 ( y n +1 )) } , and the same prop osi- tional assignmen ts as T n . W e show that the construction satisfies the requiremen ts 1-3. The first p oin t, whic h is the same for b oth claims, holds by definition. F or the first claim, w e prov e that for each n, it holds that edges ( T strict ) ⊆ edges ( T n ) ⊆ edges ( typ es-list ( T strict )). Since b y definition, edges ( T n ) ⊆ edges ( T n +1 ) , we kno w that for all n, it holds that edges ( T strict ) = edges ( T 0 ) ⊆ edges ( T n ) , and w e also know that edges ( T strict ) = edges ( T 0 ) ⊆ edges ( typ es-list ( T strict )) . Hence assume that there is some minimal n suc h that edges ( T n ) * edges ( typ es-list ( T strict )). Due to the minimalit y of n, and since the claim holds for n = 0 , we know that the edge whic h is not presen t in edges ( typ es-list ( T strict )) is the edge ( α n ( x n ) , α n ( y n )). By definition, α n : prereq ( ˆ ϕ n ) ∪ { x n , y n } → T n − 1 is a homomorphism. Since due to minimality of n, we kno w that edges ( T n − 1 ) ⊆ edges ( typ es-list ( T strict )) , this implies that α n : prereq ( ˆ ϕ n ) ∪ { x n , y n } → typ es-list ( T strict ) is a homomorphism as well. Since ˆ ϕ is a clause in ˆ ψ , and typ es-list ( T strict ) | = ˆ ψ , w e know that typ es-list ( T strict ) | = ˆ ϕ, and with Prop osition 4.3, we conclude that ( α n ( x n ) , α n ( y n )) is an edge in typ es-list ( T strict ) , a con tradiction. Therefore w e kno w that edges ( T strict ) ⊆ edges ( T n ) ⊆ edges ( typ es-list ( T strict )) for all n, and hence w e hav e prov en the second p oin t in the case of the first claim. F or the second claim, w e need to sho w that T n is a w T -canonical graph. F or i ∈ N , let L i denote the no des in the i -th lev el of T n − 1 , i.e., the set n v ∈ T n − 1 | T n − 1 | = w T i − → v o . In order to prov e that T n is w T -canonical, since T n − 1 is, it suffices to prov e that the edge ( α n ( x n ) , α n ( y n )) in the step from T n − 1 to T n do es not destroy the prop ert y of b eing canon- ical, i.e., we need to show that α n ( x n ) ∈ L i and α n ( y n ) ∈ L i +1 for some i . Let L b e the homomorphical image of T n − 1 as a strict line via the homomorphism β (since T n − 1 is w -canonical, this exists and is unique). Since α n : prereq ( ˆ ϕ n ) ∪ { x n , y n } → T n − 1 is a homo- morphism, w e know that β ◦ α n : prereq ( ˆ ϕ n ) ∪ { x n , y n } → L is a homomorphism as well. 44 Edith Hemaspaandra and Henning Schnoor Since ˆ ψ is satisfied on every strict line, this is also true for ˆ ϕ, and hence due to Prop osi- tion 4.3, we know that ( β ◦ α n ( x n ) , β ◦ α n ( y n )) is an edge in L . Therefore, α n ( x n ) is exactly one lev el ab o ve α n ( y n ) in T n − 1 , as required. F or b oth claims, we no w show that f : T n → M is a homomorphism for all n . Again, we pro ve the fact by induction, and for n = 0 , this holds due to the choice of T 0 , since ev ery b ounded morphism is a homomorphism. Therefore, let the claim hold for n, and let ( u, v ) b e an edge in T n +1 . If ( u, v ) is not the edge ( α n +1 ( x n +1 ) , α n +1 ( y n +1 )) , then w e know that ( u, v ) is an edge in T n as w ell, and since due to induction hypothesis, we know that f : T n → M is a homomorphism, it follows that ( f ( u ) , f ( v )) is an edge in M . Therefore assume that u = α n +1 ( x n +1 ) and v = α n +1 ( y n +1 ). W e need to show that ( f ◦ α n +1 ( x n +1 ) , f ◦ α n +1 ( y n +1 )) is an edge in M . By construction, we know that α n +1 : prereq ( ˆ ϕ n +1 ) ∪ { x n +1 , y n +1 } → T n is a homomorphism. Since by induction hypothesis, we kno w that f : T n → M is a homo- morphism, it follo ws that f ◦ α n +1 : prereq ( ˆ ϕ n +1 ) ∪ { x n +1 , y n +1 } → M is a homomorphism as well. Since M is a K ( ˆ ψ )-model and ˆ ϕ n +1 is a clause in ˆ ψ , w e know that M satisfies ˆ ϕ n +1 , and thus by Prop osition 4.3, we know that ( f ◦ α n +1 ( x n +1 ) , f ◦ α n +1 ( y n +1 )) is an edge in M , as required. W e no w construct the desired K ( ˆ ψ )-model as follows: Define T ∞ as having vertices ( T ∞ ) = vertices ( T 0 ) and edges ( T ∞ ) = ∪ n ∈ N edges ( T n ). W e show that T ∞ is a K ( ˆ ψ )-model, and that f : T ∞ → M is a b ounded morphism. Assume that T ∞ is not a K ( ˆ ψ )-model. By construction, we know that in this case, there is no n suc h that T n = T n +1 , and therefore each T n +1 has exactly one additional edge in comparison to T n . Hence w e can define a sequence ( f n ) n ∈ N suc h that f n = i ∈ N iff edges ( T n +1 ) = edges ( T n ) ∪ { e i } . Then f n is a sequence of pairwise differen t natural n um b ers. Since ˆ ψ is not satisfied in T ∞ , there is a clause ˆ ϕ from ˆ ψ whic h is not satisfied in T ∞ . F or b oth claims, we therefore kno w by the abov e that conc ( ˆ ϕ ) = ( x, y ) for v ariables x, y with x = y or x, y ∈ prereq ( ˆ ϕ ). By Prop osition 4.3, w e know that there is a homomorphism α : prereq ( ˆ ϕ ) ∪ { x, y } → M suc h that ( α ( x ) , α ( y )) is not an edge in T ∞ . Let j ∈ N such that ( α ( x ) , α ( y )) = e j . Since in the sequence f n , no num b er is rep eated, there is some natural n umber n 0 suc h that f n > j for all n ≥ n 0 . Since prereq ( ˆ ϕ ) is a finite graph, and edges ( T n ) ⊆ edges ( T n +1 ) , and edges ( T ∞ ) = ∪ n ∈ N edges ( T n ) , we kno w that there is some n 1 ∈ N such that α : prereq ( ˆ ϕ ) ∪ { x, y } → T n 1 is a homomorphism. Then α : prereq ( ˆ ϕ ) ∪ { x, y } → T n is also a homomorphism for all n ≥ n 1 , since every edge present in T n 1 is also present in every T n for n ≥ n 1 . Let n := max( n 0 , n 1 ). Then in the step from T n to T n +1 , the edge e f n w as added, and by choice of n w e know that f n > j . Since e j is not an edge in T ∞ , w e know that e j is also not an edge in T n . Recall that α n +1 , ˆ ϕ n +1 are chosen in such a wa y that the edge ( α n +1 ( x ) , α n +1 ( y )) has minimal index in the sequence ( e n ) n ∈ N , this is a con tradiction, since the edge e j is an edge with a smaller index than e f j , and since α : prereq ( ˆ ϕ ) ∪ { x, y } → T n is a homomorphism, e j satisfies the conditions of the edge ( α n +1 ( x ) , α n +1 ( y )) in the construction of T n +1 . It remains to show that f : T ∞ → M is a bounded morphism. Property ( i ) holds by construction, since we do not change prop ositional assignments, and f : T 0 → M is a b ounded morphism. W e no w sho w that f is a homomorphism. Hence let ( u, v ) be an edge in T ∞ . Since T ∞ is the union ov er all T n , there is some n ∈ N such that ( u, v ) is an edge in T n . Since by the ab o ve, f : T n → M is a homomorphism, it follo ws that ( f ( u ) , f ( v )) is an edge in M , as claimed. F or prop ert y ( iii ) , let u ∈ T ∞ and v 0 in M such that ( f ( u ) , v 0 ) is an edge in M . Since f : T 0 → M is a bounded morphism, we know that there is some v ∈ T 0 suc h that ( u, v ) is an edge in T 0 , and f ( v ) = v 0 . By construction, ( u, v ) is also an edge in T ∞ , and therefore f : T ∞ → M is a b ounded morphism. By choice of f , and since vertices ( T 0 ) = vertices ( T ∞ ) , f is also surjective. Hence there is some w 0 ∈ T ∞ suc h that f ( w 0 ) = w . Since M , w | = φ, On the Complexity of Elemen tary Mo dal Logics 45 it follows from Prop osition 4.31 that T ∞ , w 0 | = φ . By construction, for the first claim it holds that edges ( T strict ) ⊆ edges ( T ∞ ) ⊆ edges ( typ es-list ( T strict )) , since this holds for the individual T n and T ∞ is the union o ver the edges of all T n , and for the second claim, T ∞ is obviously w T -canonical: Assume that it is not, then there is a no de x ∈ T ∞ and natural n umbers i 6 = j such that T ∞ | = w T i − → x and T ∞ | = w T j − → x . Since only a finite n umber of edges is relev an t for this path, there exists some n such that T n | = w T i − → x and T n | = w T j − → x . This is a contradiction, since T n is w T -canonical. Note that w e can assume that the no de w 0 is the root of T ∞ , since due to Prop osition 3.7, w e can assume that every no de in T ∞ can b e reached from w 0 . 4.7 PSP ACE upp er complexity b ounds In the previous section, w e show ed that for logics defined by universal Horn formulas, sat- isfiable formulas are alwa ys satisfiable in a tree-like model. T ree-like models are the main argumen t in many proofs showing PSP ACE-mem b ership for satisfiabilit y problems in modal logic. W e now show that these mo dels indeed allow us to construct PSP ACE algorithms for a wide class of mo dal logics. Note that while the construction in the pro of of the following theorem has similarities to the constructions b y Ladner in [Lad77] or by Halp ern and Moses in [HM92], the focus of our result is different. Many pro ofs of previous PSP A CE-algorithms also ga ve pro ofs of a v ariant of some tree-lik e mo del prop erty . Our pro of relies on this prop ert y (which we already prov ed for our logics in Theorem 4.33), and as a consequence, the verification that the algorithm works correctly with respect to the modal asp ect of its task is very easy to v erify . The main work of the pro of is to pro ve that the algorithm handles the first-order part of the satisfiability problem correctly , i.e., that the mo del it constructs is in fact a model satisfying the first-order formula ˆ ψ defining the logic. Whereas this is easy for standard classes of frames (chec king reflexivity , symmetry , transitivity etc is straightforw ard), in the general case that w e cov er here this requires most of the work. The main feature of the logics that w e use here is that of lo c ality : The pro of mak es extensiv e use of the fact that in order to v erify that the first-order clauses are satisfied it is sufficien t to consider lo cal parts of the mo del constructed b y the algorithm. This is the main reason why we b eliev e that this pro of do es not easily generalize to cases where a v arian t of transitivit y is among the conditions implied by the first-order formula ˆ ψ . Theorem 4.34. L et ˆ ψ b e a universal Horn formula such that Horn-Classifica tion do es not add any element of the form trans k to typ es-list on input ˆ ψ . Then K ( ˆ ψ ) - SA T ∈ PSP ACE . Pr o of. Since NP ⊆ PSP A CE we can assume that K ( ˆ ψ )- SA T / ∈ NP. Let typ es-list b e as determined by Horn-Classifica tion on input ˆ ψ . F rom the prerequisites, we know that typ es-list ⊆ { refl , symm } . F rom Theorem 4.33, w e know that for every K ( ˆ ψ )-satisfiable mo dal form ula φ, there is a mo del T of φ such that T is an edge-extension of a strict tree T strict , and every edge presen t in T whic h is not an edge of T strict is a reflexive or a symmetric edge. By the pro of of Lemma 3.8, w e can assume that in the tree T strict , every node has at most | sf ( φ ) | successors. The strategy of the PSP ACE-algorithm is as follows: W e nondeterministically guess the mo del T and v erify that it is a mo del of b oth φ and of ˆ ψ b y p erforming a depth-first-search. It is straightforw ard to see that in this wa y , we can verify that the mo dal form ula φ holds in the mo del. T o also chec k if ˆ ψ is satisfied requires a bit more effort: Even though w e know that ˆ ψ only adds reflexive or symmetric edges in addition to those present in T strict , w e need 46 Edith Hemaspaandra and Henning Schnoor to b e careful which edges are required and whic h are not (there may v ery w ell b e form ulas whic h are not satisfiable on a symmetric and reflexive tree, but are K ( ˆ ψ )-satisfiable). The main reason why w e can p erform these tests is that the prop erties that we work with hav e a “lo cal c haracter:” T o chec k if an edge is required b et ween some no des u and v in T , we need to know whether there is a clause ˆ ϕ in ˆ ψ such that ˆ ϕ can b e homomorphically mapp ed into T in such a w ay that the conclusion edge is mapp ed to the pair ( u, v ). Since we are working with a tree only extended with reflexiv e and symmetric edges, we kno w that a homomorphic image of a connected comp onen t of some prereq ( ˆ ϕ ) including u and v contains only vertices whic h are “near” to b oth u and v . Therefore w e can verify that these clauses are satisfied b y pro cedures lo oking only lo cally at the mo del T . There are tw o main obstacles to this approac h: F or once, the clause ˆ ϕ that requires ( u, v ) to b e an edge migh t v ery w ell contain more than one connected component except that one containing the conclusion edge (we can ignore the case where there is no conclusion edge, or the vertices from the conclusion edge are unconnected in prereq ( ˆ ϕ ) , since if suc h a clause can b e applied, i.e., homomorphically mapp ed to T , then it can also b e homomor- phically mapp ed to the typ es-list -closure of T , and hence to a typ es-list -tree, in whic h case Horn-Classifica tion rep orts NP-mem b ership, which is a con tradiction to our assumption K ( ˆ ψ )- SA T / ∈ NP). The other obstacle is that although we only need to lo ok at vertices in the “neighborho od” of the current vertex to chec k that it has all the right edges coming in and out, we need to ensure that all the vertices that we lo ok ed at “lo cally” are consisten t, when w e revisit a part of the mo del which is close to a no de that we already considered. The wa ys to deal with these obstacles is the following: F or the first problem, we simply k eep a list of connected comp onen ts of prereq ( ˆ ϕ )-graphs, and at the b eginning of the al- gorithm, guess for each one if it will app ear as a homomorphic image in the tree (which of course later we need to v erify). F or the second problem, we k eep more no des in storage than just the ones in the neigh b orho od of the one we are curren tly visiting, but only a p olynomial n umber. Strictly sp eaking, the algorithm do es not op erate on a mo del, but on an “annotated mo del.” The annotation of a world is the set of subformulas and negated subformulas of the input formula φ which are true at this world, and are required to b e true to ensure that the form ula φ is true at the ro ot-w orld. By Prop osition 3.7, w e can assume that the tree T has height of at most md ( φ ). F or a no de v in the i -th lev el of T , let annot ( v ) denote the set of subformulas and negated subform ulas of φ whic h hav e a mo dal depth of at most md ( φ ) − i . These are exactly those form ulas for which we need to kno w that they hold at v in order to verify that the input form ula φ holds at the ro ot of T . W e no w describe the decision pro cedure, which is a nondeterministic PSP ACE-algorithm. Let S b e the cardinality of the largest connected component in an y of the graphs prereq ( ˆ ϕ ) for clauses ˆ ϕ of ˆ ψ . Note that this num b er only dep ends on ˆ ψ , and therefore can b e regarded as constant. The algorithm as stated in Figure 11 do es not work in p olynomial space, since it guesses and stores the p ossibly exp onen tially-sized mo del T . W e will first show that the algorithm as stated is correct and then pro ve how it can b e implemented using only p olynomial space, by only storing a currently relev ant subset of the mo del T . F or the description of the algorithm, w e will call a node v ∈ T b ack-symmetric if there is an edge ( v , u ) , where u is the predecessor of v in T strict . When the algorithm guesses the model T , it additionally guesses the set annot ( v ) for ev ery no de v in T , and for e ac h no de it guesses if it is back-symmetric and if it is reflexive. The pro cedure Verify-Consistency ( v ) p erforms the follo wing chec k: F or a no de v on the i -th level of T , annot ( i ) is required to con tain all subformulas and negated subformulas On the Complexity of Elemen tary Mo dal Logics 47 F or connected comp onen ts C i of all prereq ( ˆ ϕ ) , guess if it appears as homomorphic image in T Guess the mo del T V erify that φ ∈ annot (0) current := w while w not marked done do Let preq be the predecessor of current (if current 6 = w ) Verify-Horn ( current ) if There is ♦ χ ∈ annot ( current ) not marked done then if current is reflexiv e and χ ∈ annot ( current ) then Mark ♦ χ done in annot ( current ) end if if current is bac k-symmetric and χ ∈ annot ( preq ) then Mark χ done end if Let next b e next un visited successor of current V erify that χ ∈ annot ( next ) current := next else Verify-Consistency ( current ) if current is reflexiv e then V erify that annot ( current ) does not contain χ and ¬ ♦ χ for any χ end if if current is bac k-symmetric then V erify that annot ( current ) does not contain ¬ ♦ χ for χ ∈ annot ( p req ) end if V erify that annot ( preq ) do es not con tain ¬ ♦ χ for some χ ∈ annot ( current ) Mark current as done In preq , mark ♦ χ done for all χ ∈ annot ( current ) current := preq end if end while Accept Fig. 11. Algorithm Sa tisfiability 48 Edith Hemaspaandra and Henning Schnoor of φ which hav e mo dal depth of at most md ( φ ) − i, and are true at v . Hence, annot ( current ) m ust con tain exactly one of ¬ χ or χ for eac h relev ant χ, and additionally , if χ 1 ∧ χ 2 ∈ annot ( current ) , then b oth χ 1 and χ 2 need to b e mem b ers as well. Similarly , if χ 1 ∨ χ 2 is a mem b er, then at least one of them must b e an element of annot ( current ) . The pro cedure Verify-Horn ( v ) works as follows: If there is a clause ˆ ϕ in ˆ ψ with conc ( ˆ ϕ ) = ( x, x ) for x / ∈ prereq ( ˆ ϕ ) such that all connected comp onen ts of prereq ( ˆ ϕ ) can b e mapp ed homomorphically into T , then Verify-Horn ( v ) ensures that v is reflexiv e. Note that all other Horn clauses in ˆ ψ satisfy that conc ( ˆ ϕ ) = ( x, y ) for some x, y ∈ prereq ( ˆ ϕ ). F or these clauses, the pro cedure considers the subgraph G v consisting of all nodes of T whic h can b e reached from v in at most S undirected steps (note that a no de can b e reac hed in at most S steps in T if and only if it can b e reached in at most S steps in T strict ). F or ev ery connected comp onent C of prereq ( ˆ ϕ ) , Verify-Horn ( v ) tests all functions α : C → G v . If one of these α is a homomorphism, then Verify-Horn ( v ) rejects, if the algorithm guessed in the b eginning that C cannot be mapp ed homomorphically into T . If there is one clause ˆ ϕ in ˆ ψ suc h that all connected comp onen ts of prereq ( ˆ ϕ ) can b e mapp ed in to T (according to the list of these p ossibilities maintained b y the algorithm) and Verify-Horn ( v ) detected a homomorphism α : C prereq( ˆ ϕ ) → G v (where C prereq( ˆ ϕ ) is the connected comp onent of prereq ( ˆ ϕ ) containing the no des from the conclusion edge of ˆ ϕ ) for some ˆ ϕ with conc ( ˆ ϕ ) = ( x, y ) suc h that v ∈ { α ( x ) , α ( y ) } , then Verify-Horn ( v ) rejects if ( α ( x ) , α ( y )) is not an edge in G v . W e pro ve that the algorithm is correct. First note that for each connected comp onen t C of some prereq ( ˆ ϕ ) for a clause ˆ ϕ in ˆ ψ , if there is a homomorphism α : C → T , then there is a no de v ∈ T suc h that α : C → G v is a homomorphism. This holds b ecause all edges in T are already presen t in the strict tree T strict or are symmetric or reflexive edges, and the homomorphic image of C under the homomorphism α is a connected comp onen t of T , and the maximal distance of the no des in this image is S (recall that this is the maximal cardinalit y of a connected component in any prereq ( ˆ ϕ )). Therefore, we can assume that for eac h connected comp onen t C of some prereq ( ˆ ϕ ) , if it can b e homomorphically mapp ed into T , then Sa tisfiability guessed this correctly in the b eginning in every accepting run of the algorithm (an incorrect guess would, due to the observ ation just made, b e detected by Verify-Horn ( v ) for some no de v ). No w assume that the algorithm accepts. W e claim that the model obtained from the annotated mo del guessed by the algorithm where a v ariable x is true at a w orld v if and only if x ∈ annot ( v ) is a model of b oth the modal formula φ (at the ro ot-w orld w ) and of the Horn formula ˆ ψ . By the chec ks the algorithm p erforms, it can easily b e v erified by induction on the level of the no des (corresponding to the mo dal depth of the inv olved formulas) that for ev ery world v in T , every formula in annot ( v ) is satisfied at v . Since φ ∈ annot ( w ) , this implies that T , w | = φ . The base case for the induction is clear, since for worlds v in the level md ( φ ) , annot ( v ) only contains literals, and the algorithm ensures that annot ( v ) is propositionally consistent. Since for each subformula χ of φ of relev an t mo dal depth, annot ( v ) con tains exactly one of χ and ¬ χ, the induction hypothesis can b e applied in the relev ant cases. Note that the algorithm also chec ks consistency for the cases in whic h w e ha ve reflexive and/or symmetric edges. It remains to sho w that T is also a mo del of the first-order formula ˆ ψ . Assume that this is not the case. Then there exists some clause ˆ ϕ in ˆ ψ which is not satisfied in T . In particular, this implies that prereq ( ˆ ϕ ) can b e homomorphically mapp ed in to T , and since edges ( T ) ⊆ edges ( typ es-list ( T )) , this implies that prereq ( ˆ ϕ ) can b e homomorphically mapp ed in to a typ es-list -tree. Since w e assumed that Horn-Classifica tion do es not return NP on input ˆ ψ , we know that none of the NP-conditions from Horn-Classifica tion are On the Complexity of Elemen tary Mo dal Logics 49 satisfied. Since none of the NP-conditions from Horn-Classifica tion o ccur, we kno w that ˆ ϕ has conclusion edge conc ( ˆ ϕ ) = ( x, y ) for v ariables x, y where x = y or x, y ∈ prereq ( ˆ ϕ ). First assume that x = y . Since prereq ( ˆ ϕ ) can be mapp ed homomorphically in to T , the pro cedure Verify-Horn ( . ) required ev ery no de in T to be reflexiv e, hence ˆ ϕ is satisfied in T . Not assume that x, y ∈ prereq ( ˆ ϕ ). Since none of the NP-conditions apply , we know that x and y are connected with an undirected path in prereq ( ˆ ϕ ). In particular, they lie in the same connected component C prereq( ˆ ϕ ) of prereq ( ˆ ϕ ). Since ˆ ϕ is not satisfied in T , this implies b y Proposition 4.3 that there are no des u, v ∈ T suc h that ( u, v ) is not an edge in T , there is no edge ( u, v ) in T , and there is a homomorphism α : prereq ( ˆ ϕ ) → T suc h that α ( x ) = u, and α ( y ) = v . Due to the abov e, w e kno w that α : C prereq( ˆ ϕ ) → G v is a homomorphism. Therefore, the homomorphism α w as found by Verify-Horn ( u ) and Verify-Horn ( v ). Since prereq ( ˆ ϕ ) can b e homomorphically mapp ed in to T , we know that ev ery connected comp onen t C of prereq ( ˆ ϕ ) can b e homomorphically mapp ed in to T , and due to the ab ov e, we know that the Sa tisfiability guessed this correctly in an accepting run of the algorithm. Therefore, the pro cedure Verify-Horn ( . ) ensured that ( u, v ) is an edge in T , a contradiction. No w assume that φ is K ( ˆ ψ )-satisfiable. Due to the remarks at the b eginning of the pro of, w e know that in this case, there exists a K ( ˆ ψ )-model T such that T is an edge-extension of a strict tree, and edges ( T ) ⊆ edges ( typ es-list ( T )). Therefore the algorithm can guess this mo del and verify that it satisfies b oth φ and ˆ ψ . It remains to pro ve that the algorithm can b e implemented in nondeterministic p oly- nomial space. The result then follows, since due to a classic result by Savitc h [Sav73], NPSP ACE = PSP ACE. In order to implement the algorithm using only p olynomial space, the main change needed compared to the v ersion stated in Figure 11 is ho w muc h of the guessed mo del T is stored in memory at a given time. The NPSP ACE-implemen tation do es not guess the en tire model T at the start of the algorithm, but guesses each no de the momen t it is first accessed (either by being created explicitly , or b y b eing explored as an S -step neighbor of another node by the pro cedure Verify-Horn ( . )). It remov es the no de from memory at a time when it will not b e accessed an ymore in the remaining execution of the algorithm. T o b e precise, the algorithm at all times keeps in its memory the no de current and all of its predecessors, and all no des which can be reached from these in at most S steps in the tree T strict . Since in T , every no de has at most | sf ( φ ) | successors in the next level, and S is a constan t, this is a p olynomial n umber of no des. W e now need to pro ve that no necessary information is remov ed from memory , i.e., that no no de is first created, then deleted and then accessed again. Note that from the construction of the algorithm, it is ob vious that new no des are visited in a depth-first order. Therefore assume that this happ ens for some no de no de . Note that an y no de which gets deleted from memory is not reac hable from the root world w in at most S steps, and therefore no de is at some lev el i > S in the tree T stric . Let v 1 b e the no de for which no de w as visited for the first time, i.e., the first no de visited suc h that no de ∈ G v 1 (recall that G v 1 is the set of no des which can b e reached from v 1 in at most S undirected steps in T ). Since no de is deleted from memory and required again later, there is some no de v 2 suc h that no de cannot b e reac hed from any predecessor of v 2 in at most S steps, and a no de v 3 suc h that no de can b e reached from v 3 in at most S steps. Let a be the (uniquely determined) common predecessor of no de and v 2 with a maximal level in the tree. Then, since a is a predecessor of v 2 , we know that no de / ∈ G a . Hence, no de is at least S lev els below a . Since T strict is a tree, any no de t such that no de ∈ G t m ust therefore b e a successor of a . In particular, v 3 50 Edith Hemaspaandra and Henning Schnoor is a successor of a . This is a contradiction, b ecause Sa tisfiability tra verses the tree in depth-first-searc h, and hence do es not lea ve the sub-tree with ro ot a and re-enters it later. Therefore we hav e shown that it is sufficient to keep a p olynomial num b er of no des in storage, and which no des to keep can b e decided by an easy pattern. Hence it follows that the algorithm can indeed b y implemented in nondeterministic p olynomial space as required, concluding the pro of. 4.8 Applications Theorem 4.17 and 4.34 can b e used to classify the complexity of a lot of concrete logics, but they also imply more general results, for whic h we will give tw o examples. F or once, recall that Ladner prov ed that all normal mo dal logics KL such that S4 (the logic o v er all transitive and reflexive frames) is an extension of KL giv e rise to a PSP ACE-hard satisfiability problem. The follo wing corollary shows that this result is optimal in the sense that every universal Horn logic which is a “prop er extension” of S4 in the wa y that they imply the conditions of S4 , already giv es an NP-solv able satisfiability problem. Corollary 4.35. L et ˆ ψ b e a universal Horn formula such that ˆ ψ implies ˆ ϕ refl ∧ ˆ ϕ trans . Then either K ( ˆ ψ ) = S4 , or K ( ˆ ψ ) has the p olynomial-size mo del pr op erty and K ( ˆ ψ ) - SA T ∈ NP . Pr o of. By the prerequisites, we kno w that ˆ ψ is equiv alent to ˆ ψ ∧ ˆ ϕ refl ∧ ˆ ϕ trans . Hence we can, without loss of generalit y , assume that ˆ ϕ refl and ˆ ϕ trans app ear as clauses in ˆ ψ . If every clause in ˆ ψ is satisfied in every transitiv e and reflexive tree, then every mo dal form ula φ which is satisfiable in a transitiv e and reflexive tree is K ( ˆ ψ )-satisfiable. Note that a sp ecial case of Theorem 4.33 gives the result that every S4 -satisfiable form ula also is satisfiable in a reflexive and transitiv e tree. Therefore, ev ery S4 -satisfiable formula is also K ( ˆ ψ )-satisfiable, and hence, ev ery K ( ˆ ψ )-v alidity is also S4 -v alid. Therefore, S4 is an extension of K ( ˆ ψ ). Since by Prop osition 2.3, K ( ˆ ψ ) is an extension of S4 = K ( ˆ ϕ refl ∧ ˆ ϕ trans ) , this implies that K ( ˆ ψ ) = S4 . Therefore, we can assume that ˆ ψ is not satisfied in ev ery reflexiv e and transitive tree. No w let typ es-list b e as determined by Horn-Classifica tion on input ˆ ψ . Since ˆ ϕ refl and ˆ ϕ trans are clauses in ˆ ψ , we know that refl and trans 2 are elements of typ es-list . If all elements in typ es-list are of the form refl or trans k , then we kno w (since k -transitivit y is implied by 2- transitivit y), since ˆ ψ is satisfied on ev ery typ es-list -tree, that ˆ ψ is satisfied in ev ery reflexiv e and transitiv e tree, a contradiction. Therefore, we now that symm ∈ typ es-list , and hence b y construction, Horn-Classifica tion rep orts NP-membership. Since b y Theorem 4.17 the output of the algorithm is correct, we kno w that K ( ˆ ψ )- SA T ∈ NP , and K ( ˆ ψ ) has the p olynomial-size mo del property , as claimed. W e further can sho w a PSP ACE upp er b ound for all univ ersal Horn logics which are extensions of the logic T , and hence, from Theorem 4.17, conclude that these are all either solv able in NP (and thus NP-complete if they are consisten t), or PSP ACE-complete. Corollary 4.36. L et ˆ ψ b e a universal Horn formula such that ˆ ψ implies ˆ ϕ refl . Then K ( ˆ ψ ) - SA T ∈ PSP ACE . Pr o of. Assume without loss of generality that Horn-Classifica tion determines the logic K ( ˆ ψ ) to hav e a PSP ACE-hard satisfiability problem, otherwise the theorem holds trivially , since NP ⊆ PSP ACE. If ˆ ψ implies ˆ ϕ trans , then the result follows from Corollary 4.35. Hence On the Complexity of Elemen tary Mo dal Logics 51 assume that this is not the case. Note that in reflexive graphs, k -transitivity is equiv alent to transitivit y . Also note that the conditions requiring a no de to ha ve a certain depth or height in a graph are alwa ys satisfied in a reflexive graph, b ecause no des here hav e infinite depth and height. Therefore, if ˆ ψ implies a formula of the form ˆ ϕ 0 → k w ≥ p,x ≥ q ,y ≥ r for some 2 ≤ k and some p, q , r ∈ N , then ˆ ψ also implies ϕ trans , and due to the ab o ve, w e can assume that this is not the case. Th us, typ es-list as determined by Horn-Classifica tion contains no condition of the form trans k for an y k ∈ N . The complexit y result now follows from Theorem 4.34. In a similar w ay , we can pro ve that all universal Horn logics whic h imply a v arian t of symmetry give rise to a satisfiabilit y problem in PSP A CE. A noteworth y difference in the prerequisites of Corollary 4.36 and Corollary 4.37 is that the former requires the reflexivity condition to b e implied b y the form ula ψ , while the latter only needs a “near-symmetry”- condition as detected b y Horn-Classifica tion . Corollary 4.37. L et ˆ ψ b e a universal Horn formula such that Horn-Classifica tion adds symm to typ es-list on input ˆ ψ . Then K ( ˆ ψ ) - SA T ∈ PSP ACE . In p articular, any universal Horn lo gic which is an extension of B has a satisfiability pr oblem solvable in PSP ACE . Pr o of. If K ( ˆ ψ )- SA T ∈ NP , the claim trivially holds. Hence, since Horn-Classifica tion is correct due to Theorem 4.17, we can assume that Horn-Classifica tion returns PSP ACE- hard, and symm ∈ typ es-list , where typ es-list is as determined b y Horn-Classifica tion . Since Horn-Classifica tion do es not rep ort NP, w e kno w from its construction that trans k / ∈ typ es-list for all k ∈ N . Hence the complexity result follows from Theorem 4.34. 5 Conclusion and F uture Researc h W e analyzed the complexit y of mo dal logics defined b y universal Horn formulas, co vering man y w ell-known logics. W e sho wed that the non-trivial satisfiabilit y problems for these logics are either NP-complete or PSP ACE-hard, and gav e an easy criterion to recognize these cases. Our results directly imply that (unless NP = PSP ACE) such a logic has a satisfiabilit y problem in NP if and only if it has the p olynomial-size mo del property . W e also demonstrated that a wide class of the considered logics has a satisfiability problem solv able in PSP ACE. Op en questions include determining complexity upper b ounds for the satisfiability prob- lems for all modal logics defined by universal Horn formulas. W e strongly conjecture that all of these are decidable, and consider it p ossible that all of these problems are in PSP ACE. A successful wa y to establish upp er complexit y b ounds is the guarded frag- men t [AvBN98,Gr¨ a99]. This do es not seem to b e applicable to our logics, since it cannot b e used for transitive logics, and we obtain PSP ACE-upper b ounds for all of our logics except those in volving a v ariant of transitivity . The next ma jor op en challenges are generalizing our results to form ulas not in the Horn class, and allowing arbitrary quantification. Initial results sho w that ev en when considering only universal formulas ov er the frame language, undecidable logics app ear. An in teresting enric hment of Horn clauses is to allow the equality relation. Preliminary results indicate that Corollary 4.29 holds for this more general case as well. Ac knowledgmen ts: W e thank the anon ymous referees for many hints and suggestions. The second author thanks Thomas Sc hneider for helpful discussionshint 52 Edith Hemaspaandra and Henning Schnoor References [AvBN98] H. Andr ´ ek a, J. v an Benthem, and I. N´ emeti. Mo dal languages and b ounded fragments of predicate logic. Journal of Philosophic al L o gic , 27:217–274, 1998. [BdR V01] P . Blackburn, M. de Rijke, and Y. V enema. Mo dal lo gic . Cam bridge Universit y Press, New Y ork, NY, USA, 2001. [BG04] B. Bennett and A. Galton. A unifying semantics for time and even ts. Artificial Intel li- genc e , 153(1-2):13–48, 2004. [BHSS06] M. Bauland, E. Hemaspaandra, H. Sc hno or, and I. Sc hno or. Generalized mo dal satisfia- bilit y . In Pr o c e e dings of ST ACS 2006 , pages 500–511, 2006. [BZ05] C. Baral and Y. Zhang. Kno wledge up dates: Seman tics and complexity issues. A rtificial Intel ligenc e , 164(1-2):209–243, 2005. [CDF03] T. Coffey , R. Do jen, and T. Flanagan. On the automated implementation of modal logics used to verify securit y proto cols. In Pro c e e dings of ISICT 2003 , pages 329–334. T rinity College Dublin, 2003. [CL94] C. Chen and I. Lin. The computational complexity of the satisfiability of modal horn clauses for mo dal propositional logics. The or etic al Computer Scienc e , 129(1):95–121, 1994. [FHJ02] U. F rendrup, H ¨ uttel, and J. Jensen. Mo dal logics for cryptographic pro cesses. In Pro- c e e dings of EXPRESS 02 , 2002. [Gr¨ a99] E. Gr¨ adel. Why are mo dal logics so robustly decidable? Bul letin of the Eur op e an Asso- ciation for The or etical Computer Scienc e , 68:90103, 1999. [Hal95] J. Halp ern. The effect of b ounding the num b er of primitiv e prop ositions and the depth of nesting on the complexity of mo dal logic. Artificial Intel ligenc e , 75(2):361–372, 1995. [HM92] J. Halp ern and Y. Moses. A guide to completeness and complexity for mo dal logics of kno wledge and belief. Artificial Intel ligenc e , 54(2):319–379, 1992. [HMT88] J. Halp ern, Y. Moses, and M. T uttle. A knowledge-based analysis of zero knowledge. In Pr o c e edings of STOC 1988 , pages 132–147, New Y ork, NY, USA, 1988. ACM Press. [HR07] J. Halpern and L. Rˆ ego. Characterizing the NP-PSP ACE gap in the satisfiability problem for mo dal logic. In Pr o c e e dings of IJCAI 2007 , pages 2306–2311, 2007. [Lad77] R. Ladner. The computational complexity of pro v abilit y in systems of mo dal propositional logic. SIAM Journal on Computing , 6(3):467–480, 1977. [LR86] R. Ladner and J. Reif. The logic of distributed protocols: Preliminary rep ort. In Pr o c e e d- ings of T ARK 1986 , pages 207–222, San F rancisco, CA, USA, 1986. Morgan Kaufmann Publishers Inc. [Ngu05] L. Nguyen. On the complexity of fragments of mo dal logics. A dvanc es in Mo dal L o gic - V olume 5 , pages 249–268. King’s College Publications, 2005. [Sah73] H. Sahlqvist. Completeness and corresp ondence in the first and second order semantics for mo dal logic. In Pr o c e e dings of the Thir d Sc andinavian L o gic Symp osium , 1973. [Sa v73] W. J. Sa vitc h. Maze recognizing automata and nondeterministic tap e complexity . Journal of Computer and Systems Scienc es , 7:389–403, 1973. [SC85] A. Sistla and E. Clarke. The complexit y of prop ositional linear temporal logics. Journal of the A CM , 32(3):733–749, 1985. [SP06] L. Schr¨ oder and D. Pattinson. PSP A CE b ounds for rank-1 mo dal logics. In Pr o c e e dings of LICS 2006 , pages 231–242, 2006. [Spa93] E. Spaan. Complexity of Mo dal L ogics . PhD thesis, Department of Mathematics and Computer Science, Universit y of Amsterdam, 1993.
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment