Complexit y of nonrecursiv e logic programs with complex v alues Sergei V orob y o v Andrei V oronk o v MPI f ur � Informatik Uppsala Univ ersit y Saarbr uc � k en Uppsala German y Sw eden 1 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Ov erview Query languages and complexit y; I Complex v alues; I Nonrecursiv e logic programming; I T erm algebras; I Results; I T ec hniques. I 2 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Query languages and complexit y Examples of query languages: Relational algebra; I First-order logic; I Logic programming. I T yp es of complexit y: 1. Complexit y (what resources do es it tak e to ev aluate a query); 2. Expressiv e p o w er (what functions can w e express). 3 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Complex v alues An ything whic h is di�eren t from tuples of simple, atomic ob jects, e.g., Em b edded tuples; I Lists; I T rees; I Finite sets; I Finite m ultisets; I Images; I V oices; I HTML pages. I 4 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Complex v alues in logic programming In logic programming v alues dep end on the signature used: F unction-free signatures represen t tuples; I Signatures with unary function sym b ols I represen t lists: the term f ( g ( h ( a ))) represen ts the list [ f a ]. ; g ; Signatures with binary function sym b ols I represen t trees. Other complex v alues ma y b e represen ted b y I using non-free constructors (e.g., set constructor), and c hanging equalit y in terpretation (uni�cation), or b y using constrain ts. 5 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Logic programs A logic program is a �nite set of clauses, i.e., form ulas L ^ : : : ^ L � A; 1 n where n 0, A is an atom and L are literals. � i Another notation for clauses: A L ; : : : ; L : 1 n Nonrecursiv e logic programs: the predicates are . If the head con tains , then the P ; : : : ; P P 1 m i b o dy can only use . P ; : : : ; P 1 i � 1 6 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Sources of expressiv e p o w er Complex v alues, e.g., trees v ersus lists: I ( f ( x; x ) ) Q ( x ) : P Negation: I ( x ) Q ( x ) ; ( x ) : P : R (Absence of ) range restriction: I P ( f ( x ) ; x ) : 7 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Seman tics F or recursiv e programs there is no generally accepted seman tics (due to nonmonotone recursion). F or nonrecursiv e ones view a program as a set of explicit de�nitions of predicates, using Clark's completion. F or example, ( x; ( x )) ( x; ) P f P y 3 1 ( x; ( z )) ( x; ) ; ( a; ) P g P y P z 3 2 2 denotes the explicit de�nition ( x; u ) P � 3 ( y = ( x ) ( x; )) _ 9 y f ^ P y 1 9 y 9 z ( u = g ( z ) P ( x; y ) P ( a; z )) : ^ ^ 2 2 Ev en tually , ev ery predicate ma y b e view ed as explicitly de�ned in terms of equalit y =. 8 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
T erm algebra Explicit de�nitions o v er what? T erm algebra of a signature � , denoted T A (�) : 1. the domain is the set of all ground terms of �; 2. ev ery term is in terpreted b y itself. The p erfect mo del of a logic program L : the mo del induced b y the explicit de�nitions. Note: language-dep enden t in general, language-indep enden t for range-restricted programs. 9 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
The SUCCESS problem SUCCESS(�): sev eral equiv alen t reform ulations: 1. Giv en a logic program L and a predicate P , is nonempt y in the p erfect mo del of L ? P 2. Giv en a logic program and n ullary predicate suc c ess , is true in the p erfect mo del success of L ? 3. The com bined complexit y. 4. The program complexit y. 10 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Results function sym b ols no unary an y not range-restricted no negation PSP A CE NEXP NEXP ( n ) O with negation PSP A CE LA TIME (2 ) NONELEM (n) range-restricted no negation PSP A CE PSP A CE NEXP O ( n ) with negation PSP A CE PSP A CE LA TIME (2 ) 11 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Complexit y classes ( n ) O LA TIME (2 ) is the class of problems solv able b y alternating T uring mac hines running in time ( n ) O 2 with a linear n um b er of alternations. ( n ) ( n ) ( n ) O O O NTIME (2 ) TIME (2 ) CE (2 ) : � � LA DSP A e ( n ) = n; 0 ( n ) e ( n ) = 2 e ; k k +1 ( n ) = (0) : e e n 1 NONELEM ( f ( n )) is the class of problems with lo w er and upp er b ounds of the form e ( f ( cn )) 1 and ( f ( dn )). e 1 12 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
function sym b ols no unary an y not range-restricted no negation PSP A CE NEXP NEXP ( n ) O with negation TIME (2 ) NONELEM ( n ) PSP A CE LA range-restricted no negation PSP A CE PSP A CE NEXP ( n ) O with negation PSP A CE PSP A CE LA TIME (2 ) S | folklore; S | using complexit y of term algebras; S | upp er b ound b y constrain t SLD-resolution, lo w er b y di�erence lists; S | upp er b ound b y constrain t SLD-resolution, lo w er b ound b y tiling; S | upp er b ound b y guessing terms of restricted depth, lo w er trivial; S | upp er b ound b y guessing terms of restricted depth, lo w er using the theory of t w o sucessor functions; 13 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
T erm algebra and nonrecursiv e logic programs h ( T A (�)) is p olynomial-time Theorem 1 T e quivalent to SUCCESS (�) . SUCCESS(�) is PSP A CE -complete for I function-free � (Sto c kmey er and Mey er, 1973); ( n ) O SUCCESS(�) is LA TIME (2 )-complete for I monadic � (F erran te and Rac k o�, 1979; V olger 1983); SUCCESS(�) is in NONELEM ( n ) for � with I binary sym b ols (upp er b ound b y quan ti�er elimination Malcev, 1961, lo w er b ound in V orob y o v, 1996). 14 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Upp er b ounds without negation (Dantsin, V or onkov, 1997) If Theorem 2 uni�c ation over a domain is solvable in D nondeterministic p olynomial time, then the SUCCESS pr oblem for lo gic pr o gr ams without ne gation over is in NEXP. D Pro of b y using constrain t SLD-resolution: clauses lik e P ( f ( x; y )) P ( x ) ; P ( y ) n � 1 n � 1 n giv e exp onen tially long branc hes, but at the end w e solv e exp onen tially long sets of equations b y using the nondeterministic uni�cation algorithm. 15 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Upp er b ounds with range restriction ( f ( x; )) ( x ) ; ( y ) P y P P n � 1 n � 1 n F or P to b e true on terms of depth k + 1, P n n � 1 m ust b e true on terms of depth : term depth k gro ws slo wly. 16 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Lo w er b ounds without negation The Tiling Problem: can w e co v er b y tiles the n n square of size 2 2 b y tiles from a giv en �nite � set, suc h that some conditions on adjacen t tiles are held? Represen t tilings b y terms: the term [ t ; t ; t ; t ] 1 2 3 4 represen ts the tiling t t 1 2 t t 3 4 17 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Lo w er b ounds without negation (con t.) n +1 2 tiles z }| { { X X Y Y 1 2 1 2 tiles X X Y Y 3 4 3 4 }| n +1 Z Z U U 1 2 1 2 2 Z Z U U 3 4 3 4 z X X X Y Y Y 1 2 2 1 1 2 X X X Y Y Y 3 4 4 3 3 4 X X X Y Y Y 3 4 4 3 3 4 Z Z Z U U U 1 2 2 1 1 2 Z Z Z U U U 1 2 2 1 1 2 Z Z Z U U U 3 4 4 3 3 4 18 S.V orob y o v, A.V oronk o v. Complexit y of nonrecursiv e . . .
Recommend
More recommend