Loading in 2 Seconds...
Loading in 2 Seconds...
Environments for Tabled Prolog: Progress and Open Issues. Terrance Swift CENTRIA Universidade Nova de Lisboa. Motivation * Tabling has proven its usefulness over the past decade -- cf. How tabling solves real problems www.cs.sunysb.edu/~tswift/talks.html
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
XSB’s tabling methodology as discussed in this talk was developed and implemented by (in alphabetical order)Luis de Castro, Baoqiu Cui, Steve Dawson,Ernie Johnson, Juliana Freire, Michael Kifer,
Rui F. Marques, C.R. Ramakrishnan, I.V. Ramakrishnan,Prasad Rao, Konstantinos Sagonas, Diptikalyan Saha,Terrance Swift,David S. Warren
It depends on what a future tabling system might look like
Non-monotonic Deductive databases
* Most work in tabling has been from the LP perspective (including enviroment support)
* Some work has been done to support NMR with residual programs and XASP
* Less has been done to support deductive database features
What topics might an ideal compiler address to support all the functionality we’d like?
#1 Managing table space
#2 Updating tables when dynamic code changes
#3 Automatically deciding which predicates to table
#4 Deciding what kind of tabling to use
#5 Optimizing transformations
#6 Choosing a scheduling strategy
#8 Support for transformation-based semantic extensions
#9 Better ASP Integration
#10 Making answer subsumption usable by real
* Space reclamation becomes more complicated when supporting well-founded reducts
* XSB maintains the well-founded reduct in its table, called the residual progam e.g in
the table p(X) depends on the table b(X) through the answer b(2) which is undefined under WFS
* Abolishing b(2) but not p(X) changes the residual program with semantic implications when integrating with ASP solvers, not to mention core dumps.
* XSB has a flag indicating whether table abolishes are to be cascaded
<owl:Class rdf:ID="PinotBlanc"> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#hasColor" /> <owl:hasValue rdf:resource="#White" /> </owl:Restriction> </rdfs:subClassOf> <owl:intersectionOf rdf:parseType="Collection"> <owl:Class rdf:about="#Wine" /> <owl:Restriction> <owl:onProperty rdf:resource="#madeFromGrape" /> <owl:hasValue rdf:resource="#PinotBlancGrape" /> </owl:Restriction> <owl:Restriction> <owl:onProperty rdf:resource="#madeFromGrape" /> <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:maxCardinality> </owl:Restriction> </owl:intersectionOf> </owl:Class>
The ontology is translated by KAON2 to a definite program with about 1000 clauses
pinotblanc(X) :- q24(X).pinotblanc(X) :- pinotblanc(Y),kaon2equal(X, Y).pinnotblanc(X) :-wine(X),madefromgrape(X, Y),ot____nom21(Y).
madefromgrape(Y, X) :- madeintowine(X, Y).madefromgrape(X, X) :- riesling(X),kaon2namedobjects(X).madefromgrape(X, X) :- wine(X),kaon2namedobjects(X).% 18 others
wine(X) :- q14(X).wine(X) :- texaswine(X).% 24 others
% 31 others
q24(X) :-pinotblanc(X).q24(X) :- muscadet(X).q24(X) :- q24(Y),kaon2equal(X, Y).
XSB, YAP, BProlog
Global Tables vs Call Variance
* Similar to call subsumption, YAP’s global tables [CR09] allow answers to be shared between different calls
* Unlike call subsumption, global tables can share answer information for two calls that unify even if neither subsumes the other (e.g. p(a,X) and p(X,b))
* On the other hand, unlike call subsumption, computation is not shared between two calls with global tables
* However, global tables accrue a time cost over call variance, as well as a space cost if they are not used.
* So in addition to deciding what predicates to table, our perfect compiler decides between call variance, call subsumption and global tables (and BDDs and other data structures)
* Some work has been done on analyzing when to use call subsumption [RRR96], but it has not been put into a compiler
is equivalent to
is not equivalent to
* Suppose we want to annotate an answer with an explicit truth value
* If p(a):true and p(a):false are both derived, then the table should only contain p(a):top -- which wasn’t directly derived
* This can be performed through a mechanism called answer subsumption (for want of a better name)
[ADP94] J. Alferes, C. V. Dam´asio, and L. M. Pereira. A top-down query evaluation for well-founded semantics with explicit negation. In European Conference on Artificial Intelligence, pages 140–144. Morgan Kaufmann, 1994.
[CR09] J. Costa and R. Rocha. One table fits all. In Practical Applications of Declarative Languages, pages 195–208, 2009.
[CS02] B. Cui and T. Swift. Preference logic programs: Fixed-point semantics and application to data standardization. Artificial Intelligence, 138:117–147, 2002.
[CSL07] V. Santos Costa, K. Sagonas, and R. Lopes. Demand-driven indexing of prolog clauses. In Proceedings of the 23rd International Conference Logic Programming, pages 395–409. Springer, 2007.
[DP01] C. V. Dam´asio and L. Pereira. Monotonic and residuated logic programs. In ECSQARU, pages 748–759, 2001.
[Ear70] Jay Earley. An efficient context-free parsing algorithm. Communications of the ACM, 13(2):94–102, 1970.
[FSW98] J. Freire, T. Swift, and D. S. Warren. Beyond depth-first: Improving tabled logic programs through alternative scheduling strategies. Journal of Functional and Logic Programming, 1998(3), 1998.
[GJM95] K. Govindarajan, B. Jayaraman, and S. Mantha. Preference logic programming. In International Conference on Logic Programming, pages 731–746, 1995.
[GST+00] J. Gartner, T. Swift, A. Tien, L. M. Pereira, and C. Dam´asio. Psychiatric diagnosis from the viewpoint of computational logic. In 8th International Workshop on Non-Monotonic Reasoning, 2000.
[JRRR99] E. Johnson, C.R. Ramakrishnan, I.V. Ramakrishnan, and P. Rao. A space-efficient engine for subsumption based tabled evaluation of logic programs. In 4th International Symposium on Functional and Logic Programming, 1999.
[KS92] M. Kifer and V. S. Subrahmanian. Theory of generalized annotated logic programming and its applications. Journal of Logic Programming, 12(4):335–368, 1992.
[LMP08] P. Dell’Acqua L. M. Pereira, Gonalo Lopes. On preferring and inspecting abductive models. In Practical Applications of Declarative Languages, 2008.
[Nau88] J. Naughton. Compiling separable recursions. In SIGMOD, pages 312–319, 1988.
[Nau89] J. Naughton. Data independent recursion in deductive databases. J. Computer and System Sciences, 38:259-289, 1989.
[PA09] L. M. Pereira and H. T. Anh. Evolution prospection. In KES-IDT, 2009.
[PGD+04] G. Pemmasani, H. Guo, Y. Dong, C. R. Ramakrishnan, and I. V. Ramakrishnan. Online justification for tabled logic programs. In FLOPS, 2004.
[PL07] L. M. Pereira and G Lopes. Prospective logic agents. In EPIA, pages 73–86, 2007.
[PP95] M. Proetti and A. Petterossi. Unfolding - definition - folding, in that order, for avoiding unecessary variables in logic programs. Theoretical Computer Science, 142:89–124, 1995.
[PR09] L. M. Pereira and Carroline Ramli. Modelling probabilistic causation in decision making. In KES-IDT, 2009.
[PSE09] E. Pontelli, T.C. Son, and O. Elkatib. Justifications for logic programs under the answer set semantics. Theory and Practice of Logic Programming, 9:1–56, 2009.
[Roc07] R. Rocha. On Improving the Efficiency and Robustness of Table Storage Mechanisms for Tabled Evaluation. In Practical Applications of Declarative Languages, pages 155–169, 2007.
[RRR96] P. Rao, C.R. Ramakrishnan, and I.V. Ramakrishnan. A thread in time saves tabling time. In Joint International Conference/Symposium on Logic Programming, 1996.
[RSC05] R. Rocha, F. Silva, and V. Santos Costa. Dynamic mixed-strategy evaluation of tabled logic programs. In International Conference on Logic Programming, page 250264, 2005.
[Sah06] D. Saha. Incremental Evaluation of Tabled Logic Programs. PhD thesis, SUNY Stony Brook, 2006.
[SvL08] K. Stenning and M. van Lambalgen. Human Reasoning and Cognitive Science. MIT Press, 2008.
[Swi99] T. Swift. Tabling for non-monotonic programming. Annals of Mathematics and Artificial Intelligence, 25(3-4):201–240, 1999.
[Swi09] T. Swift. An engine for efficiently computing (sub-)models. In International Conference on Logic Programming, 2009.
[van86] M. van Emden. Quantitative deduction and its fixpoint theory. Journal of Logic Programming, 4:37–53, 1986.