On finitely recursive programs

Disjunctive finitary programs are a class of logic programs admitting function symbols and hence infinite domains. They have very good computational properties, for example ground queries are decidable while in the general case the stable model seman…

Authors: ** Sabrina Baselice, Piero A. Bonatti, Giovanni Criscuolo (Università di Napoli “Federico II”

T o appea r in Theory and Practice of Logic Pr og ramming (TPLP) 1 On F initely Recursive Pr o grams ∗ Sabrina Baselice, Piero A. Bonatti, Giovanni Criscuolo Univer sit ` a di Napoli “F ederi co II”, Italy submitte d 7 April 2008; rev ised 30 December 2008; accepte d 16 J anuary 2009 Abstract Disjunctiv e finitary pr o gra ms are a class of logic programs admitti n g f u nction symbols and hence infinite do mains. They ha ve v ery good compu tational properties, for ex ample ground queries are de- cidable while in the general case the stable model semantics is Π 1 1 -hard. In t his paper we prove that a larger class of programs, called finitely rec ursive pro gr ams , preserves most of the good properties of finitary programs under the st ab le model semantics, namely: (i) finit ely recu rsiv e programs enjoy a compactness property; (ii) inconsistenc y checking and ske ptical reasoning are semidecidable; (iii) skeptical resolution is complete for normal finitely recursi ve programs. Moreov er , we sho w ho w t o check inconsistency and answer skeptical queries using finite subsets of the ground program instan- tiation. W e achie ve this by extending the splitting sequence theorem by Lifschitz and T urner: W e prov e that if the input program P is fi n itely recursive , then the partial stable models determined by any smo oth splitting ω -sequence con verge to a stable model of P . KEYWORDS : Answer set programming with infinite domains, Infinite stable models, F initary pro- grams, Compactness, Skep tical resolution. 1 Introduction Answer Set Programm ing (ASP) (Marek and T ru szczynski 19 98 ; Niemel ¨ a 1999) is o ne of the most interesting achiev ements in the area of Logic Pro gramming a nd Nonmo no- tonic Reasoning. It is a d eclarati ve prob lem solving parad igm, mainly cen tered aro und some well-engineer ed implemen tations of the stable mod el sema ntics of logic progr ams (Gelfond and Lifschitz 1988; Gelfond and Lifschitz 199 1 ), such as S M O D E L S (Niem el ¨ a and Simons 1997) and DL V (Eiter et al. 1997). The most po pular ASP langu ages a re extensions of Datalog, namely , function-f ree, pos- sibly disjun cti ve logic progr ams with negation as failur e. The lack of f unction symbols has se veral drawback s, related to expr essi vene ss and encodin g sty le (Bonatti 2004). In order to overcome such limitations and red uce the me mory requ irements of curr ent im- plementation s, a class of lo gic pro grams called fi nitary pr ograms has be en intro duced (Bonatti 2004). In finitary pro grams func tion symbols (hence infinite d omains) and recursion are al- lowed. Howe v er , recursion is r estricted by req uiring each groun d atom to depen d on finitely many gr ound atoms; such program s are called finitely r ecursive . More o ver , o nly finitely ∗ T hi s paper exte nds and refines (Baselice et al. 2007) 2 S. Baselice, P .A. Bonatti, G. Criscuolo many gro und atoms must o ccur in odd- cycles —that is, cycles of recur si ve calls in volving an od d num ber of negati ve subgoals—which means that there should be only finitely many potential sources of inconsistencies. These two restrictions bring a nu mber of nice seman- tical and compu tational properties ( Bonatti 2004). I n gen eral, functio n symbols make the stable model semantics hig hly und ecidable (Marek and Remmel 200 1 ). On the contra ry , if the giv en pro gram is finitary , then consistency ch ecking, ground cr edulous queries, and groun d skeptical qu eries are decidable. Nong round queries were proved to be r .e.- complete. Moreover , a fo rm of comp actness holds: an inco nsistent finitary pr ogram has always a fi- nite u nstable kernel , i.e. a finite subset of the gro und instantiation of the pro gram with no stable models. All of these proper ties are qu ite unu sual for a nonmo notonic logic. As fu nction sym bols are b eing integrated in state-of-the -art reasoners such as DL V (Calimeri et al. 2008), it is interesting to extend these good properties to larger pro gram classes. This go al requires a better un derstanding of the role of each re st riction in the def- inition of finitary p rograms. It has alread y been noted (Bon atti 200 4 ) that by dro pping the first co ndition (i.e., if the prog ram is not finitely recursive) on e obtains a superclass of strat- ified pro grams, wh ose c omplexity is then far beyond c omputability . In the same paper, it is argued that the second restriction (o n odd-cycles) is need ed for the dec idability of grou nd queries. Howe ver , if a pro gram is o nly finitely recursiv e (and infinitely many od d-cycles are allo wed), then the results of (Bonatti 2004) do not characterize the exact comp le xity of reasoning and say nothing about com pactness, nor about the completeness of the skeptical resolution calculus (Bonatti 2001b). In this paper we extend and refine those results, and prove that s ev eral impo rtant pro per - ties of fi nitary program s carr y over to all disjunctive finitely recursive p rograms. W e p rov e that fo r all such prog rams the compac tness pro perty still hold s, and that inconsistency checking and skeptical rea s oning are semidecidable. Moreover, we extend the co mplete- ness of skeptical resolutio n (Bona tti 200 1b ; Bonatti 2004) to all normal fin itely r ecursi ve progr ams. Our results clarify the role tha t e ach o f th e two restriction s definin g nor mal finitary program s h as in ensurin g their prop erties. In ord er to prove th ese results we use pro gram splitting s (Lifsch itz and T urner 1994), but the focus is shifted from splitting sequences (who se elements are sublan guages) to the correspo nding sequences of s ubpro grams, th at enjoy mor e in variant pr operties and may be regarded a s a sort o f nor mal fo rm fo r splitting sequences. For this p urpose we intro duce the notion of mod ule sequen ce . It tur ns out that d isjuncti ve finitely recursive pr ograms are exactly those disjun cti v e pro grams who se module sequences consist of fi nite elements. Moreover a disjuncti ve finitely recursi ve pro gram P ha s a stable model whene ver e ach ele- ment P i of the sequen ce has a stable model, a con dition which is n ot valid in general for all disjunctive p rograms with negation. This result pr o vides an iterati ve chara cterization of the stable models o f P . M odule sequences and th is theorem constitute a powerful formal tool that may facilitate th e proof of new consistency results, and p rovide a unifo rm fram e w ork for comparing different approaches to decida ble reasonin g with infinite doma ins. The pap er is organize d as fo llo ws. The next section is dev oted to prelim inaries. In Sec- tion 3, we de fine mo dule sequen ces and stud y their prop erties. In Section 4, we prove that ev ery finitely recursive program with a consistent mo dule sequen ce is co nsistent, and u se this result to extend th e compactness prop erty of finitary p rograms to all finitely recursive progr ams. Co mplexity results and two simp le sound an d co mplete algorithm s for inco n- On F initely Recursive Pr ograms 3 sistency che cking and skeptical reaso ning can be fou nd in Sec tion 5. Then, for a better, goal-dir ected calculus, the comp leteness theore m f or skeptical resolu tion is extended to all finitely recu rsi v e pr ograms in Section 6. Section 7 re lates finitely recu rsi ve program s and our iterati ve appro ach to previous appr oaches to decidable reasoning w ith infinite stable models, an d makes a first step towards a u nified picture b ased on o ur framework. Finally , Section 8 concludes the pap er with a summary and a brief discussion o f o ur results, as well as some interesting directions for future research. 2 Preliminaries W e assume the read er to b e familiar with th e classical the ory of lo gic pr ogramming (Lloyd 1984). Disjunctive logic pr ograms are sets of (disjunctive) ru les A 1 ∨ A 2 ∨ ... ∨ A m ← L 1 , ..., L n ( m > 0 , n ≥ 0) , where each A j ( j = 1 , ..., m ) is a log ical atom and eac h L i ( i = 1 , ..., n ) is a literal , that is, either a logical atom A or a negated atom not A . If r is a rule with the above structur e, then let he ad ( r ) = { A 1 , A 2 , ..., A m } a nd body ( r ) = { L 1 , ..., L n } . Moreover, let b ody + ( r ) (respectively body − ( r ) ) be the set of all atoms A such that A (respectively no t A ) belon gs to body ( r ) . Normal logic pr ograms are disju ncti ve logic pro grams whose r ules r have o ne atom in their head, that is, | head ( r ) | = 1 . The ground instantiation of a progr am P is denoted by Ground ( P ) , and the set of atoms occurrin g in Ground ( P ) is deno ted by atom ( P ) . Similarly , atom ( r ) den otes the set of atoms occurrin g in a g round rule r . A Herb rand model M of P is a stable mod el of P iff M ∈ lm ( P M ) , wher e lm ( X ) de- notes t he set of least mod els of a po s iti ve (possibly disjunctiv e) progra m X , and P M is the Gelfond-Lifschitz transformatio n (Gelf ond and Lifschitz 198 8 ; Gelfond and Lifschitz 199 1 ) of P , obtain ed from Ground ( P ) by i) removing all rules r su ch that body − ( r ) ∩ M 6 = ∅ , and ii) removing all negati ve liter als from the bo dy of the remain ing rules. Disjunctive an d normal pr ograms may hav e one, none, or m ultiple stable models. W e say that a program is co nsistent if it has at least one stab le m odel; otherwise the p rogram is incon sist ent . A skeptical con sequence of a program P is any closed first ord er formu la satisfied by all th e stable mod els o f P . A cr edulous consequ ence of P is any closed first order formu la satisfied by at least on e stable mo del of P . The dependency graph of a pr o gram P is a labelled directed graph , deno ted by DG ( P ) , whose vertices are the ground atom s of P ’ s lang uage. Moreover , i) there exists an edge labelled ‘+’ (called positi ve edge) from A to B iff for some rule r ∈ Ground ( P ) , A ∈ he ad ( r ) a nd B ∈ body ( r ) ; ii) there exists an edge labelled ‘-’ (called negativ e edge) from A to B iff for some rule r ∈ Ground ( P ) , A ∈ he ad ( r ) a nd not B ∈ body ( r ) ; iii) there exists an unlab elled edge from A to B iff fo r som e rule r ∈ Ground ( P ) , A ∈ head ( r ) an d B ∈ head ( r ) . 4 S. Baselice, P .A. Bonatti, G. Criscuolo An ato m A dep ends positively (respectively ne gatively ) on B if the re is a dir ected path from A to B in the depend ency g raph with an even (respecti vely odd) number of n e gativ e edges. M oreover , each atom de pends positively on itself. A d epends on B if A d epends positively or negati vely on B . An odd-cycle is a c ycle in the dependency g raph with an odd number of negati ve edges. A ground atom is odd-cy clic if it occu rs in an odd-cycle. Note that there exists an odd-cycle iff some gr ound atom A dep ends negatively on itself. The class o f progra ms on which th is pap er is focussed can now be d efined very co ncisely . Definition 2.1 A disjunctive pro gram P is fi nitely r ecursive if f eac h g round atom A d epends o n finitely many ground atoms in DG ( P ) 1 . For examp le, mo st standar d list manipulatio n pr ograms ( me mber , ap pend , rem ove etc .) are finitely re cursi ve. The read er can find numero us exam ples of finitely r ecursi ve progr ams in (Bonatti 200 4 ). In gene ral, checkin g whether a program is finitely recursive is undecid- able (Bonatti 2004). Howe ver , in (Bonatti 2001a; Bonatti 2004) a large decidable subclass has been implicitly char acterized via static analy sis techniq ues. Ano ther expressive, decid - able class of finitely recursive p rograms can be found in ( Simkus and Eiter 200 7 ). W e will also mentio n frequ ently an important subclass of finitely recursive progr ams: Definition 2.2 ( F initary pr ograms ) W e say that a disjunc ti ve progra m P is finita ry if the following conditions ho ld: 1. P is fin itely recursi ve. 2. There are finitely many odd-cyclic atoms in the dep endency g raph DG ( P ) . Finitary prog rams ha ve very goo d computational prop erties (for examp le ground inf er - ences are decidable) . Many in teresting pro grams, howev er , ar e finitely recursiv e but not finitary , due to integrity constraints that apply to infinitely many individuals. Example 2.3 T yp ical progr ams for reasonin g about actions an d cha nge are finitar y . Fig. 4 of (Bon atti 200 4 ) illustrates one of them , modelling a blocks w orld. That program defines—among other s— two pr edicates holds ( fluent , time ) a nd do ( action , t ime ) . Th e simplest way to add a con- straint that forb ids any parallel execution of two incompatib le actions a 1 and a 2 is includ - ing a rule f ← n ot f , do ( a 1 , T ) , do ( a 2 , T ) in that program, where f is a fresh pr opositional symbo l (often such rules are equ i v alently expressed as denia ls like ← do ( a 1 , T ) , do ( a 2 , T ) ). This progr am is not finitary (because f de pends o n infinitely many atoms sin ce T has an infinite ran ge of values) but it can be reform ulated as a fin itely recu rsi ve pr ogram by repla cing the above rule with f ( T ) ← not f ( T ) , do ( a 1 , T ) , do ( a 2 , T ) . 1 This definition differs from the one adopted in (Bonatti 2002) because it is based on a dif ferent notion of depende ncy . Here the dependenc y graph contain s edges between ato ms occurring in the same head, while in (Bonatt i 2002) such dependenc ies are dealt with in a third condit ion in the definiti on of finitary programs. Further comparison with (Bonat ti 2002) can be found in Section 7. On F initely Recursive Pr ograms 5 Note that the new program is finitely recursi ve but not finitary , because the new rule intro - duces infinitely many odd c ycles (one for each instance of f ( T ) ). Our results on finitely recursiv e prog rams dep end on the splitting theorem that allo ws to construct stable models in stages. In turn, this theor em is b ased on the notion o f splitting set . Definition 2.4 ( Splitting set and bottom pr ogram (Baral 2003; Lifsc hitz and T urner 199 4 ) ) A splitting set o f a disjun cti v e logic progr am P is any s et U of ground atoms such that, fo r all rules r ∈ Ground ( P ) , if head ( r ) ∩ U 6 = ∅ then atom ( r ) ⊆ U . If U is a s plitting set for P , we also s ay that U splits P . The set of rules r ∈ Ground ( P ) such that head ( r ) ∩ U 6 = ∅ is called the bottom of P relativ e to the splitting set U an d is denoted by bot U ( P ) . The subprog ram Ground ( P ) \ bot U ( P ) is called the top of P relative to U . The bottom p rogram character izes the restriction of the stable models of P to the language determined by the splitting set. T he top program determin es the rest of each stable mod el; for th is pur pose it should be partially ev aluated with respect to the stable models of the bottom. Definition 2.5 ( P artial evaluatio n ( Bar al 2003; Lifsc hitz and T urner 19 94 ) ) The pa rti al evalua tion of a d isjuncti ve logic progra m P with splitting set U with respect to a set of ground atoms X is the program e U ( Ground ( P ) , X ) defined as follows: e U ( Ground ( P ) , X ) = { r ′ | there exists r ∈ Ground ( P ) s.t. ( body + ( r ) ∩ U ) ⊆ X and ( body − ( r ) ∩ U ) ∩ X = ∅ , and head ( r ′ ) = head ( r ) , body + ( r ′ ) = body + ( r ) \ U, body − ( r ′ ) = body − ( r ) \ U } . W e are finally r eady to formulate the splitting theor em (an d hence the modu lar co nstruction of stable models based on the top and bottom program s) in fo rmal terms. Theor em 2.6 ( Splitting theor em (Lifs chitz and T urne r 1994) ) Let U b e a splitting set for a disjunctive logic progra m P . An interpr etation M is a stable model of P iff M = I ∪ J , where 1. I is a stable model of bot U ( P ) , and 2. J is a stable mod el of e U ( Ground ( P ) \ b ot U ( P ) , I ) . The splitting theor em has b een extended to transfinite sequen ces in (Lif schitz and T urner 1994). A (transfinite) seq uence is a family who s e index set is an initial segment of or dinals, { α : α < µ } . The ordina l µ is the length o f the sequen ce. A sequence h U α i α<µ of sets is mono tone if U α ⊆ U β whenever α < β , an d continuous if, for each limit ordinal α < µ , U α = S ν <α U ν . Definition 2.7 ( Lifschitz-T u rner , (Lifschitz and T urner 199 4 ) ) A splitting sequ ence for a disjun cti ve program P is a mo notone, continuou s sequence h U α i α<µ of splitting sets for P su ch that S α<µ U α = atom ( Ground ( P )) . Lifschitz and T u rner gen eralize the splitting theore m to splitting sequences. 6 S. Baselice, P .A. Bonatti, G. Criscuolo Theor em 2.8 ( Splitting sequence theor em (Lifs chitz and T urne r 1994) ) Let P be a disjun cti ve prog ram. 2 M is a stable model of P iff there exists a splitting sequence h U α i α<µ such that 1. M 0 is a stable model of bot U 0 ( P ) , 2. for all suc cessor ordin als α < µ , M α is a stable mod el of e U α − 1 ( bot U α ( P ) \ bot U α − 1 ( P ) , S β <α M β ) , 3. for all limit ordina ls λ < µ , M λ = ∅ , 4. M = S α<µ U α . 3 Module sequences and a normal form f or sp litting sequences In this section we replace the sequences of program slices bot U α ( P ) \ bot U α − 1 ( P ) adopte d by L ifschitz and Turner with slightly different and simpler program module sequ ences. Then we pr ov e some properties of mod ule sequen ces that will be useful in proving our main results. Definition 3.1 ( GH, Module sequence ) Let P be a disjunctive pro gram and let the set of its gr ound head atoms be GH = { p | p ∈ head ( r ) , r ∈ Ground ( P ) } . The mod ule s equence P 1 , P 2 , ..., P n , ... indu ced by an enu mer ation p 1 , p 2 , ..., p n , ... of GH is defined as follows: P 1 = { r ∈ Ground ( P ) | p 1 depend s on some A ∈ head ( r ) } P i +1 = P i ∪ { r ∈ Ground ( P ) | p i +1 depend s on some A ∈ head ( r ) } ( i ≥ 1) . Of cou rse, we ar e p articularly interested in tho se p roperties of module sequ ences that are ind ependent from the enumera tion of GH. W e say th at a gr ound subprogra m P ′ ⊆ Ground ( P ) is downward closed , if for each atom A occurrin g in atom ( P ′ ) , th e su bpro- gram P ′ contains all the rules r ∈ Ground ( P ) such tha t A ∈ h ead ( r ) . Pr o position 3.2 Let P be a disjunctive pro gram. For all module sequences P 1 , P 2 , ... , for P : 1. S i ≥ 1 P i = Ground ( P ) , 2. for each i ≥ 1 an d j ≥ i , atom ( P i ) is a sp litt ing set o f P j , and P i = bot atom ( P i ) ( P j ) , 3. for each i ≥ 1 , atom ( P i ) is a splitting set o f P , a nd P i = bot atom ( P i ) ( P ) , 4. for each i ≥ 1 , P i is downward closed. This p roposition follows easily fr om the d efinitions. I t shows that eac h m odule sequence for P co nsists of the bottom pro grams corresp onding to a particular splitting sequence h atom ( P i ) i i<ω that depends on the underly ing en umeration of GH . Roughly speaking, such sequ ences (wh ose leng th is limited by ω ) constitute a normal form for splitting se- quences and enjoy useful properties that are in v ariant with respect to the enu meration. 2 The splitting s e quence theorem holds for disjuncti ve logic programs exte nded with so-called str ong ne gation that, ho we ve r , is essentially syntactic sugar . Therefore , for the sake of simplicit y , we ignore it here. On F initely Recursive Pr ograms 7 Definition 3.3 ( Smoothn ess ) A transfinite sequence of sets h X α i α<µ is smoo th iff X 0 is finite and for each non -limit ordinal α + 1 < µ , the difference X α +1 \ X α is finite. Note tha t wh en µ = ω (as in mo dule sequences), smoo thness imp lies that eac h X α in the sequence is finite. Finitely recur si ve programs are completely chara cterized by smooth module sequences: Theor em 3.4 For all disjuncti ve logic pro grams P , the fo llo wing are equivalent: 1. P is fin itely recursi ve; 2. P h as a smo oth mod ule sequence (where each P i is finite); 3. all modu le sequences for P are smooth . Pr o of (1 ⇒ 3) Let P be a finitely recu rsi ve progr am and let e = p 1 , p 2 , . . . be any enumer- ation of GH . If S = P 1 , P 2 , . . . is the module sequen ce induc ed by the enumer a- tion e then S is smooth beca use, fo r each ato m p i in e , the set { r ∈ Ground ( P ) | p i depends on some A ∈ head ( r ) } is finite, as P is finitely re cursi ve. Sin ce this holds for an arbitrary enumeratio n e , all mo dule sequences for P a re s mooth. (3 ⇒ 2) Tri vial. (2 ⇒ 1) Let S = P 1 , P 2 , . . . , b e a smooth modu le sequence for P and let p be an atom in Ground ( P ) . By Prop osition 3.2.(1), there is a program P i in S such that p ∈ atom ( P i ) . Moreover , P i is d o wnward closed by definition of module sequence an d it is finite be- cause S is smooth . The n p dep ends only o n finitely many g round a toms. Since p has b een arbitrarily chosen, the same holds for all grou nd atoms, therefore P is finitely recur si ve. Smooth mo dule sequence s clearly correspond to smooth splitting sequences of length ω . In particu lar , for each smooth module sequence h P i i i<ω , h atom ( P i ) i i<ω is a smooth splitting s equence. Con versely , g i ven a smooth splitting sequence h U i i i<ω and an arbitrary enumera tion p 1 , p 2 , . . . , p i , the r esulting mo dule sequ ence must n ecessarily be smo oth. Suppose no t; th en some p i must dep end on infinitely m any atoms. Con sequently , all the sets U j containing p i should be infinite as well (a con tradiction). Note that in gene ral a smooth splitting s equence does not strictly correspond to a module sequence. For example, the d if ference between two consecutive elements of a splitting sequ ence may c ontain two atoms that do n ot dep end on ea ch othe r , while this is impossible in mo dule sequenc es by construction . Using the above relatio nships betwe en smooth m odule sequ ences and smooth sp litt ing sequences of le ngth ω , the characteriz ation o f finitely recursive progra ms can be completed as follows, in terms of standard splitting sequ ences: Cor o llary 3.5 For all disjuncti ve prog rams P , the fo llo wing are equ i v alent: 1. P is fin itely recursi ve; 2. P h as a smo oth splitting sequen ce of length µ ≤ ω . 8 S. Baselice, P .A. Bonatti, G. Criscuolo Pr o of A straightforward consequen ce of T heorem 3.4 an d the co rrespondence between smoo th module sequences and smooth splitting sequences of length µ ≤ ω . Note the asymmetry betwee n Coro llary 3.5 and Th eorem 3 .4. It can be explained by the g enerality of splitting sequenc es: ev en if the unde rlying progr am is finitely r ecursi ve, splitting sequen ces are n ot f orced to be all smooth. For example, the finitely recur si ve progr am even (0) even ( s ( s ( X ))) ← even ( X ) o dd ( s (0)) o dd ( s ( s ( X ))) ← o dd ( X ) has a non-smo oth splitting sequ ence h{ even ( s n ( X )) | n ev en } , { o dd ( s n ( X )) | n odd }i . Next we illustrate how m odule sequences provide an incremental characterization o f th e stable models of disjunctive lo gic programs. Roughly spe aking, the following theo rem r ephrases the splitting sequenc e theor em of (Lifschitz and T u rner 1994) in terms of mod ule sequences. The original splitting sequence theorem applies to seq uences of disjoint pro gram “slices”, while o ur theo rem applies to monoto nically increasing pro gram sequen ces. Since no direct p roof of the splittin g se- quence theorem was ever p ublished (only the p roof o f a m ore general result for d ef ault logic was published (T ur ner 199 6 )), here we gi ve a dire ct proof of our result. Theor em 3.6 ( Module sequence theor em ) Let P b e a disjun cti ve program an d P 1 , P 2 , ... be a m odule seque nce for P . Then M is a stable model of P iff there exists a seque nce M 1 , M 2 , ... such that : 1. for each i ≥ 1 , M i is a stable model of P i , 2. for each i ≥ 1 , M i = M i +1 ∩ atom ( P i ) , 3. M = S i ≥ 1 M i . Pr o of Let M be a stable mode l of P . Since P 1 , P 2 , ... is a module sequence for P then for each i ≥ 1 , atom ( P i ) is a splitting set of P and P i = b ot atom ( P i ) ( P ) . Consider the sequence of mod els M i = M ∩ atom ( P i ) , ( 1 ≤ i < ω ). By the splitting th eorem (Lifschitz and T u rner 1994), for each i ≥ 1 , M i is a stable model of P i . Secon d, sin ce P i +1 ⊇ P i , we have M i = M ∩ atom ( P i ) = ( M ∩ atom ( P i +1 )) ∩ atom ( P i ) = M i +1 ∩ atom ( P i ) . Finally , by Pr oposition 3 .2.(1) we have S i M i = M . Then for each stable model M of P there exists a sequen ce of finite sets of gro und a toms that satisfies proper ties 1, 2 an d 3. Con versely , let P be a disjunctiv e logic prog ram. For the sak e of readability , we assume without loss of gene rality that P is groun d. Sup pose that there exists a sequence M 1 , M 2 , ... that satisfies proper ties 1, 2 an d 3. W e have to prove that the set M = S i ≥ 1 M i is a stable model of P ; equiv alently , [ i ≥ 1 M i ∈ lm ( P M ) . On F initely Recursive Pr ograms 9 Properties 2 an d 3 imply that f or all i ≥ 1 , ( M ∩ atom ( P i )) = M i ; consequ ently P M i = P M i i and by Proposition 3.2.(1), P M =   [ i ≥ 1 P i   M = [ i ≥ 1 P M i = [ i ≥ 1 P M i i . (1) First we prove that M is a model of P M , that is for each rule r in P M , if body ( r ) ⊆ M then head ( r ) ∩ M 6 = ∅ . Let r be any rule in P M such that body ( r ) ⊆ M . By equa tion (1), there is an in te ger i ≥ 1 such th at r ∈ P M i i . Moreover , it is no t h ard to prove that p roperties 2, 3 a nd body ( r ) ⊆ M im ply body ( r ) ⊆ M i . Now , since M i is a stable mod el of P i and body ( r ) ⊆ M i , we ha ve head ( r ) ∩ M i 6 = ∅ . It follows immed iately that head ( r ) ∩ M 6 = ∅ . Since this holds for any r ∈ P M , we conclude that M is a m odel of P M . W e are left to show that M is a minima l model for P M . Sup pose that P M has a mod el M ′ ⊂ M . Let p ∈ ( M \ M ′ ) an d let i be an integer such that p ∈ atom ( P i ) . Sin ce P M i = P M i i is a bottom progr am for P M then M ′ ∩ atom ( P i ) is a model for P M i i and it is strictly contained in M i , but this is a contra diction because by hypoth esis M i is a minimal model of P M i i . The module sequence theorem (respectively , th e splitting sequence theorem) suggests a r elationship between the consistency of a progr am P and the consistency of each step in P ’ s mod ule sequences (respectively , the sequence of progr am slices induced by P ’ s splitting sequen ces). T o clarify this po int we in troduce an other inv ariant prop erty of mod ule sequences. Definition 3.7 A module sequence S = P 1 , P 2 , ... for a disjunctive pr ogram P is inconsistent if for some i < ω , P i is inconsistent; otherwise S is consistent . Pr o position 3.8 If a disjunctiv e program P has an inconsistent module sequence then P is inco nsistent. Pr o of Suppose that P has an inco nsistent mo dule sequence P 1 , P 2 , ... , that is, some P i in the sequence is inconsistent. It fo llo ws that P has an inc onsistent bottom pr ogram and h ence P is incon si stent by the splitting theorem. Theor em 3.9 Let S = P 1 , P 2 , ... be a mod ule sequen ce for a disjun cti ve progr am P . If S is inconsistent then each module sequence for P is incon si stent. Pr o of Let S = P 1 , P 2 , ... be an incon s istent module sequenc e for P induced by the enu meration p 1 , p 2 , ... of GH and let i be the least ind e x such th at P i is inconsistent. Let S ′ = P ′ 1 , P ′ 2 , ... be any module sequence for P induced by th e enu meration p ′ 1 , p ′ 2 , ... of GH . Since i is fi- nite, t here e xists a finite k such that { p 1 , p 2 , ..., p i } ⊆ { p ′ 1 , p ′ 2 , ..., p ′ k } . S o, by constru ction, P i ⊆ P ′ k and then atom ( P i ) ⊆ atom ( P ′ k ) . Moreover , by d efinition, P i is d o wnward closed, theref ore P i = bot atom ( P i ) ( P ′ k ) . Since P i is inco nsistent, P ′ k is inco nsistent ( by the splitting theorem) and hence S ′ is inconsistent, too. 10 S. Baselice, P .A. Bonatti, G. Criscuolo In other words, for a given pro gram P , either all mod ule sequences are incon sis tent, or they are all consistent. In particu lar , if P is consistent, then every memb er P i of any mod- ule sequence for P must be con sis tent. The con verse proper ty would a llo w to defin e a proced ure for enum erating the stab le mo dels o f P ( as shown in the following sections). Unfortu nately , even if each step in a modu le sequence is consistent, the entir e program P is not necessarily consistent, as shown by the following example. Example 3.10 As a preliminary step, consider the following prog ram P f (due to Fages (F ages 1994)): q ( X ) ← q ( f ( X )) . q ( X ) ← not q ( f ( X )) . r (0) . The third rule is only needed to introdu ce the con stant 0 into the pro gram’ s language. This program is inco nsistent. T o see this, note that – rou ghly speaking – th e first two rules in P f are classically equiv alent to q ( X ) ← q ( f ( X )) ∨ not q ( f ( X )) . Since the body is a tautology and the stable models of a progr am are also classical models of the pro gram (if not is in terpreted as ¬ ), we hav e that e very stable mo del of P f should satisfy all grou nd instances of q ( X ) . Howe ver , the Gelfo nd-Lifschitz transforma tion with respect to such a model w ould contain only the first and the third program rules, and hen ce the least model of the transform ation would contain no instance of q ( X ) . It follows that P f is inconsistent (it has no stable models). No w consider the following extension P of P f : 1. q ( X ) ← q ( f ( X )) , p ( X ) . 2. q ( X ) ← not q ( f ( X )) , p ( X ) . 3. r (0) . 4. p ( X ) ← n ot p ′ ( X ) . 5. p ′ ( X ) ← no t p ( X ) . 6. c ( X ) ← n ot c ( X ) , not p ( X ) . The program P is in consistent, too. T o verify it, supp ose th at M is a stable model of P . By rules 4 and 5, f or all gro und instances o f X , exactly one of p ( X ) an d p ′ ( X ) is true in M . Howe ver , if p ( X ) is false, then ru le 6 pr oduces an in consistency due to the od d-cycle in volving c ( X ) . It follows that all ground instances o f p ( X ) mu st be true in M . But then rules 1, 2 and 3 becom e equiv alent to program P f and p re vent M from being a stable model, as explained above. So P is incon sis tent. Next, conside r the enumeration e = r (0) , q (0) , p (0) , p ′ (0) , c (0) , q ( f (0)) , p ( f (0)) , p ′ ( f (0)) , c ( f (0)) , ... , of th e set GH . T his enumeration induce s the fo llo wing m odule sequence for P (wh ere the expression [ X/t ] deno tes the substitution mapping X onto t ): On F initely Recursive Pr ograms 11 P 0 = { r (0) } P 1 = P 0 ∪ S k<ω { q ( X ) ← q ( f ( X )) , p ( X ) , q ( X ) ← not q ( f ( X )) , p ( X ) , p ( X ) ← n ot p ′ ( X ) , p ′ ( X ) ← no t p ( X ) } [ X/ f k (0)] P i +1 = P i ∪ { c ( X ) ← no t c ( X ) , not p ( X ) } [ X/f i − 1 (0)] ( i ≥ 1) . Note that M 0 = { r (0) } is a stable model of P 0 and for each i ≥ 1 an d k ≥ i − 2 M k i = { r (0 ) , p ( f 0 (0)) , p ( f 1 (0)) , p ( f 2 (0)) , . . . , p ( f k (0)) , p ′ ( f k +1 (0)) , p ′ ( f k +2 (0)) , . . . , p ′ ( f k + j (0)) , . . . q ( f 0 (0)) , q ( f 1 (0)) , q ( f 2 (0)) , . . . , q ( f k (0)) } is a stable mo del of P i . Therefore, each P i is consistent wh ile S i P i = Ground ( P ) is inc onsistent. This happens be cause for each stab le model M of P 1 there exists a P j ( j > 1) such that M is not the bottom p art of any stab le model of P j . Intuitiv ely , M has been “eliminated” at step j . In this example P 1 has infinitely many stable models, and it turns out that no fin ite step elimin ates them a ll. Consequ ently , each P i in the mod ule sequence is consistent, b ut the entire prog ram is not. Note th at P is n ot finitely r ecursi ve because, for each gro unding substitution σ , q ( X ) σ depend s on the in finite set of groun d atoms { q ( f ( X )) σ, q ( f ( f ( X ))) σ, ... } (due to ru les (1) and (2)). In the follo wing section we are going to prove tha t finitely recursive pro grams are no t affected by t he pr oblem illustrated in Example 3.10 , that is, they enjoy the con verse of The orem 3.9. This p roperty will be u sed to design an effectiv e enu meration proce dure for their stable models. 4 Compactness property of disjuncti ve finitely recursi ve pr ograms Here we prove that the comp actness theo rem proved in (Baselice et al. 20 07 ) for n ormal finitely recursive p rograms actually holds for all disjun cti ve finitely recursive progr ams. The first step is t o prove the con verse o f Theor em 3.9 for all finitely recursive prog rams. Theor em 4.1 For all disjunctive fin itely r ecursi ve pro grams P , if some mod ule sequen ce f or P is con- sistent, then P is con sis tent. Pr o of Let S be any modu le sequen ce for P . If S is consistent, th en each module P i in S has a nonemp ty set of stable mod els. It suffices to prove th at there exists a sequence M 1 , M 2 , ... of stable mod els of P 1 , P 2 , ... , respectively , that satisfy the pr operties of Th eorem 3 .6, because this implies that M = S i M i is a stable model of P . W e call a stab le mod el M i of P i “bad” if there exists a k > i such that no stable model M k of P k extends M i , “good” o therwise. W e say that M k extends M i if M k ∩ atom ( P i ) = M i . 12 S. Baselice, P .A. Bonatti, G. Criscuolo Claim 1 : Each P i must hav e at least one “good” stable model. T o prove the claim , sup pose that there exists an i such that all stable mode ls of P i are “bad” . Since P i is a finite progra m, it has a finite num ber M i, 1 , ..., M i,r of stable mode ls . By ass umption , fo r e ach M i,j there is a progr am P k j none of whose stab le mod els extends M i,j . Let k = max { k 1 , ..., k r } ; clea rly , no stab le mod el of P k extends any stable model of P i , an d this is a contra diction beca use P k , by hyp otheses, has at least one stab le model M k and by the splitting theorem, M k must extend a stable model of P i . This proves Claim 1. Claim 2 : Each “goo d” stable model M i of P i is extende d by s ome “good” stab le model M i +1 of P i +1 . Suppose not. Then, non e of the stable models M i +1 , 1 , . . . , M i +1 ,r of P i +1 that extend the good stable model M i of P i is good. This implies (by analogy with the proof of Claim 1) that there exists a mo dule P k ( k > i + 1 ) non e of wh ose stable m odels extends any of M i +1 , 1 , . . . , M i +1 ,r . It fo llo ws th at none o f P k ’ s stable models can extend M i , and this contradicts the hypoth esis that M i is good. From the two claim s it follows immediately that there exists an infinite sequen ce M 1 , M 2 , ... th at satisfies properties 1 and 2 of Theorem 3.6 and hence the union M = S i M i is a stable model of P . Note that in Example 3.10, module P 1 is infinite and has infinitely many stable models, all of which are “b ad”. Each o f them is elimin ated at some step , but no finite step eliminates them all, which is why that modu le sequence is consistent althoug h the en tire progr am P is not. Theorem 4.1 can be extended to all smooth s plitting sequences with length ω : Cor o llary 4.2 Let h U α i α<ω be a smooth splitting sequ ence for a disjun cti v e program P . Th en P is con- sistent iff fo r all α < ω , bot U α ( P ) is consistent. Pr o of A straightfor w ard con sequence of th e cor respondence betwee n modu le and splitting se- quences. The restriction to sequen ces with length ω is e ss ential to derive the above co rollary , which is not v alid otherwise, as shown by the fo llo wing example. Example 4.3 Let P be the following program , where rule 1 has the role of cre ating an infinite Herbra nd domain: 1. r ( f (0)) . 2. p ( X ) ← n ot q ( X ) . 3. q ( X ) ← not p ( X ) . 4. some q ← q ( X ) . 5. f ← not f , not some q . 6. c ( X ) ← n ot c ( X ) , q ( X ) . On F initely Recursive Pr ograms 13 This prog ram is in consistent fo r the following r easons: For all groun d instances of X , rules 2 and 3 force exactly one of p ( X ) and q ( X ) to be tr ue. If n o instance of q ( X ) is tru e, then rules 4 and 5 cr eate a contradictio n b y “activ ating” the odd- c ycle inv olving f . Howe ver , if so me instance of q ( X ) is tru e, then rule 6 generates a contrad iction b y “activ ating” the od d-cycle inv olving c ( X ) . It follows that P has no stable models. Howe ver , P has a smooth splitting s equence with len gth 2 ω whose bottom progr ams a re all consistent: U 0 = { p (0) , q (0) , r (0) } U i = U i − 1 ∪ { p ( f i (0)) , q ( f i (0)) , r ( f i (0)) } (0 < i < ω ) U ω = [ i<ω U i U ω +1 = U ω ∪ { some q , f , c (0 ) } U ω + j +1 = U ω + j ∪ { c ( f j (0)) } (0 ≤ j < ω ) . In particular, i) bot U ω ( P ) ha s infinitely many stable models, on e for each choice between p ( X ) and q ( X ) , for all instances of X ; ii) bot U ω +1 ( P ) keeps all the stable models where at least o ne instance of q ( X ) is true; iii) bot U ω + j +1 ( P ) keeps o nly tho se stable mo dels where the first true instance of q ( X ) is q ( f k (0)) with k > j . Now we are ready to e xtend the co mpactness p roperty of finitary normal programs to all disjunctive finitely re cursi ve prog rams. Definition 4.4 An u nstable kernel for a disjun cti v e progr am P is a set K ⊆ Ground ( P ) with th e following proper ties: 1. K is downward closed. 2. K h as no stable model. Theor em 4.5 ( Compactness ) A disjun cti ve finitely recu rsi v e pr ogram P has no stable mo del iff it has a fin ite unstable kernel. Pr o of By Prop osition 3.8 an d Theorem 4. 1 , P h as no stable mo del iff it h as a n incon sis tent module seque nce. So, let P 1 , P 2 , ..., P n , ... b e an inc onsistent module sequence for P and choose an in de x i ≥ 1 such that P i is in consistent. By Prop osition 3.2, P i ⊆ Ground ( P ) ; moreover , P i is d o wnward closed. Th en P i is an u nstable kernel f or P . Moreover, by Theorem 3.4, P i is finite. 14 S. Baselice, P .A. Bonatti, G. Criscuolo 5 Reasoning with disjunctive finitely r ecursiv e programs By taking an effecti ve enu meration of the set GH o f gro und head atoms, one can effec- ti vely compu te each element of the co rresponding module sequen ce. Le t us call C O N - S T RU C T ( P , i ) an effectiv e pro cedure that, given a finitely recu rsi ve p rogram P a nd an index i , returns the ground pro gram P i , and let SM ( P i ) be an algorithm that comp utes the finite set of the finite stable models of P i : Theor em 5.1 Let P be a disjunctive finitely recu rsi ve pr ogram. De ciding whether P is inc onsistent is semidecidable. Pr o of Giv en a module seq uence P 1 , P 2 , ..., P n , ... for the progr am P , co nsider the algorithm C O N S I S T E N T ( P ) . Algorithm C O N S I S T E N T ( P ) 1: i = 0 ; 2: answe r = TRUE ; 3: repeat 4: i = i + 1 ; 5: P i = C O N S T RU C T ( P, i ) ; 6: if SM ( P i ) = ∅ then 7: answ e r = F ALSE ; 8: until ¬ answe r OR P i = Ground ( P ) 9: return answe r ; By Proposition 3.8 and Theorem 4.1, P is incon sis tent if f th ere exists an i ≥ 1 such that P i is in consistent (note that we can a l ways check the consistency of P i because P i is finite). Then, the algorithm returns F ALSE if f P is inco nsistent. Note that if Ground ( P ) is in finite then any modu le sequen ce for P is infinite an d the algorithm C O N S I S T E N T ( P ) terminates iff P is no t con sis tent. Next we deal with skeptical inferen ce. Recall that a closed first order form ula F is a skeptical consequ ence of P iff F is satisfied (accor ding to classical semantics) by all the stable models of P . Theor em 5.2 Let P be a disjunctive finitely rec ursi ve pro gram and P 1 , P 2 , ... be a modu le sequen ce for P . A groun d formu la F in the language of P is a skeptical consequen ce of P iff there exists a finite k ≥ 1 such tha t F is a skeptical consequenc e of P k and atom ( F ) ⊆ atom ( P k ) . Pr o of Let h b e th e least integer such that atom ( F ) ⊆ atom ( P h ) (note that there always exists such an h beca use atom ( F ) is finite). Suppose th at there exists a k ≥ h suc h that F is a skeptical consequence of P k . Since P k is a bo ttom prog ram for P , then each stable mo del M of P extends a stable mo del M k of P k and then satisfies F (here the assumption that On F initely Recursive Pr ograms 15 atom ( F ) ⊆ atom ( P k ) is essential to conclude that M and M k agree o n the truth o f F ). So, F is a skeptical consequen ce o f P . This p rov es the “if ” part. Now suppose that, for each k ≥ h , F is not a skeptical consequ ence of P k . This implies that each P k is consistent (hence P is consistent) and, mo reov er , th e set S of all the stable models of P k that falsify F is not empty . Note that S is fin ite becau se P k is finite (as P is finitely recursive). So, if all the models in S ar e “ bad ” (cf. the pr oof of Theor em 4.1), the n t here exists a fin ite integer j > k such that no mod el of P j contains any model of S . Consequen tly , F is a skeptical consequenc e of P j —a contradiction . Therefo re at least one of these mo del must be go od . Then there must be a model M of P that con tains th is “ good ” mod el o f P k , and hence F is n ot a skeptical co nsequence o f P . The next theorem follo ws eas ily . Theor em 5.3 Let P be a disjun cti ve finitely re cursi ve pr ogram. F or all g round formu las F , the prob lem of deciding whether F is a skeptical consequ ence of P is semidecida ble. Pr o of Giv en a module seq uence P 1 , P 2 , ..., P n , ... for the progr am P , co nsider the algorithm S K E P T I C A L ( P, F ) . Algorithm S K E P T I C A L ( P, F ) 1: answe r = F ALSE ; 2: i = 0 ; 3: repeat 4: i = i + 1 ; 5: P i = C O N S T RU C T ( P, i ) ; 6: until atom ( F ) ⊆ atom ( P i ) 7: repeat 8: if SM ( P i ) = ∅ OR P i skeptically entails F then 9: answ e r = TRUE ; 10: else 11: i = i + 1 ; 12: P i = C O N S T RU C T ( P, i ) ; 13: until answ er OR P i = P 14: return answ er ; For each P i such th at atom ( F ) ⊆ atom ( P i ) , the algorithm S K E P T I C A L ( P, F ) check s if F is a skeptical conseq uence of P i . Since P i is finite, we c an always decid e if F is a skeptical con sequence of P i . So, by Theor em 5.2, the algor ithm retu rns T RUE iff F is a skeptical consequence of P . Note that if Ground ( P ) is in finite then any modu le sequen ce for P is infinite an d the algorithm S K E P T I C A L ( P, F ) teminates if f F is a skeptical consequence of P . 16 S. Baselice, P .A. Bonatti, G. Criscuolo For a complete c haracterization of the comp le xity of g round que ries and in consistency checking , we are o nly left to prove that the ab ov e u pper bo unds ar e tight. Actually , we prove slightly strong er lower boun ds, that hold even for normal finitely recur si ve p rograms. Theor em 5.4 Deciding whether a normal finitely recursiv e program P is inconsistent is r .e.-ha rd. Pr o of The p roof is by red uction of the prob lem of skeptical inferen ce of a quan tifi ed f ormula over a finitar y n ormal prog ram (proved to be r .e.-complete in (Bon atti 20 04 , Co rollary 23)) to the problem of inconsistency checking o ver a normal finitely r ecursi ve p rogram. Let P be a finitary program and ∃ F be a c losed existentially quan tified form ula. Let (( l 11 ∨ l 12 ∨ ... ) ∧ ( l 21 ∨ l 22 ∨ ... ) ∧ ... ) be the conjunctive n ormal for m of ¬ F . Then ∃ F is a skeptical consequence of P iff the program P ∪ C is inconsistent, where C =      p 1 ( ~ x 1 ) ← not l 11 , no t l 12 , ..., not p 1 ( ~ x 1 ) p 2 ( ~ x 2 ) ← not l 21 , no t l 22 , ..., not p 2 ( ~ x 2 ) . . .      , p 1 , p 2 , ... are new atom symbo ls not occurr ing in P or F , an d ~ x i is th e vector of all variables occurrin g in ( l i 1 ∨ l i 2 ∨ ... ) . Note that P ∪ C is a norma l finitely recursive p rogram. The con straints in C add no model to P , but they only discard those models of P th at satisfy F θ (fo r some substitution θ ). So, let SM ( P ) be the set of stable models of P . Then each model in SM ( P ∪ C ) satisfies ∀¬ F . SM ( P ∪ C ) = ∅ (that is P ∪ C is inconsistent) iff either SM ( P ) = ∅ or all stable mo dels of P satisfy ∃ F . T hen SM ( P ∪ C ) = ∅ if f ∃ F is a skeptical consequence of P . Theor em 5.5 Deciding wheth er a normal finitely recur si ve p rogram P skeptically entails a grou nd for- mula F is r . e.-hard. Pr o of The proof is by redu ction of inconsistency ch ecking for normal finitely recu rsi ve progr ams to the prob lem of s keptical inferen ce of a g round formula from a norm al finitely recu rsi ve progr am. Let P be a norm al finitely recur si ve pro gram and q be a new gr ound atom th at doesn’t occur in P . Then, P is inconsistent iff q is a skeptical con sequence of P . Since q o ccurs in the head of no r ule of P , q canno t occu r in a model of P . So, P skeptically entails q iff P has no stable model. Cor o llary 5.6 Deciding wheth er a disjunctive finitely rec ursi ve program P c redulously entails a grou nd formu la F is co-r .e. com plete. Pr o of The proof follows immediately from Theorems 5.3 and 5.5 and from the fact that a ground formu la F is a credulo us co nsequence of P iff ¬ F is not a skeptical conseque nce of P . On F initely Recursive Pr ograms 17 6 Skeptical resolution for finitely recursi ve normal pr ograms In this section we extend the work in (Bon atti 200 1b ; Bonatti 2004) b y proving that skep- tical resolu tion (a top -do wn calculus which is k no wn to be complete for Datalo g and n or - mal finitary pro grams under the skeptical stab le mo del sema ntics) is com plete also for the class of finitely recursiv e norm al p rograms. Skeptical resolution has se veral interestin g proper ties. F or examp le, it doe s not requir e the inp ut progr am P to be instantiated b efore reasoning (unlike the major state-of- the-art stable m odel reasoners), an d it can pr oduce nongr ound (i.e., un i versally quantified ) an swer substitutio ns. The g oal-directed natu re of skeptical resolution makes it more interesting than the naive algorithms illustrated in Sec- tion 5. W e are not describin g all the for mal details of the calculu s he re—the reader is refer red to (Bonatti 2001b). Sk eptical resolution i s based on goa ls with hypoth eses ( h-goa ls for short) which are pairs ( G | H ) where H and G ar e finite sequences of literals. Rou ghly speakin g, the answer t o a query ( G | H ) shou ld b e yes if G holds in all the stable models that satisfy H . Hence ( G | H ) has th e same m eaning in answer set semantics as the implication ( V G ← V H ) . Finally , a skeptical goal ( s-goal for short) is a finite sequen ce of h-go als. The calculus consists of fi ve inference rules: Resolution. This ru le may take two forms; a literal can b e u nified with either a pro gram rule or a hypothesis. First suppose that L i is an atom, A ← B 1 , . . . , B k is a standardized apart variant of a ru le of P , and θ is the mg u of L i and A . Then the following is an instance of the rule. Γ ( L 1 . . . L i − 1 , L i , L i +1 . . . L n | H ) ∆ [Γ ( L 1 . . . L i − 1 , B 1 , . . . , B k , L i +1 . . . L n | H ) ∆] θ . Next, let L i be a (p ossibly ne gative) literal, let L ′ be a hy pothesis, and let θ be the mgu of L i and L ′ . Then the following is an instan ce of the rule. Γ ( L 1 . . . L i − 1 , L i , L i +1 . . . L n | H , L ′ ) ∆ [Γ ( L 1 . . . L i − 1 , L i +1 . . . L n | H , L ′ ) ∆] θ . Contradiction. This rule tr ies to pr o ve ( G | H ) “vacuously”, by showing th at the hy- potheses H canno t be satisfied by any stable m odel of P . Her eafter ¯ L = not A if L is an atom A , and ¯ L = A if L = not A . Γ ( G | H , L ) ∆ Γ ( ¯ L | H , L ) ∆ . Split. Essentially , this rule is neede d to compute floating conclusions and discover co ntra- dictions. It splits the search sp ace by in troducing two new , comple mentary hypotheses. Let G 0 be the restart goal (i.e. the left-h and side of the first h -goal of the der i v ation), L be an arbitrary literal and σ b e the composition of the mgu s previously computed during the deriv ation; the Split rule is: Γ ( G | H ) ∆ Γ ( G | H , L ) ( G 0 σ | H , ¯ L ) ∆ , Success. This is a structural rule that removes h-go als once th e y have been suc cess fully 18 S. Baselice, P .A. Bonatti, G. Criscuolo proved. As usual, ✷ denotes the empty goal. Γ ( ✷ | H ) ∆ Γ ∆ . W e are left to illustrate the last ru le o f th e ca lculus, that models negation as failure. In order to abstract away the details of the compu tation of failed facts, th e ru le is expressed in terms of so-called counter-supports , that in turn are derived from the standard notion of support . Recall th at a support for a gro und atom A is a set of n e gativ e li terals ob tained by applying SLD resolution to A with respect to the given program P until n o positi ve literal is left in the current goal (the final, negative goal of the SLD deriv ation is a suppor t for A ). Definition 6.1 ( (Bonatti 2001b) ) Let A b e a g round atom. A gr ound counter -support for A in a program P is a set of atoms K with the following properties: 1. For each support S f or A , there exists not B ∈ S such that B ∈ K . 2. For each B ∈ K , ther e exists a support S for A such tha t not B ∈ S . In other words, the first property says that K contrad icts all possible w ays of proving A , while the seco nd prop erty is a sort of relev ance pro perty . Infor mally speaking, the failur e rule o f skeptical resolutio n says tha t if all atoms in a counter-suppo rt are true, then all attempts to prove A fail, and hence no t A can be con cluded. Of course, in g eneral, cou nter -supports are not compu table and may be infinite (wh ile skeptical deriv ations and their goals should be finite). In (Bonatti 2001 b ) the n otion of cou nter -support is g eneralized to no n ground atoms in the following way: Definition 6.2 A (genera lized) counter-support for a gr ound atom A is a pair h K, θ i where K is a set of atoms and θ a substitution, such that f or all gro unding substitutions σ , K σ is a gro und counter-suppor t f or Aθσ . The actu al m echanism for co mputing counter-supports can be abstracted by m eans of a suitable function CounterSupp , mapping each (possibly n onground ) atom A onto a set of finite generalize d co unter-supports for A . The under lying in tuition is that fu nction CounterSupp captures all the negative in ferences that can actually be co mputed by the chosen implementation . Now negation-as-failure can be axiomatized as follows: Failur e. Sup pose that L i = not A , and h{ B 1 , . . . , B k } , θ i ∈ CounterSupp ( A ) . The n the following is an instance of the Failure rule. Γ ( L 1 . . . L i − 1 , L i , L i +1 . . . L n | H ) ∆ [Γ ( L 1 . . . L i − 1 , B 1 , . . . , B k , L i +1 . . . L n | H ) ∆] θ . T o achieve co mpleteness f or the nongr ound skeptical resolution calculus, we need the negation-as-failure mechan ism to be complete in the following sense. Definition 6.3 The fun ction CounterSupp is comp lete if f for each atom A , for all of its grou nd instances Aγ , and for all gro und co unter -suppor ts K for Aγ , there exist h K ′ , θ i ∈ CounterSupp ( A ) and a substitution σ such that Aθ σ = Aγ and K ′ σ = K . On F initely Recursive Pr ograms 19 A skeptical derivation fr om P and CounterSupp with r estart go al G 0 is a (possibly infinite) sequence of s-go als Γ 0 , Γ 1 ,..., where each Γ i +1 is ob tained fr om Γ i throug h one of the fi ve rewrite rules of the calcu lus. A skeptical deri vation is successful if its last s-goal is empty; in this case we say that th e first s-goal has a successful skeptical deriv ation f rom P . Example 6.4 Let P be 1. p ( X ) ← n ot q ( X ) 2. q ( X ) ← not p ( X ) 3. r ( f ( X )) ← not p ( X ) 4. r ( f ( X )) ← not q ( X ) For all ground terms t , the literal not p ( t ) is the unique suppo rt of q ( t ) . Therefo re, we can set CounterSupp ( q ( X )) = {h p ( X ) , ε i} (where ε den otes the empty substitution), since the truth of p ( X ) suffices to block all deriv ations o f q ( X ) , for all possible v alues of X ( the issue of how to compute CounterSupp will be briefly discu ss ed at the end of this section ). The following is a successful deriv ation of ( r ( Y ) | ∅ ) from P with answer substitution [ Y /f ( X )] , showing that for all X , r ( f ( X )) is a skeptical consequence of P . ( r ( Y ) | ∅ ) ( not p ( X ) | ∅ ) by resolution with 3; it binds Y to f ( X ) ; ( not p ( X ) | not p ( X )) ( r ( f ( X )) | p ( X )) by the splitting rule; ( ✷ | no t p ( X )) ( r ( f ( X )) | p ( X )) by resolution with the hypothesis; ( r ( f ( X )) | p ( X )) by the success rule; ( not q ( X ) | p ( X )) by resolution with 4; ( p ( X ) | p ( X )) by the f ailure rule using h p ( X ) , ε i ; ( ✷ | p ( X )) by resolution with the hypothesis; ✷ by the s uccess rule. Skeptical resolutio n is sound for all normal program s and counter-suppo rt calculatio n mechanisms, as stated in the following theor em. Theor em 6.5 ( Soundne s s, (Bon atti 2001 b ) ) Suppose th at an s-go al ( G | H ) has a successful skeptical deriv ation from a no rmal pr o- gram P an d Co unterSupp with restart go al G and answer substitution θ . Then , for all groun ding substitution σ , all th e stab le m odels of P satisfy ( V Gθ ← V H θ ) σ (equiva- lently , ∀ ( V Gθ ← V H θ ) is skeptically entailed by P ). Howe ver , skeptical resolu tion is not alw ays complete. Completeness analy si s is founded on ground skeptical deri v ations, that require a ground version of CounterSupp . Definition 6.6 For all gr ound atoms A , let CounterSupp g ( A ) be the least set such that if h K , θ i ∈ CounterSupp ( A ′ ) and fo r some grou nding σ , A = A ′ θσ , then h K σ , ǫ i ∈ CounterSupp g ( A ) , 20 S. Baselice, P .A. Bonatti, G. Criscuolo where ǫ is the empty substitution . Theor em 6.7 ( F inite Gr ound Completeness, (Bonatti 2001b) ) If s ome ground implication V G ← V H is skeptically entailed by a finite grou nd prog ram P an d CounterSupp is complete with respect to P , then ( G | H ) has a su ccessful skeptical deriv ation from P and CounterSupp g with restart go al G . In particular, if G is skeptically entailed by P , then ( G | ∅ ) has such a derivation. This b asic theo rem an d the following standard lifting lemma allow to pr o ve comp lete- ness for all finitely recursive n ormal pr ograms. Lemma 6.8 ( Lifting, (Bonatti 2001b) ) Let Coun terSupp be comp lete. For all skeptical deriv ations D fro m a norm al prog ram P and CounterSupp g with restart goal G 0 , there exists a substitution σ and a skeptical deriv ation D ′ from P and CounterSupp with restart g oal G ′ 0 and answer substitution θ , such that D = D ′ θσ and G 0 = G ′ 0 θσ . Theor em 6.9 ( Completeness for finitely r ecu r sive normal pr ograms ) Let P be a finitely recur si ve norm al pr ogram. Sup pose CounterSupp is com plete with respect to P and that for so me grou nding substitution γ , ( V G ← V H ) γ hold s in all the stable models of P . T hen ( G | H ) h as a successful skeptical d eri v ation f rom P a nd CounterSupp with restart goa l G and some answer substitution θ more general than γ . Pr o of By The orems 3 .4 an d 5.2, there exists a smooth mo dule sequen ce for P with finite elemen ts P 1 , P 2 , ..., and a finite k such that ( V G ← V H ) γ holds in all the stable mod els of P k . Since each P i is d o wnward closed , the gr ound suppor ts of any given A ∈ atom ( P k ) with respect to prog ram P k coincide with th e ground suppor ts of A with r espect to the entire pro gram P . Co nsequently , also grou nd counter-supports and (gener alized) cou nter - supports, respectively , co incide in P k and P . Th erefore, CounterSupp is c omplete with respect to P k , too . As a con sequence, since P k is a g round, finite program, the groun d completen ess theo rem can be applied to conclude that ( G | H ) γ has a succe s sful skeptical deriv ation from P k and Coun terSupp g with re s tart goal Gγ . The same deriv ation is also a deriv ation from P ( as P k ⊆ Ground ( P ) ) and CounterSupp g . Then, by th e Lifting lemm a (note that P is supposed to be no rmal), ( G | H ) has a successful skeptical deriv ation from P and CounterSupp , with restart goal G and some answer substitution θ , su ch th at ( G | H ) γ is an in st ance of ( G | H ) θ . It follows that θ is m ore gene ral than γ . An impo rtant question is whe ther any com putable, complete function CounterSupp ex- ists. T ake any module sequen ce P 1 , P 2 , . . . , P i , . . . based o n any effecti ve en umeration of GH . Note that for all g round ato ms A on e can effectiv ely find a k ∈ N such that A ∈ atom ( P k ) . Now , if the gi ven pr ogram P is finitely r ecursi ve, then the gro und sup- ports o f A can be com puted by building all the acyclic SLD-derivations f or A u s ing th e finitely many g round rules of P k . Consequen tly , the groun d counter-suppor ts of A are fi- nite and finitely many , too, and can be easily computed from the g round suppo rts o f A . Now conside r a nongr ound atom A . Let Coun terSupp ( A ) be the set of pairs h K, γ i such On F initely Recursive Pr ograms 21 that γ is a gr ounding substitutio n f or A and K is a gro und cou nter -support f or Aγ . Clearly , for any giv en A suc h p airs ca n b e r ecursi vely enume rated by en umerating the gro und in- stances of A , and comp uting for each of the m the co rresponding ground cou nter -supports as explained above. Clearly , this cou nter -support f unction is complete b y con struction. Th is proves that: Theor em 6.10 If P is normal and finitely recursive, then ther e exists a comp lete Co unterSupp function such that for all atoms A , CounterSupp ( A ) is recu rsi vely en umerable. This p roperty allows to recur si vely enumerate all skeptical derivations fro m P . There- fore, skeptical resolution p rovides an alter nati ve p roof that s keptical inference f rom finitely recursive n ormal programs is in r .e . 7 Finitary programs and other decidable fragments The in herent com ple xity of finitely recur si ve p rograms calls for furth er restriction s to make deduction decidable. One of such additional r estrictions is based on the following idea: Suppo se tha t there exists a mod ule sequence P 1 , P 2 , . . . , P i , . . . a nd an index k su ch that for all inter preta- tions I ⊆ atom ( P k ) , the “ top” progra m e atom ( P k ) ( Ground ( P ) \ P k , I ) is consistent. Then the splitting th eorem guarantees that every stable mo del of P k can be extended to a stable model of P and , conversely , ev ery stable m odel of P extends a stable model of P k . As a co nsequence, g i ven a g round g oal G (be it credulou s or skeptical) wh ose ato ms are in- cluded in atom ( P k ) , the answer to G can be co mputed by inspecting only the stable mod els M k, 1 , . . . , M k,n of P k (which is a finite groun d prog ram if P is finitely recursive). Th e “up- per” par t of the stable mo dels of P , that is, th e stable models of e atom ( P k )( Ground ( P ) \ P k , M k,i ) ( 1 ≤ i ≤ n ), need not be comp uted at all—we only need to know that they e xist to be confident that M k, 1 , . . . , M k,n are sufficient to answer G . This is th e idea underly ing finitary p r ograms (Bonatti 200 4 ). For no rmal progr ams, the consistency of the top p rogram is guarantee d by means of a theorem due to Fages (Fages 19 94 ), stating that o r der consistent normal pro grams are alw ays consistent. A no r - mal pro gram is ord er con si stent if ther e exists no infinite sequen ce of (po ssi bly rep eated) atoms h A i i i<ω such that A i depend s both positi vely and negatively on A i +1 for all i < ω . For e xample, all positiv e programs are tr i vially ord er consistent, while Fage’ s prog ram q ( X ) ← q ( f ( X )) q ( X ) ← not q ( f ( X )) exploited in Examp le 3. 10 is not, as well as any normal pro gram whose dependen c y gra ph contains some o dd-cycle. T he above progr am shows th at a progra m may fail to be ord er consistent e ven if the prog ram is acyclic. However , if P is n ormal and fin itely recu rsi v e, then it c an b e shown that P is order consistent iff P is od d-cycle free (Bona tti 2004). This observation justifies the definition of finitary pr ograms (Definition 2.2): By requirin g 22 S. Baselice, P .A. Bonatti, G. Criscuolo finitary pr ograms to h a ve finitely many od d-cycles, it is possible to confine all odd -c ycles into a single, finite pro gram module P k and en sure that th e “top” pr ograms are o dd-cycle free and hence consistent. As proved in (Bonatti 200 4 ), the extra cond ition on odd-cycles suffices to make both credulou s an d skeptical gr ound qu eries de cidable. Howev er , in ( Bonatti 2004) the state- ment erroneo usly fails to include the set o f odd -c yclic literals am ong th e inp uts of the algorithm . Here is the correct stateme nt and a slightly d if ferent proof based on module sequences: Theor em 7.1 Giv en a finitary normal prog ram P and a finite set C containing ( at least) all of the odd- cyclic atoms of P ’ s Her brand base, i) deciding whether a grou nd fo rmula G is a credulous con sequence of P is decidable; ii) deciding whether a groun d formula G is a skeptical consequen ce o f P is decidab le. Pr o of (Sketch) Let P 1 , P 2 , . . . , P i , . . . be any (recu rsi ve) m odule sequence ind uced by a re- cursive enu meration of P ’ s Herb rand b ase, and let k be the min imal index such that C ∪ atom ( G ) ⊆ atom ( P k ) . Clearly , such a k exists and is effecti vely comp utable. More- over , P k is groun d and finite (because P is finitely recursi ve), th erefore the set of its stable models M k, 1 , . . . , M k,n can be effecti vely computed as well, it is fi nite, and consists of fi- nite models. Now , by constru ction, the “top” pr ograms e atom ( P k ) ( Ground ( P ) \ P k , M k,i ) ( 1 ≤ i ≤ n ) are all odd-cycle free—and hence consistent, by F age’ s theorem. It follows b y the splitting theo rem that for all i = 1 , . . . , n , the prog ram P h as a stab le mode l M such that M ∩ atom ( P k ) = M k,i . As a conseq uence, if G is true (resp. false) in a stable model of P k , then G mu st be true (resp . false) in a stable model of P . Conversely , b y the splitting theorem, if G is true (resp . false) in a stable mod el of P , then G must be true (resp . false) in a stable model of P k (because atom ( P k ) splits P ). It f ollo ws easily that G is a credulou s (resp. skeptical) con sequence of P iff G is a c redulous (resp . skeptical) con sequence of P k . Of course, since the set of stable m odels of P k is finite, recursive, and contains o nly finite models, both the credulou s a nd the skeptical consequen ces of P k are decida ble. Extendin g this result to disjunctive pro grams is not a tri vial task because, unfortunately , Fage’ s theorem do es no t scale to disjunctiv e pr ograms in any obviou s way . Consider th e possible natural g eneralization of atom dep endencies fro m th e class of no rmal pro grams to the class of disjunctive progr ams: 1. First assume that the unlabelled ed ges of D G ( P ) are ign ored, that is, let A de pend on B iff th ere is a p ath f rom A to B in D G ( P ) with no unlabe lled edges. This is eq ui v alent to adoptin g a d ependency graph similar to th e trad itional graphs for normal program s, with no head-to- head edg es. Using the resulting notion o f atom depend encies, o ne can find progra ms that are order consistent but have no stable On F initely Recursive Pr ograms 23 models. One of them is p 1 ∨ p 2 q 1 ∨ q 2 p 1 ← not q 1 q 1 ← not p 2 p 2 ← not q 2 q 2 ← not p 1 . 2. Next, suppose th at unlab elled edges are regarded as po siti ve ed ges, that is, A depend s positively (resp . negatively) on B iff there is a path fro m A to B in D G ( P ) with an ev en (resp. odd ) num ber of negative edges. T he above inco nsistent p rogram is still order consistent under this new notio n of depen dency . 3. Finally , assume that unlabelled ed ges are regarded as negative ed ges. This is a natur al assumption giv en the m inimization-based natu re of disjunctive stable models: For instance if P = { p ∨ q } , then the falsity o f p implies the truth of q and viceversa (indeed P is equivalent to { p ← no t q , q ← n ot p } ). A major prob lem is that with this for m of dependen c y , too many interesting disjun cti v e p rograms are not order consistent: • ev ery r ule with at least three atoms in the h ead generates an odd-cycle throu gh those atoms, therefor e th e pro gram would not be order consistent; • for every cycle C co ntaining a h ead-to-body edge ( A, ± , B ) originated by a “prope r” disjunctive rule (i.e., a rule with two o r more atoms in the he ad) there e xists an odd -c ycle (possibly C itself, or the cycle obtained by extending C with a negative ed ge from A to another atom in the same head). This means that disjunctive rules could nev er be applied in any recur si on. Similar pr oblems (precon ditions that are difficult to ensure in practical cases) affect T urner’ s approach to con si stency (T urner 1994). His signed pr ograms genera lize order consistent nor mal pro grams as follows: It should b e p ossible to partition the Herbran d base into two sets H 1 and H 2 such that: 1. negativ e edges always cross the two partitions; positi ve edg es never do; 2. each rule head is entirely contain ed in a single partition; 3. the set of rules whose head is containe d in H 1 is a norma l progra m. Unfortu nately , to th e best of our knowledge no application doma ins naturally require pro - grams satisfyin g the th ird con dition (that roughly speakin g makes the program “h alf no r - mal”). A mo re recent paper (Bon atti 200 2 ) ensures co nsistency thro ugh the theory of pr ogram shifting (Bonatti 1993). A shif ting of P is a modified version of P where some ato ms are moved from heads to bodies and enclosed in the scope of a negation symb ol. This transform ation preserves the classical semantics of the pro gram but no t its stable models. Howe ver , every stable mo del of a shifted pro gram is a ls o a stable mod el o f the orig inal progr am, so the consistency of the former implies th e co nsistency o f the latter . Then the approa ch of (Bon atti 20 02 ) consists in a dding more con ditions to the definition o f finitary 24 S. Baselice, P .A. Bonatti, G. Criscuolo progr ams to ensure that at least one “f ull” shifting of P —transfo rming P into a norma l progr am—is finitary , so th at the original co nsistency theorem by Fages can be applied. The main drawback of this approach is that the extra conditio ns requ ired are clumsy and— again—difficult to use in practice. A very interesting and n o vel recent approach by Eiter and Simkus (Simk us and Eiter 20 07 ) consists in replacing the co nsistenc y p roperty with other prop erties enjoyed by som e d e- cidable fragments of first-ord er logic such as descrip tion logics and the g uarded frag ment. In these f ragments, co nsistent theo ries always have both a finite mod el and a tree mo del which is the “unwindin g” of the finite model, i.e., a regular tree. Syn tactic restriction s on predicate a rity and on th e occurren ces of func tion symbols (mod elled around the skolem- ization of g uarded form ulae) hav e been exploited to prove the d ecidability of a new class of finitely recursi ve pro grams called FDNC programs. In our frame work, this idea roughly correspo nds to having regular modu le sequence s where after some steps the new rules contained in P i \ P i − 1 are isomor phic to some previous program slice P j \ P j − 1 ( j < i ). Therefo re in order to find a stable model of P one needs on ly to find a stable model M fo r some finite mod ule P i , as a mod el for the up per part can th en be con st ructed by cloning M or submo dels thereof. FDNC pr ograms can b e applied to encode on tologies expressed in d escription logics, and ar e suitable to model a wide class of p lanning problems. An in - teresting o pen question is whether this approach ca n be generalized to wider interesting classes of progra ms by stud ying re gular module sequences. 8 Conclusions In this p aper we hav e extensi vely studied th e properties of stable mo del r easoning with disjunctive, finitely recu rsi ve program s —a very expressive formalism for a nswer set pr o- grammin g. Finitely recursive progr ams extend th e class of finitary pr ograms by dropp ing the restrictio ns on odd-cycles, that is, on th e numb er of possible sources of inc onsisten- cies. W e extended to finitely re cursi ve pr ograms m any of the nice properties of finitary progr ams: ( i) a compactness p roperty (The orem 4.5); (ii) the r .e.- completeness of inconsis- tency checkin g and skeptical inferen ce (Theore m 5.4); ( iii) the comp leteness of skeptical resolution (Theor em 6.9); n ote that this r esult applies to norma l program s only , u nlike (i) and (ii). Unfortu nately , some of the nice properties of finitar y pro grams do not ca rry over to finitely recur si ve p rograms: (i) gr ound queries are n ot decidable (Th eorem 5.5 and Coro l- lary 5.6); (ii) nongro und cred ulous que ries are not semidecidable (Corollary 5.6). W e proved ou r results by extendin g the s plitting sequence theo rem that, in general, gu ar - antees o nly that each co nsistent prog ram P has a consistent modu le sequen ce f or P . W e proved that in general th e converse does n ot ho ld (Exa mple 3.10), un less P is finitely r e- cursive: In tha t case, the stable models o f a consistent module seq uence always c on verge to a model of P (Theo rem 4.1). As a side bene fit, o ur techn iques intro duce a normal fo rm for splitting seq uences and their bottom p rograms, whe re seq uence len gth is limited to ω and—if the p rogram is finitely recur si ve—the sequence is smooth ( i.e., the “delta” b etween each n on-limit element and its predec ess or is finite). Such pro perties co nstitute an alternative character ization of finitely recursive pr ograms. The theor y of modu le seq uences is a po werful tool for working On F initely Recursive Pr ograms 25 on decida ble in ference with in finite stable mod els, as it provid es a con structi ve, iterative characterizatio n of the stable mod els of a large class of program s with infinite do mains. In Sectio n 7 we carrie d out a first attempt a t relating different ap proaches u sing module sequences as a unifying fram e w ork. Howe ver su ch an analysis is still v ery pr eliminary a nd partially info rmal; its development constitutes an interesting subject for future work, and it may contribute to recen t areas such as research on FDNC prog rams. Another interesting open prob lem is extend ing to d isjuncti ve prog rams Fage’ s co n- sistency result (an im portant in gredient in several de cidability results). The existing ap- proach es are b ased on rather restrictive assump tions that call for mor e flexible solutions. Finally , an in teresting theo retical question is whether skeptical resolution can be ex- tended to disjunctive programs. A related challeng e is find ing a satisfactory goal-d irected calculus for the positi ve fragment, which i s based on a minimal model semantics. Ackno wledgements This work was partially suppor ted by the PRIN p roject Enhanceme nt and Application s of Disjunctive Logic Pr ogramming , funded by the Italian Ministry of Research (MIUR). References B AR A L , C . 2003. Knowledg e Repr esenta tion, Reasoning and Declara tive Pr oblem Solving . C am- bridge Univ ersity Press, Cambridge. B AS E L I C E , S . , B O N A T T I , P . A . , A N D C R I S C U O L O , G . 2007. On fi n itely recursiv e programs. In ICLP , V . Dahl and I. Niemel ¨ a, Eds. Lecture Notes in C o mputer Sci en ce, vol. 4670. Springer, 89– 103. B O NAT T I , P. 2001a. Prototypes for reasoning wi th infinite stable models and function symbols. In Logic Pro gr amming and Nonmonoton ic Reasoning , 6th International Confer ence , LPNMR 2001 . LNCS, vol. 217 3. Springer , 416–419. B O NAT T I , P. A . 1993. Shift-based semantics: General results and applications. T ech. Rep. CD-TR 93/59, T echnical University of Vien na, Computer Science Department, Institute of Information Systems. B O NAT T I , P . A . 2001b . R eso lution for s keptical stable model semantics. J. Autom. Reasonin g 27, 4, 391–42 1. B O NAT T I , P . A . 2002. Reasoning with infinite stable mod els II: Disjunctiv e programs. In ICLP , P . J. Stucke y, Ed. Lecture Notes in Computer Science, vol. 240 1. Springer , 333–346. B O NAT T I , P . A . 2004. Reasoning with infinite stable models. Artif. Intell. 1 56, 1, 75–111. C A L I M E R I , F., C O Z Z A , S . , I A N N I , G . , A N D L E O N E , N . 2008. Computable functions in ASP : Theory and implementation. In ICLP , M. G. de la Banda and E. Pontelli, E d s. Lecture Notes i n Computer Science, vol. 536 6. Springer , 407–4 24. E I T E R , T., L E O N E , N . , M A T E I S , C . , P F E I F E R , G ., A N D S C A R C E L L O , F . 1 997. A deductiv e system for non-monoto nic reasoning. In L o gic Pr o gr amming and Nonmon otonic Reasoning , 4th Interna- tional Confer enc e, LP NMR’97, Procee dings . LNCS, v ol. 1265. Springer , 364– 375. F AG E S , F. 1994. Consistency of Cl ark ’ s completion and existence of stable models. Methods of Logic in Computer Science 1 , 51–6 0. G E L F O N D , M . A N D L I F S C H I T Z , V . 1988. The stable model semantics for logic program ming. In Pr oc. of the 5th ICLP . MIT Press, 1070– 1080. G E L F O N D , M . A N D L I F S C H I T Z , V . 1991. Classical negation in logic programs and disjunctive databases. New Generation Computing 9, 3-4, 365–38 6. 26 S. Baselice, P .A. Bonatti, G. Criscuolo L I F S C H I T Z , V . A N D T U R N E R , H . 1994. Splitting a logic program. In I n ternational Confer ence on Logic Pr o gr amming . MIT Press, 23–37. L L OY D , J . W . 1984 . F oundations of Logic Pr ogr amming , 1st Edition . Springer . M A R E K , V . A N D R E M M E L , J . 2001. On the ex pressibility of stable logic programming . In L o gic Pr og ramming and Nonmonotonic Reaso ning, 6th International Confer ence, LPNMR 2001 . LNCS, vol. 2173 . Springer , 107–12 0. M A R E K , V . W. A N D T R U S Z C Z Y N S K I , M . 1998. Stable models and an alternative l o gic program- ming paradigm. CoRR cs.L O/98 09032 . N I E M E L ¨ A , I . 1999. Logic programs with stable model semantics as a constraint programming paradigm. A nn . Math. Artif. Intell. 25, 3-4, 241 –273. N I E M E L ¨ A , I . A N D S I M O N S , P . 1997 . S mo dels – an implementation of the stable model and well- founded semantics for normal LP. In Logic P r ogramming and Nonmonotonic Reasoning, 4th International Confer enc e, LP NMR’97, Procee dings . LNCS, vo l. 1265. Springer , 421– 430. S I M K U S , M . A N D E I T E R , T . 2007. FDNC: Decidable non-monoton ic disjunctive logic programs with function symbols. In 14th Int. Conf . on Logic for P r ogrammin g, Artificial I n telligence , and Reasoning , LP AR 2007 . Lecture Notes in Computer Science, vol. 4790. Springer , 5 14–530 . T U R N E R , H . 1994. Si g ned logic programs. In SLP . MIT P ress, 61–75. T U R N E R , H . 1996. Spli tting a default theory . In Pr oce edings of the Thirteenth National Confer ence on Artificial Intelligenc e , H. Shrobe and T . Senator, E ds. AAAI P ress, Menlo Park, California, 645–65 1.

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment