An Improved Reductant Calculus using Fuzzy Partial Evaluation Techniques

Pascual Julián^{a} Ginés Moreno^{b} Jaime Penabad^{c}

aDept. of Information Technologies and Systems ESI, Univ. of Castilla–La Mancha Paseo de la Universidad, 4; 13071 Ciudad Real, Spain bDept. of Computing Systems cDept. of Mathematics EPSA, Univ. of Castilla–La Mancha Campus Universitario, s/n; 02071 Albacete, Spain

Abstract

Partial evaluation (PE) is an automatic program transformation technique aiming to obtain, among other advantages, the optimization of a program with respect to parts of its input: hence, it is also known as program specialization. This paper introduces the subject of PE into the field of fuzzy logic programming. We define the concept of PE for multi-adjoint logic programs and goals, and apart from discussing the benefits achieved by this technique, we also introduce in the fuzzy setting a completely novel application of PE which allows us the computation of reductants guaranteeing completeness properties without harming the computational efficiency. Reductants are a special kind of fuzzy rules which constitute an essential theoretical tool for proving correctness properties. As observed in the specialized literature, a multi-adjoint logic program, when interpreted on a partially ordered lattice, has to include all its reductants in order to preserve the (approximate) completeness property. This introduces severe penalties in the implementation of efficient multiadjoint logic programming systems: not only the size of programs increases but also their execution time. In this paper we define a refinement to the notion of reductant based on PE techniques, that we call P E-reductant. We establish the main properties of P E-reductants (i.e., the classical concept of reductant and the new notion of P E-reductant are both, semantically and operationally, equivalent) and, what is the best, we demonstrate that our refined notion of P E-reductant is even able to increase the efficiency of multi-adjoint logic programs.

Key words: Fuzzy Logic Programming, Partial Evaluation, Reductants

⋆ This work has been partially supported by the EU, under FEDER, and the Spanish Science and Education Ministry (MEC) under grant TIN 2004-07943-C04-03.

Email addresses: Pascual.Julian@uclm.es (Pascual Julián),

                Gines.Moreno@uclm.es (Ginés Moreno),
                Jaime.Penabad@uclm.es (Jaime Penabad).

Preprint submitted to Elsevier Science 19 May 2008

1 Introduction

Many transformation techniques have been proposed in the literature, in order to improve program code. One of the best known is Partial evaluation (PE) [1], which also offers a unified framework for the study of compilers and interpreters. PE is an automatic program transformation technique aiming at the optimization of a program with respect to parts of its input: hence, it is also known as program specialization. It is expected that the specialized program (also called residual program or partially evaluated program) could be executed more efficiently than the original program. This is because the residual program is able to save some computations, at execution time, that were done only once at PE time. To fulfill this goal, PE uses symbolic computation as well as some techniques provided by the field of program transformation [2], specially the so called unfolding transformation. Unfolding is essentially the replacement of a call by its definition, with appropriate substitutions. In general, PE techniques include stop criteria to guarantee the termination of the PE process^{1} . Therefore, PE is an automatic transformation technique (that is, the PE process can be completed without human intervention). This feature distinguishes PE from other program transformation techniques [2–4].

PE has been widely applied in the field of declarative languages: functional programming [5,1,6]; logic programming [7–9,3], where it is usually called partial deduction; and functional logic programming [10–12]. Also it has been applied to the area of imperative languages (e.g., the language C [13]). Although the objectives are similar, the general methods are often different due to the distinct underlying computational models. Techniques in conventional partial deduction of logic programs usually rely on the unification-based parameter propagation [14], which is part of the resolution principle. In this context, the input data are provided as partial data arguments in a goal (mainly an atomic formula).

Also, PE has been applied extensively to a variety of concrete problems, such as [1]: specialization of database queries; mechanical theorem proving; optimization of ray tracing procedures in the area of computer graphics; software maintenance and program understanding; specialization of simulators for training neuronal networks; and circuit simulators specialization.

On the other hand, Multi-adjoint logic programming [15–17] is an extremely flexible framework combining fuzzy logic and logic programming. Informally speaking, a multi-adjoint logic program can be seen as a set of rules each of which is annotated by a truth degree (a value of a complete lattice, for instance the real interval [0, 1]) and a query to the system is a goal plus a substitu-

1 Controlling the PE process is an important task. However, it is out of the scope of this work.

tion (initially the identity substitution, denoted by id). Given a multi-adjoint logic program, goals are evaluated in two separate computational phases. During the operational phase, admissible steps (a generalization of the classical modus ponens inference rule) are systematically applied by a backward reasoning procedure in a similar way to classical resolution steps in pure logic programming. More precisely, in an admissible step, for a selected atom A in a goal and a rule ⟨H←B; v⟩ of the program, if there is a most general unifier θ of A and H, the atom A is substituted by the expression (v&B)θ, where “&” is an adjoint conjunction evaluating modus ponens. Finally, the operational phase returns a computed substitution together with an expression where all atoms have been exploited. This last expression is then interpreted under a given lattice during what we call the interpretive phase [18], hence returning a pair ⟨truth degree; substitution⟩ which is the fuzzy counterpart of the classical notion of computed answer traditionally used in pure logic programming.

A multi-adjoint logic program, when interpreted on a partially ordered lattice, needs to incorporate a special kind of rules, called reductants, in order to preserve the (approximate) completeness property [17]. This introduces severe penalties in the implementation of efficient multi-adjoint logic programming systems. Because a multi-adjoint logic program has to include all its reductants, not only the size of programs increases but also their execution time. Therefore, if we want to develop complete, efficient implementation systems for the multi-adjoint logic framework, it is essential to define methods for optimizing the computation of reductants. In this work we apply PE techniques to achieve this goal. The idea is to diminish the negative impact of incorporating reductants to a multi-adjoint logic program, by means of a preprocess where reductants are partially evaluated before they are included in the target program: the PE phase produces a set of refined reductants; hence, the computational effort done (only once) during the generation time is avoided (many times) at execution time.

In this work, after recalling in Section 2 the main concepts of the multi-adjoint logic programming paradigm [15–17], being inspired by our own experience in the development of PE techniques for declarative programs [19,11] and program transformation rules for multi-adjoint logic programs [20,18], we deal with the following objectives:

• We define the concept of PE for the new fuzzy setting in Section 3. The idea is to adapt, for this richer framework, the techniques arisen around the field of partial deduction of pure logic programs [7,21,9], but incorporating the unfolding rule developed in [20,18] for this class of fuzzy logic programs. Following this path, we try to unfold admissible goals, as much as possible, in order to obtain an optimized (specialized) version of the original program.

• Using the partial evaluation techniques just developed, in Section 4 we give a more refined version of the concept of reductant considered in [17], which we call P E-reductant. We present its formal definition and then, we relate it with the classical concept of reductant and also with the notion of partial evaluation. We also informally discuss the benefits of the resulting technique by means of some representative examples.

• In Section 5 we establish the formal correctness properties of P E-reduc-tants focusing in both, semantic and procedural aspects. These properties enjoyed by our PE technique, are formally proved and its benefits are easily evidenced with some elucidating examples. Moreover, we also confirm the reduction of the length of admissible derivations when using the improved notion of P E-reductant instead of the older one of reductant, which allows us to obtain more efficient residual programs in practice.

• Finally, before concluding in Section 7, we discuss in Section 6 some other different approaches appeared in the specialized literature. Our contrast is made at several levels, including language extensions, transformation techniques and implementation issues.

2 Preliminaries

This section summarizes the main features of multi-adjoint logic programming. We refer the interested reader to [15–17] for a complete formulation.

2.1 The multi-adjoint logic language

We work with a first order language, L, containing variables, function symbols, predicate symbols, constants, quantifiers, ∀ and ∃, and several (arbitrary) connectives to increase language expressiveness. In our fuzzy setting, we use implication connectives (←_{1}, ←_{2}, …, ←_{m}) and also other connectives which are grouped under the name of “aggregators” or “aggregation operators”. They are used to combine/propagate truth values through the rules. The general definition of aggregation operators subsumes conjunctive operators (denoted by &_{1}, &_{2}, …, &_{k}), disjunctive operators (∨_{1}, ∨_{2}, …, ∨_{l}), and average and hybrid operators (usually denoted by @_{1}, @_{2}, …, @_{n}). Although the connectives &_{i} and ∨_{i} are binary operators, @_{i} operators are usually functions with an arbitrary number of arguments. Also note that, we often abstract a complex expression, E, containing &_{i}, ∨_{i} and @_{i} operators, as simply writing @(x_{1}, x_{2}, …, x_{n}), where {x_{1}, x_{2}, …, x_{n}} is the set of distinct variables occurring in E.

Aggregation operators are useful to describe/specify user preferences. An aggregation operator, when interpreted as a truth function, may be an arithmetic mean, a weighted sum or in general any monotone application whose arguments are values of a complete bounded lattice L. For example, if an aggregator @ is interpreted as ˙@(x, y, z) = (3x + 2y + z)/6, we are giving the highest preference to the first argument, then to the second, being the third argument the least significant. By definition, the truth function for an n-ary aggregation operator ˙@ : L^{n} → L is required to be monotone and fulfill ˙@(⊤, …, ⊤) = ⊤, ˙@(⊥, …, ⊥) = ⊥.

Additionally, our language L contains the values of a multi-adjoint lattice, ⟨L, ⪯, ←_{1}, &_{1}, …, ←_{n}, &_{n}⟩, equipped with a collection of adjoint pairs of the form ⟨←_{i}, &_{i}⟩ where each &_{i} is a conjunctor^{7} intended to produce the evaluation of modus ponens. In general, the set of truth values L may be the carrier of any complete bounded lattice, as occurs for instance with the simpler case of the set of real numbers in the interval [0, 1] (which is a totally ordered lattice or chain).

A rule is a formula H ←_{i} B, where H is an atomic formula (usually called the head) and B (which is called the body) is a formula built from atomic formulas B_{1}, …, B_{n}, n ≥ 0, truth values of L and aggregation operators. Rules whose body is ⊤ are called facts (usually, we will represent a fact as a rule with an empty body). A goal is a body submitted as a query to the system. Variables in a rule are assumed to be universally quantified. Roughly speaking, a multiadjoint logic program is a set of pairs ⟨R; α⟩, where R is a rule and α is a truth degree (a value of L) expressing the confidence that the user of the system has in the truth of the rule R. Observe that, truth degrees are axiomatically assigned (for instance) by an expert. By abuse of language, we sometimes refer a tuple ⟨R; α⟩ as a “rule”.

Formulas are interpreted on a multi–adjoint lattice. In this framework, it is sufficient to consider Herbrand interpretations, in order to define a declarative semantics [17]. Therefore, a fuzzy interpretation, I, is a mapping from the Herbrand base, B_{L}, into the multi–adjoint lattice of truth values L. The truth value of a ground atom A ∈ B_{L} is I(A). Given an assignment ϑ from terms into elements of the Herbrand universe U_{L}, the valuation of a formula in an interpretation is obtained by structural induction:

I(p(t_{1}, …, t_{n}))[ϑ] = I(p(t_{1}ϑ, …, t_{n}ϑ)),
I(@(A_{1}, …, A_{n}))[ϑ] = ˙@(I(A_{1})[ϑ], …, I(A_{n})[ϑ]),
I(A←B)[ϑ] = I(A)[ϑ] ˙←I(B)[ϑ],
I((∀x)A)[ϑ] = inf{I(A)[ϑ′] | ϑ′ x–equivalent to ϑ},

7 For a formal definition of a multi-adjoint lattice and the semantic properties of the connectives in L, see [17]. It is noteworthy that a symbol &_{j} of L does not always need to be part of an adjoint pair.

where p is a predicate symbol, @ an arbitrary aggregator, A and A_{i} atomic formulas, B any body, A any formula and we denote the truth value function of a connective @ by ˙@. An assignment ϑ′ is x–equivalent to ϑ when z[ϑ′] = z[ϑ] for all variable z ≠ x of L. When the assignment would not be relevant, we shall omit it during the valuation of a formula. Moreover, an interpretation I satisfies a rule ⟨A←_{i}B; v⟩ if, and only if, v ≤ I(A←_{i}B), and an interpretation I is a model of P if, and only if, all rules in P are satisfied by I.

2.2 Procedural Semantics

The procedural semantics of the multi-adjoint logic language L can be thought of as an operational phase followed by an interpretive one. Similarly to [18], in this section we establish a clear separation between both phases. The operational mechanism uses a generalization of modus ponens that, given an atomic goal A and a program rule ⟨H←_{i}B; v⟩, if there is a substitution θ = mgu({A = H}) ^{1} , we substitute the atom A by the expression (v&_{i}B)θ. In the following, we write C[A] to denote a formula where A is a sub-expression (usually an atom) which arbitrarily occurs in the —possibly empty— context C[]. Moreover, an expression C[A/H] means the replacement of A by H in context C[]. Also we use Var(s) for referring to the set of variables occurring in the syntactic object s, whereas θ[Var(s)] denotes the substitution obtained from θ by restricting its domain, Dom(θ), to Var(s).

Definition 1 (Admissible Steps) Let Q be a goal and let σ be a substitution. The pair ⟨Q; σ⟩ is a state and we denote by E the set of states. Given a program P, an admissible computation is formalized as a state transition system, whose transition relation →_{AS} ⊆ (E ×E) is the smallest relation satisfying the following admissible rules^{2} (where we always consider that A is the selected atom in Q):

1) ⟨Q[A]; σ⟩→_{AS}⟨(Q[A/v&_{i}B])θ; σθ⟩ if θ = mgu({H = A}), ⟨H←_{i}B; v⟩ in P.

2) ⟨Q[A]; σ⟩→_{AS}⟨(Q[A/⊥]); σ⟩ if there is no rule in P whose head unifies A.

Formulas involved in admissible computation steps are renamed apart before being used. Note also that the second rule is introduced to cope with (possible) unsuccessful admissible derivations. When needed, we shall use the sym-

1 Let mgu(E) denote the most general unifier of an equation set E (see [22] for a formal definition of this concept). 2 Note that the first case subsumes the second case in the original definition presented in [17], since a fact H ← is really the rule H ← ⊤. However, from a practical point of view, when an admissible step is performed with a fact, we abbreviate the step “⟨Q[A]; σ⟩→_{AS} ⟨(Q[A/v&_{i}⊤])θ; σθ⟩” by “⟨Q[A]; σ⟩→_{AS}⟨(Q[A/v])θ; σθ⟩”, since ˙&_{i}(v, ⊤) = v.

bols →_{AS1} and →_{AS2} to distinguish between specific admissible steps. Also, when required, the exact program rule used in the corresponding step will be annotated as a super-index of →_{AS}. Also the symbols →_{AS}^{+} and →_{AS}^{∗} denote, respectively, the transitive closure and the reflexive, transitive closure of →_{AS}.

Definition 2 Let P be a program and let Q be a goal. An admissible derivation is a sequence ⟨Q; id⟩ →_{AS}^{∗} ⟨Q′; θ⟩. When Q′ is a formula not containing atoms, the pair ⟨Q′; σ⟩, where σ = θ[Var(Q)], is called an admissible computed answer (a.c.a.) for that derivation.

If we exploit all atoms of a goal, by applying admissible steps as much as needed during the operational phase, then it becomes a formula with no atoms which can be then directly interpreted in the multi-adjoint lattice L.

Definition 3 (Interpretive Step) Let P be a program, Q a goal and σ a substitution. We formalize the notion of interpretive computation as a state transition system, whose transition relation →_{IS}⊆ (E × E) is the smallest one satisfying: ⟨Q[@(r_{1}, …, r_{n})]; σ⟩→_{IS}⟨Q[@(r_{1}, …, r_{n})/˙@(r_{1}, …, r_{n})];σ⟩, where ˙@ is the truth function of connective @ in the lattice ⟨L, ⪯⟩ associated to P.

Definition 4 Let P be a program and ⟨Q; σ⟩ an a.c.a., that is, Q is a goal not containing atoms. An interpretive derivation is a sequence ⟨Q; σ⟩ →_{IS}^{∗} ⟨Q′; σ⟩. When Q′ = r ∈ L, ⟨L, ⪯⟩ being the lattice associated to P, the state ⟨r; σ⟩ is called a fuzzy computed answer (f.c.a.) for that derivation.

We denote by →_{IS}^{+} and →_{IS}^{∗} the transitive closure and the reflexive, transitive closure of →_{IS}, respectively. Usually, we refer to a complete derivation as the sequence of admissible/interpretive steps of the form ⟨Q; id⟩ →_{AS}^{∗} ⟨Q′; σ⟩ →_{IS}^{∗} ⟨r; σ⟩ (sometimes we denote it by ⟨Q; id⟩ →_{AS/IS}^{∗} ⟨r; σ⟩) where ⟨Q′; σ[Var(Q)]⟩ and ⟨r; σ[Var(Q)]⟩ are, respectively, the a.c.a. and the f.c.a. for the derivation. Also note that, sometimes, when it is not important to pay attention on the substitution component of a f.c.a. ⟨r; θ⟩ (maybe, because θ = id) we shall refer to the value component r as the “f.c.a.”.

In the following, we denote by FCA(E) the set of f.c.a.’s of a given expression (goal) E. Formally, FCA(E) = {⟨r; θ⟩ | ⟨E; id⟩ →_{AS/IS}^{∗} ⟨r; σ⟩, r ∈ L, θ = σ[Var(E)]} which can be generalized to a set of expressions E_{1}, …, E_{n} as FCA(E_{1}, …, E_{n}) = FCA(E_{1}) ∪ ⋯ ∪ FCA(E_{n}). Moreover, in order to give a measure of the computational effort needed to compute such set of f.c.a.’s for a given expression E, we denote by [[FCA]](E) the total sum of admissible/interpretive steps needed to generate the whole set FCA(E). An evaluation step contributing to reach one or more solutions for a given expression E, is only counted once when computing FCA(E).

3 Partial Evaluation of Multi-Adjoint Logic Programs

This section formalizes the basic notions involved in the partial evaluation of multi-adjoint logic programs. Some of these concepts were introduced in a preliminary version appeared in [23]. We start with the concept of resultant.

Definition 5 (Resultant) Let P be a program and Q a goal. Given the sequence of admissible and interpretive steps ⟨Q; id⟩ →^{+} ⟨Q′; σ⟩, whose length is strictly greater than zero, we define the resultant of this derivation^{2} as: ⟨Qσ ← Q′ ; ⊤⟩, where “←” is any implication with an adjoint conjunctor.

Observe that, in contrast with the operational semantics defined in Section 2.2, admissible and interpretive steps can be interleaved in any order. In practice we will give preference to the interpretive steps over the admissible steps during the PE process. This method resembles the normalization technique^{3} introduced in the context of functional logic programming to reduce the nondeterminism of a computation [24]. In the sequel we call normalization the sequence of interpretive steps performed before an operational unfolding step.

Also, note that the “rule” component of a resultant is not in general a rule, since goal Q stands for an aggregation of atomic formulas. A resultant is particularly significant when the original goal Q is an atomic formula A, since then, the resultant ⟨Aσ ← Q′ ; ⊤⟩ is a pair ⟨rule; truth degree⟩ which is a constituent of the transformed program. The following example illustrates the intuition behind the notion of resultant.

Example 6 Given the lattice ([0, 1], ≤), where “≤” is the usual order on real numbers, let P be the following multi-adjoint logic program, where labels G and L on program rules refer to Gödel’s intuitionistic logic and Łukasiewicz logic, respectively:

\begin{matrix}R_{1} : ⟨p(a)←_{L} q(X, a); & 0.7⟩ \\ R_{2} : ⟨p(a)←_{G} s(Y); & 0.5⟩ \\ R_{3} : ⟨p(Y)←_{G} q(b, Y)&_{L} t(Y); & 0.8⟩ \\ R_{4} : ⟨q(b, a)← ; & 0.9⟩ \end{matrix}  \begin{matrix}R_{5} : ⟨s(a)←_{G} t(a); & 0.5⟩ \\ R_{6} : ⟨s(b)←_{L} t(b); & 0.8⟩ \\ R_{7} : ⟨t(a)←_{L} p(X); & 0.9⟩ \\ R_{8} : ⟨t(b)←_{G} q(X, a); & 0.9⟩ \end{matrix}

Now, we can build the following derivation in P, starting from goal p(X):

2 Note that, in general, the derivation may possibly be incomplete. 3 In a normalizing narrowing strategy, a term is rewritten to its normal form before a narrowing step is applied. This procedure is also applied in narrowing-based PE and narrowing-based fold/unfold transformation techniques.

⟨p(X); id⟩→_{AS1}^{R_{1}}⟨0.7&_{L}q(X_{1}, a); {X/a}⟩→_{AS1}^{R_{4}}⟨0.7&_{L}0.9; {X/a, X_{1}/b}⟩

whose resultant is ⟨p(a) ← 0.7&_{L}0.9; 1⟩. Note that, an admissible step performed with this resultant on goal p(X) mimics the effects of the two admissible steps of the former derivation.

Therefore, the resultant encapsulates the whole information of the original derivation for goal A in a single step (hence its name). It also compiles the information of the truth degree inside the body of the resultant. So, in order to reproduce the effect of the original derivation, it suffices that the associated truth degree component of the resultant be the top value of lattice L.

The partial evaluation of an atomic goal is defined by firstly constructing an incomplete search tree for that goal and then, extracting the specialized definition —the resultants— from the root-to-leaf branches. Hence, before defining this concept, we precise the introduction of the following notion of unfolding tree.

Definition 7 (Unfolding tree) Let P be a program and let Q be a goal. An unfolding tree τ_{φ} for P and Q (using the computation rule^{4} φ) is a set of ⟨goal; substitution⟩ pair nodes satisfying the following conditions:

(1) The root node of τ_{φ} is ⟨Q ; id⟩, where id is the identity substitution.

(2) If N_{i} ≡ ⟨Q[A]; σ⟩ is a node of τ_{φ} and assuming that φ(Q) = A is the selected atom, then for each rule R_{j} ≡ ⟨H ← B; v⟩ in P, with θ = mgu({H = A}), N_{ij} ≡ ⟨(Q[A/v&B])θ; σθ⟩ is a node of τ_{φ}.

(3) If N_{i} ≡ ⟨Q[@(r_{1}, …, r_{n})]; σ⟩ is a node of the unfolding tree τ_{φ} then, N_{ij} ≡ ⟨Q[@(r_{1}, …, r_{n})/ ˙@(r_{1}, …, r_{n})]); σ⟩ is a node of τ_{φ}.

As defined in [20,18], the second and third cases relate to the application of an operational unfolding step and an interpretive unfolding step, respectively. An incomplete unfolding tree is an unfolding tree which, in addition to completely evaluated leaves, may also contain leaves where no atom (or interpretable expression) has been selected for a further unfolding step, which allows us to finish derivations at any adequate point.

Definition 8 (Partial evaluation of an atom) Let P be a program, A be an (atomic) goal, and τ a (possibly incomplete) finite unfolding tree for P and A, containing at least one non-root node. Let {Q_{i} | i = 1, …, k} be the leaves of the branches of τ, and let P′ = {⟨Aσ_{i} ← Q_{i} ; ⊤⟩ | i = 1, …, k} be the set of resultants associated to derivations {⟨A ; id⟩ →^{+} ⟨Q_{i} ; σ_{i}⟩ | i = 1, …, k}.

4 A computation rule is a function that, when applied to a query Q, outputs one of the atoms of Q to be evaluated by an admissible step. Note that a computation rule may select an atom for which no admissible step is possible.

Then, the set P′ is called a partial evaluation of A in P (using τ).

Example 9 Given the program P of Example 6, we can construct the following unfolding tree with depth 3 (that is, all its branches have been unfolded no more than 3 steps) for program P and atom p(X):

p(X)

0.7&_{L}q(X_{1}, a) R_{1} θ_{\begin{matrix}0.7&_{L}0.9 \\ 0.6 \end{matrix} R_{4} θ} 0.5&_{G}s(Y_{2}) R_{2} θ 0.5&_{G}(0.5&_{G}t(a)) R_{5} θ_{0.5&_{G}(0.5&_{G}(0.9&_{L}p(X_{4}))) R_{7} θ} _{0.5&_{G}(0.8&_{L}t(b)) R_{6} θ_{0.5&_{G}(0.8&_{L}(0.9&_{G}q(X_{5}, a))) R_{8} θ}} 0.8&_{G}(q(b, Y_{3})&_{L}t(Y_{3})) R_{3} σ_{0.8&_{G}(0.9&_{L}t(a)) R_{4} θ_{0.8&_{G}(0.9&_{L}(0.9&_{L}p(X_{6}))) R_{7} θ}}

Depicting the figure, we have followed these conventions: the substitution component of each node is annotated as a label of the arc connecting that node and its parent node (the only exception is the root node, whose associate substitution is by default the identity substitution, id); by the sake of simplicity, substitutions are restricted to variables of the initial goal, hence: θ = {X/a} and σ = {X/Y_{3}}. Note also that, as usual in classical resolution procedures, rules in admissible steps are taken standardized apart, whereas those nodes where a normalization sequence (of interpretive steps) has been applied, generating a new additional node, are surrounded by boxes. ¿From the above incomplete unfolding tree we obtain the following set of resultants:

R′_{1} : ⟨p(a)← 0.6; 1⟩
R′_{2} : ⟨p(a)← 0.5&_{G}(0.5&_{G}(0.9&_{L} p(X_{4}))); 1⟩
R′_{3} : ⟨p(a)← 0.5&_{G}(0.8&_{L}(0.9&_{G}q(X_{5}, a))); 1⟩
R′_{4} : ⟨p(a)← 0.8&_{G}(0.9&_{L}(0.9&_{L}p(X_{6}))); 1⟩

It is easy to extend Definition 8 to sets of atomic formulas. If S is a finite set of atoms, then a partial evaluation of S in P (also called a partial evaluation of P with respect to S) is the union of the partial evaluations of the elements of S in P. Moreover, the restriction to specialize atom goals is not a severe limitation in order to prevent the specialization of more complex goals, if we convey to specialize their components by separate^{5} . Given a program P and

5 However, it is necessary to admit that some opportunities to achieve a good specialization are lost. This can be avoided by introducing some particular techniques

a complex goal Q, assuming that S = {B_{1}, …, B_{n}} is the set of the atomic constituents of Q, the partial evaluation of Q in P is the partial evaluation of P with regard to S.

4 Reductants versus P E-reductants

In this section we recall from [17] the notion of reductant and, after establishing the relationship between the construction of reductants and techniques coming from the field of partial evaluation, we override the original definition by proposing our improved notion of P E-reductant. But let us firstly state the relevance of reductants and discuss more deeply the problems they introduce in the framework of multi-adjoint logic programming.

Reductancts were introduced in the context of multi-adjoint logic programming to cope with a problem of incompleteness that arises when dealing with some (non totally-ordered) lattices. In general, it might be not possible to compute the greatest correct answer (for a given goal and program) when considering a partially ordered lattice (L, ⪯) [17]. For instance, let a, b be two non comparable elements in L; assume that for a (ground) goal A there are only two (fact) rules (⟨A←; a⟩ and ⟨A←; b⟩) whose heads directly match with it; the first rule contributes with truth degree a, and derives the fuzzy computed answer a (with empty substitution); similarly, the second one contributes with b, and derives the fuzzy computed answer b; therefore, by the soundness theorem of multi-adjoint logic programming [17], both a and b are correct answers and hence, by definition of correct answer [17], the supremum (or lub, least upper bound) sup{a, b}, is also a correct answer; however, since there exists c = sup{a, b} in L, our computational principle, as described in Section 2.2, will never return c as a computed answer, thus implying that completeness would be lost. The above problem can be solved by extending the original program with an special rule ⟨A←sup{a, b}; ⊤⟩, the so called reductant, which allows us to obtain the supremum of all the computational contributions to A.

The above discussion shows that a multi-adjoint logic program, interpreted inside a partially ordered lattice, needs to contain all its reductants in order to guarantee the completeness property. This obviously increases both the size and execution time of the final “completed” program. However, this negative effects can be highly diminished if the proposed reductants have been partially evaluated before being introduced in the target program: the compu-

which are able to adequately reorder and split up complex goals into smaller pieces before considering them for specialization, as it has been proposed in the field of conjunctive partial deduction [25,26].

tational effort done (once) at generation time would be avoided (many times) at execution time. In what follows, we are interested in showing how a refined notion of a reductant can be constructed using PE techniques in order to solve the problems detailed before. The starting point is the original definition presented in [17], where the classical notion of reductant was initially adapted to the multi-adjoint logic programming framework in the following terms:

Definition 10 (Reductant [17]) Let P be a program, A a ground atom, and ⟨C_{i}←_{i} B_{i}; v_{i}⟩ the (non empty) set of rules in P whose head matches with A (i.e., there are θ_{i} such that A = C_{i}θ_{i}). A reductant for A in P is a rule ⟨A← @(B_{1}, …, B_{n})θ; ⊤⟩ where θ = θ_{1} ⋯ θ_{n}, ← is any implication with an adjoint conjunctor, and the truth function for the intended aggregator @ is defined as ˙@(b_{1}, …, b_{n}) = sup{v_{1} ˙&_{1}b_{1}, …, v_{n} ˙&_{n}b_{n}}.

Now we are going to show how Definition 10 can be improved, leading to a more flexible approximation to this concept, by using proper notions of partial evaluation. So, using an arbitrary unfolding tree, τ, for a program P and a ground atom A, it is possible to construct a more refined version of the notion of a reductanct which we call P E-reductant for A in P. The main novelty of the following definition (which generalizes a very close, precedent notion of P E-reductant, that we firstly introduced in [23]), is the fact that it is directly based on the set of leaves of a given unfolding tree. Similarly to the previous definition, in the sequel we assume that ← is the implication of any adjoint pair ⟨←, &⟩.

Definition 11 (P E-reductant) Let P be a program, A a ground atom, and τ an unfolding tree for A in P. A P E-reductant for A in P with respect to τ, is a rule ⟨A← @_{sup}(D_{1}, …, D_{n}); ⊤⟩, where the truth function for the intended aggregator @_{sup} is defined as ˙@_{sup}(d_{1}, …, d_{n}) = sup{d_{1}, …, d_{n}}, and D_{1}, …, D_{n} are, respectively, the leaves of τ.

Observe that our definition of P E-reductant respects the syntax of our extended language (Section 2.1), where truth degrees and adjoint conjunctions are really allowed in the body of program rules. As in the case of resultants, P E-reductants incorporate information about all the relevant aspects of the rules ⟨C_{i}←_{i} B_{i}; v_{i}⟩ used for the evaluation of the atom A: the truth degree v_{i}, the adjoint implication and conjunction operators, the computed substitutions and the instances of the bodies B_{i}. On the other hand, in the particular case in which the tree used in Definition 11 is unfolded only one step (assuming that {⟨C_{i}←_{i}B_{i}; v_{i}⟩ ∈ P | there is a θ_{i}, A = C_{i}θ_{i}} is the -nonempty- set of rules in P whose heads match with A) then, the resulting P E-reductant is the rule ⟨A←@_{sup}((v_{1}&_{1}B_{1})θ_{1}, …, (v_{n}&_{n}B_{n})θ_{n}); ⊤⟩, whose shape greatly mirrors Definition 10.

Example 12 Given the lattice ([0, 1], ⪯), where “⪯” is the usual order on real numbers, consider the following multi-adjoint logic program P:

\begin{matrix}R_{1} : ⟨p(a)←_{L} q(X, a); & 0.7⟩ \\ R_{2} : ⟨p(a)←_{G} s(Y); & 0.5⟩ \\ R_{3} : ⟨p(Y)← ; & 0.6⟩ \\ R_{4} : ⟨p(Y)←_{G} q(b, Y)&_{L} t(Y); & 0.8⟩ \end{matrix}  \begin{matrix}R_{5} : ⟨q(b, a)← ; & 0.9⟩ \\ R_{6} : ⟨s(a)←_{G} t(a); & 0.5⟩ \\ R_{7} : ⟨s(b)← ; & 0.8⟩ \\ R_{8} : ⟨t(a)←_{L} p(X); & 0.9⟩ \end{matrix}

The one-step unfolding tree for program P and atom p(a) is:

⟨p(a); id⟩ ; ⟨0.7&_{L}q(X_{1}, a); id⟩ R_{1}  ⟨0.5&_{G}s(Y_{2}); id⟩ R_{2}  ⟨0.6; {Y_{3}/a}⟩ R_{3}  ⟨0.8&_{G}(q(b, a)&_{L}t(a)); {Y_{4}/a}⟩ R_{4}

from which we obtain the P E-reductant:

⟨p(a) ← @_{sup}(0.7&_{L}q(X_{1}, a), 0.5&_{G}s(Y_{2}), 0.6, 0.8&_{G}(q(b, a)&_{L}t(a))); 1⟩.

On the other hand, it is important to contrast the similarities/ differences between this rule and the reductant that the application of Definition 10 would have produced: ⟨p(a) ← @(q(X_{1}, a), s(Y_{2}), 1, q(b, a)&_{L}t(a)); 1⟩, where ˙@ is defined by ˙@(b_{1}, b_{2}, b_{3}, b_{4}) = sup{0.7 ˙&_{L}b_{1}, 0.5 ˙&_{G}b_{2}, 0.6, 0.8 ˙&_{G}b_{4}}.

This particular case of P E-reductant which uses a one-step unfolding tree, conforms with the original definition of reductant appeared in [17]. In particular, the following result shows that both kinds of reductants are semantically equivalent^{6} , since they have the same value when they are interpreted.

Theorem 13 Let P be a program, A a ground atom and R ≡ ⟨A← @(B_{1}, …, B_{n})θ; ⊤⟩ the reductant for A in P, where θ = θ_{1} ⋯ θ_{n} and each substitution θ_{i} is a matcher of A and the head of a rule ⟨C_{i}←_{i} B_{i}; v_{i}⟩. The P E-reductant R′ ≡ ⟨A←@_{sup}(D_{1}, …, D_{n}); ⊤⟩ (where D_{i} ≡ v_{i}&_{i}B_{i}θ_{,} 1 ≤ i ≤ n) obtained from an unfolding tree of depth one for P and A, is semantically equivalent to the reductant R.

PROOF. In order to state the semantic equivalence between both notions of reductants it suffices to prove that I(@(B_{1}, …, B_{n})θ) = I(@_{sup}(D_{1}, …, D_{n})). First note that, the rules C_{i}←_{i} B_{i} whose head matches with A, are taken standardized apart. Moreover, the atom A is ground. Therefore, the substitutions θ_{i}, such that A = C_{i}θ_{i}, do not share variables in common either in

6 The procedural counterpart of this result is proved in Section 5 (see Theorem 18).

their domains or in their ranges. Hence, θ = θ_{1}θ_{2} ⋯ θ_{n} = θ_{1} ∪ θ_{2} ∪ ⋯ ∪ θ_{n}. Then:

I(@(B_{1}, …, B_{n})θ) = I(@(B_{1}θ, …, B_{n}θ))
= I(@(B_{1}θ_{1}, …, B_{n}θ_{n}))
= ˙@(I(B_{1}θ_{1}), …, I(B_{n}θ_{n}))
= sup{v_{1} ˙&_{1}I(B_{1}θ_{1}), …, v_{n} ˙&_{n}I(B_{n}θ_{n})}
= sup{I(v_{1}&_{1}B_{1}θ_{1}), …, I(v_{n}&_{n}B_{n}θ_{n})}
= sup{I(D_{1}), …, I(D_{n})}
= ˙@_{sup}(I(D_{1}), …, I(D_{n}))
= I(@_{sup}(D_{1}, …, D_{n})),

which concludes the proof.

It is noteworthy that a P E-reductant can be constructed by using the notion of unfolding tree in the following way.

Definition 14 (Construction of P E-reductants) Let P be a program and let A be a ground atomic goal. We can enumerate the following steps in the construction of a P E-reductant of A in P:

(1) Construct an unfolding tree, τ, for P and A, that is, the tree obtained by unfolding the atom A in the program.

(2) Collect the set of leaves S = {D_{1}, …, D_{n}} in τ.

(3) Construct the rule ⟨A ← @_{sup}(D_{1}, …, D_{n}); ⊤⟩, which is the PE-reductant of A in P with regard to τ.

The following example presents a P E-reductant obtained from an unfolding tree of depth 3 (all its branches have been unfolded no more than 3 steps).

Example 15 Let P be the program of Example 12 and consider atom p(a). In the next figure, nodes where normalization steps have been applied, producing additional nodes, are remarked by boxes.

⟨p(a); id⟩

⟨0.7&_{L}q(X_{1}, a); id⟩ R_{1}

\begin{matrix}⟨0.7&_{L}0.9; \{X_{1}/b\}⟩ \\ ⟨0.6; \{X_{1}/b\}⟩ \end{matrix} R_{5}

⟨0.5&_{G}s(Y_{2}); id⟩ R_{2}

⟨0.5&_{G}(0.5&_{G}t(a)); {Y_{2}/a}⟩ R_{6}

⟨0.5&_{G}(0.5&_{G}(0.9&_{L}p(X_{5}))); {Y_{2}/a}⟩ R_{8}

⟨0.5&_{G}0.8; {Y_{2}/b}⟩ ⟨0.5; {Y_{2}/a}⟩ R_{7}

⟨0.6; {Y_{3}/a}⟩ R_{3} ⟨0.8&_{G}(q(b, a)&_{L}t(a)); {Y_{4}/a}⟩ R_{4}

⟨0.8&_{G}(0.9&_{L}t(a)); {Y_{4}/a}⟩ R_{5}

⟨0.8&_{G}(0.9&_{L}(0.9&_{L}p(X_{6}))); {Y_{4}/a}⟩ R_{8}

After collecting the leaves of this unfolding tree, we obtain the following P Ereductant: ⟨p(a) ← @_{sup}(0.6, 0.5&_{G}(0.5&_{G}(0.9&_{L}p(X_{5}))), 0.5, 0.6, 0.8&_{G}(0.9&_{L} (0.9&_{L}p(X_{6})))); 1⟩.

Since this formulation is based on partial evaluation techniques, it can be seen as a method that produces a specialization of a program with respect to an atomic goal which, in particular, means that it is able to compute the greatest correct answer for that goal too. Moreover, although for the same program P and a ground atom A, it is possible to derive distinct reductants, depending on the precision of the underlying unfolding tree, we claim the remarkable fact that all of them are able to compute the same greatest correct answer for the ground goal A.

To finish this section, we wish to introduce a brief comment about our running examples. We have seen that PE techniques are in general useful for different software engineering purposes, independently of the partial/total ordering among the elements of the underlying lattices associated to fuzzy programs. For the sake of simplicity, all the previous examples, specially those illustrating the generation of unfolding trees in Sections 3 and 4, only consider the simple case corresponding to lattice ([0, 1], ≤). However, as we also advanced in the introduction section, (PE-)reductants are really interesting only when we consider partially ordered lattices. For this reason, all the examples we provide in the sequel use this kind of more complex lattices.

5 Formal Properties of P E-reductants

In this section we establish the formal correctness properties of P E-reduc-tants, starting with the procedural properties and following with their semantic counterparts.

As we have seen in the previous section, it is important to note that the original notion of reductant as well as our improved definition of P E-reductant, are both referred to ground atoms. On the other hand, the substitution component of any fuzzy computed answer, for a given ground atom A, is irrelevant. So, in this section, we will take advantage of these facts when defining and formally proving our main results. In particular, in what follows, we will use with no risk a simpler version (where the second component —substitution— of a f.c.a. is dropped out) of the notions of FCA and [[FCA]] introduced in Section 2. That is, from now, FCA(E) = {r ∈ L | ⟨E; id⟩ →_{AS/IS}^{∗} ⟨r; σ⟩}, whereas [[FCA]](E) is the total sum of admissible/interpretive steps needed to generate the whole set FCA(E).

Moreover, for readability reasons too, in the sequel we will use the words P E^{1}- reductant and P E^{k}-reductant for referring to those P E-reductants which are obtained from unfolding trees of depth 1 and depth k, respectively.

5.1 Procedural Correctness and Efficiency

This section is devoted to establish that the classical notion of reductant, according Definition 10, the P E^{1}-reductant and the P E^{k}-reductant contribute with the same fuzzy computed answer for a ground goal A in a program P and, therefore, they can be considered equivalent under a procedural point of view. In addition, we will also prove that the notion of P E^{k}-reductant is more efficient than the one defined in [17], in the sense that, by using a P E^{k}- reductant we can obtain fuzzy computed answers for a given goal with a lesser computational effort than by using the ordinary reductans of [17]. In order to achieve this goal, we firstly formalize the following preparatory result.

Lemma 16 Given an unfolding tree τ for a program P and a ground atom A, let E_{1} and E_{2} be expressions (nodes) of τ, such that there exists a one-step derivation of the form E_{1} →_{AS/IS} E_{2}. Then,

(1) FCA(E_{2}) ⊆ FCA(E_{1}), and

(2) [[FCA]](E_{2}) < [[FCA]](E_{1}).

PROOF. We prove each claim of the Lemma separately:

(1) It suffices to show that, for each value r ∈ FCA(E_{2}), then r ∈ FCA(E_{1}). By hypothesis, there exists a one-step derivation D : ⟨E_{1}; id⟩ →_{AS/IS} ⟨E_{2}; σ⟩ and moreover, since r ∈ FCA(E_{2}), there also exists a derivation D′ : ⟨E_{2}; id⟩ →_{AS/IS}^{∗} ⟨r; σ′⟩. Now, by composing both derivations D and D′, we have the new derivation D′′ : ⟨E_{1}; id⟩ →_{AS/IS} ⟨E_{2}; σ⟩ →_{AS/IS}^{∗} ⟨r; σσ′⟩, which justifies that r ∈ FCA(E_{1}), as we wanted to prove.

(2) This claim trivially follows from the fact that the previous derivation D′′ has just one step more (the first one, associated to D) than D′, that is length(D′) < length(D) + length(D′) = 1 + length(D′) = length(D′′), which directly implies that [[FCA]](E_{2}) < [[FCA]](E_{1}).

The following proposition proves that, given an unfolding tree of a ground atom A and a program P, the set of fuzzy computed answers of a node (state) E is the union of the sets of fuzzy computed answers of its successor states (that is, those nodes obtained from E after executing an admissible or interpretive step).

Proposition 17 Given an unfolding tree τ for a program P and a ground atom A, containing at least one non-root node, let E be an expression (node) of τ and let U(E) = {E′ | E →_{AS/IS} E′} be the set of successors of E. Then, FCA(E) = ⋃_{E_{i}∈U(E)} FCA(E_{i}).

PROOF. If E is not a value of L and for a certain index i there is a step E →_{AS/IS} E_{i}, by the first claim of Lemma 16, we have that FCA(E_{i}) ⊆ FCA(E) and, by definition of union, we can conclude that

⋃_{E_{i}∈U(E)} FCA(E_{i}) ⊆ FCA(E)

On the contrary, if r ∈ FCA(E), we shall prove that r is a f.c.a. of the set ⋃_{E_{i}∈U(E)} FCA(E_{i}). Since r ∈ FCA(E), there exists a derivation E →_{AS/IS}^{n} r, for which we consider two cases:

- if n = 0, then E is a value of L and the result vacuously holds.

- if n > 0, let E_{j} be the expression verifying ⟨E; id⟩ →_{AS/IS} ⟨E_{j}; σ⟩ →_{AS/IS}^{n−1} ⟨r; θ⟩. Then, r ∈ FCA(E_{j}) ⊆ ⋃_{E_{i}∈U(E)} FCA(E_{i}), as we wanted to prove.

Now, we are ready to prove the first main result of this section, which is perfectly symmetrical to Theorem 13, but focusing now in procedural aspects instead in semantic notions. More exactly, we prove that the reductant considered in Definition 10 and the P E^{1}-reductant are procedurally equivalent.

Theorem 18 Let P be a program, A a ground atom and R ≡ ⟨A← @(B_{1}, …, B_{n})θ; ⊤⟩ the reductant for A in P, where θ = θ_{1} ⋯ θ_{n} and each substitution θ_{i} is a matcher of A and the head of a rule ⟨C_{i}←_{i} B_{i}; v_{i}⟩. The P E^{1}-reductant R′ ≡ ⟨A←@_{sup}(D_{1}, …, D_{n}); ⊤⟩ (where D_{i} ≡ v_{i}&_{i}B_{i}θ_{,} 1 ≤ i ≤ n) obtained from an unfolding tree of depth one for P and A, is procedurally equivalent to the reductant R.

PROOF. In order to state the procedural equivalence between both notions of reductants it suffices to prove that FCA(@(B_{1}, …, B_{n})θ) = FCA(@_{sup}(D_{1}, …, D_{n})). Due to Proposition 17, if we first perform all the admissible steps with the P E^{1}-reductant before performing the interpretive ones, we obtain with both reductants the same admissible computed answers (for atom A). Moreover, by the strong correctness of the transformation of interpretive unfolding (see [18]), the interpretive phase considered in [17] leads to the same fuzzy computed answers than the execution of all the interpretive steps defined in [18].

Till here, we have connected the notion of classical reductant with the one of P E^{1}-reductant, by proposing equivalence results at a semantic and a procedural level (Therorems 13 and 18, respectively). From here, our interest is also to establish equivalence links between P E^{1}-reductants and P E^{k}-reductants (Theorem 19). Moreover, we also show that as much a P E-reductant is partially evaluated, the gains in efficiency are more relevant at execution time (Theorem 20).

The following result shows, in a simple formulation, that the f.c.a.’s of the expressions in the leaves of an unfolding tree associated to the P E^{1}-reductant, for a ground atom A in a program P, coincide with the f.c.a.’s of the expressions in the leaves of an unfolding tree associated to the P E^{k}-reductant. Therefore, the P E^{1}-reductant and the P E^{k}-reductant are procedurally equivalent.

Theorem 19 (Procedural Correctness) If R^{1} = ⟨A← @_{sup}(D_{1}, …, D_{n}); ⊤⟩ and R^{k} = ⟨A← @_{sup}(D′_{1}, …, D′_{m}); ⊤⟩ are, respectively, the P E^{1}-reductant and the P E^{k}-reductant for a ground atom A in a program P, then, R^{1} and R^{k} are procedurally equivalent, that is, FCA(D_{1}, …, D_{n}) = FCA(D′_{1}, …, D′_{m}).

PROOF. By Proposition 17, we know that FCA(A) = FCA(D_{1}, …, D_{n}) = FCA(D_{1}) ∪ ⋯ ∪ FCA(D_{n}) and also, each FCA(D_{i}) = FCA(B_{i_{1}}, …, B_{i_{r}}), where B_{i_{1}} , …, B_{i_{r}} are all the successors of D_{i}, which are the formulas in body of the P E^{2}-reductant. Following this way as far as reaching the nodes of depth k, we obtain FCA(A) = FCA(D′_{1}, …, D′_{m}) and the result is verified.

And now, we are able to introduce the following result which complements the previous one by confirming the gains in efficiency achieved by P E^{k}-reductants in comparison with P E^{1}-reductants.

Theorem 20 (Procedural Efficiency) If R^{1} = ⟨A← @_{sup}(D_{1}, …, D_{n}); ⊤⟩ and R^{k} = ⟨A← @_{sup}(D′_{1}, …, D′_{m}); ⊤⟩ are, respectively, the P E^{1}-reductant and the P E^{k}-reductant of a ground atom A in a program P, then, R^{k} is more efficient than R^{1} when k>1, that is, [[FCA]](D_{1}, …, D_{n})>[[FCA]](D′_{1}, …, D′_{m}).

PROOF. This proof is perfectly analogous to the previous one used in Theorem 19, but also exploiting now the second claim (instead of the first one) of Lemma 16.

To finish this section, in the following corollary we connect at a procedural level (as a direct consequence of Theorems 18 and 19) the notion of classical reductant and our improved definition of P E^{k}-reductant.

Corollary 21 Let R = ⟨A← @(B_{1}, …, B_{n}); ⊤⟩, and R^{k} = ⟨A←@_{sup}(D_{1}, …, D_{m}); ⊤⟩ be, respectively, a reductant according Definition 10 and a P E^{k}-re-ductant of a ground atom A in P. Then R and R^{k} are procedurally equivalent, that is, FCA(@(B_{1}, …, B_{n})) = FCA(@_{sup}(D_{1}, …, D_{m})).

In the following sub-section we plan to reach a similar result to the previous corollary, but focusing now in semantic properties.

5.2 Semantic Correctness

In Theorem 13 we proved that the concept of an ordinary reductant (see Definition 10) and the notion of P E^{1}-reductant, were semantically equivalent. Now we are going to establish that the interpretation of the P E^{1}-reductant is greater or equal than the interpretation of the P E^{k}-reductant (and therefore, by transitivity, we will show that the interpretation of an ordinary reductant will be greater or equal than the interpretation of the P E^{k}-reductant). Surprisingly (at least when compared with pure logic programming), this is the strongest result we can achieve in the fuzzy setting, as we are going to detail in what follows.

In order to obtain this result, we need to introduce the immediate consequence operator, T_{P}, defined by van Emden and Kowalski, and extended in [17] for the framework of multi-adjoint logic programming.

Definition 22 Let P be a multi-adjoint program, I an interpretation and A a ground formula. We define the operator T_{P} as a mapping in the set of interpretations such that for each ground atom A

T_{P}(I)(A) = sup{v ˙&_{i}I(Bθ) | ⟨C←_{i}B; v⟩ ∈ P, A = Cθ}

This operator allows us to formalize the semantics of themulti-adjoint programs: the semantics of a program P is defined as the least fix point of T_{P}. It is possible to prove that the operator T_{P} fulfills the following suitable property [17]: an interpretation I is a model of a multi-adjoint program P if, and only if, T_{P}(I) ⊆ I. Therefore, for every model I of P we have that

T_{P}(I)(A) = sup{v ˙&_{i}I(Bθ) | ⟨C←_{i}B; v⟩ ∈ P, A = Cθ} ≤ I(A)

Thus, the interpretation of a ground atom A, by a model I of P, is greater or equal than the interpretation of the body of the P E^{1}-reductant corresponding to this atom.

Moreover, in general, the equality T_{P}(I)(A) = I(A) does not hold. Roughly speaking, it tells us that “as much as an atom is evaluated/interpreted, its truth degree might even decrease”. The following example illustrates this fact.

Example 23 Let P be the following program, where A, B are any ground atoms; let (L, ≤) be the multi-adjoint lattice associated to P described by the diagram of the figure below, in which we have also included the unfolding tree for A in P. Let (&, ←) be the adjoint pair in (L, ≤) collected from the Gödel intuistionistic logic, such that the truth functions for & and ← are defined

respectively by ˙&(x, y) = inf\{x, y\} and ˙←(y, x) = \{ \begin{matrix}⊤, & if x ≤ y \\ y, & otherwise \end{matrix}

\begin{matrix}R_{1} : ⟨A← B; & α⟩ \\ R_{2} : ⟨A← ; & β⟩ \end{matrix}  \begin{aligned}& ⊤ \\ & γ \\ α & & β \\ & ⊥ \end{aligned}  ⟨A; id⟩ ; ⟨α&B; id⟩ R_{1}  ⟨β; id⟩ R_{2}

Then, for every interpretation I : B_{P} ⟶ L such that I(A) = ⊤, I(B) = γ, I is a model of P since α ˙&I(B) ≤ I(A), β ≤ I(A) and, moreover, it fulfills: T_{P}(I)(A) = sup{α ˙&I(B), β} = sup{inf{α, γ}, β} = sup{α, β} = γ < ⊤ = I(A).

The following Lemma will allow us to relate the interpretation of the body of the P E^{1}-reductant to the one of the body of the P E^{2}-reductant, and as a consequence, with the interpretation of the body of the P E^{k}-reductant.

Lemma 24 Let A be a ground atom that matches with the head of the rules ⟨C_{1}←_{1}B_{1}; v_{1}⟩, …,⟨C_{i}←_{i}B_{i}; v_{i}⟩, …, ⟨C_{r}←_{r}B_{r}; v_{r}⟩ in P (substitution θ_{i} being such that C_{i}θ_{i} = A, one of the matchers). Assume that formula B_{i}θ_{i} unifies with the head of rules ⟨H_{1}←^{1}D_{1}; u_{1}⟩, …, ⟨H_{s}←^{s}D_{s}; u_{s}⟩ in P. Then, if I is a model of P, L_{2} ≤ L_{1}, where:

• L_{1} = sup{v_{1} ˙&_{1}I(B_{1}θ_{1}), …, v_{i} ˙&_{i}I(B_{i}θ_{i}), …, v_{r} ˙&_{r}I(B_{r}θ_{r})}

• L_{2} =sup{v_{1} ˙&_{1}I(B_{1}θ_{1}), …, v_{i} ˙&_{i}(u_{1} ˙&^{1}I(D_{1}σ_{1})), …, v_{i} ˙&_{i}(u_{s} ˙&^{s}I(D_{s}σ_{s})), …, v_{r} ˙&_{r}I(B_{r}θ_{r})}

Moreover, I(A) ≥ T_{P}(I)(A) ≥ sup{v_{1} ˙&_{1}I(B_{1}θ_{1}), …, v_{i} ˙&_{i}(u_{1} ˙&^{1} I(D_{1}σ_{1})), …, v_{i} ˙&_{i}(u_{s} ˙&^{s}I(D_{s}σ_{s})), …, v_{r} ˙&_{r}I(B_{r}θ_{r})}.

PROOF.

Since the atom B_{i}θ_{i} unifies with the head of all the rules ⟨H_{1}←^{1}D_{1}; u_{1}⟩, …, ⟨H_{s}←^{s}D_{s}; u_{s}⟩, there is θ_{j} such that (B_{i}θ_{i})θ_{j} = H_{j}θ_{j}, for each j = 1, …, s. By the adjoint property, a model interpretation I of P fulfills that u_{j} ˙&_{j}I(D_{j}θ_{j}) ≤ I(H_{j}θ_{j}) = I((B_{i}θ_{i})θ_{j}) ≤ I(B_{i}θ_{i}) for all j = 1, …, s and, since & is increasing in both arguments, we have that v_{i} ˙&_{i}(u_{j} ˙&_{j}I(D_{j}θ_{j})) ≤ v_{i} ˙&_{i}I(B_{i}θ_{i}). By definition of least upper bound, it turns out that sup{v_{i} ˙&_{i}(u_{1} ˙&^{1}I(D_{1}σ_{1})), …, v_{i} ˙&_{i}(u_{s} ˙&^{s}I(D_{s}σ_{s}))} ≤ v_{i} ˙&_{i}I(B_{i}θ_{i}) and therefore L_{2} ≤ L_{1}.

Finally, if I is a model of P, we have I(A)≥T_{P}(I)(A) ≥ sup{v_{1} ˙&_{1}I(B_{1}θ_{1}), …, v_{i} ˙&_{i}(u_{1} ˙&^{1}I(D_{1}σ_{1})), …, v_{i} ˙&_{i}(u_{s} ˙&^{s}I(D_{s}σ_{s})), …, v_{r} ˙&_{r}I(B_{r}θ_{r})}, using the inequality L_{1} ≥ L_{2}.

Observe that rule ⟨A← @_{sup}(v_{1}&_{1}B_{1}θ_{1}, …, v_{i}&_{i}B_{i}θ_{i}, …, v_{r}&_{r}B_{r}θ_{r}); ⊤⟩, associated with expression L_{1}, is a P E^{1}-reductant for the ground atom A in P, and rule ⟨A← @_{sup}(v_{1}&_{1}B_{1}θ_{1}, …, v_{i}&_{i}(u_{1}&^{1}D_{1}σ_{1}), …, v_{i}&_{i}(u_{s}&^{s}D_{s}σ_{s}), …, v_{r}&_{r}B_{r}θ_{r}); ⊤⟩, associated with expression L_{2}, is a P E^{2}-reductant.

If R^{1} = ⟨A← @_{sup}(D_{1}, …, D_{n}); ⊤⟩, R^{2} = ⟨A← @_{sup}(D′_{1}, …, D′_{m}); ⊤⟩ are, respectively, a P E^{1}-reductant and a P E^{2}-reductant of a ground atom A in a program P , then, as the following example shows, I(@_{sup}(D_{1}, …, D_{n})) and I(@_{sup}(D′_{1}, …, D′_{m})) do not coincide in general (in concordance with the fact we pointed out at the beginning of this section).

Example 25 Let P be the following program, where A and B are any ground atoms; let (L, ≤) be the multi-adjoint lattice associated to P described by the diagram of the figure below and consider again the adjoint pair based on the Gödel intuistionistic logic used in Example 23.

\begin{matrix}R_{1} : ⟨A← B; & α⟩ \\ R_{2} : ⟨A← ; & β⟩ \\ R_{3} : ⟨B← ; & β⟩ \end{matrix}  \begin{aligned}& ⊤ \\ α & & β \\ & ⊥ \end{aligned} ⟨A; id⟩ ; ⟨α&B; id⟩ R_{1} \begin{matrix}⟨α&β; id⟩ \\ R_{3} \end{matrix}  ⟨β; id⟩ R_{2}

Then, given an interpretation I : B_{P} ⟶ L such that I(A) = I(B) = ⊤, I is a model of P since α ˙&I(B) ≤ I(A), β ≤ I(A), β ≤ I(B). Moreover, the P E^{1}-reductant is the rule ⟨A← @_{sup}(D_{1}, D_{2}); ⊤⟩ = ⟨A← @_{sup}(α&B, β); ⊤⟩ and the P E^{2}-reductant the rule ⟨A← @_{sup}(D′_{1}, D′_{2}); ⊤⟩ = ⟨A← @_{sup}(α&β, β); ⊤⟩, which fulfills: I(@_{sup}(D′_{1}, D′_{2})) = sup{α ˙&β, β} = sup{inf{α, β}, β} = sup{⊥, β} = β < ⊤ = sup{α, β} = sup{inf{α, ⊤}, β} = sup{α ˙&I(B), β} =I(@_{sup}(D_{1}, D_{2})).

The following result complements at a semantic level the (procedural) Theorem 19 by generalizing Lemma 24 and relating the interpretation (within a model of P) of the bodies of P E^{1}-reductants and P E^{k}-reductants (for ground atom A).

Theorem 26 (Semantic Correctness) If R^{1} = ⟨A← @_{sup}(D_{1}, …, D_{n}); ⊤⟩ and R^{k} = ⟨A← @_{sup}(D′_{1}, …, D′_{m}); ⊤⟩ are, respectively, the P E^{1}-reductant and the P E^{k}-reductant of a ground atom A in a program P, then, R^{1} and R^{k} fulfills I(@_{sup}(D_{1}, …, D_{n})) ≥ I(@_{sup}(D′_{1}, …, D′_{m})) where I is a model of P.

PROOF. The proof is made by recurrence. By Theorem 24, if I is a model of P, I(@_{sup}(D_{1}, …, D_{n})) = L_{1} ≥ L_{2} = I(@_{sup}(B′_{1}, …, B′_{r})), where R′ = ⟨A← @_{sup}(B′_{1}, …, B′_{r}); ⊤⟩ is the P E^{2}-reductant. Iterating the process k − 1 times (by unfolding, in every step, the formulas in the body of the reductant that has been obtained in the previous step), we have that I(@_{sup}(D_{1}, …, D_{n})) ≥ I(@_{sup}(D′_{1}, …, D′_{m})) where rule R′ = ⟨A← @_{sup}(D′_{1}, …, D′_{m}); ⊤⟩ is the P E^{k}-reductant, which concludes the proof.

We finish this section in a similar way to the previous one, by proposing the following corollary which this time connects at a semantic level (as a direct consequence of Theorems 13 and 26) the notion of classical reductant and our improved definition of P E^{k}-reductant.

Corollary 27 Let R ≡ ⟨A← @(B_{1}, …, B_{n}); ⊤⟩ and R^{k} ≡ ⟨A←@_{sup}(D_{1}, …, D_{m}) ; ⊤⟩ be, respectively, a reductant according Definition 10 and a P E^{k}-re-ductant, k ≥ 1, of a ground atom A in a program P. Then, R and R^{k} fulfills I(@(B_{1}, …, B_{n})) ≥ I(@_{sup}(D_{1}, …, D_{m})).

6 Final Discussion

This section is devoted to relate both the underlying language and the transformation techniques presented in this work with other approaches appeared in the literature. At the same time, we also plan to provide some implementation issues regarding our proposal.

\underline{Underlying language}. As it was commented, our work is concerned with the introduction of partial evaluation techniques for specializing programs and computing efficient reductants. The selection of the underlying language (based in the multi-adjoint logic programming approach of [15–17]) has been mainly motivated by its high level of expressiveness as well as for its clear procedural semantics. The first point is useful for increasing the relevance and generality of our results, also contributing to a broader dissemination, whereas the second point is crucial to effectively define our transformations (in particular, for a formal definition of unfolding rules and partial evaluation techniques, a procedural semantics formalized in terms of a state transition system seems to be mandatory).

Regarding expressiveness, the multi-adjoint logic programming approach represents an extremely flexible fuzzy framework based on weighted rules, which largely improves older approaches previously introduced in this field (see, for instance, the Prolog–Elf system of [27], the Fril system of [28] and the fuzzy variants of Prolog proposed in [29–31]). Moreover, in [32]^{7} , the authors justify the need for considering such a very abstract framework in order to be able to state and prove general results on termination, fix-point semantics, query answering procedures, etc..., which can apply to several apparently distinct settings such as van Emden’s Quantitative Deduction, Possibilistic Logic Pro-

7 In this last work, a sorted version of the multi-adjoint logic language is proposed. This extension does not seriously affect our techniques and therefore, in order to preserve the readability of this paper and our methods, we postpone their adaptation to the sorted case as future work.

gramming, Non-classical SLD resolution, Ordinary Probabilistic Logic Programs and Probabilistic Deductive Databases.

Due to the increasing interest in models of reasoning under “imperfect” information, we have observed, in recent years, the proliferation of an enormous number of proposals for the integration of approximate reasoning into the context of (classical) Logic Programming. Consequently, there exist some cases not fully covered by the multi-adjoint logic approach. These are, for instance, the cases of similarity-based [33] and annotated [34] logic programming. Nevertheless, for the first case, we can find in [17] some (theoretical) analysis establishing nice correspondences between both languages. In particular, it can be proved that the effects of the similarity-based unification/resolution methods of [33] can be somehow replicated (at a theoretical level) by applying the procedural mechanism seen here on multi-adjoint logic programs augmented with special weighted rules which simulate similarity equations. On the other hand, for the annotated logic programs of [34] and specially, for the more recent (and much easier in its formulation) version of [35], we need to make a more detained analysis.

In contrast with [35], most of the reported approaches (including the multiadjoint logic one^{8} ) exhibit an important limitation, as they do not address any mode of non-monotonic negation. We can compare this approach with the one used along this paper at the following levels:

• Expressiveness. Apart from the fact that in the multi-adjoint logic approach the discussion is centered on the monotonic case, ignoring default negation, the underlying notion of lattice is different from the concept of bilattice [36]. Bilattices are slightly more general structure than lattices. They are able to cope with non-monotonic negation and provide an elegant, powerful way for combining belief and doubt degrees on program rules. Although this gap of the multi-adjoint framework has been alleviated in [37] by considering multiple sorts via the so called multi-lattices, the proposed treatment seems to be anyway weaker than the one carried out in [35].

• Syntax. Program rules in [35] have the form A ← f(B_{1}, …, B_{n}) where f is an operator interpreted as a computable truth combination function, whereas A and B_{i} are atoms. Note that this syntax is very close to the one used in the multi-adjoint logic approach, where as explicitly said in [32] “sometimes, we will represent bodies of formulas as @[B_{1}, …, B_{n}], where ... @ is the monotone aggregator obtained as a composition”^{9} . As seen so far, both approaches are quite similar from a syntactic point of view, apart

8 In [32], authors claim that they “have already started the research in this direction”. 9 See also [38], where we provide a transformation operation called “aggregation” which automatically adapts program rules to this clearer shape.

from the different representation of lattices commented before. However, no function symbols (apart of constants) are allowed in [35] where to ease the presentation, the attention is limited to the propositional case (authors argue that the “first order case can be handled by grounding”).

• Procedural semantics. Maybe the major differences between both approaches, emerge at the procedural semantics level. We have seen that the formalization (as a transition system) presented in sub-section 2.2 was crucial for effectively defining the construction of unfolding trees in Section 3. In [35] a general top-down query answering procedure for normal logic programs over lattices and bilattices is provided. The method could be understood as a procedural semantics for such kind of programs, and has the advantage that it can be instantiated for “mirroring” differen semantics (as the Kripke-Kleene and the Well-Founded semantics) when evaluating goals. Unfortunately, the query answering procedure is presented in an algorithmic way which is far away from the desirable transition-system like formulation traditionally used in program transformation tasks.

Now, putting together all the pieces presented before, we can extract the following three conclusions: i) the framework of [35] is a challenging approach for which (once surpassed the propositional case and/or allowed the presence of function symbols in its syntax) we are interested in the adaptation of our partial evaluation techniques in order to capture important expressive resources including non-monotonic negation; ii) in order to do this, it is mandatory to previously investigate in new re-formulation ways of its procedural semantics and query answering mechanisms; and iii) we think that the experience we can accumulate developing the techniques proposed in this paper (for the multiadjoint logic approach), will largely help us to generalize our results to the alternative fuzzy framework of [35] in the near future.

\underline{Tabulation techniques}. As it was reported in [35], any logic programming language should be accompanied with query answering procedures. In this paper we are not directly concerned with this subject, having into account that our main goals are twofold: i) to specialize programs; and ii) to generate sophisticated (partially evaluated) reductants which, once added to original programs, contribute to a correct, complete and efficient evaluation of goals using the procedural semantics described in sub-section 2.2. Nevertheless, inspired by the tabulation goal-oriented query procedure presented in [39,40] (for residuated and multi-adjoint logic programs) and extended in [32] (for sorted multi-adjoint logic programs), we think that it is possible to improve the efficiency of both, PE-reductant calculus and query answering w.r.t. those programs generated by our partial evaluation techniques.

The underlying idea of tabulation (tabling, or memoising) is, essentially, that atoms of selected tabled predicates as well as their answers are stored in a table. When an identical atom is recursively called, the selected atom is not resolved against program clauses; instead, all corresponding answers computed so far are looked up in the table and the associated answer substitutions are applied to the atom. The process is repeated for all subsequent computed answer substitutions corresponding to the atom.

Tabulation methods have been largely used in the past to increase the efficiency of proof procedures. The usual SLD based implementations of Fuzzy Logic Programming languages (e.g. [30]) are goal-oriented and inherit the problems of non-termination and re-computation of goals. For grappling with these problems, tabulation implementation techniques have been proposed in the deductive databases and logic programming communities. More recently, an extension of SLD for implementing generalised annotated logic programs has been proposed in [34,41]. Following these ideas, the tabulation goal-oriented query procedure provided in [32] is accompanied with interesting termination results considering a significant class of sorted multi-adjoint logic programs but only applicable to ground goals^{10} .

It is important to note that in [32] complete trees are generated for executing goals; hence, the termination results provided there are mandatory. However, the use of tabulation techniques is neither directly dependent on the shape of the generated trees (finite or infinite, partial or complete) nor on their final use (query answering, goal solving, program transformation, partial evaluation, etc.). On the other hand, partial evaluation techniques are also based on the generation of (incomplete) search trees. Therefore, the more intelligent the method for generating trees is (by using, for instance, tabulation or thresholding techniques), the more efficient will be the final application of such trees in practice. So, we think that tabulation techniques can be successfully embedded inside a transformation task such as the partial evaluation method we are dealing with.

In particular, the calculus of partial unfolding trees presented in Section 3 admits a tabulation based reformulation near to the one proposed in [32], but with the advantage in our case that since we simply generate partial trees during the PE process, we are not directly limited for any termination constraint. In this sense, we also plan to take advantage of the experience acquired in [42], where we introduced thresholding techniques for dynamically reducing the size of unfolding trees. Our thresholding techniques have some correspondences with the tabulation method used in [32] in the sense that we also store/update/compare the current best truth degree associated to a given (first order) atom when building its associated (partial) unfolding tree. Anyway, more research is needed to relate tabulation and thresholding

10 In [32], although it is argued that there is no loss of generality since infinite programs are allowed, authors also make the claim that it is important to extend this technique to the first order case as future work.

if we really want to take profit of their simultaneous use when computing reductants, specializing programs and solving goals in the multi-adjoint logic setting. In this sense, some prioritary lines of future work are:

• The techniques presented so far here as well as those described in [42] can be extended to cope with the possibility of tabulating several thresholds instead of a single one^{11} .

• Our experience in managing trees where nodes contain atoms with variables, might help to lift the tabulation method of [32] to both, the non-ground case and the first-order case.

• Finally, we also think that the proper tabulated query answering procedure of [32] admits an almost immediate characterization as a procedural semantics muc more efficient than the one we have used along this paper.

Regarding this last point, we think that such (tabulation based) procedural semantics can be conceived as an state transition system, where states might contain tree forest instead of simple goals: the great amount of information provided by forest will be the key point for to efficiently formulate the new improved procedural mechanism.

\underline{Implementation issues}. As we announced in [18], the implementation of a prototype interpreter/compiler for the multi-adjoint logic language was a prioritary task proposed as future work. In [43] we have recently reported our preliminary results in such direction, also describing a powerful method for translating fuzzy programs into directly executable standard Prolog code. The final goal is that the compiled code be executed in any Prolog interpreter in a completely transparent way for the final user, i.e., our intention is that after introducing fuzzy programs and fuzzy goals to the system, it be able to return fuzzy computed answers (i.e., pairs including truth degrees and substitutions) even when all intermediate computations have been executed in a pure (not fuzzy) logic programming environment.

Our approach is somehow inspired by [31], where an interpreter conceived using Constraint Logic Programming over real numbers (CLP (R)) has been efficiently implemented for a fuzzy logic language close to ours. Anyway, we use the Prolog programming language without considering a CLP (R) extension, since it suffices for implementing our ideas. Nowadays, our systems only deals with programs focusing in a simple lattice whose carrier set is the real interval [0, 1] and the connectives are collected from standard fuzzy logic (as the product, Łukasiewicz and Gödel intuitionistic logic). Although the expres-

11 Note that in our case, since unfolding trees have been mainly used for computing reductants, we only needed to generate a single tree for a given atom. However, in the general case, when partial evaluation techniques are used for specialization purposes, they really generate tree forest, which implies the need for tabulating several values as it is similarly done in [32].

sive power of our preliminary implementation is rather limited, a high-priority task for future developments will be to let our system accept fuzzy programs as well as multi-adjoint lattices in a parametric way, which implies the design of appropriate protocols, interfaces, etc.

We have used Sicstus Prolog v.3.12.5 for executing fuzzy programs once translated to Prolog code, as well as for implementing the proper tool. Our parser has been developed by using the classical DCG’s (Definite Clause Grammars) resource of the Prolog language, since it is a convenient notation for expressing grammar rules. The application contains about 300 clauses and once it is loaded inside a Prolog interpreter (in our case, Sicstus Prolog), it shows a menu which includes (among others) options for:

• Loading a prolog file with extension `.pl'. This action is useful for reading a file containing a set of clauses implementing aggregators, user predicates, etc. Nevertheless, the original connectives of the Product, Gödel and Łukasiewicz logic, expressed in the Prolog style seen in the previous section, are defined in file prelude.pl, which is automatically loaded by the system at the beginning of each work session.

• Parsing a fuzzy program included in a file with extension `.fpl'. In order to simultaneously perform the parsing process with the code generation, each parsing predicate used in DCG’s rules, has been augmented with a variable as extra argument which is intended to contain the Prolog code generated after parsing the corresponding fragment of fuzzy code.

• Listing the set of Prolog clauses loaded from a `.pl' file as well as those ones obtained after compiling an `.fpl' file. Of course, the original fuzzy program contained in this last file is also displayed.

• Saving the resulting Prolog code into a file, and finally

• Executing a fuzzy goal after being introduced from the keyboard.

Therefore, our implementation system translates a multi-adjoint logic program and goal to standard Prolog code, allowing the execution of fuzzy programs inside a classical logic programming environment. A detailed explanation of the implementation techniques we use can be found in [43].

It is important to note that, in our implementation system, all internal computations (including compiling and executing) are pure Prolog derivations whereas inputs (fuzzy programs and goals) and outputs (fuzzy computed answers) have always a fuzzy taste, which generates the illusion on the user of being working with a purely fuzzy tool. However, when trying to go beyond goal solving and program execution, our method becomes insufficient. In particular, observe that we can only simulate complete fuzzy derivations (by performing the corresponding Prolog derivations based on SLD-resolution) but we can not generate partial derivations or even apply a single admissible/interpretive step on a given fuzzy expression. This kind of low-level manipulations are mandatory when trying to incorporate to the tool mechanisms for generating derivations of a fixed number of steps, rearranging the body of a program rule, applying substitutions to its head, etc... in order to implement some program transformation techniques such as the ones presented in this paper as well as those described in [20,18,42].

To achieve this aim, we have conceived a new low-level representation for the fuzzy code: each parsing predicate used in DCG’s rules (which already contains a parameter allocating the Prolog code obtained after the compilation process) has also been augmented with a second extra argument for storing now the new representation associated to the corresponding fragment of parsed fuzzy code. Details on such low-level representation of the fuzzy code can be found in [43]. Anyway, although the new method allows us nowadays to build unfolding trees with any level of depth (observe that the correct manipulation of the leaves of this kind of partially evaluated trees, opens the door to produce unfolded rules, specialized program, PE-reductants, and so on), we continue investigating on new implementation methods for extending the tool. In particular, we are nowadays studying the recent proposal presented in [32], where an implementation of the tabulation procedure discussed before is underway using the GAP package of XSB Prolog, as well as a distributed implementation for the use in the Semantic Web.

7 Conclusions and Further Research

In this work we have defined, for the first time, a partial evaluation technique for multi-adjoint logic programs. We have shown its capability to specialize programs, as it happens in other (declarative) programming contexts. Moreover, we have introduced a method for computing reductants based on partial evaluation techniques, which constitutes a novel application for the multiadjoint logic programming framework. The established relationship between reductants and its refined construction by means of partial evaluation techniques, is an important issue if we really want to build complete and efficient systems for the multi-adjoint logic programming framework. Such relationships have been strengthened as much as possible, by providing formal proofs regarding procedural and semantic correctness results, as well as efficiency criteria.

As we advanced in the previous section, there are several ways for extending and improving the partial evaluation framework and the P E-reductant calculus presented in this work:

(1) To overcome the restriction to specialize atom goals separately, thus allowing the specialization of more complex goals to achieve a better specialization. This can be done by introducing some particular techniques able to adequately specialize aggregations of atoms, similarly as it has been proposed in the field of conjunctive partial deduction [25,26] for the specialization of conjunctions of atoms.

(2) To introduce more refined local control strategies, like methods based on well-founded orders or well-quasi orders [11], instead of imposing an arbitrary ad hoc depth bound for the unfolding. Also it is necessary to introduce an effective procedure for the partial evaluation of a multiadjoint logic program with regard to a set of (goal) atoms. This problem links with the definition of global control strategies. The global level of control concerns with the termination of recursive unfolding, or how to stop recursively constructing unfolding trees while still guaranteeing that the desired amount of specialization is retained and that the semantic correctness of the partial evaluation process is reached. Note that, when a program is partially evaluated, the set of goals appearing in the initial set (with regard the specialization is performed) usually needs to be augmented in order to obtain an effective specialization. These new goals must be recursively unfolded (generating new unfolding trees in a similar way as the tabulation technique of [32] generates tree forests) to complete the specialization of the program. Therefore, to guarantee the termination of the partial evaluation process is important to investigate some appropriate technique able to keep this set finite.

(3) To improve the method for the construction of the so called P E-reduc-tants by means of a refined algorithm based on unfolding with a set of dynamic thresholds (we have some preliminary results in this line [42]) and tabulation techniques (in the style of [39,40,32]), in order to prune tree branches and properly decide which nodes in the unfolding tree must be selected to be exploited.

(4) To allow the presence of variables in the heads of P E-reductants. We think that this action will be especially interesting in practice when considering that all the arguments in these heads be variables, since it might be the key allowing us to attach the notion of reductant to a (finite) set of predicate symbols instead to a (possibly infinite) set of ground atoms.

(5) Last, but no least, it would be interesting to investigate a new, more powerful procedural semantics based on tabulation techniques [32] and capturing non-monotonic negation [35] in order to increase both its efficiency and expressiveness. In a second research stage, we think that those procedural mechanisms, once formulated as state transition systems, would become excellent platforms to support improved partial evaluation and other transformation techniques.

References

[1] N. Jones, C. Gomard, P. Sestoft, Partial Evaluation and Automatic Program Generation, Prentice-Hall, Englewood Cliffs, NJ, 1993.

[2] R. Burstall, J. Darlington, A Transformation System for Developing Recursive Programs, Journal of the ACM 24 (1) (1977) 44–67.

[3] A. Pettorossi, M. Proietti, Transformation of Logic Programs: Foundations and Techniques, Journal of Logic Programming 19,20 (1994) 261–320.

[4] M. Alpuente, M. Falaschi, G. Moreno, G. Vidal, Rules + Strategies for Transforming Lazy Functional Logic Programs, Theoretical Computer Science, Elsevier 311 (1-3) (2004) 479–525.

[5] C. Consel, O. Danvy, Tutorial notes on Partial Evaluation, in: Proc. of 20th Annual ACM Symp. on Principles of Programming Languages, ACM, New York, 1993, pp. 493–501.

[6] V. Turchin, The Concept of a Supercompiler, ACM Transactions on Programming Languages and Systems 8 (3) (1986) 292–325.

[7] J. Gallagher, Tutorial on Specialisation of Logic Programs, in: Proc. of Partial Evaluation and Semantics-Based Program Manipulation, Copenhagen, Denmark, June 1993, ACM, New York, 1993, pp. 88–98.

[8] H. Komorowski, Partial Evaluation as a Means for Inferencing Data Structures in an Applicative Language: A Theory and Implementation in the Case of Prolog, in: Proc. of 9th ACM Symp. on Principles of Programming Languages, 1982, pp. 255–267.

[9] J. Lloyd, J. Shepherdson, Partial Evaluation in Logic Programming, Journal of Logic Programming 11 (1991) 217–242.

[10] M. Alpuente, M. Falaschi, G. Vidal, Partial Evaluation of Functional Logic Programs, ACM Transactions on Programming Languages and Systems 20 (4) (1998) 768–844.

[11] E. Albert, M. Alpuente, M. Falaschi, P. Julián, G. Vidal, Improving Control in Functional Logic Program Specialization, in: G. Levi (Ed.), Proc. of Static Analysis Symposium, SAS’98, Springer, Lecture Notes in Computer Science 1503, 1998, pp. 262–277.

[12] E. Albert, M. Alpuente, M. Hanus, G. Vidal, A Partial Evaluation Framework for Curry Programs, in: Proc. of the 6th International Conference on Logic for Programming and Automated Reasoning, LPAR’99, Springer, Lecture Notes in Artificial Intelligence 1705, 1999, pp. 376–395.

[13] C. Consel, L. Hornof, F. Noël, J. Noyé, E. Volanschi, A Uniform Approach for Compile-Time and Run-Time Specialisation, in: O. Danvy, R. Glück, P. Thiemann (Eds.), Proc. of the 1996 Dagstuhl Seminar on Partial Evaluation, Springer, Lecture Notes in Computer Science 1110, 1996, pp. 54–72.

[14] R. Glück, M. Sørensen, Partial Deduction and Driving are Equivalent, in: Proc. Int’l Symp. on Programming Language Implementation and Logic Programming, PLILP’94, Springer, Lecture Notes in Computer Science 844, 1994, pp. 165–181.

[15] J. Medina, M. Ojeda-Aciego, P. Vojtáš, Multi-adjoint logic programming with continuous semantics, Proc of Logic Programming and Non-Monotonic Reasoning, LPNMR’01, Springer-Verlag, Lecture Notes in Artificial Intelligence 2173 (2001) 351–364.

[16] J. Medina, M. Ojeda-Aciego, P. Vojtáš, A procedural semantics for multi-adjoint logic programing, Progress in Artificial Intelligence, EPIA’01, Springer-Verlag, Lecture Notes in Artificial Intelligence 2258 (1) (2001) 290–297.

[17] J. Medina, M. Ojeda-Aciego, P. Vojtáš, Similarity-based Unification: a multiadjoint approach, Fuzzy Sets and Systems 146 (2004) 43–62.

[18] P. Julián, G. Moreno, J. Penabad, Operational/Interpretive Unfolding of Multiadjoint Logic Programs, Journal of Universal Computer Science 12 (11) (2006) 1679–1699.

[19] M. Alpuente, M. Falaschi, P. Julián, G. Vidal, Specialization of Lazy Functional Logic Programs, in: Proc. of the ACM SIGPLAN Conf. on Partial Evaluation and Semantics-Based Program Manipulation, PEPM’97, Vol. 32, 12 of Sigplan Notices, ACM Press, New York, 1997, pp. 151–162.

[20] P. Julián, G. Moreno, J. Penabad, On Fuzzy Unfolding. A Multi-adjoint Approach, Fuzzy Sets and Systems, Elsevier 154 (2005) 16–33.

[21] J. Komorowski, An Introduction to Partial Deduction, in: A. Pettorossi (Ed.), Meta-Programming in Logic, Uppsala, Sweden, Springer Lecture Notes in Computer Science 649, 1992, pp. 49–69.

[22] J. L. Lassez, M. J. Maher, K. Marriott, Unification Revisited, in: J. Minker (Ed.), Foundations of Deductive Databases and Logic Programming, Morgan Kaufmann, Los Altos, Ca., 1988, pp. 587–625.

[23] P. Julián, G. Moreno, J. Penabad, Evaluación Parcial de Programas Lógicos Multi-adjuntos y Aplicaciones, in: A. Fernández (Ed.), Proc. of Campus Multidisciplinar en Percepción e Inteligencia, CMPI-2006, Albacete, Spain, July 10-14, UCLM, 2006, pp. 712–724.

[24] M. Fay, First Order Unification in an Equational Theory, in: Proc of 4th Int’l Conf. on Automated Deduction, 1979, pp. 161–167.

[25] R. Glück, J. Jørgensen, B. Martens, M. Sørensen, Controlling Conjunctive Partial Deduction of Definite Logic Programs, in: Proc. Int’l Symp. on Programming Languages: Implementations, Logics and Programs, PLILP’96, Springer, Lecture Notes in Computer Science 1140, 1996, pp. 152–166.

[26] M. Leuschel, D. De Schreye, A. de Waal, A Conceptual Embedding of Folding into Partial Deduction: Towards a Maximal Integration, in: M. Maher (Ed.), Proc. of the Joint International Conference and Symposium on Logic Programming, JICSLP’96, The MIT Press, Cambridge, MA, 1996, pp. 319– 332.

[27] M. Ishizuka, N. Kanai, Prolog-ELF Incorporating Fuzzy Logic, in: A. K. Joshi (Ed.), Proceedings of the 9th International Joint Conference on Artificial Intelligence (IJCAI’85). Los Angeles, CA, August 1985., Morgan Kaufmann, 1985, pp. 701–703.

[28] J. F. Baldwin, T. P. Martin, B. W. Pilsworth, Fril- Fuzzy and Evidential Reasoning in Artificial Intelligence, John Wiley & Sons, Inc., 1995.

[29] D. Li, D. Liu, A fuzzy Prolog database system, John Wiley & Sons, Inc., 1990.

[30] P. Vojtáš, L. Paulík, Soundness and completeness of non-classical extended SLD-resolution, in: R. Dyckhoff et al (Ed.), Proc. ELP’96 Leipzig, LNCS 1050, Springer Verlag, 1996, pp. 289–301.

[31] S. Guadarrama, S. Muñoz, C. Vaucheret, Fuzzy Prolog: A new approach using soft constraints propagation, Fuzzy Sets and Systems, Elsevier 144 (1) (2004) 127–150.

[32] C. Damásio, J. Medina, M. Ojeda-Aciego, Termination of logic programs with imperfect information: applications and query procedure, Journal of Applied Logic 5 (2007) 435–458.

[33] M. Sessa, Approximate reasoning by similarity-based SLD resolution, Fuzzy Sets and Systems 275 (2002) 389–426.

[34] M. Kifer, V. Subrahmanian, Theory of generalized annotated logic programming and its applications., Journal of Logic Programming 12 (1992) 335–367.

[35] U. Straccia, Query answering in normal logic programs under uncertainty, in: L. Godó (Ed.), Proc. of 8th. European Conference on Symbolic and Quantitative Approaches to Reasoning with Uncertainty (ECSQARU-05), Barcelona, Spain, Lecture Notes in Computer Science 3571, Springer Verlag, 2005, pp. 687–700.

[36] M. L. Ginsberg, Multi-valued logics: a uniform approach to reasoning in artificial intelligence, Computational Intelligence 4 (1988) 265–316.

[37] J. Medina, M. Ojeda-Aciego, J. Ruiz-Calviño, On the ideal semantics of multilattice-based logic programs, in: Information Processing and Management of Uncertainty, IPMU’06, 2006, pp. 463–470.

URL ./TR/ipmu2006-ss.pdf

[38] J. Guerrero, G. Moreno, Optimizing Fuzzy Logic Programs by Unfolding, Aggregation and Folding, in: J. Visser, V. Winter (Eds.), Proc. of the 8th. International Workshop on Rule-Based Programming, RULE-07, Paris, France, June 29, Electronic Notes in Theoretical Computer Science (to appear), 2007, p. 15.

[39] C. Damásio, J. Medina, M. Ojeda-Aciego, A tabulation proof procedure for residuated logic programming, In Proc. of the European Conference on Artificial Intelligence, Frontiers in Artificial Intelligence and Applications 110 (2004) 808– 812.

[40] C. Damásio, J. Medina, M. Ojeda-Aciego, Sorted multi-adjoint logic programs: termination results and applications, in: Proc. of Logics in Artificial Intelligence, JELIA’04, Springer, Lecture Notes in Artificial Intelligence 3229, 2004, pp. 260– 273.

[41] T. Swift, Tabling for non-monotonic programming, Annals of Mathematics and Artificial Intelligence 25 (3–4) (1999) 201–240.

[42] P. Julián, G. Moreno, J. Penabad, Efficient reductants calculi using partial evaluation techniques with thresholding, in: P. Lucio (Ed.), Electronic Notes in Theoretical Computer Science, Vol. 188C, Elsevier, 2007, pp. 77–90.

[43] J. Abietar, P. Morcillo, G. Moreno, Building a Fuzzy Logic Programming Tool, in: E. Pimentel (Ed.), Proc. of VII Jornadas sobre Programación y Lenguajes, PROLE’2007, Zaragoza, Spain, September 12-14, University of Zaragoza, 2007, pp. 215–222.