Paraconsistent Modular ASP Paraconsistent Modular Answer Set Programming Thomas Eiter joint with M. Dao-Tran, M. Fink, T. Krennwallner Institut für Informationsysteme, TU Wien 2nd Datalog 2.0 Workshop, Vienna, September 13, 2012 Austrian Science Fund (FWF) grant P20841 Vienna Science and Technology Fund (WWTF) grant ICT08-020. 1/58
Paraconsistent Modular ASP 1. Introduction Needs for Knowledge Representation Wanted: Interlink knowledge sources Cope with heterogeneity Modularization Handle inconsistency, incompleteness Dynamics, openness Issues: Frameworks, formal semantics Algorithms, implementations modular representation inconsistency management T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 2/58
Paraconsistent Modular ASP 1. Introduction 1.1 Modularity in LP Modularity in Logic Programming Goal: Structured programming Gaifman and Shapiro [1989]: module architecture, interaction via input/output interfaces Different directions in general LP [Brogi et al. , 1994]: • Programming in the large: compositional operators to build complex programs • Programming in the small: abstraction and scoping (e.g., macros, templates, . . . ) Issue: Modularity in Nonmonotonic LP • rudimentary tools: Stratified logic programs [Apt et al. , 1988]. Splitting Sets [Lifschitz and Turner, 1994] • more recent interest: module concepts [E_ et al. , 1997b], [Janhunen et al. , 2007], [Dao-Tran et al. , 2009a] T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 3/58
Paraconsistent Modular ASP 1. Introduction 1.2 Paraconsistency Paraconsistent Reasoning Knowledge explosion: A, ¬ A ⊢ B Belnap’s 4-valued logic: bilattice Paraconsistent Logic Programming: [Blair and Subrahmanian, 1989] Answer Set Programming: e.g. [Sakama and Inoue, 1995], [Alcântara et al. 2002,2004], [Arieli, 2002], [Odintsov and Pearce, 2005] T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 4/58
Paraconsistent Modular ASP 1. Introduction 1.2 Paraconsistency Roadmap This talk: modularity and paraconsistency in nonmonotonic LP Focus: Answer Set Semantics, work at KBS • Modular Answer Set Programming (MLP) • Paraconsistent Answer Set Programming (ASP) • Combination of Modular and Paraconsistent ASP • Conclusion T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 5/58
Paraconsistent Modular ASP 2. Modularity in NonMon LP 2.1 Replacement Modular Replacement in NonMon LP Problem: Replacement property (substitution) does not hold If P ≡ P ′ then Q ∪ P ≡ Q ∪ P ′ Counterexample: P = { a ← not b } , P ′ = { a } , Q = { b ← not a } . P and P ′ have the same model (answer set) { a } Q ∪ P ′ has the same model, but Q ∪ P in addition { b } Solution: Notion of strong equivalence [Lifschitz et al. , 2001]: P ≡ s P ′ iff Q ∪ P ≡ Q ∪ P ′ for all programs Q Refined notions (survey [Woltran, 2008]): uniform equivalence (restrict Q to sets of facts), modular equivalence [Oikarinen and Janhunen, 2006], projection equivalence [Oetsch et al. , 2007], . . . Still not fully explored; computational complexity may be high T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 6/58
Paraconsistent Modular ASP 2. Modularity in NonMon LP 2.2 Modular ASP Modular Answer Set Programming Aim: [E_ et al. , 1997b], [Dao-Tran et al. , 2009a] Provide module (“procedure”) concept as in ordinary programming realize libraries, code reuse establish call by value mechanism allow the use of recursive calls T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 7/58
Paraconsistent Modular ASP 2. Modularity in NonMon LP 2.2 Modular ASP Program Modules Conventional programming: Nonmonotonic LP: Definition: Definition: proc p(x, y: int): int Module m = ( P [ q 1 , q 2 ] , R ) , begin ... where a := ... • P is a module name return a • q 1 , q 2 are predicate names end p; • R is a set of rules Use: p ( X ) ← P [ r, s ] .a Use: x := p ( y, z ) ; Modular Logic Programs A modular (nonmon.) logic program (MLP) P = ( m 1 , . . . , m n ) , consists of modules m i = ( P i [ � q i ] , R i ) where at least one m i has void � q i (=main). Rule bodies may contain module atoms P [ p 1 , . . . , p k ] .o ( t 1 , . . . , t l ) , where p 1 , . . . , p k are predicate names and o ( t 1 , . . . , t l ) is an ordinary atom. T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 8/58
Paraconsistent Modular ASP 2. Modularity in NonMon LP 2.2 Modular ASP Semantics [E_ et al. , 1997b]: view modules as generalized quantifiers : access a module P 2 from module P 1 by module atoms of the form P 2 [ � p ] .q ( X ) , using the extension of � p as input from P 1 . For an MLP P as above, answer sets were defined using a generalization of the GL-reduct [Gelfond and Lifschitz, 1991]. Drawbacks Calls of modules must be acyclic (similar in other approaches). Lack of groundedness (minimality). Handling multiple models of called modules difficult. T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 9/58
Paraconsistent Modular ASP 2. Modularity in NonMon LP 2.2 Modular ASP Example: Odd/Even Canonical example of mutual recursion in LP even (0) ← . even ( f ( X )) ← odd ( X ) . odd ( f ( X )) ← even ( X ) . Datalog version: Given unary relation q , decide whether | q | is even. Not expressible in plain datalog, nor in monadic ASP, but with an ordering (successor) on q using recursion Use choice in a recursive module: P [ q ] : q ′ ( X ) ← q ( X ) , rem ( Y ) , X � = Y . rem ( X ) ← q ( X ) , not q ′ ( X ) . odd ← rem ( X ) , P [ q ′ ] . even . even ← not odd . T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 10/58
Paraconsistent Modular ASP 2. Modularity in NonMon LP 2.2 Modular ASP Example: Order Similar: generate an ordering (successor) P ord [ q/ 1] : define relations succ , first , last q ′ ( X ) ∨ q ′ ( Y ) ← q ( X ) , q ( Y ) , X � = Y. rem ( X ) ← q ( X ) , not q ′ ( X ) . first ( X ) ← rem ( X ) . succ ( X, Y ) ← first ( X ) , P ord [ q ′ ] . first ( Y ) . succ ( X, Y ) ← P ord [ q ′ ] . succ ( X, Y ) . n _ last ( X ) ← succ ( X, Y ) . last ( X ) ← q ( X ) , not n _ last ( X ) . No guess on binary predicates Answer sets correspond to orderings T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 11/58
Paraconsistent Modular ASP 2. Modularity in NonMon LP 2.2 Modular ASP Example: Positive Loop Consider P = ( m 1 , m 2 ) , where m 1 = ( P 1 [] , R 1 ) , with R 1 = { a ← P 2 [ ] .b } m 2 = ( P 2 [] , R 2 ) ,with R 2 = { b ← P 1 [ ] .a } Thus, has a loop via positive mutual calls. Desired semantics: an “empty” model • Neither a in P 1 nor b in P 2 should be true. Proposals like DLP functions [Janhunen et al. , 2007] exclude positive recursion. Yet useful e.g. for modular embedding of nonmonotonic dl-programs into datalog (cf. [E_ et al. , 2012]) T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 12/58
Paraconsistent Modular ASP 2. Modularity in NonMon LP 2.2 Modular ASP Syntax of MLPs Datalog language (function-free first order) Module names P , each with a fixed associated list � q = q 1 , . . . , q k ( k ≥ 0 ) of predicates q i (the formal input parameters ). Atoms: • Ordinary atoms: o ( t 1 , . . . , t ℓ ) • Module atoms P [ p 1 , . . . , p k ] .o ( t 1 , . . . , t ℓ ) p 1 , . . . , p k are predicates matching q 1 , . . . , q k ( call input parameters ) α 1 ∨ · · · ∨ α k ← β 1 , . . . , β j , not β j +1 , . . . , not β m , k ≥ 1 Rules: where the α i are ordinary atoms, the β j are atoms Module: m = ( P [ � q ] , R ) , where R is finite set of rules q ] R P [ � Modular Nonmonotonic Logic Program: P = ( m 1 , . . . , m n ) T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 13/58
Paraconsistent Modular ASP 2. Modularity in NonMon LP 2.2 Modular ASP Odd/Even: Mutual Recursion main () : P = ( m 1 , m 2 , m 3 ) , where m 1 = ( P 1 , R 1 ) , m 2 = ( P 2 [ q 2 ] , R 2 ) , m 3 = ( P 3 [ q 3 ] , R 3 ) . n := | q | ; if even ( n ) then return ok ; R 1 = { q ( a ) . q ( b ) . ok ← P 2 [ q ] . even 2 . } even ( n ) : q ′ 2 ( X ) ∨ q ′ 2 ( Y ) ← q 2 ( X ) , q 2 ( Y ) , n ′ := n − 1 ; X � = Y. if n ′ < 0 then return true ; q 2 ( X ) , not q ′ rem 2 ← 2 ( X ) . R 2 = if n ′ = 0 then return false ; ← not rem 2 . even 2 if odd ( n ′ ) then return true ; rem 2 , P 3 [ q ′ ← 2 ] . odd . even 2 else return false ; odd ( n ) : q ′ 3 ( X ) ∨ q ′ 3 ( Y ) ← q 3 ( X ) , q 3 ( Y ) , X � = Y. n ′ := n − 1 ; R 3 = ← q 3 ( X ) , not q ′ rem 3 3 ( X ) . if even ( n ′ ) then return true ; ← rem 3 , P 2 [ q ′ odd 3 ] . even 2 . else return false ; T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 14/58
Paraconsistent Modular ASP 2. Modularity in NonMon LP 2.2 Modular ASP Semantics of MLPs Defined by grounding as usual, over the constants (Herbrand universe) of an MLP P . For a rule, set of rules, module, MLP X let gr ( X ) denote the grounding of X . In the sequel, we assume grounded modules / MLPs The Herbrand base of P , HB P , consists of all ground atoms An interpretation of a (ground) rule set R is a subset M ⊆ HB P containing only ordinary atoms. To interpret a (ground) module m = ( P [ � q, R ]) , we need to consider its instantiations T. Eiter / TU Wien Datalog 2.0 12, 13.09.2012 15/58
Recommend
More recommend