declarative Horn logic?

I would like to formalize some knowledge and execute queries in what may referred to as fully-declarative Horn logic (or, fully-declarative Prolog). Could anyone provide some guidelines on how to implement it? I briefly recap the fine description from the link above:

The formal language is that of (the core of) Prolog: a "program" is a set of rules and facts as in Prolog (including functions and variables and basically, containing only user defined predicates).

In contrast to Prolog, however, I am looking for an implementation that is sound and complete with respect to the standard declarative semantics of logic programs --- the least Herbrand model (ie, the inductively defined set of ground terms). In theoretical work on logic programming this is usually the object of study, and it is well known that a sound and complete answer to queries can be attained (in the "recursively-enumerable" sense), for example, using SLD-resolution subject to the following conditions:

  • fair search for matching rules (eg, Prolog's depth-first search is not fair);
  • unification with " occurs-check " (checking that a variable doesn't occur in a term with which it is unified).
  • I am looking for a concise implementation that would build on existing capabilities, rather than inventing the wheel. Two of the more promising directions that I see are implementing it as a meta-interpreter of Prolog, or as part of some theorem prover. Could anyone with practical knowledge in these domains provide some guideline on how to implement it? Can it be easily implemented in miniKanren?


    My intentions are to formalize some knowledge in a fully-declarative manner. The crucial characteristics of such a formalization is that it precisely corresponds to the mathematical notion of (monotone) induction, so that the knowledge and it's properties can be easily reasoned about with inductive arguments.


    It is an easy exercise to implement a prover for Horn logic in a few lines of Prolog. Start with the Vanilla Meta-interpreter, then modify it to use the standard unify_with_occurs_check/2 predicate for all unifications, and to use a complete search procedure - iterative deepening depth first search is the simplest to implement.

    See @mat's page A Couple of Meta-interpreters in Prolog for some inspiration.


    More pointers:

  • Datalog has declarative semantics, but as a "Prolog without function symbols" it is not Prolog. See the excellent intro "What You Always Wanted to Know About Datalog (And Never Dared to Ask)" by Ceri, Gottlob and Tanca, 1989. Available via CiteSeerX

  • Implementations of Prolog that use tabling instead of depth-first search for added declarativeness (plus other nice features as I understand), like XSB.

  • 链接地址: http://www.djcxy.com/p/66940.html

    上一篇: 在prolog建设FSA

    下一篇: 声明性的Horn逻辑?