hex programs with existential quantification
play

HEX-Programs with Existential Quantification Thomas Eiter, Michael - PowerPoint PPT Presentation

HEX-Programs with Existential Quantification Thomas Eiter, Michael Fink, Thomas Krennwallner, Christoph Redl { eiter,fink,tkren,redl } @kr.tuwien.ac.at September 13, 2013 Redl C. (TU Vienna) HEX-Programs September 13, 2013 1 / 18 Motivation


  1. HEX-Programs with Existential Quantification Thomas Eiter, Michael Fink, Thomas Krennwallner, Christoph Redl { eiter,fink,tkren,redl } @kr.tuwien.ac.at September 13, 2013 Redl C. (TU Vienna) HEX-Programs September 13, 2013 1 / 18

  2. Motivation HEX-Programs Extend ASP by external sources Traditional safety not sufficient due to value invention Notion of liberal domain-expansion safety guarantees finite groundability Example � � r 1 : t ( a ) . r 3 : s ( Y ) ← t ( X ) , & cat [ X , a ]( Y ) . Π= r 2 : dom ( aa ) . r 4 : t ( X ) ← s ( X ) , dom ( X ) . Contribution Domain-specific existential quantification in rule heads Grounding algorithm extended by application-specific termination hooks Instances: model computation over acyclic programs, query answering over programs with logical existential quantifier, function symbols Redl C. (TU Vienna) HEX-Programs September 13, 2013 2 / 18

  3. HEX-Programs HEX-programs extend ordinary ASP programs by external sources Definition (HEX-programs) A HEX-program consists of rules of form a 1 ∨ · · · ∨ a n ← b 1 , . . . , b m , not b m + 1 , . . . , not b n , with classical literals a i , and classical literals or an external atoms b j . Definition (External Atoms) An external atom is of the form & p [ q 1 , . . . , q k ]( t 1 , . . . , t l ) , p . . . external predicate name q i . . . predicate names or constants HEX- t j . . . terms Reasoner program Semantics: 1 + k + l -ary Boolean oracle function f & p : Implementation p [ q 1 , . . . , q k ]( t 1 , . . . , t l ) is true under assignment A & of & p iff f & p ( A , q 1 , . . . , q k , t 1 , . . . , t l ) = 1 . Redl C. (TU Vienna) HEX-Programs September 13, 2013 3 / 18

  4. Domain-specific Existential Quantification Idea Introduce new values which may appear in answer sets Structure of these values matters Introduction may be subject to constraints outside the program Realization: Use value invention in rule body, transfer new values to the head Example iban ( B , I ) ← country ( B , C ) , bank ( B , N ) , & iban [ C , N , B ]( I ) . Example lifetime ( M , L ) ← machine ( M , C ) , & lifetime [ M , C ]( L ) . Redl C. (TU Vienna) HEX-Programs September 13, 2013 4 / 18

  5. Existential Quantification We will now discuss 3 instances of our approach: Model-building over acyclic HEX ∃ -Programs Query Answering over positive HEX ∃ -Programs Function Symbols Redl C. (TU Vienna) HEX-Programs September 13, 2013 5 / 18

  6. Algorithm BGroundHEX Input : A HEX-program Π Output : A ground HEX-program Π g g [ � Y ]( � X ) Π p = Π ∪ { r & g [ � Y ]( � | & X ) in r ∈ Π } inp g [ � Y ]( � Y ( � X ) in all rules r in Π p by e r , & X ) Replace all external atoms & g � while Repeat() do PIT ← ∅ NewInputTuples ← ∅ repeat Π pg ← GroundASP (Π p ) g [ � Y ]( � for & X ) in a rule r ∈ Π do c ) ∈ A (Π pg ) , p ∈ � c ) ∈ A (Π pg ) , p ∈ � A ma = { T p ( � c ) | a ( � Y m } ∪ { F p ( � c ) | a ( � Y a } c ) ∈ A (Π pg ) , p ∈ � Y n } s.t. ∄ a : T a , F a ∈ A nm do for A nm ⊆ { T p ( � c ) , F p ( � c ) | p ( � A = ( A ma ∪ A nm ∪ { T a | a ←∈ Π pg } ) \ { F a | a ←∈ Π pg } g [ � Y ]( � g [ � Y ]( � c | r & X ) c ) ∈ A (Π pg ) s . t . Evaluate ( r & X ) for � y ∈ { � ( � ( � c )) = true } do inp inp Let O = { � x | f & g ( A ,� x ) = 1 } y ,� Π p ← Π p ∪ { e r , & x ) ∨ ne r , & x ) ←| � x ∈ O } y ] ( � y ] ( � g [ g [ � � g [ � Y ]( � X ) NewInputTuples ← NewInputTuples ∪ { r & y ) } ( � inp PIT ← PIT ∪ NewInputTuples until Π pg did not change Remove input auxiliary rules and external atom guessing rules from Π pg Replace all e & y ] ( � x ) in Π pg by & g [ � y ]( � x ) g [ � return Π pg Redl C. (TU Vienna) HEX-Programs September 13, 2013 6 / 18

  7. Model-building over Acyclic HEX ∃ -Programs Definition A HEX ∃ -program is a finite set of rules of form X ′ ∪ � Y : atom [ � ∀ � X ∃ � Y ] ← conj [ � X ] , (1) X ′ ⊆ � where � X and � Y are disjoint sets of variables, � X , atom [ � X ] . Definition For HEX ∃ -program Π let T ∃ (Π) be the HEX-program where each X ′ ∪ � r = ∃ � Y : atom [ � Y ] ← conj [ � X ] is replaced by X ′ ∪ � exists | ˜ X ′ | , | ˜ atom [ � Y ] ← conj [ � Y | [ r , � X ′ ]( � X ] , & Y ) , where f & exists n , m ( A , r ,� x ,� y ) = 1 iff � y = φ 1 , . . . , φ m is a vector of fresh and unique null values for r ,� x and do not appear in Π , and f & exists n , m ( A , r ,� x ,� y ) = 0 otherwise. Redl C. (TU Vienna) HEX-Programs September 13, 2013 7 / 18

  8. Model-building over Acyclic HEX ∃ -Programs Example Program Π : employee ( john ) . employee ( joe ) . r 1 : ∃ Y : office ( X , Y ) ← employee ( X ) . r 2 : room ( Y ) ← office ( X , Y ) Program T ∃ (Π) : employee ( john ) . employee ( joe ) . r ′ exists 1 , 1 [ r 1 , X ]( Y ) . office ( X , Y ) ← employee ( X ) , & 1 : room ( Y ) ← office ( X , Y ) r 2 : The unique answer set of T ∃ (Π) is { employee ( john ) , employee ( joe ) , office ( john , φ 1 ) , office ( joe , φ 2 ) , room ( φ 1 ) , room ( φ 2 ) } . Redl C. (TU Vienna) HEX-Programs September 13, 2013 8 / 18

  9. Model-building over Acyclic HEX ∃ -Programs For de-safe programs we do not need the hooks, thus let GroundDESafeHEX be the instantiation of BGroundHEX where Repeat repeats exactly once Evaluate return always true Then: Proposition For de-safe programs Π , AS ( GroundDESafeHEX (Π)) ≡ pos AS (Π g ) . Redl C. (TU Vienna) HEX-Programs September 13, 2013 9 / 18

  10. Query Answering over Positive HEX ∃ -Programs Definition X ′ ∪ � A Datalog ∃ -program is a finite set of rules of form ∀ � X ∃ � Y : atom [ � Y ] ← conj [ � X ] X ′ ⊆ � where � X and � Y are disjoint sets of variables, � X . Disallowed: default negation, general external atoms. Definition A homomorphism is a mapping h : N ∪ V → C ∪ V . A homomorphism h is called substitution if h ( N ) = N for all N ∈ N . Definition Model of a program: set of atoms M s.t. whenever there is a substitution h with h ( B ( r )) ⊆ M for some r ∈ Π , then h | � X ( H ( r )) is substitutive to some atom in M . Definition A conjunctive query q is of form ∃ � Y : ← conj [ � X ∪ � Y ] with free variables � X . Redl C. (TU Vienna) HEX-Programs September 13, 2013 10 / 18

  11. Query Answering over Positive HEX ∃ -Programs Answer of a CQ q with free variables � X wrt. model M : ans ( q , M ) = { h | � X | h is a substitution and h | � X ( q ) is substitutive to some a ∈ M } Answer of a CQ q wrt. a program Π : ans ( q , Π) = { h | h ∈ ans ( q , M ) ∀ M ∈ mods (Π) } Redl C. (TU Vienna) HEX-Programs September 13, 2013 11 / 18

  12. Query Answering over Positive HEX ∃ -Programs Answer of a CQ q with free variables � X wrt. model M : ans ( q , M ) = { h | � X | h is a substitution and h | � X ( q ) is substitutive to some a ∈ M } Answer of a CQ q wrt. a program Π : ans ( q , Π) = { h | h ∈ ans ( q , M ) ∀ M ∈ mods (Π) } Definition Model U of a program Π is universal if, for each M ∈ mods (Π) , there is a homomorphism h s.t. h ( U ) ⊆ M . Proposition Let U be a universal model of Datalog ∃ -program Π . Then for each CQ q , h ∈ ans ( q , Π) iff h ∈ ans ( q , U ) and h : V → C \ N . Redl C. (TU Vienna) HEX-Programs September 13, 2013 11 / 18

  13. Query Answering over Positive HEX ∃ -Programs Answer of a CQ q with free variables � X wrt. model M : ans ( q , M ) = { h | � X | h is a substitution and h | � X ( q ) is substitutive to some a ∈ M } Answer of a CQ q wrt. a program Π : ans ( q , Π) = { h | h ∈ ans ( q , M ) ∀ M ∈ mods (Π) } Definition Model U of a program Π is universal if, for each M ∈ mods (Π) , there is a homomorphism h s.t. h ( U ) ⊆ M . Proposition Let U be a universal model of Datalog ∃ -program Π . Then for each CQ q , h ∈ ans ( q , Π) iff h ∈ ans ( q , U ) and h : V → C \ N . ⇒ Key issue: Computing (finite subsets of) a universal model Redl C. (TU Vienna) HEX-Programs September 13, 2013 11 / 18

  14. Query Answering over Positive HEX ∃ -Programs Example Let Π be the following Datalog ∃ -program: person ( john ) . person ( joe ) . r 1 : ∃ Y : father ( X , Y ) ← person ( X ) . r 2 : person ( Y ) ← father ( X , Y ) . Then T ∃ (Π) is the following program: person ( john ) . person ( joe ) . r ′ exists 1 , 1 [ r 1 , X ]( Y ) . 1 : father ( X , Y ) ← person ( X ) , & r 2 : person ( Y ) ← father ( X , Y ) . Redl C. (TU Vienna) HEX-Programs September 13, 2013 12 / 18

Recommend


More recommend