Meta-Programming in Logic Programming

Author(s):  
P. M. Hill ◽  
J. Gallagher

A meta-program, regardless of the nature of the programming language, is a program whose data denotes another (object) program. The importance of meta-programming can be gauged from its large number of applications. These include compilers, interpreters, program analysers, and program transformers. Furthermore, if the object program is a logic or functional program formalizing some knowledge, then the meta-program may be regarded as a meta-reasoner for reasoning about this knowledge. In this chapter, the meta-program is assumed to be a logic program. The object program does not have to be a logic program although much of the work in this chapter assumes this. We have identified three major topics for consideration. These are the theoretical foundations of meta-programming, the suitability of the alternative meta-programming techniques for different applications, and methods for improving the efficiency of meta-programs. As with logic programs generally, meta-programs have declarative and procedural semantics. The theoretical study of meta-programming shows that both aspects of the semantics depend crucially on the manner in which object programs are represented as data in a meta-program. The second theme of the paper is the problem of designing and choosing appropriate ways of specifying important meta-programming problems, including dynamic metaprogramming and problems involving self-application. The third theme concerns efficient implementation of meta-programs. Meta-programming systems require representations with facilities that minimize the overhead of interpreting the object program. In addition, efficiency can be gained by transforming the meta-program, specializing it for the particular object program it is reasoning about. This chapter, which concentrates on these aspects of meta-programming, is not intended to be a survey of the field. A more complete survey of meta-programming for logic programming can be found in [Barklund, 1995]. Many issues in meta-programming have their roots in problems in logic which have been studied for several decades. This chapter emphasizes meta-programming solutions. It is not intended to give a full treatment of the underlying logical problems, though we try to indicate some connections to wider topics in meta-logic. The meta-programs in this chapter are logic programs based on first order logic.

2017 ◽  
Vol 17 (5-6) ◽  
pp. 906-923 ◽  
Author(s):  
EKATERINA KOMENDANTSKAYA ◽  
YUE LI

AbstractLogic Programming is a Turing complete language. As a consequence, designing algorithms that decide termination and non-termination of programs or decide inductive/coinductive soundness of formulae is a challenging task. For example, the existing state-of-the-art algorithms can only semi-decide coinductive soundness of queries in logic programming for regular formulae. Another, less famous, but equally fundamental and important undecidable property is productivity. If a derivation is infinite and coinductively sound, we may ask whether the computed answer it determines actually computes an infinite formula. If it does, the infinite computation is productive. This intuition was first expressed under the name of computations at infinity in the 80s. In modern days of the Internet and stream processing, its importance lies in connection to infinite data structure processing. Recently, an algorithm was presented that semi-decides a weaker property – of productivity of logic programs. A logic program is productive if it can give rise to productive derivations. In this paper, we strengthen these recent results. We propose a method that semi-decides productivity of individual derivations for regular formulae. Thus, we at last give an algorithmic counterpart to the notion of productivity of derivations in logic programming. This is the first algorithmic solution to the problem since it was raised more than 30 years ago. We also present an implementation of this algorithm.


Proceedings ◽  
2019 ◽  
Vol 21 (1) ◽  
pp. 22
Author(s):  
Rodrigo Martin ◽  
Pedro Cabalar

When it comes to the writing of a new logic program or theory, it is of great importance to obtain a concise and minimal representation, for simplicity and ease of interpretation reasons. There are already a few methods and many tools, such as Karnaugh Maps or the Quine-McCluskey method, as well as their numerous software implementations, that solve this minimization problem in Boolean logic. This is not the case for Here-and-There logic, also called three-valued logic. Even though there are theoretical minimization methods for logic theories and programs, there aren’t any published tools that are able to obtain a minimal equivalent logic program. In this paper we present the first version of a tool called that is able to efficiently obtain minimal and equivalent representations for any logic program in Here-and-There. The described tool uses an hybrid method both leveraging a modified version of the Quine-McCluskey algorithm and Answer Set Programming techniques to minimize fairly complex logic programs in a reduced time.


2019 ◽  
Vol 19 (04) ◽  
pp. 603-628 ◽  
Author(s):  
FRANCESCO CALIMERI ◽  
SIMONA PERRI ◽  
JESSICA ZANGARI

AbstractAnswer Set Programming (ASP) is a purely declarative formalism developed in the field of logic programming and non-monotonic reasoning: computational problems are encoded by logic programs whose answer sets, corresponding to solutions, are computed by an ASP system. Different, semantically equivalent, programs can be defined for the same problem; however, performance of systems evaluating them might significantly vary. We propose an approach for automatically transforming an input logic program into an equivalent one that can be evaluated more efficiently. One can make use of existing tree-decomposition techniques for rewriting selected rules into a set of multiple ones; the idea is to guide and adaptively apply them on the basis of proper new heuristics, to obtain a smart rewriting algorithm to be integrated into an ASP system. The method is rather general: it can be adapted to any system and implement different preference policies. Furthermore, we define a set of new heuristics tailored at optimizing grounding, one of the main phases of the ASP computation; we use them in order to implement the approach into the ASP systemDLV, in particular into its grounding subsystemℐ-DLV, and carry out an extensive experimental activity for assessing the impact of the proposal.


2016 ◽  
Vol 16 (3) ◽  
pp. 269-295 ◽  
Author(s):  
ROBERT KOWALSKI ◽  
FARIBA SADRI

AbstractIn previous work, we proposed a logic-based framework in which computation is the execution of actions in an attempt to make reactive rules of the form if antecedent then consequent true in a canonical model of a logic program determined by an initial state, sequence of events, and the resulting sequence of subsequent states. In this model-theoretic semantics, reactive rules are the driving force, and logic programs play only a supporting role. In the canonical model, states, actions, and other events are represented with timestamps. But in the operational semantics (OS), for the sake of efficiency, timestamps are omitted and only the current state is maintained. State transitions are performed reactively by executing actions to make the consequents of rules true whenever the antecedents become true. This OS is sound, but incomplete. It cannot make reactive rules true by preventing their antecedents from becoming true, or by proactively making their consequents true before their antecedents become true. In this paper, we characterize the notion of reactive model, and prove that the OS can generate all and only such models. In order to focus on the main issues, we omit the logic programming component of the framework.


Author(s):  
HIROSHI SAKAI ◽  
AKIMICHI OKUMA

We are now touching a problem how we add soft computing aspects to logic programming and we have been discussing null attribute values on logic programs. Here, we introduce two functors setu and sets into logic programs for describing indefinite attribute values explicitly. Every logic program with setu or sets has variability and tolerance in itself, namely this program expresses a set of possible definite logic programs. We call this program a variational logic program. In this paper, we show the variational logic programs and a theorem prover for them.


2009 ◽  
Vol 9 (3) ◽  
pp. 309-341 ◽  
Author(s):  
VAN HUNG LE ◽  
FEI LIU ◽  
DINH KHANG TRAN

AbstractThe paper introduces fuzzy linguistic logic programming, which is a combination of fuzzy logic programming, introduced by P. Vojtáš, and hedge algebras in order to facilitate the representation and reasoning on human knowledge expressed in natural languages. In fuzzy linguistic logic programming, truth values are linguistic ones, e.g., VeryTrue, VeryProbablyTrue and LittleFalse, taken from a hedge algebra of a linguistic truth variable, and linguistic hedges (modifiers) can be used as unary connectives in formulae. This is motivated by the fact that humans reason mostly in terms of linguistic terms rather than in terms of numbers, and linguistic hedges are often used in natural languages to express different levels of emphasis. The paper presents: (a) the language of fuzzy linguistic logic programming; (b) a declarative semantics in terms of Herbrand interpretations and models; (c) a procedural semantics which directly manipulates linguistic terms to compute a lower bound to the truth value of a query, and proves its soundness; (d) a fixpoint semantics of logic programs, and based on it, proves the completeness of the procedural semantics; (e) several applications of fuzzy linguistic logic programming; and (f) an idea of implementing a system to execute fuzzy linguistic logic programs.


2007 ◽  
Vol 30 ◽  
pp. 501-523 ◽  
Author(s):  
S. Greco ◽  
I. Trubitsyna ◽  
E. Zumpano

This work is a contribution to prioritized reasoning in logic programming in the presence of preference relations involving atoms. The technique, providing a new interpretation for prioritized logic programs, is inspired by the semantics of Prioritized Logic Programming and enriched with the use of structural information of preference of Answer Set Optimization Programming. Specifically, the analysis of the logic program is carried out together with the analysis of preferences in order to determine the choice order and the sets of comparable models. The new semantics is compared with other approaches known in the literature and complexity analysis is also performed, showing that, with respect to other similar approaches previously proposed, the complexity of computing preferred stable models does not increase.


Author(s):  
ALEXANDROS CHORTARAS ◽  
GIORGOS STAMOU ◽  
ANDREAS STAFYLOPATIS

Fuzzy logic programming has been lately used as a general framework for representing and handling imprecise knowledge. In this paper, we define the syntax and the semantics of definite weighted fuzzy logic programs, which extend definite fuzzy logic programs by allowing the inclusion of different significance weights in the individual atoms that make up the antecedent of a fuzzy logic rule. The weights add expressiveness to a fuzzy logic program and allow the determination of the level up to which an atom in the antecedent of a rule may affect the truth value of its consequent. In describing the semantics of definite weighted fuzzy logic programs we introduce the notion of the generalized weighted fuzzy conjunction operator, which can be regarded as a weighted t-norm based aggregation. We determine the properties of generalized weighted fuzzy conjunction operators and provide several examples. A methodology for constructing generalized weighted fuzzy conjunction operators using generator functions of existing t-norms is also introduced. Finally, a method for setting up a parametric weighted fuzzy logic program and automatically adapting the weights of its rules using a numerical dataset is developed.


2011 ◽  
Vol 13 (1) ◽  
pp. 33-70 ◽  
Author(s):  
JUAN CARLOS NIEVES ◽  
MAURICIO OSORIO ◽  
ULISES CORTÉS

AbstractIn this paper, a possibilistic disjunctive logic programming approach for modeling uncertain, incomplete, and inconsistent information is defined. This approach introduces the use of possibilistic disjunctive clauses, which are able to capture incomplete information and states of a knowledge base at the same time. By considering a possibilistic logic program as a possibilistic logic theory, a construction of a possibilistic logic programming semantic based on answer sets and the proof theory of possibilistic logic is defined. It shows that this possibilistic semantics for disjunctive logic programs can be characterized by a fixed-point operator. It is also shown that the suggested possibilistic semantics can be computed by a resolution algorithm and the consideration of optimal refutations from a possibilistic logic theory. In order to manage inconsistent possibilistic logic programs, a preference criterion between inconsistent possibilistic models is defined. In addition, the approach of cuts for restoring consistency of an inconsistent possibilistic knowledge base is adopted. The approach is illustrated in a medical scenario.


2015 ◽  
Vol 30 (4) ◽  
pp. 953-989 ◽  
Author(s):  
Patrick Kahl ◽  
Richard Watson ◽  
Evgenii Balai ◽  
Michael Gelfond ◽  
Yuanlin Zhang

Abstract In this article, we present a new version of the language of Epistemic Specifications. The goal is to simplify and improve the intuitive and formal semantics of the language. We describe an algorithm for computing solutions of programs written in this new version of the language. The new semantics is illustrated by a number of examples, including an Epistemic Specifications-based framework for conformant planning. In addition, we introduce the notion of an epistemic logic program with sorts . This extends recent efforts to define a logic programming language that includes the means for explicitly specifying the domains of predicate parameters. An algorithm and its implementation as a solver for epistemic logic programs with sorts is also discussed.


Sign in / Sign up

Export Citation Format

Share Document