Liberal Safety for Answer Set Programs with External Sources Thomas Eiter, Michael Fink, Thomas Krennwallner, Christoph Redl { eiter,fink,tkren,redl } @kr.tuwien.ac.at July 16, 2013 Redl C. (TU Vienna) HEX-Programs July 16, 2013 1 / 10
Motivation HEX-Programs Extend ASP by external sources Traditional safety not sufficient due to value invention Current notion of strong safety is unnecessarily restrictive 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 New more liberal safety criteria Still guarantee finite groundability Based on a modular framework ⇒ extensibility of the approach Redl C. (TU Vienna) HEX-Programs July 16, 2013 2 / 10
Liberal Safety: Basic Concepts Monotone Grounding Operator G Π (Π ′ ) = � r ∈ Π { r θ | A ⊆ A (Π ′ ) , A �| = B + ( r θ ) } , = ⊥ , A | where A (Π ′ ) = { T a , F a | a ∈ A (Π ′ ) } \ { F a | a ← . ∈ Π } and r θ is the instance of r under variable substitution θ : V → C . Example Program Π : r 1 : s ( a ) . r 2 : dom ( ax ) . r 3 : dom ( axx ) . r 4 : s ( Y ) ← s ( X ) , & cat [ X , x ]( Y ) , dom ( Y ) . Least fixpoint of G Π : r ′ r ′ r ′ 1 : s ( a ) . 2 : dom ( ax ) . 3 : dom ( axx ) . Redl C. (TU Vienna) HEX-Programs July 16, 2013 3 / 10
Liberal Safety: Basic Concepts Monotone Grounding Operator G Π (Π ′ ) = � r ∈ Π { r θ | A ⊆ A (Π ′ ) , A �| = B + ( r θ ) } , = ⊥ , A | where A (Π ′ ) = { T a , F a | a ∈ A (Π ′ ) } \ { F a | a ← . ∈ Π } and r θ is the instance of r under variable substitution θ : V → C . Example Program Π : r 1 : s ( a ) . r 2 : dom ( ax ) . r 3 : dom ( axx ) . r 4 : s ( Y ) ← s ( X ) , & cat [ X , x ]( Y ) , dom ( Y ) . Least fixpoint of G Π : r ′ r ′ r ′ 1 : s ( a ) . 2 : dom ( ax ) . 3 : dom ( axx ) . r ′ 4 : s ( ax ) ← s ( a ) , & cat [ a , x ]( ax ) , dom ( ax ) . Redl C. (TU Vienna) HEX-Programs July 16, 2013 3 / 10
Liberal Safety: Basic Concepts Monotone Grounding Operator G Π (Π ′ ) = � r ∈ Π { r θ | A ⊆ A (Π ′ ) , A �| = B + ( r θ ) } , = ⊥ , A | where A (Π ′ ) = { T a , F a | a ∈ A (Π ′ ) } \ { F a | a ← . ∈ Π } and r θ is the instance of r under variable substitution θ : V → C . Example Program Π : r 1 : s ( a ) . r 2 : dom ( ax ) . r 3 : dom ( axx ) . r 4 : s ( Y ) ← s ( X ) , & cat [ X , x ]( Y ) , dom ( Y ) . Least fixpoint of G Π : r ′ r ′ r ′ 1 : s ( a ) . 2 : dom ( ax ) . 3 : dom ( axx ) . r ′ 4 : s ( ax ) ← s ( a ) , & cat [ a , x ]( ax ) , dom ( ax ) . r ′ 5 : s ( axx ) ← s ( ax ) , & cat [ ax , x ]( axx ) , dom ( axx ) . Redl C. (TU Vienna) HEX-Programs July 16, 2013 3 / 10
Liberal Safety: Basic Concepts Monotone Grounding Operator G Π (Π ′ ) = � r ∈ Π { r θ | A ⊆ A (Π ′ ) , A �| = B + ( r θ ) } , = ⊥ , A | where A (Π ′ ) = { T a , F a | a ∈ A (Π ′ ) } \ { F a | a ← . ∈ Π } and r θ is the instance of r under variable substitution θ : V → C . Example Program Π : r 1 : s ( a ) . r 2 : dom ( ax ) . r 3 : dom ( axx ) . r 4 : s ( Y ) ← s ( X ) , & cat [ X , x ]( Y ) , dom ( Y ) . Least fixpoint of G Π : r ′ r ′ r ′ 1 : s ( a ) . 2 : dom ( ax ) . 3 : dom ( axx ) . r ′ 4 : s ( ax ) ← s ( a ) , & cat [ a , x ]( ax ) , dom ( ax ) . r ′ 5 : s ( axx ) ← s ( ax ) , & cat [ ax , x ]( axx ) , dom ( axx ) . Intuition: We call a program safe if this operator produces a finite grounding Redl C. (TU Vienna) HEX-Programs July 16, 2013 3 / 10
Liberal Safety Two concepts A term is bounded if G Π (Π ′ ) contains only finitely many substitutions for it An attribute is de-safe if G Π (Π ′ ) contains only finitely many values at this attribute position Idea 1 Start with empty set of bounded terms B 0 and de-safe attributes S 0 2 For all n ≥ 0 until B n and S n do not change anymore a Identify additional bounded terms ⇒ B n + 1 (assuming that B n are bounded and S n are de-safe) b Identify additional de-safe attributes ⇒ S n + 1 (assuming that B n + 1 are bounded and S n are de-safe) Redl C. (TU Vienna) HEX-Programs July 16, 2013 4 / 10
Liberal Safety Two concepts A term is bounded if G Π (Π ′ ) contains only finitely many substitutions for it An attribute is de-safe if G Π (Π ′ ) contains only finitely many values at this attribute position Idea 1 Start with empty set of bounded terms B 0 and de-safe attributes S 0 2 For all n ≥ 0 until B n and S n do not change anymore a Identify additional bounded terms ⇒ B n + 1 (assuming that B n are bounded and S n are de-safe) b Identify additional de-safe attributes ⇒ S n + 1 (assuming that B n + 1 are bounded and S n are de-safe) Identification of bounded terms in Step 2a by term bounding functions (TBFs) Concrete safety criteria can be plugged in by specific TBF b (Π , r , S , B ) Redl C. (TU Vienna) HEX-Programs July 16, 2013 4 / 10
Liberal Safety Two concepts A term is bounded if G Π (Π ′ ) contains only finitely many substitutions for it An attribute is de-safe if G Π (Π ′ ) contains only finitely many values at this attribute position Idea 1 Start with empty set of bounded terms B 0 and de-safe attributes S 0 2 For all n ≥ 0 until B n and S n do not change anymore a Identify additional bounded terms ⇒ B n + 1 (assuming that B n are bounded and S n are de-safe) b Identify additional de-safe attributes ⇒ S n + 1 (assuming that B n + 1 are bounded and S n are de-safe) Identification of bounded terms in Step 2a by term bounding functions (TBFs) Concrete safety criteria can be plugged in by specific TBF b (Π , r , S , B ) ⇒ TBFs are a flexible means that however must fulfill certain conditions Redl C. (TU Vienna) HEX-Programs July 16, 2013 4 / 10
Liberal Safety: Concrete TBF Definition (Syntactic Term Bounding Function) t ∈ b syn (Π , r , S , B ) iff (i) t is a constant in r ; or (ii) there is an ordinary atom q ( s 1 , . . . , s ar ( q ) ) ∈ B + ( r ) s.t. t = s j , for some 1 ≤ j ≤ ar ( q ) and q ↾ j ∈ S ; or g [ � X ]( � Y ) ∈ B + ( r ) , we have that t = Y i for some (iii) for some external atom & Y i ∈ � Y , and for each X i ∈ � X , � X i ∈ B , if τ ( & g , i ) = const , X i ↾ 1 , . . . , X i ↾ ar ( X i ) ∈ S , if τ ( & g , i ) = pred . Redl C. (TU Vienna) HEX-Programs July 16, 2013 5 / 10
Liberal Safety: Concrete TBF Example Program Π : r 1 : s ( a ) . r 2 : dom ( ax ) . r 3 : dom ( axx ) . r 4 : s ( Y ) ← s ( X ) , & cat [ X , x ]( Y ) , dom ( Y ) . B 1 ( r 2 , Π , b syn ) = { ax } , B 1 ( r 3 , Π , b syn ) = { axx } , B 1 ( r 4 , Π , b syn ) = { x } Redl C. (TU Vienna) HEX-Programs July 16, 2013 6 / 10
Liberal Safety: Concrete TBF Example Program Π : r 1 : s ( a ) . r 2 : dom ( ax ) . r 3 : dom ( axx ) . r 4 : s ( Y ) ← s ( X ) , & cat [ X , x ]( Y ) , dom ( Y ) . B 1 ( r 2 , Π , b syn ) = { ax } , B 1 ( r 3 , Π , b syn ) = { axx } , B 1 ( r 4 , Π , b syn ) = { x } ⇒ S 1 (Π) = { dom ↾ 1 , & cat [ X , x ] r 4 ↾ I 2 } Redl C. (TU Vienna) HEX-Programs July 16, 2013 6 / 10
Liberal Safety: Concrete TBF Example Program Π : r 1 : s ( a ) . r 2 : dom ( ax ) . r 3 : dom ( axx ) . r 4 : s ( Y ) ← s ( X ) , & cat [ X , x ]( Y ) , dom ( Y ) . B 1 ( r 2 , Π , b syn ) = { ax } , B 1 ( r 3 , Π , b syn ) = { axx } , B 1 ( r 4 , Π , b syn ) = { x } ⇒ S 1 (Π) = { dom ↾ 1 , & cat [ X , x ] r 4 ↾ I 2 } B 2 ( r 4 , Π , b syn ) = { Y } , B 2 ( r 1 , Π , b syn ) = { a } Redl C. (TU Vienna) HEX-Programs July 16, 2013 6 / 10
Liberal Safety: Concrete TBF Example Program Π : r 1 : s ( a ) . r 2 : dom ( ax ) . r 3 : dom ( axx ) . r 4 : s ( Y ) ← s ( X ) , & cat [ X , x ]( Y ) , dom ( Y ) . B 1 ( r 2 , Π , b syn ) = { ax } , B 1 ( r 3 , Π , b syn ) = { axx } , B 1 ( r 4 , Π , b syn ) = { x } ⇒ S 1 (Π) = { dom ↾ 1 , & cat [ X , x ] r 4 ↾ I 2 } B 2 ( r 4 , Π , b syn ) = { Y } , B 2 ( r 1 , Π , b syn ) = { a } ⇒ S 2 (Π) ⊇ { s ↾ 1 , & cat [ X , x ] r 4 ↾ O 1 } Redl C. (TU Vienna) HEX-Programs July 16, 2013 6 / 10
Liberal Safety: Concrete TBF Example Program Π : r 1 : s ( a ) . r 2 : dom ( ax ) . r 3 : dom ( axx ) . r 4 : s ( Y ) ← s ( X ) , & cat [ X , x ]( Y ) , dom ( Y ) . B 1 ( r 2 , Π , b syn ) = { ax } , B 1 ( r 3 , Π , b syn ) = { axx } , B 1 ( r 4 , Π , b syn ) = { x } ⇒ S 1 (Π) = { dom ↾ 1 , & cat [ X , x ] r 4 ↾ I 2 } B 2 ( r 4 , Π , b syn ) = { Y } , B 2 ( r 1 , Π , b syn ) = { a } ⇒ S 2 (Π) ⊇ { s ↾ 1 , & cat [ X , x ] r 4 ↾ O 1 } X ∈ B 3 ( r 4 , Π , b syn ) Redl C. (TU Vienna) HEX-Programs July 16, 2013 6 / 10
Liberal Safety: Concrete TBF Example Program Π : r 1 : s ( a ) . r 2 : dom ( ax ) . r 3 : dom ( axx ) . r 4 : s ( Y ) ← s ( X ) , & cat [ X , x ]( Y ) , dom ( Y ) . B 1 ( r 2 , Π , b syn ) = { ax } , B 1 ( r 3 , Π , b syn ) = { axx } , B 1 ( r 4 , Π , b syn ) = { x } ⇒ S 1 (Π) = { dom ↾ 1 , & cat [ X , x ] r 4 ↾ I 2 } B 2 ( r 4 , Π , b syn ) = { Y } , B 2 ( r 1 , Π , b syn ) = { a } ⇒ S 2 (Π) ⊇ { s ↾ 1 , & cat [ X , x ] r 4 ↾ O 1 } X ∈ B 3 ( r 4 , Π , b syn ) ⇒ & cat [ X , x ] r 4 ↾ I 1 ∈ S 3 (Π) Redl C. (TU Vienna) HEX-Programs July 16, 2013 6 / 10
Recommend
More recommend