This document discusses binary frontier-guarded ASP (BFG programs), a new decidable class of answer set programs that allows for function symbols. BFG programs restrict programs to unary and binary predicates and unary function symbols, with rules required to be frontier-guarded. Stable models of BFG programs can be represented as forests or labeled trees. The document proposes an automata-based algorithm using tree automata to check properties of BFG programs such as consistency, which is shown to be 3ExpTime-complete. Description logics can also be encoded as BFG programs.
Davis plaque method.pptx recombinant DNA technology
Binary Frontier-guarded ASP Encoding of Description Logics
1. Binary Frontier-guarded ASP with Function Symbols
Mantas Šimkus
Institute of Information Systems
Vienna University of Technology
simkus@dbai.tuwien.ac.at
RuleML 2015
Mantas Šimkus 1/27
2. 1. Introduction
Outline
1 a brief introduction to Answer Set Programming
2 BFG programs (binary frontier-guarded programs)
• a new decidable class of programs with function symbols
3 encoding Description Logics into BFG programs
4 automata-based algorithm for BFG programs
Mantas Šimkus 2/27
3. 2. Logic Programming
Logic Programs
A (disjunctive) logic program P is a (finite) set of rules of the form
a1 ∨ . . . ∨ al
head
← b1, . . . , bm, not c1, . . . , not cn
body
where all ak, bi, cj are atoms.
• if the body is empty, the rule is a fact
• if the head is empty, the rule is a constraint
The grounding of P is denoted Ground(P)
For a program P, HBP is the set of all atoms that can be built from
predicate names, constants and function symbols in P
An (Herbrand) interpretation for P is any set I ⊆ HBP
I is a model of P if I satisfies every rule in Ground(P)
Mantas Šimkus 3/27
4. 2. Logic Programming
Answer Set Semantics (a.k.a. Stable Model Semantics)
Answer Set Semantics is a particular way to deal with “not”
Assume a program P and an interpretation I ⊆ HBP
The Gelfond-Lifschitz (GL) reduct PI is the program obtained from
Ground(P) by removing
1 every rule a1 ∨ . . . ∨ al ← b1, . . . , bm, not c1, . . . , not cn,
where some ci is in I, and
2 all literals not cj from the remaining rules
M is an answer set of P iff M is a minimal model of PM
Such an I satisfies all rules, and intuitively P justifies each atom in I
Mantas Šimkus 4/27
5. 2. Logic Programming
Example (1)
P = { person(joey) ←;
male(X) ∨ female(X) ← person(X);
bachleor(X) ← male(X), not married(X);
M1 = {person(joey), male(joey), bachelor(joey)}
PM1 = { person(joey) ←;
male(joey) ∨ female(joey) ← person(joey);
bachleor(joey) ← male(joey); }
M1 is a minimal model of PM1 . Hence, M1 is a stable model of P.
Mantas Šimkus 5/27
6. 2. Logic Programming
Example (2)
P = { person(joey) ←;
male(X) ∨ female(X) ← person(X);
bachleor(X) ← male(X), not married(X);
M2 = {person(joey), male(joey), married(joey)}
PM2 = { person(joey) ←;
male(joey) ∨ female(joey) ← person(joey);}
M2 is not a minimal model of PM2 . Hence M2 is not a stable model.
In general, no, one, or multiple stable models exist.
Mantas Šimkus 6/27
7. 2. Logic Programming
Finite vs. Infinite Interpretations/Grounding
If P does not allow for function symbols, then HBP finite
• Decidability is easy: guess-and-check
In the presence of functions, HBP and Ground(P) infinite.
• We have to build minimal models for infinite programs
Mantas Šimkus 7/27
8. 2. Logic Programming
Why function symbols?
Function symbols are desirable:
to model recursive data-structures,
temporal reasoning,
planning,
encoding DLs,
infinite objects, in general
Unrestricted use of function leads to high undecidability:
Finding a stable model is Σ1
1-complete [Marek and Remmel, 2001]
Mantas Šimkus 8/27
9. 2. Logic Programming
Some Related Work
ASP with function symbols:
Finitely Recursive and Finitary programs [Baselice et al., 2007]
Finitely Ground programs [Calimeri et al., 2008]
Various acyclicity notions [Syrjänen, 2001][Gebser et al.,
2007][Calautti et al., 2014]
Open Answer Set Programming [Heymans et al., 2007]
FDNC programs and BD-programs by [Eiter and Šimkus, 2010]
Existential rules:
Datalog± [Calì et al., 2013][Gottlob et al., 2014]
Frontier-guarded rules [Baget et al., 2011]
Mantas Šimkus 9/27
10. 3. BFG Programs
BFG Programs (Binary Frontier-guarded Programs)
BFG programs is a restricted class of programs with function symbols
High level description:
only unary and binary relations are allowed
only unary function symbols are allowed
3 shapes of unary atoms
4 shapes of binary atoms
rules are frontier-guarded
• a relaxation of standard (full)-guardedness
• not minor ; exponential blow-up in complexity
Mantas Šimkus 10/27
11. 3. BFG Programs
BFG Programs (Binary Frontier-guarded Programs)
Definition
A program is called a BFG program if it satisfies the following conditions:
1) Only unary and binary relations are allowed
2) All ground rules are facts of the form A(c) ← and R(c, d) ←
3) Constant occur in facts only
4) The rules with variables have the following properties:
1 Binary atoms are of the form R(x, y), R(x, f(x)) or R(f(x), x);
2 Unary atoms are of the form A(x) or A(f(x));
3 (frontier-guardedness) If H is an atom in the head, then there is a
positive body atom that contains all the variables of H;
Note that rules are not guarded!
Mantas Šimkus 11/27
12. 3. BFG Programs
Example Rules (1)
A(x) ← R(x, y1), R(y2, x), not Q(y1, z), Q(z, y2), B(z)
y2
y1
z
A B
x
not, Q
Q
R
R
Mantas Šimkus 12/27
13. 3. BFG Programs
Example Rules (2)
R(x, f(x)) ← R(x, y1), R(y2, x), not Q(y1, z), Q(z, y2), B(z)
y2
y1
z
B
x
not, Q
Q
R
R
R, f
Mantas Šimkus 13/27
14. 3. BFG Programs
Example Rules (3)
P(x, y2) ← R(x, g(y1)), R(y2, x), not Q(y1, z), Q(z, y2), B(z)
y2
y1
z
B
x
not, Q
Q
R, g
R
P
Mantas Šimkus 14/27
15. 3. BFG Programs
Example Rules (4)
P(x, z) ← R(x, y1), R(y2, x), not Q(y1, z), Q(z, y2), B(z)
y2
y1
z
B
x
not, Q
Q
R
R
P
Mantas Šimkus 15/27
16. 3. BFG Programs
Example Rules (4)
P(x, z) ← R(x, y1), R(y2, x), not Q(y1, z), Q(z, y2), B(z)
y2
y1
z
B
x
not, Q
Q
R
R
P
Disallowed! (not frontier-guarded)
Mantas Šimkus 15/27
17. 3. BFG Programs
Example Program
A program P for generating 2-colored trees:
N(c) ←
N(f(x)) ← N(x)
N(g(x)) ← N(x)
E(x, f(x)) ← N(x)
E(x, g(x)) ← N(x)
E(x, y) ← E(y, x)
B(x) ∨ R(x) ← N(x)
g(c)
c
EE
E
N, B
EE E
N, R
f(c)
N, R
Mantas Šimkus 16/27
18. 3. BFG Programs
Stable Models of BFG Programs
Forest models
Each binary atom in a stable model of a BFG program P has the form
R(c, d),
R(t, f(t)), or
R(f(t), t)
Proof (sketch)
Assume there is a stable model I of P violating the above property.
Remove from I all the binary atoms that are not of the form above.
Due to frontier-guardedness, the resulting interpretation J does not
violate any rule in PI, i.e. J is a model of PI. Contradiction.
Mantas Šimkus 17/27
19. 3. BFG Programs
Stable Models of BFG Programs (Cnt’d)
If P has only one constant c, then each stable
model can be represented as a (labeled) tree:
the nodes are terms of the form
f1(f2(. . . fn(c) . . .))
terms f(t) are leaves of t
a term t may be labeled with some
unary predicates
an arc (t, f(t)) may be labeled with
binary predicates
g(c)
c
f(g(c))g(f(c))
f(c)
f(f(c))
A
Q
A
Q
Q
B
B B
RR
In general, stable models of BFG programs are forests.
Mantas Šimkus 18/27
20. 4. Encoding Description Logics
Encoding Description Logics
Encoding knowledge bases of the Description Logic ALCHI:
A0 . . . An B0 . . . Bm B0(x) ∨ . . . ∨ Bm(x)←A0(x), . . ., An(x)
A ∃R.B R(f(x), x) ← A(x); B(f(x)) ← A(x)
A ∀R.B B(y) ← R(x, y), A(x)
R S S(x, y) ← R(x, y)
(c, d) : R R(c, d) ←
c : A A(c) ←
inverses R−
(x, y) ← R(y, x)
This translation uses a normal form & Herbrand’s theorem.
Translation preserves logical consequences.
Mantas Šimkus 19/27
21. 5. Reasoning in BFG Programs
Reasoning in BFG Programs
All stable models of BFG are forest-shaped. Forests can also be
represented as labeled trees.
We can employ tree automata to reason about BFG programs:
• consistency testing (existence of a stable model),
Tree automata generalize the standard finite state automata (FSA).
Reasoning reduces to non-emptiness tests for tree automata.
There exist powerful automata models:
• e.g. alternating 2-way tree automata (2ATA) [Vardi, 1998]
run over infinite trees,
can move up and down in the tree,
allow for parallelization, and
can prohibit certain states from occurring infinitely often.
Mantas Šimkus 20/27
22. 5. Reasoning in BFG Programs
Automata accepting interpretations
Some assumptions/notions/observations:
We fix a BFG program P
All interpretations for P (denoted I, I , J, . . .) are forests.
There is a representation of forest interpretations via labeled trees.
We say an automaton A1 accepts an interpretation I if A1 accepts
the corresponding labeled tree.
Mantas Šimkus 21/27
23. 5. Reasoning in BFG Programs
Pairs of interpretations
A pair (I, I ) of interpretations can be represented in a single labeled
tree.
We say an automaton A2 accepts a pair (I, I ) if A2 accepts the
labeled tree that corresponds to (I, I ).
A2 ↓ is the projection automaton for A2:
• A2 ↓ accepts I iff there exists I such that A2 accepts (I, I )
Mantas Šimkus 22/27
24. 5. Reasoning in BFG Programs
Counter-models
Generating Counter-examples
We can build an automaton Ace that accepts exactly the pairs (I, I )
such that I |= PI .
Intuitively,
1 First, Ace non-deterministically assigns variables of P to terms.
2 Then, Ace guesses a rule r ∈ P and
3 checks that under the variable assignment in (1), the following are
true:
• body+
(r) ⊆ I,
• body−
(r) ∩ I = ∅, and
• head(r) ∩ I = ∅.
Ace accepts the here-and-there interpretations that are not models of P.
Mantas Šimkus 23/27
25. 5. Reasoning in BFG Programs
Generating Models
The complement Ace of Ace accepts pairs (I, I ) such that I |= PI .
We can build an automaton A= that accepts exactly the pairs (I, I )
such that I = I .
Then Ace ∩ A= accepts interpretations (I, I) such that I |= PI.
• or, total here-and-there models of P.
Let Amods = (Ace ∩ A=) ↓.
Amods accepts exactly the interpretations I such that I |= PI.
It remains to ensure minimality.
Mantas Šimkus 24/27
26. 5. Reasoning in BFG Programs
Ensuring Minimality
We can build an automaton A that accepts exactly the pairs (I, I )
such that I I .
Let A1 = Ace ∩ A accepts interpretations (I, I ) such that I |= PI
and I I .
Let A2 = A1 ↓.
• A2 accepts I iff there exists I I such that I |= PI
.
Let Amin = A2.
Amin accepts exactly the interpretations I such that there exists
no J I with J |= PI.
Final result
Amods ∩ Amin accepts exactly the stable models of P.
Mantas Šimkus 25/27
27. 5. Reasoning in BFG Programs
Complexity
Ace is a nondeterministic automaton with exponentially many states.
• The construction of Ace
is inspired by [Calvanese et al., 2007]
Complementation causes an exponential blowup in states.
The construction of Amods involves 1 complementation step.
The construction of Amin involves 2 complementation step.
Thus consistency of BFG programs is in 3ExpTime.
The problem is 2ExpTime-hard (due to [Lutz, 2007]).
Mantas Šimkus 26/27
28. 6. Conclusion
Summary
We have defined BFG programs
• extremely simple syntax
• high expressivity
BFG programs capture many DLs and can extend them with
recursive rules
For future work:
• a 2ExpTime upper bound for BFG programs possible?
• to characterize the data complexity of BFG programs, i.e. the
complexity measured in the size of program facts.
• to investigate the possibility of rewriting BFG programs into ASP
programs without function symbols
Mantas Šimkus 27/27
29. 7. References
Jean-François Baget, Michel Leclère, Marie-Laure Mugnier, and Eric Salvat.
On rules with existential variables: Walking the decidability line.
Artif. Intell., 175(9-10):1620–1654, 2011.
Sabrina Baselice, Piero A. Bonatti, and Giovanni Criscuolo.
On finitely recursive programs.
In Proceedings 23rd International Conference on Logic Programming (ICLP 2007),
volume 4670 of Lecture Notes in Computer Science, pages 89–103. Springer, 2007.
Marco Calautti, Sergio Greco, Cristian Molinaro, and Irina Trubitsyna.
Checking termination of logic programs with function symbols through linear constraints.
In Proc. of RuleML 2014, volume 8620 of Lecture Notes in Computer Science, pages
97–111. Springer, 2014.
Andrea Calì, Georg Gottlob, and Michael Kifer.
Taming the infinite chase: Query answering under expressive relational constraints.
J. Artif. Intell. Res. (JAIR), 48:115–174, 2013.
Francesco Calimeri, Susanna Cozza, Giovambattista Ianni, and Nicola Leone.
Computable functions in asp: Theory and implementation.
In Maria Garcia de la Banda and Enrico Pontelli, editors, ICLP, volume 5366 of Lecture
Notes in Computer Science, pages 407–424. Springer, 2008.
Diego Calvanese, Thomas Eiter, and Magdalena Ortiz.
Answering regular path queries in expressive description logics: An automata-theoretic
approach.
Mantas Šimkus 27/27
30. 7. References
In Proc. of the 22nd Nat. Conf. on Artificial Intelligence (AAAI 2007), pages 391–396,
2007.
Martin Gebser, Torsten Schaub, and Sven Thiele.
GrinGo : A new grounder for answer set programming.
In Proc. LPNMR 2007, volume 4483 of LNCS, pages 266–271. Springer, 2007.
Georg Gottlob, André Hernich, Clemens Kupke, and Thomas Lukasiewicz.
Stable model semantics for guarded existential rules and description logics.
In Proc. of KR’14. AAAI Press, 2014.
Stijn Heymans, Davy Van Nieuwenborgh, and Dirk Vermeir.
Open answer set programming for the semantic web.
J. Applied Logic, 5(1):144–169, 2007.
Carsten Lutz.
Inverse roles make conjunctive queries hard.
In Proc. of the 2007 Description Logic Workshop (DL 2007), volume 250 of CEUR
Electronic Workshop Proceedings, http://ceur-ws.org/Vol-250/, pages 100–111,
2007.
V. Wiktor Marek and Jeffrey B. Remmel.
On the expressibility of stable logic programming.
In LPNMR, pages 107–120, 2001.
T. Syrjänen.
Omega-restricted logic programs.
Mantas Šimkus 27/27
31. 7. References
In Proc. of the 6th Intl. Conference on Logic Programming and Nonmonotonic
Reasoning. Springer-Verlag, 2001.
Moshe Y. Vardi.
Reasoning about the past with two-way automata.
volume 1443 of Lecture Notes in Computer Science, pages 628–641. Springer, 1998.
Mantas Šimkus 27/27