There is a growing need for abstractions in logic specification languages such as FO(.) and ASP. One technique to achieve these abstractions are templates (sometimes called macros). While the semantics of templates are virtually always described through a syntactical rewriting scheme, we present an alternative view on templates as second order definitions. To extend the existing definition construct of FO(.) to second order, we introduce a powerful compositional framework for defining logics by modular integration of logic constructs specified as pairs of one syntactical and one semantical inductive rule. We use the framework to build a logic of nested second order definitions suitable to express templates. We show that under suitable restrictions, the view of templates as macros is semantically correct and that adding them does not extend the descriptive complexity of the base logic, which is in line with results of existing approaches.
Previously, meta-programming @cite_10 has also been used to introduce abstractions, for example in systems such as @cite_1 . One of s most notable features is that it combines a higher-order syntax with a first-order semantics. s main motivation for this is to introduce a useful degree of second order yet remain decidable. While decidability is undeniably an interesting property, the problem of decidability already arises in logic programs under well-founded or stable semantics, certainly with the inclusion of inductive definitions: the issue of undecidability is not inherent to the addition of template behavior. As a result, in recent times deduction inference has been replaced by various other, more practical inference methods such as model checking, model expansion, or querying. Furthermore, for practical applications, we impose the restriction of stratified templates for which an equivalent first-order semantics exists.
@cite_1 @cite_10
1979966822 1522278016
Abstract We describe a novel logic, called HiLog, and show that it provides a more suitable basis for logic programming than does traditional predicate logic. HiLog has a higher-order syntax and allows arbitrary terms to appear in places where predicates, functions, and atomic formulas occur in predicate calculus. But its semantics is first-order and admits a sound and complete proof procedure. Applications of HiLog are discussed, including DCG grammars, higher-order and modular logic programming, and deductive databases. Meta-programs, which treat other computer programs as data, include compilers, editors, simulators, debuggers, and program transformers. Because of the wide ranging applications, meta-programming has become a subject of considerable practical and theoretical interest. This book provides the first comprehensive view of topics in the theory and application of meta-programming, covering problems of representation and of soundness and correctness of interpreters, analysis and evaluation of meta-logic programs, and applications to sophisticated knowledge-based systems.Harvey Abramson is Reader in Computer Science at the University of Bristol, England; M. H. Rogers is Professor of Computer Science, also at the University of Bristol. Meta-Programming in Logic Programming is in the series Logic Programming Research Reports and Notes, edited by Ehud Shapiro.