Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Soft Comput (2010) 14:299–311 DOI 10.1007/s00500-009-0404-6 ORIGINAL PAPER Meta-logic programming for a synonymy logic Daniele Genito Æ Giangiacomo Gerla Æ Alessandro Vignes Published online: 27 February 2009  Springer-Verlag 2009 Abstract In order to give a suitable framework for a synonymy-based logic programming, we argue about the possibility of reducing fuzzy logic programming to classical logical programming. More precisely, we show that given a fuzzy program in a language L, we can translate it into an equivalent classical program in a (meta-)language Lm in which every predicate name in L becomes a constant in Lm : This enables us to admit in Lm meta-relations among predicates and therefore, in particular, the synonymy. Keywords Synonymy logic  Logic programming  Fuzzy logic  Translation 1 Introduction Recently, there have been several interesting proposals to extend logic programming in such a way to admit vague predicates. An important step in such a direction was made in Vojtáš (2001) where the basic theoretical notions for fuzzy logic programming were established (see also; Ebrahim 2001; Gerla 2005 where applications to fuzzy control are suggested). A promising idea is to extend fuzzy logic programming to take into account the synonymy D. Genito (&)  G. Gerla  A. Vignes Dipartimento di Matematica ed Informatica, Università di Salerno, via Ponte don Melillo, 84084 Fisciano (SA), Italy e-mail: dgenito@unisa.it G. Gerla e-mail: gerla@unisa.it A. Vignes e-mail: avignes@unisa.it relation among predicates in accordance with the similarity logic proposed by Ying (1994). The idea of Ying is that it is possible to relax the application of the inference rules in such a way that it is also admitted an approximate matching of the predicate names. As an example it is admitted that from a and a0 ! b we can infer b even in the case that a0 is only approximately equal to a. An application to such an idea to logic programming was done in several papers (see Biacino and Gerla 1998; Fontana et al. 1998; Alsinet and Godo 2004; Biacino et al. 2000) where the definition of synonymy refers to Gödel’s norm. Successively, in Medina and Ojeda-Aciego (2004) one shows that it is possible to define a similarity logic programming (in particular a synonymy logic programming) in the framework of multi-adjoint logic programming. The proposed procedure works with any triangular norm and the author shows that the resulting logic coincides with the existing ones in the case of Gödel’s norm. In this paper we start from a different point of view. Indeed, we observe that since the synonymy is a metarelation, in order to define a synonymy logic we have to consider a suitable meta-logic. On the other hand, all the definitions in fuzzy logic programming and in similarity logic programming can be expressed by positive clauses in classical logic programming. Then, we show that given a fuzzy program in a language L, we can translate it into an equivalent classical program in a suitable (meta-) language Lm : Since the predicate names in L become constants in Lm ; this enables us to admit in Lm meta-relations among predicates. In particular, the meta-relation the paper is interested is the synonymy and this enable us to define a synonymy-sensitive fuzzy logic programming. Three reasons in favor of such a logic are exhibited. The first one is that, differently from the papers (Biacino and Gerla 1998; Fontana et al. 1998; Alsinet and Godo 2004), 123 300 D. Genito et al. all the triangular norms are admitted. The second is that the resulting notion of fuzzy Herbrand model is uniformly continuous with respect to the synonymy relation (a basic property for a synonymy logic, in our opinion). Finally, another reason is that the resulting logic is a similarity logic in the abstract sense given in Gerla (2001) This means that its deduction operator is the closure operator obtained by combining the similarity closure operator with the one-step consequence operator associated with the given fuzzy program. Finally, we analyze the computational features of the proposed logic by referring to the notion of recursively enumerable fuzzy subset given in Gerla (2001), (2006). As usual, if L is a first order language, then we denote by Form(L) the set of formulas of L, by B(L) the Herbrand base, i.e. the set of facts, by Cl(L) the related set of positive clauses. A positive program is a set P of positive clause. We call least Herbrand model of P, the set MP of facts we can prove from P. Denote by Gr(P) the set of ground instances of the formulas in P and by Fact(P) the set of facts in Gr(P). Then, the one-step consequence operator is the function TP : PðBðLÞÞ ! PðBðLÞÞ defined by setting TP ðSÞ ¼ fa 2 BP : a a1 ^    ^ am 2 Gr ðPÞ; a1 2 S; . . .; am 2 Sg [ FactðPÞ for every subset S of BL : Such an operator enables us to obtain the least Herbrand model MP of P by the equation MP ¼ [n2N TPn ð[Þ: 2 Translation of a classical program As a first step, we consider a way to translate a classical program (in a language L) into another simple classical program (in a suitable ‘‘meta-language’’ Lm ). Successively we will extend this to the fuzzy case. As an example, consider the following program P r(a, b) r(b, c) r(c, d) r(s, s) sr ðX; Y Þ sr ðX; Y Þ Then we have to consider a language Lm in which, by a reification process, the predicate symbols r and sr become two constants and in which there are two predicates corresponding to the notions ‘‘to be an axiom’’ and ‘‘to be a theorem’’. In such a language we can translate the program P into the following program ax(r, a, b) ax(r, b, c) ax(r, c, d) ax(r, s, s) thðsr; X; Y Þ thðsr; X; Y Þ thðr; X; Y Þ thðr; Y; X Þ: Obviously, we have to add also a general rule to claim that any axiom is a theorem thðR; X; Z Þ axðR; X; Z Þ: We can also avoid such a rule and to substitute directly ax with th. Notice that we cannot interpret thðsr; X; Y Þ thðr; Y; X Þ as ‘‘if r(Y, X) is a theorem then r(X, Y) is a theorem’’ since this should be the interpretation of the formula 8X8Y ðsr ðX; Y ÞÞ ð8X8Y ðr ðY; X ÞÞÞ: Instead a ground instance as thðsr; b; aÞ thðr; a; bÞ of such a rule is correctly interpreted as ‘‘if r(a, b) is a theorem then r(b, a) is a theorem’’. Definition 2.1 Given a first order language L we denote by Lm the language such that: – – – the constants of Lm are obtained by adding to the constants of L all the predicate symbols of L the function symbols are the same as in L there is a predicate symbol thn of arity n þ 1 for every arity n of a predicate symbol in L. A translation function from L to Lm is defined as follows. r ðY; X Þ r ðX; Y Þ: The language L of P has two predicate symbols r and sr and the constants a, b, c, d, s. Now, we can interpret a fact as r(a, b) at a meta-linguistic level by claiming that: the sentence ‘‘the relation r is satisfied by a and b’’ is an axiom. Likewise, we can interpret the instance sr ðb; aÞ r ða; bÞ of the rule sr ðX; Y Þ r ðY; X Þ by claiming 123 if the sentence ‘‘the relation r is satisfied by a and b’’ is a theorem, then the sentence ‘‘the relation sr is satisfied by b and a’’ is a theorem. Definition 2.2 The translation function is the map s : FormðLÞ ! FormðLm Þ defined by setting sðr ðt1 ; . . .; tn ÞÞ ¼ thn ðr; t1 ; . . .; tn Þ: sða1 ^ a2 Þ ¼ sða1 Þ ^ sða2 Þ; sða1 _ a2 Þ ¼ sða1 Þ _ sða2 Þ; sð:aÞ ¼ :sðaÞ; sð8xi aÞ ¼ 8xi sðaÞ: In particular, the translation of a (positive) clause a a1 ^    ^ ah is the (positive) clause sðaÞ s ð a1 Þ ^    ^ sðah Þ: This means that if P is a (positive) program, then s(P) is a (positive) program, too. To simplify our notations, Meta-logic programming for a synonymy logic 301 in the sequel we will write thðr; t1 ; . . .; tn Þ instead of thn ðr; t1 ; . . .; tn Þ: Equivalently, we can consider only a monadic predicate th in Lm and some way to represent a vector ðx0 ; x1 ; . . .; xn Þ: For example, we can add in Lm a name List for a binary function, and to write ðx0 ; x1 ; . . .; xn Þ to denote the term Listððx0 ; x1 ; . . .; xn1 Þ; xn Þ and ðx0 Þ to denote x0 : Then the translation can be defined by substituting the first rule with b1 ^    ^ bh ! b with b ¼ sðaÞ in s(P) such that b1 2 n1 Tsn1 ðPÞ ð[Þ; . . .; bh 2 TsðPÞ ð[Þ: In the first case by induction n1 hypothesis a 2 TP ð[Þ and therefore a 2 TPn ð[Þ: In the latter, let a0 a1 ^    ^ ah be a rule in P whose translation is b b1 ^    ^ bh : Then sðr ðt1 ; . . .; tn ÞÞ ¼ thððr; t1 ; . . .; tn ÞÞ: Since by inductive hypothesis, a1 2 TPn1 ð[Þ; . . .; ah 2 this entails that a0 2 TPn ð[Þ: Since s is injective, we can conclude that a 2 TPn ð[Þ: The translation of a program P into the meta-program s(P) is proposed as a first step toward a possible translation of a fuzzy logic program into a classical metaprogram. Nevertheless, perhaps this translation gives some advantages also in the case we confine ourselves to classical logic programming. As an example, if we admit the meta-predicate ‘‘is the symmetric extension of’’, then we can consider the following translation of the proposed example: TPn1 ð[Þ; It is evident that, T ‘ a , s ð T Þ ‘ s ð aÞ where ‘ is the classical entailment relation, T is a theory and a a formula. To show this it is sufficient to observe that: – – if Ax is the set of logical axioms, then a 2 Ax if and only if sðaÞ 2 Ax the translation is compatible with the inference rules. In particular, if P is a program and a a fact, a 2 MP , sðaÞ 2 MsðPÞ where MP and MsðPÞ are the Herbrand models of P and s(P), respectively. We give a step-by-step proof of such an equivalence in the perspective of its extension to fuzzy logic programming. Theorem 2.3 Let P be a positive program and let MP and MsðPÞ be the Herbrand models of P and s(P), respectively. Then, a 2 MP , sðaÞ 2 MsðPÞ : ð2:1Þ Proof It is not restrictive to assume that P is ground. To prove (2.1) it is sufficient to prove that, for every fact a and n 2 N; a 2 TPn ð[Þ , sðaÞ 2 TsnðPÞ ð[Þ: sða0 Þ ¼ b ¼ sðaÞ; n1 sða1 Þ ¼ b1 2 Tsn1 ðPÞ ð[Þ; . . .; sðah Þ ¼ bh 2 TsðPÞ ð[Þ: ð2:2Þ We will prove this by induction on n. Indeed, in the case n = 1, since TP ð[Þ ¼ FactðPÞ and TsðPÞ ð[Þ ¼ FactðsðPÞÞ ¼ sðFactðPÞÞ; (2.2) is evident. Consider the case n 6¼ 1; assume that (2.2) is satisfied by n  1 and that a 2 TPn ð[Þ ¼ TP ðTPn1 ð[ÞÞ: Then either a 2 TPn1 ð[Þ or there is a rule a a1 ^    ^ ah in P such that a1 2 TPn1 ð[Þ; . . .; ah 2 TPn1 ð[Þ: In the first case, by the induction hypothesis sðaÞ 2 TPn1 ð[Þ and therefore sðaÞ 2 TPn ð[Þ: In the latter, by the induction hypothesis sða1 Þ 2 n1 n1 TsðPÞ ð[Þ; . . .; sðah Þ 2 TsðPÞ ð[Þ and, since the rule sðaÞ sða1 Þ ^    ^ sðah Þ is in s(P), this entails that sðaÞ 2 TsnðPÞ ð[Þ: n assume that sðaÞ 2 TsðPÞ ð[Þ ¼ TsðPÞ  Conversely,  n1 n1 TsðPÞ ð[Þ : Then either sðaÞ 2 TsðPÞ ð[Þ or there is a rule th(r, a, b) th(r, b, c) th(r, c, d) th(r, s, s) symm extenðsr; r Þ thðR2 ; X; Y Þ symm extenðR2 ; R1 Þ ^ thðR1 ; X; Y Þ thðR2 ; X; Y Þ symm extenðR2 ; R1 Þ ^ thðR1 ; Y; X Þ: The advantage of such a translation is that the two metarules give a general procedure for the symmetric extension of a relation. So we can add such a procedure to our library. In a similar uniform way we can define, for example, procedures for the reflexive extension and the transitive extension of a relation. Observe that the idea for a translation of classical logic into classical logic programming was examined in literature in an extensive way (see for example Costantini 2002; Hill and Gallagher 1998). 3 Deduction apparatus for fuzzy logic First order fuzzy logic is based on the notion of fuzzy subset. If (V, B, 0, 1) is a complete lattice and S a nonempty set, then a fuzzy subset of S is any map s : S ! V: For every x 2 S; the value s(x) is interpreted as a membership degree. We say that s is finite provided that its support fx 2 S : sð xÞ 6¼ 0g is finite. We denote by V S the class of all the fuzzy subsets of S. If ðsi Þi2I is a family of fuzzy subsets of S, then [i2I si and \i2I si are the fuzzy subsets defined by the equations 123 302 D. Genito et al. ð[i2I si Þð xÞ ¼ Supi2I si ð xÞ; ð\i2I si Þð xÞ ¼ Infi2I si ð xÞ: In all the logics the deduction apparatus is a tool to elaborate pieces of information. In fuzzy logic a piece of information is represented by a fuzzy subset s : FormðLÞ ! V of formulas we call a fuzzy theory or fuzzy subset of proper axioms. The intended meaning of a fuzzy theory is that, given a formula a, s(a) represents the information ‘‘the truth value of a is at least s(a)’’. We call fuzzy formula any pair (a, k) where a is a formula and k 2 V: Let s be a finite fuzzy theory whose support is fa1 ; . . .; an g: Then we can represent s by the finite set fða1 ; k1 Þ; . . .; ðan ; kn Þg of fuzzy formulas where ki ¼ sðai Þ: Equivalently, we represent s by a list as a1  an ½k1  ½kn  We can improve the available information s by the proofs and, in turn, this requires a notion of fuzzy inference rule. The following are examples of ‘‘fuzzyfication’’ of three famous classical rules (modus ponens, particularization, and ^-introduction rule):       a; a ! b k; l 8xa k a; b k; l ; ; ; ; ; b kl aðtÞ k a^b kl where t is any term, a and b are formulas in L, k, l elements in V and  is a suitable binary operation. Notice that the values k and l in the inference rules are not intended as truth values but as constraints on the possible truth values. So, the operation  expresses a way to calculate a constraint on the truth value of the conclusion from constraints on the truth values of the premises. More in particular, the meaning of these rules is the following. Extended modus ponens if it is proved that the truth value of a is at least k and that the truth value of a ! b is at least l, then we can claim that the truth value of b is at least k  l: assume that  satisfies the continuity condition, i.e. x  ðSupi2I xi Þ ¼ Supi2I x  xi for every family ðxi Þi2I of elements in V. Important examples are obtained by setting V equal to the interval [0, 1] and by assuming that  is a continuous triangular norm. More in general a fuzzy inference rule is defined as a pair r ¼ rsyntax ; rsemantics where rsyntax is a partial n-ary operation defined in the set of sentences (i.e. an inference rule in the usual sense) and rsemantics is an n-ary operation in the set V of truth values satisfying a continuity property. Definition 3.1 Let L be a first order language, then a fuzzy deduction apparatus in L is a pair (IR, la) where IR is a set of fuzzy inference rules and la : FormðLÞ ! V is a fixed fuzzy set of formulas we call the fuzzy subset of logical axioms. Notice that, as in classical logic, the fuzzy subset of logical axiom is fixed in a fuzzy logic while the fuzzy subset of proper axioms varies. In classical logic given a set T of hypothesis a proof is a finite sequence of formulas such that every formula is either a logical axiom, or a hypothesis, or is obtained by an inference rule from early proved formulas. Instead in fuzzy logic we can admit every formula as a logical axiom or as a hypothesis. The valuation of the correctness degree of the proof depends on the correctness degree of these assumptions. Definition 3.2 A proof p of a formula a is any sequence a1 ; . . .; am of formulas such that am ¼ a; together with the related ‘‘justifications’’. This means that, for any formula ai ; we must specify whether (i) ai is assumed as a logical axiom; or (ii) ai is assumed as a hypothesis; or (iii) ai is obtained by a rule (in this case we have to indicate also the rule and the formulas from a1 ; . . .; ai1 used to obtain ai ). Extended particularization if it is proved that the truth value of 8xa is at least k and t is a term, then the truth value of a(t) is at least k. The importance of the justifications is that they are necessary to define the validity degree of the proof. Such a definition is by induction on the length of p (see Pavelka 1979; Gerla 2001). Observe that, as in the classical case, for any i  m; the initial segment a1 ; . . .; ai is a proof of ai we denote by pðiÞ: Extended ^-introduction rule if it is proved that the truth value of a is at least k and that the truth value of b is at least l, then we can claim that the truth value of a ^ b is at least k  l: Definition 3.3 Given a fuzzy theory s and a proof p, the valuation Val(p, s) of p with respect to s is defined by induction on the length m of p in accordance with the following rules: In a large and basic class of fuzzy logics one assumes that the valuation structure is a residuated lattice ðV; ; !;  ; 0; 1Þ and that the fuzzy inference rules are defined by the product  in such a lattice. Also, we Valðp; sÞ ¼ laðam Þ if am is assumed as a logical axiom, Valðp; sÞ ¼ sðam Þ if am is assumed as a hypothesis. Valðp; sÞ ¼ rsemantics ðValðpðið1ÞÞ; sÞ; . . .; ValðpðiðnÞÞ; sÞÞ if am is obtained by the rule r ¼ rsyntax ; rsemantics ; and 123 Meta-logic programming for a synonymy logic 303  am ¼ rsyntax aið1Þ ; . . .; aiðnÞ with 1  ið1Þ\m; . . .; 1  iðnÞ\mÞ: Notice that we have only two proofs of a whose length is equal to 1. The formula a with the justification that a is assumed as a logical axiom and the formula a with the justification that a is assumed as a hypothesis. So, the first two lines of the definition of 3.3 give also the induction basis. The value Valðp; sÞ is interpreted as a piece of information on the truth value of a, more precisely, the information: ‘‘the truth value if a is at least Val(p, s)’’. Different proofs of the same formula a give different pieces of information on the truth value of a. This suggests the following definition. Definition 3.4 Given a fuzzy deduction apparatus (IR, la), the deduction operator is the operator D : V FormðLÞ ! V FormðLÞ such that, for every s 2 V FormðLÞ the fuzzy subset D(s) is defined by setting, DðsÞðaÞ ¼ SupfValðp; sÞ : p is a proof of ag ð3:1Þ for every formula a. We emphasize that D(s)(a) represents the best possible information on a we can draw from s. 4 Fuzzy logic programming We can apply the just exposed definitions to give a basis for fuzzy logic programming. We refer to a residuated lattice ðV; ; !;  ; 0; 1Þ: The following definition of least fuzzy Herbrand model is syntactical in nature. It is possible to prove that such a definition is equivalent with the usual one, semantic in nature (see Gerla 2005). Definition 4.1 Consider a fuzzy deduction apparatus (IR, la). Then we call fuzzy program any fuzzy subset p : ClðLÞ ! V of positive clauses. We call least fuzzy Herbrand model of p the fuzzy subset of facts mp we can derive from p, i.e. the restriction of D(p) to B(L). Such a notion depends on the considered deduction apparatus, obviously. In this paper we refer to a deduction apparatus with no logical axiom and whose fuzzy rules are the extended Modus Ponens, the extended ^-introduction rule and the extended particularization. As an example, consider the following fuzzy program p in the interval [0, 1]: loves(carl, luise) [0.3] loves(carl, mary) [0.2] lovesðcarl; X Þ youngð X Þ ^ beautifulð X Þ ½0:9 beautiful(mary) [0.8] young(mary) [0.7] young(helen) [0.7] we represent by a set of fuzzy rules, i.e. as the set of pair ða; pðaÞÞ; pðaÞ 6¼ 0: Also, assume that we will calculate, for example, the value mp ðlovesðcarl; maryÞÞ: Then, a simple proof of the fact loves(carl, mary), we denote by p1 ; consists in the observation that such a formula is an axiom at degree 0.2 (i.e. it is true at least at degree 0.2), and this gives the constraint Valðp1 ; pÞ ¼ 0:2: A different proof p2 is obtained by observing that, by particularization, we obtain the formula lovesðcarl; maryÞ youngðmaryÞ ^ beautifulðmaryÞ with truth degree 0.9. On the other hand, by the ^-introduction rule, we obtain the formula youngðmaryÞ ^ beautifulðmaryÞ with truth degree 0:8  0:7: Afterwards by Modus Ponens we get lovesðcarl; maryÞ with truth degree 0:9  0:8  0:7: In the case  is the usual product, this gives the value valðp2 ; pÞ ¼ 0:504: Since there is no further proof for such a fact, we can conclude that mp ðlovesðcarl; maryÞÞ ¼ maxfValðp1 ; pÞ; Valðp2 ; pÞg ¼ 0:504: Instead, if we consider the fact loves(carl, helen), then there is no proof for such a fact using the formulas in the support of p. On the other hand, since the fuzzy program p assigns to loves(carl, helen) the value 0, the observation that loves(carl, helen) is an axiom at degree 0 is a proof with degree 0. Then, mp ðlovesðcarl; helenÞÞ ¼ 0: A general way to calculate the least Herbrand model of a fuzzy program, is obtained by extending the fixed point method of classical logic programming. To give a notion of one-step consequence operator, given a fuzzy program p, we define the fuzzy subset of ground instances of clauses in p as the fuzzy program Gr ð pÞ : ClðLÞ ! V defined by setting Gr ð pÞðaÞ ¼ 0 if a is not ground and n o Gr ð pÞðaÞ ¼ Sup pða Þ : a is a ground instance of a clause a ; otherwise. The supremum is justified by the fact that it is possible for a formula a to be the ground instance of more than one formula in supp(p). As an example if pðr ðx; bÞÞ ¼ 0:7 and pðr ða; yÞÞ ¼ 0:5; then we have to set Gr ð pÞðr ða; bÞÞ ¼ maxf0:5; 0:7g ¼ 0:7: We say that p is ground if Gð pÞ ¼ p: We define the fuzzy subset of fact of p as the restriction of Gr(p) to the Herbrand base, i.e. the fuzzy subset Factð pÞ : BðLÞ ! V defined by 123 304 D. Genito et al. Factð pÞðaÞ ¼ Supfpða Þ : a is a ground instance of an atomic formula a g: x ¼ supðfb 2 B : b  xgÞ In the case p is ground, Factð pÞðaÞ ¼ pðaÞ: Definition 4.2 Let p : ClðLÞ ! V be a fuzzy program. Then the one-step consequence operator is the operator Tp : V BðLÞ ! V BðLÞ defined by setting, for every s 2 V BðLÞ ; Tp ðsÞ ¼ Tp ðsÞ [ Factð pÞ where, in turn Tp : V BðLÞ ! V BðLÞ is defined by setting, for every a 2 BðLÞ; Tp ðsÞðaÞ ¼ SupfGr ð pÞða s ð a1 Þ      s ð am Þ : a with enumerable basis B, provided that  is continuous, B is an enumerable sublattice of V closed with respect to  and, for every x 2 V; a1 ^    ^ am Þ a1 ^    ^ am 2 SuppðGr ð pÞÞg: The supremum is justified by the fact that it is possible that in Supp(Gr(p)) there are different rules with the same head a. As in the classical case, the one-step consequence operator enables us to give a simple characterization of the least Herbrand model of p (see, Pavelka 1979; Medina and Ojeda-Aciego 2004). Proposition 4.3 Let p : ClðLÞ ! V be a fuzzy program and mp the least fuzzy Herbrand model for p, then mp ¼ [n2N Tpn ð[Þ: This proposition entails that the fuzzy least Herbrand model of p coincides with the fuzzy least Herbrand model of Gr(p). So, in all the proofs it is not restrictive to assume that p is ground. In other words, in a continuous residuated lattice all the elements can be approximate ‘‘from below’’ by elements in B. As an example, we can consider the case V is the lattice [0, 1], B is the set of rational numbers in [0, 1] and  is the usual product. In such a case  is the strict order. Further examples are obtained by assuming that  is one of the triangular norms usually considered in literature. Also, every finite residuated lattice is a continuous residuated lattice provided that we put B ¼ V: In such a case  coincides with the order relation B. If S is an enumerable set, then P(S) is a continuous residuated lattice in which a basis is defined by the class of all the finite subsets of S. In such a case b  x if and only if b is a finite part of x. In the following we consider only continuous residuated lattices with an enumerable basis B and fuzzy programs with values in B. Also, in the meta-language Lm we put only an enumerable amount of constants to denote the elements in B. Another question is that in the translation we have to represent in some way the product : To do this we assume that in Lm there is a predicate product and that in the translation we consider the diagram of the algebraic structure ðB; Þ; i.e. the (decidable) set of facts Diagr ðBÞ ¼ fproductðk; l; cÞ : c ¼ k  l; k; l; c 2 Bg: As an example, the translation of the fuzzy program given in Sect. 4 is obtained by adding to Diagr(B) the program 5 A meta-logic for fuzzy logic programming In this section we will show how translate a fuzzy program in a language L into a classical meta-program in a language Lm : To this aim, again we have assumed that in Lm there are the predicate names thn and a constant for every predicate name in L. In addition, since we have to write in an explicit way the involved truth values, in Lm we put constants to denote the truth values. More precisely, since it is not reasonable to admit a language which is not enumerable, it is useful to refer only to a particular class of truth values. Then, in accordance with domain theory, we consider the following definition where  is the relation in V defined by setting b  x provided that for every nonempty upward directed subset A of V th(loves, carl, luise, 0.3). th(loves, carl, mary, 0.2). thðloves; carl; X; Z Þ thðyoung; X; Z1 Þ ^thðbeautiful; X; Z2 Þ ^ productðZ1 ; Z2 ; Z3 Þ ^productðZ3 ; 0:9; Z Þ: th(beautiful, mary, 0.8). th(young, mary, 0.7). th(young, helen, 0.7). More precisely we have to consider also the default rules th(R, X, 0). th(R, X, Y, 0). x  supA ) there is a 2 A such that b  a: claiming that that every fact in L can be proved at least with truth degree 0. Thus, we propose the following general definition. Definition 5.1 We say that a residuated lattice ðV;  ; ; !; 0; 1Þ is a continuous residuated lattice Definition 5.2 Let L be a first order language and let ðV; ; !;  ; 0; 1Þ be a residuated lattice with an 123 Meta-logic programming for a synonymy logic enumerable basis B. Then we denote by Lm the first order language such that – – – – the constants of Lm are obtained by adding to the constants in L all the predicate symbols of L and all the elements k in B the function symbols in Lm are the same as in L in Lm there is a predicate symbol thn for every n which is the arity of a predicate symbol in L in Lm there is a predicate product. As early argued in Sect. 2, we can assume also that in Lm there is only a monadic predicate th. In the next definition we write Z ¼ X  Y to denote the formula productðX; Y; Z Þ; Z ¼ X  Y  A to denote the formula productðX; Y; Z1Þ ^ productðZ1; A; Z Þ and so on. Definition 5.3 Consider a first order language L, a continuous residuated lattice ðV; ; !;  ; 0; 1Þ with an enumerable basis B and the corresponding meta-language Lm : Then, given a clause a and a variable Z, we define the formula s(a, Z) in Lm by setting sðr ðt1 ; . . .; tn Þ; Z Þ ¼ thðr; t1 ; . . .; tn ; Z Þ for every atomic formula r ðt1 ; . . .; tn Þ in L sða a1 ^    ^ an ; ZÞ ¼ sða; Znþ1 Þ sða1 ; Z1 Þ ^    ^ sðan ; Zn Þ ^ ðZnþ1 ¼ Z1      Zn  Z Þ 305 an explicit way. So the translation of the fuzzy program in Sect. 3 becomes: th(loves, carl, luise, 0.3). th(loves, carl, mary, 0.2). th(beautiful, mary, 0.8). th(young, mary, 0.7). th(young, helen, 0.7). thðloves; carl; X; Z3 Þ thðyoung; X; Z1 Þ ^thðbeautiful; X; Z2 Þ ^ ðZ3 ¼ Z1  Z2  0:9Þ In such a case, given the query th(loves, carl, mary, Z), we obtain the answers Z = 0, Z = 0.2 and Z = 0.504. In accordance with (3.1), this means that the best constraint on the truth value of the formula loves(carl, mary) is the maximum 0.504. To prove the equivalence between a fuzzy program p and its translation s(p), it is useful the following very interesting lemma given in Wiedermann (2002). Lemma 5.5 Let ðM; ;  ; 1Þ be a finitely generated ordered monoid. Then every nonempty subset of M admits a maximal element and therefore every nonempty totally ordered subset of M admits a maximum. As an immediate consequence we obtain the following lemma. for every rule a a1 ^    ^ an in L and where the variables Z; Z1 ; . . .; Znþ1 are pairwise distinct and not occurring in a; a1 ; . . .; an : For example, Lemma 5.6 Assume that V is totally ordered and that the fuzzy program p assumes only a finite number of values in B. Let ðM; ;  ; 1Þ be the submonoid of ðB; ;  ; 1Þ generated by the values assumed by p and let s be a fuzzy subset of facts assuming its values in M. Then for every fact a there is a rule a a1 ^    ^ am such that sðlovesðcarl; X Þ Tp ðsÞðaÞ ¼ pða youngð X Þ ^ beautifulð X ÞÞ ¼ sðlovesðcarl; X Þ; Z3 Þ a1 ^    ^ am Þ  sða1 Þ      sðam Þ ð5:1Þ sðyoungð X Þ; Z1 Þ ^ sðbeautifulð X Þ; Z2 Þ ^ ðZ3 ¼ Z1  Z2  ZÞ Proof ¼ thðloves; carl; X; Z3 Þ f pða thðyoung; X; Z1 Þ ^ thðbeautiful; X; Z2 Þ ^ ðZ3 ¼ Z1  Z2  ZÞ: To translate a program we have to consider the set Dfl of default formulas thðR; X; 0Þ; thðR; X; Y; 0Þ; . . .; : Definition 5.4 Consider a fuzzy program p : ClðLÞ ! B in the language L. Then the translation of p is the classical program s(p) in Lm defined by setting n o sð pÞ ¼ sða; Z ÞZ=pðaÞ : a is a positive clause [ Diagr ðBÞ [ Dfl where sða; Z ÞZ=pðaÞ denotes the formula obtained from s(a, Z) by substituting in Z the value p(a). In order to simplify our notation we avoid writing the diagram of the valuation structure and the default rules in Since a1 ^    ^ am Þ  s ð a1 Þ      s ð an Þ : a a1 ^    ^ am 2 Suppð pÞg is a subset of M, by Lemma 5.5 it admits a maximum m. Then a rule a a1 ^    ^ am exists such that m ¼ pða a1 ^    ^ am Þ  sða1 Þ      sðam Þ and such a rule satisfies (5.1). Theorem 5.7 Assume that V is totally ordered and that the fuzzy program p assumes only a finite number of truth values. Then, for every fact r ðt1 ; . . .; tk Þ;  mp ðr ðt1 ; . . .; tk ÞÞ ¼ Sup k 2 B : thðr; t1 ; . . .; tk ; kÞ 2 Msð pÞ : ð5:2Þ Proof It is not limitative to assume that p is ground. To prove (5.2) it is sufficient to prove that, for every k 2 B and n 2 N; 123 306 D. Genito et al. Tpn ð[Þðr ðt1 ; . . .; tk ÞÞ ¼ k , thðr; t1 ; . . .; tk ; kÞ 2 Tsnð pÞ ð[Þ: ð5:3Þ Now in the case n = 1 observe that Tp ð[Þ ðr ðt1 ; . . .; tk ÞÞ ¼ Factð pÞðr ðt1 ; . . .; tk ÞÞ ¼ pðr ðt1 ; . . .; tk ÞÞ and Tsð pÞ ð[Þ ¼ Factðsð pÞÞ ¼ sðFactð pÞÞ: Then (5.3) follows from the definition of s. Consider the case n = 1 and, by induction hypothesis, assume that (5.3) is satisfied by n  1: Then, if Tpn ð[Þðr ðt1 ; . . .; tk ÞÞ ¼ k; since   Tpn ð[Þðr ðt1 ; . . .; tk ÞÞ ¼ Tp Tpn1 ð[Þðr ðt1 ; . . .; tk ÞÞ   ¼ Tp Tpn1 ð[Þ ðr ðt1 ; . . .; tk ÞÞ _ Factð pÞðr ðt1 ; . . .; tk ÞÞ; Let  r1 t1;1 ; . . .; t1;kð1Þ ^    ^ rm  tm;1 ; . . .; tm;kðmÞ ½l; r ðt1 ; . . .; tk Þ be the fuzzy rule in the fuzzy program p whose translation coincides with the considered rule in s(p). Then, since by inductive hypothesis,  Tpn1 ð[Þ r1 ; t1;1 ; . . .; t1;kð1Þ ¼ k1 ; . . .; Tpn1 ð[Þ  rm ; tm;1 ; . . .; tm;kðmÞ ¼ km we can conclude that Tpn ð[Þðr ðt1 ; . . .; tk ÞÞ ¼ l  Tpn1 ð[Þ r1 ; t1;1 ; . . .; t1;kð1Þ      Tpn1 ð[Þ we have to consider two cases. In the case k ¼ Factð pÞðr ðt1 ; . . .; tk ÞÞ; it is evident that thðr; t1 ; . . .; tk ; kÞ 2 Factðsð pÞÞ  Tsnð pÞ ð[Þ: In the case k ¼ Tp ðTpn1 ð[ÞÞ ðr ðt1 ; . . .; tk ÞÞ; by Lemma 5.6 there is a fuzzy inference rule in p, r ðt1 ; . . .; tk Þ ½l; r1 ðt1;1 ; . . .; t1;kð1Þ Þ ^    ^ rm ðtm;1 ; . . .; tm;kðmÞ Þ such that,  k ¼ l  Tpn1 ð[Þ r1 t1;1 ; . . .; t1;kð1Þ       Tpn1 ð[Þ rm tm;1 ; . . .; tm;kðmÞ :  Set ki ¼ Tpn1 ð[Þ ri tm;1 ; . . .; ti;kðiÞ ; then, since by induction hypothesis thðri ; ti;1 ; . . .; ti;kðiÞ ; ki Þ 2 Tsn1 ð pÞ ð[Þ and thðr; t1 ; . . .; tk ; kÞ thðr1 ; t1;1 ; . . .; t1;kð1Þ ; k1 Þ ^    ^ thðrm ; tm;1 ; . . .; tm;kðmÞ ; km Þ ^ ðk ¼ k1      km  lÞ; is a ground instance of a rule in s(p), we can conclude that thðr; t1 ; . . .; tk ; kÞ 2 Tsnð pÞ ð[Þ: Conversely, assume that thðr; t1 ; . . .; tk ; kÞ 2 Tsnð pÞ ð[Þ n1 and that thðr; t1 ; . . .; tk ; kÞ is obtained fromTsðpÞ ð[Þ by the rule thðr; t1 ; . . .; tk ; Znþ1 Þ tðr1 ; t1;1 ; . . .; t1;kð1Þ ; Z1 Þ ^    ^ thðrm ; tm;1 ; . . .; tm;kðmÞ ; Zm Þ ^ ðZnþ1 ¼ Z1      Zm  lÞ; Then there is a ground instance thðr; t1 ; . . .; tk ; kÞ thðr1 ; t1;1 ; . . .; t1;kð1Þ ; k1 Þ ^    ^ thðrm ; tm;1 ; . . .; tm;kðmÞ ; km Þ ^ ðk ¼ k1      km  lÞ; of such a rule such that thðr1 ; t1;1 ; . . .; t1;kð1Þ ; k1 Þ 2 Tsn1 ð pÞ ð[Þ; . . .; thðrm ; tm;1 ; . . .; tm;kðmÞ ; km Þ 2 Tsn1 ð pÞ ð[Þ: 123 rm ; tm;1 ; . . .; tm;kðmÞ ¼ k:   6 Similarity logic and synonymy We are now ready to face the main question we are interested. We start from an example. Let us suppose that a bookshop assistant have a request, by a customer, for an adventurous and economic book. Moreover, let us suppose that he does not find any book with these characteristics, then he tries to recommend a book which is sufficiently close to the customer’s request. For example he could propose a fantasy book which is not expensive. This attitude is a typical use of synonymy in reasoning in everyday life. Now, it is evident that the available information is vague in nature and therefore that we have to represent it by a fuzzy set of claims as if x is adventurous and economic then x is good (at degree 1) ‘‘I Robot’’ is a fantasy story (at degree 0.6) ‘‘I Robot’’ is not expensive (at degree 1) ‘‘adventurous’’ is a synonymous of ‘‘fantasy’’ (at degree 0.8) ‘‘economic’’ is synonymous of ‘‘not expensive’’ (at degree 0.7) More formally Adventurousð xÞ ^ Economicð xÞ ) Good ð xÞ ðat degree 1Þ Fantasy(‘‘I_robot’’) (at degree 0.6) Not_expensive(‘‘I_robot’’) (at degree 1) synonymous(‘‘adventurous’’, ‘‘fantasy’’) (at degree 0.8) synonymous(‘‘economic’’, ‘‘not expensive’’) (at degree 0.7) Meta-logic programming for a synonymy logic Unfortunately, we cannot consider such a list of fuzzy formulas in the framework of first order fuzzy logic. Indeed, there are words as adventurous, fantasy, economic, not expensive occurring both as predicates symbols and as constants. In a series of papers (see, for example, Fontana et al. 1998; Formato et al. 2000) such a question was faced by relaxing the notion of matching between predicates. This means that one considers only the first order fuzzy formulas Adventurousð xÞ ^ Economicð xÞ ) Good ð xÞ ½1 Fantasy(‘‘I_robot’’) [0.6] Not_expensive(‘‘I_robot’’) [1] while the information about the synonymy between predicates is used to calculate the degree of admissibility of an approximate matching. In this paper we propose a different approach in which we simply add to the metalanguage Lm the predicate symbol ‘‘synonymous’’. In accordance, we formalize the information in the considered example by the program thðgood; X; Z Þ thðadventurous; X; V1 Þ^ thðeconomic; X; V2 Þ ^ ðZ ¼ V1  V2 Þ: th(fantasy, I_robot, 0.6). th(not expensive, I_robot, 1). synonymous(adventurous, fantasy, 0.8). synonymous(economic, not expensive, 0.7). thðA; X; V Þ synonymousðA; A0 ; V1 Þ ^ th ðA; X; V2 Þ ^ ðV ¼ V1  V2 Þ: As usual in fuzzy logic, the intended meaning of a fact as synonymous(economic, not expensive, 0.7) is that economic is a synonymous of not expensive at degree at last 0.7. Equivalently, we can consider the predicate symbol synonymous as a constant and to consider the program thðgood; X; Z Þ thðadventurous; X; V1 Þ ^thðeconomic; X; V2 Þ ^ ðZ ¼ V1  V2 Þ: th(fantasy, I_robot, 0.6). th(not expensive, I_robot, 1). th(synonymous, adventurous, fantasy, 0.8). th(synonymous, economic, not expensive, 0.7). thðA; X; V Þ thðsynonymous; A; A0 ; V1 Þ ^ th 0 ðA ; X; V2 Þ ^ ðV ¼ V1  V2 Þ: Given such a program and, for example, the query th(good, I_robot, Z), we obtain the answer Z ¼ 1  0:8  0:6  0:7  1: Notice that such a program is not complete since it is natural to assume that a synonymy satisfies suitable properties, namely that it is a similarity. Definition 6.1 Let S be a nonempty set, then a fuzzy relation sim : S S ! V is a -similarity if for every x, y, z in S, 307 (a) sim(x, x) = 1 (reflexivity), (b) simðx; yÞ simðx; zÞ  simðz; yÞ (transitivity), (c) sim(x, y) = sim(y, x) (symmetry). Given a first order language L, we call -synonymy, in brief synonymy, any -similarity syn on the set of predicate symbols such that synðr; r 0 Þ ¼ 0 for every pair of predicate symbols r and r0 with different arities. It is evident that a synonymy is a fuzzy model of a suitable fuzzy program. Then, it is useful to represent it by a (small) fuzzy set of facts and suitable rules corresponding to conditions (a), (b) and (c). We write such a program directly into a suitable extension of the language Lm as follows. Definition 6.2 Let LSyn be the language obtained by adding to Lm the predicate name synonymous. Then a definition of a synonymy is a program Syn containing a set of facts like synonymous(r, r0 , k) where r and r0 are predicate names with the same arity and k 6¼ 0; together with the rules synonymous(R, R, 1) synonymousðR; R00 ; V Þ synonymousðR; R0 ; V1 Þ 0 00 ^synonymousðR ; R ; V2 Þ ^ ðV ¼ V1  V2 Þ synonymousðR0 ; R; V1 Þ synonymousðR; R0 ; V1 Þ 0 synonymous(R , R, 0). Since we assume that in the language L there is only a finite set of predicate names, Syn is a finite set. We denote by syn the interpretation of synonymous in the least Herbrand model of Syn, namely  synðr; r 0 Þ ¼ Sup k 2 B : synonymousðr; r 0 ; kÞ 2 MSyn : ð6:1Þ Due to the finiteness of Syn, the values of syn are in B. Definition 6.3 Let p be a fuzzy program and Syn be a definition of a synonymy. Then the translation of p given Syn is the classical program s(p, Syn) in the language LSyn obtained by adding to the program s(p) the program Syn and the synonymy rules thðR; X1 ; . . .; Xn ; V Þ synonymousðR; R0 ; V1 Þ ^ thðR0 ; X1 ; . . .; Xn ; V2 Þ ^ ðV ¼ V1  V2 Þ: Notice that such a rule is strictly related with a rule considered in Medina and Ojeda-Aciego (2004) (see the proof of Theorem 23). As it is usual, we denote by Msðp;SynÞ and Tsðp;SynÞ the least Herbrand model and the one-step consequence operator of sðp; SynÞ; respectively. 123 308 D. Genito et al. We are now ready to define a suitable notion of least Herbrand model for a similarity-based logic programming. Definition 6.4 Let p be a fuzzy program and Syn the definition of a synonymy. Then we call least Herbrand synmodel of p the fuzzy set of facts mSyn p : BðLÞ ! V defined by setting, for every rðt1 ; . . .; tn Þ 2 BðLÞ; 0 0 0 0 0 mSyn p ðr ðt1 ; . . .; tn ÞÞ  synða; a Þ ¼ ðSupfk 2 A gÞ  synða; a Þ ¼ Supfk0  synða; a0 Þ : k0 2 A0 g  Supfk : k 2 Ag ¼ mSyn p ðrðt1 ; . . .; tn ÞÞ: To prove (7.2) observe that (7.1) entails 0 Syn synða; a0 Þ  mSyn p ð a Þ ! m p ð aÞ mSyn p ðr ðt1 ; . . .; tn ÞÞ  ¼ Sup k 2 B : thðr; t1 ; . . .; tn ; kÞ 2 Msðp;SynÞ : ð6:2Þ and therefore by symmetry Syn 0 synða; a0 Þ  mSyn p ðaÞ ! mp ða Þ: 7 A justification for the proposed synonymy logic Since in a totally ordered residuated lattice Obviously, the question arises whether Definition 6.4 is an adequate one for a synonymy logic. Now, usually one proves the adequateness of a logic by the exhibition of a completeness theorem. Unfortunately it is not evident if this can be done for synonymy logic since it is not evident whether the notion of synonymy is semantic in nature or not. Nevertheless it is possible to give some arguments in favor of such a definition. To do this, at first we prove the following useful proposition in which the synonymy syn is extended to B(L) by setting synða;a0 Þ ¼ synðr;r 0 Þ if a ¼ r ðt1 ; ...;tn Þ and a0 ¼ r 0 ðt1 ;. ..; tn Þ synða; a0 Þ ¼ 0 otherwise: Theorem 7.1 Assume that V is totally ordered and let a and a0 be two facts. Then 0 0 Syn mSyn p ða Þ  synða; a Þ  mp ðaÞ ð7:1Þ 0 mSyn p ða Þ $ mSyn ð aÞ p  Syn 0 ¼ mp ða Þ ! mSyn ð a Þ p   Syn 0 ^ mp ðaÞ ! mSyn ð a Þ ; p (7.2) follows. Inequality (7.2) says that mSyn p is continuous with respect to syn, in a sense. We can express such a claim in a more precise way by referring to the following results proved by Valverde (1985). Proposition 7.2 Let h : ½0; 1 ! ½0; 1 be an additive generator, i.e. a strictly decreasing continuous map h : ½0; 1 ! ½0; 1 such that h(1) = 0. Define the operation  by setting x  y ¼ h1 ðhð xÞ þ hð yÞÞ if hð xÞ þ hð yÞ  hð0Þ xy¼0 otherwise: Then  is an Archimedean triangular norm. If $ is the associated equivalence, then and therefore,   Syn 0 synða; a0 Þ  mSyn p ðaÞ $ mp ða Þ ð7:2Þ Proof In the case synða; a0 Þ ¼ 0; then (7.1) is trivial. Otherwise, assume that a ¼ rðt1 ; . . .; tn Þ; a0 ¼ r 0 ðt1 ; . . .; tn Þ and set  A ¼ k 2 B : thðr; t1 ; . . .; tn ; kÞ 2 Msðp;SynÞ and A0 ¼ k0 2 B : thðr 0 ; t1 ; . . .; tn ; k0 Þ 2 Msðp;SynÞ : hðx $ yÞ ¼ jhð yÞ  hð xÞj: ð7:3Þ As an example, if hð xÞ ¼ 1  x; then  is the Łukasiewicz norm and hðx $ yÞ ¼ jy  xj: In the case hð xÞ ¼ logð xÞ for x = 0 and hð0Þ ¼ 1;  is the usual product and hðx $ yÞ ¼ jlogð yÞ  logð xÞj: Then, by the synonymy rule for every x 2 B such that synonymousðr; r 0 ; xÞ 2 MSyn we have Proposition 7.3 Assume that  is an Archimedean norm whose additive generator is the map h : ½0; 1 ! ½0; 1; and let syn be a -synonymy. Then the map d : BðLÞ BðLÞ ! ½0; 1 defined by setting k0 2 A 0 ) k0  x 2 A dsyn ða; a0 Þ ¼ hðsynða; a0 ÞÞ and therefore, since in (6.1) the value synðr; r 0 Þ ¼ synða; a0 Þ is obtained as a maximum, for every a and a0 in B(L) is an extended pseudo-distance. 0 0 0 0 k 2 A ) k  synða; a Þ 2 A: So, fk0  synða; a0 Þ : k0 2 A0 g  A continuity of ; 123 and, by the Theorem 7.4 In the case  is an Archimedean norm, the function mSyn p : BðLÞ ! ½0; 1 is a continuous  map from the extended pseudo-metric space BðLÞ; dsyn to [0, 1]. Proof By (7.2) and (7.3) for every pair a and a0 of facts Meta-logic programming for a synonymy logic 309   Syn 0 dsyn ða; a0 Þ ¼ hðsynða; a0 ÞÞ h mSyn p ðaÞ $ mp ða Þ     Syn 0 ¼ h msyn ð a Þ  h m ð a Þ p p This inequality entails that h msyn p is continuous. Since h is a injective continuous map defined in the compact set [0, 1] and with values in a Hausdorff space, h1 is continuous. So, we can conclude that msyn p is continuous, too. 8 Another justification Another argument in favor of Definition 6.4 is that it is in accordance with the abstract definition of a similarity logic given in Gerla (2001). In such a book an abstract fuzzy logic is defined as a continuous (conservative) operator H : V F ! V F defined in the class V F of all the fuzzy subsets of a given set F. H is named the one-step consequence operator. H(s) is interpreted as the fuzzy subset of formulas we can obtain from s by an one-step proof. The deduction operator is the closure operator D : V F ! V F generated by H. This means that, for every fuzzy subset s of formulas DðsÞ ¼ [n2N H n ðsÞ: Let sim be a synonymy relation, then a continuous operator SYN : V F ! V F is defined by setting, SYN ðsÞðaÞ ¼ Supfsynða0 ; aÞ  sða0 Þ : a0 2 BðLÞg: ð8:1Þ SYN(s) is interpreted as the fuzzy subsets of facts which are a synonymous of a fact in s. A fuzzy subset s of facts is a fixed point for SYN if and only if, for every a, a0 [ B(L), synða0 ; aÞ  sða0 Þ  sðaÞ: ð8:2Þ Definition 8.1 Let H be the one-step consequence operator of an abstract fuzzy logic and let SYN be a synonymy operator. Then we call abstract synonymy logic the abstract logic whose one-step consequence operator is the composition H SYN (see Gerla 2001). In the case F coincides with B(L) and H is the one-step consequence operator Tp of a fuzzy program p, we obtain an abstract synonymy logic programming. The Herbrand models of such a logic are the fixed points of Tp SYN; i.e. the Herbrand models of Tp which are fixed points for SYN. Theorem 8.2 The least Herbrand model mSyn given in p Definition 6.4 coincides with the least Herbrand model of the abstract synonymy logic defined by Tp and SYN. Proof We have to prove that mSyn p is a fixed point for both SYN and Tp and that if m is a fixed point for SYN and Tp Syn is a then m mSyn p : Now, from (7.1) it follows that mp fixed point of SYN. To prove that mSyn p is a fixed point of Tp we have to prove that, for every fact a,   Tp mSyn ðaÞ _ Factð pÞðaÞ  mSyn p ðaÞ: p Since Factð pÞðaÞ  mSyn p ðaÞ; this is equivalent to prove that   Tp mSyn ðaÞ  mSyn p p ð aÞ and therefore any ground rule a r1   that, given   1 1 m m t1 ; . . .; tnð1Þ ^    ^ rm t1 ; . . .; tnðmÞ ;    1 l  mSyn r1 t11 ; . . .; tnð1Þ   p    Syn m m  mp rm t1 ; . . .; tnðmÞ  mSyn p ð aÞ    1 where r1 t11 ; . . .; tnð1Þ ^    ^ rm   l ¼ Gr ð pÞ a m t1m ; . . .; tnðmÞ Þ: Now 1 1 Syn m m l  mSyn p ðr1 ðt1 ; . . .; tnð1Þ ÞÞ      mp ðrm ðt1 ; . . .; tnðmÞ ÞÞ 1 ¼ l  ðSupfk1 : thðr1 ; t11 ; . . .; tnð1Þ ; k1 Þ 2 Msðp;SynÞ gÞ m      ðSupfkm : thðrm ; t1m ; . . .; tnðmÞ ; km Þ 2 Msðp;SynÞ gÞ 1 ¼ Supfk1      km  l : thðr1 ; t11 ; . . .; tnð1Þ ; k1 Þ m ; km Þ 2 Msðp;SynÞ g: 2 Msðp;SynÞ ; . . .; thðrm ; t1m ; . . .; tnðmÞ On the other hand, if a is the formula rðt1 ; . .  .; tn Þ; the  1 1 translation of the rule a r t ; . . .; t   1 1 nð1Þ ^    ^ m m rm t1 ; . . .; tnðmÞ is   1 thðr; t1 ; . . .; tn ; Zmþ1 Þ th r1 ; t11 ; . . .; tnð1Þ ; Z1 ^      m ; Zm ^ ðZmþ1 ^ th rm ; t1m ; . . .; tnðmÞ ¼ Z1      Zm  lÞ: Such a rule enables us to claim that if thðr1 ; m 1 t11 ; . . .; tnð1Þ ; km Þ 2 ; k1 Þ 2 Msðp;SynÞ ; . . .; thðrm ; t1m ; . . .; tnðmÞ Msðp;SynÞ ; then thðr; t1 ; . . .; tn ; k1      km  lÞ 2 Msðp;SynÞ : In turn, this entails that 1 Supfk1      km  l : thðr1 ; t11 ; . . .; tnð1Þ ; k1 Þ m ; km Þ 2 Msðp;SynÞ g 2 Msðp;SynÞ ; . . .; thðrm ; t1m ; . . .; tnðmÞ  Supfk : thðr; t1 ; . . .; tn ; kÞ 2 Msðp;SynÞ g ¼ mSyn p ðrðt1 ; . . .; tn ÞÞ Thus, mSyn p is a fixed point of Tp : Let m be a fixed point for both SYN and Tp : Then to prove that m mSyn p ; it is sufficient to prove that, given k 2 B; n thðr; t1 ; . . .; tn ; kÞ 2 Tsðp;SynÞ ð[Þ ) mðrðt1 ; . . .; tn ÞÞ k for every n 2 N: We will prove this by induction on n. Indeed, in the case n = 1, since Tp ðmÞ [ Factð pÞ  m; we have 123 310 D. Genito et al. thðr; t1 ; . . .; tn ; kÞ 2 Tsðp;SynÞ ð[Þ ) thðr; t1 ; . . .; tn ; kÞ 2 Factðsð pÞÞ ) pðrðt1 ; . . .; tn ÞÞ ¼ k ) mðrðt1 ; . . .; tn ÞÞ k: Assume that the implication holds true for n and that nþ1 n ð[Þ ¼ Tsðp;SynÞ ðTsðp;SynÞ ð[ÞÞ: thðr; t1 ; . . .; tn ; kÞ 2 Tsðp;SynÞ Then it is possible that thðr; t1 ; . . .; tn ; kÞ is obtained by the rule   1 thðr; t1 ; . . .; tn ; kÞ ; k1 ^    ^ th r1 ; t11 ; . . .; tnð1Þ   q ; kq ^ ðk ¼ k1      kq  lÞ th rq ; t1q ; . . .; tnðqÞ i in s(p) with thðri ; t1i ; . . .; tnðiÞ ; ki Þ 2 Tsnðp;SynÞ ð[Þ: In such a case, by induction hypothesis, we have that i mðri ðt1i ; . . .; tnðiÞ ÞÞ ki : Since m is a fixed point for Tp ; 1 k ¼ k1      km  l  l  mðr1 ðt11 ; . . .; tnð1Þ ÞÞ     q q  mðrq ðt1 ; . . .; tnðqÞ ÞÞ  mðrðt1 ; . . .; tn ÞÞ: Assume that thðr; t1 ; . . .; tn ; kÞ is obtained by the rule thðr; t1 ; . . .; tn ; kÞ synonymousðr; r 0 ; k1 Þ ^ thðr 0 ; t1 ; . . .; tn ; k2 Þ ^ ðk ¼ k1  k2 Þ: in Syn with thðr 0 ; t1 ; . . .; tn ; k2 Þ 2 Tsnðp;SynÞ ð[Þ: Then by inductive hypothesis mðr 0 ðt1 ; . . .; tn ÞÞ k2 : Since m is a fixed point for SYN, k ¼ k1  k2  k1  mðr 0 ðt1 ; . . .; tn ÞÞ  mðrðt1 ; . . .; tn ÞÞ: Finally, it is possible that thðr; t1 ; . . .; tn ; kÞ 2 Fact ðsðp; SynÞÞ; i.e. that thðr; t1 ; . . .; tn ; kÞ 2 Factðsð pÞÞ: In such case we proceed as in the case n = 1. Since both the operators Tp and SYN are continuous, in accordance with the fixed point theorem for continuous operators (see for example Gerla 2001), such a theorem entails that we can obtain msyn p as the limit of the sequence Tp ð[Þ  SYNðTp ð[ÞÞ  Tp ðSYNðTp ð[ÞÞÞ     Equivalently, since the operators SYN Tp ; Tp SYN and Tp _ SYN define the same class of fixed points, we can obtain mSyn p also as the limit of the sequence SYNð[Þ  Tp ðSYNð[ÞÞ  SYNðTp ðSYNð[ÞÞÞ     shows that the associated paradigm of computability is in accordance with Church thesis. We can formulate an analogous question for fuzzy logic programming and synonymy-based logic programming. In order to do this we will refer to a notion of recursive enumerability for fuzzy subsets which is in accordance with the theory proposed in Biacino and Gerla (1987) and Gerla (2006). Definition 9.1 We say that a continuous residuated lattice ðV;  ; ; !; 0; 1Þ is effective provided that there is coding of its basis B such that – – the lattice operations and  are effectively computable in B the relation  is recursively enumerable in B. All the examples of continuous residuated lattices in Sect. 5 are also effective. Definition 9.2 Let S be a coded set and s : S ! V a fuzzy subset of S. Then we say that s is recursively enumerable provided that a computable function h : S N ! B exists which is increasing with respect to the second variable and such that, for every x 2 S; sð xÞ ¼ Supn2N hðx; nÞ: ð9:1Þ Assume that in ðV;  ; ; !; 0; 1Þ an involution * is defined which is computable in B, then we can define the notion of complement -s of a fuzzy subset s by setting ðsÞð xÞ ¼ sð xÞ: Then we say that a fuzzy subset s is recursively co-enumerable if its complement -s is recursively enumerable. If s is both recursively enumerable and recursively co-enumerable, the we say that s is decidable. Definition 9.3 Let L be a first order language and UL the related Herbrand universe. Then we say that a fuzzy subset s : UL ! V of UL is representable by a fuzzy program p provided that a predicate name r exists such that sð xÞ ¼ mp ðr ð xÞÞ for every x in UL : Theorem 9.4 Consider a finite fuzzy program p with truth values in B. Then, mp is recursively enumerable. Consequently every fuzzy subset of UL representable by a fuzzy program is recursively enumerable. or of the sequence     Tp _ SYN ð[Þ  Tp _ SYN Tp _ SYN ð[Þ      Tp _ SYN Tp _ SYN Tp _ SYN ð[Þ     Proof Since Mp is recursively enumerable, we can define the function h : BðLÞ N ! B as follows. Let r ðt1 ; . . .; tk Þ be an element in B(L), then 9 Recursive enumerability in fuzzy logic programming and in synonymy logic programming • In classical logic programming there is no difficulty to represent all the recursive enumerable subsets and this hðr ðt1 ; . . .; tk Þ; 1Þ ¼ k1 ; 123 • we generate step-by-step all the elements k1 ; . . .; ki ; . . . of the set fk 2 B : thðr; t1 ; . . .; tk ; kÞ 2 Mp g at the same time we generate the increasing sequence ðhðr ðt1 ; . . .; tk Þ; nÞÞn2N by setting Meta-logic programming for a synonymy logic 311 hðr ðt1 ; . . .; tk Þ; iÞ ¼ hðr ðt1 ; . . .; tk Þ; i  1Þ _ ki It is evident that h is computable and order-preserving with respect to the second variable and that mp ðr ðt1 ; . . .; tk ÞÞ ¼ Supn2N hðr ðt1 ; . . .; tk Þ; nÞ: at a given step. Obviously, this is not surprising since it is in accordance with the notion of recursive enumerability. ð9:2Þ Now, the question arises whether every recursively enumerable fuzzy subset can be represented in such a way or not. Unfortunately, the answer is negative. Theorem 9.5 There are recursively enumerable fuzzy subsets which are not definable by a fuzzy program. Proof In Biacino and Gerla (1987) one defines d-enumerable a recursively enumerable fuzzy subset in which instead of (9.1) we have that sð xÞ ¼ Maxn2N hðx; nÞ; i.e. every s(x) is obtained as a maximum of the sequence h(x, n). Also, one proves that, in the case V is the interval [0, 1], there is a recursively enumerable fuzzy subset s which is not d-recursively enumerable. On the other hand, since by Lemma 5.5 the sequence ðhðr ðt1 ; . . .; tk Þ; nÞÞn2N admits a maximum, all the fuzzy subsets representable by a fuzzy program are d-enumerable. It is evident that we can extend Theorems 9.4 and 9.5 to the synonymy-based logic programming. We conclude by observing that (apparently) we can obtain msyn p ðr ðt1 ; . . .; tn ÞÞ by the findall operation in Prolog and by a predicate enabling us to calculate the maximum of a list. Indeed, we can consider the rule Herbrand modelðr; t1 ; . . .; tn ; ZÞ findallðZ1 ; thðr; t1 ; . . .; tn ; Z1 Þ; ListÞ ^ maximumðList; Z Þ or, in a most general way: Herbrand modelðR; X1 ; . . .; Xn ; ZÞÞ findallðZ1 ; thðR; X1 ; . . .; Xn ; Z1 Þ; ListÞ ^ maximumðList; Z Þ: Regrettably, in spite of the fact fk 2 V : thðr; t1 ; . . .; tn ; kÞg is finite, there is no general criterion to establish if all the elements in such a set where attained at a given step of the computation. Equivalently, in spite of the fact that we can compute the increasing sequence hðr ðt1 ; . . .; tk Þ; 1Þ  hðr ðt1 ; . . .; tk Þ; 1Þ     and that such a sequence becomes constant after a finite number of steps, there is no general criterion to establish if the maximum is attained References Alsinet T, Godo L (2004) Adding similarity-based reasoning capabilities to a Horn fragment of possibilistic logic with fuzzy constants. Fuzzy Sets Syst 144:43–65. doi:10.1016/j.fss.2003.10.013 Biacino L, Gerla G (1987) Recursively enumerable L-sets. Z Math Logik Grundlagen Math 33(2):107–113. doi:10.1002/malq. 19870330204 Biacino L, Gerla G (1998) Logics with approximate premises. Int J Intell Syst 13:1–10. doi:10.1002/(SICI)1098-111X(199801) 13:1\1::AID-INT1[3.0.CO;2-U Biacino L, Gerla G, Ying M (2000) Approximate reasoning based on similarity. Math Log Q 46:77–86. doi:10.1002/(SICI)15213870(200001)46:1\77::AID-MALQ77[3.0.CO;2-X Costantini S (2002) Meta-reasoning: a survey. In: Lecture notes in computer science, computational logic: logic programming and beyond, vol 2408/2002. Springer, Berlin/Heidelberg Ebrahim R (2001) Fuzzy logic programming. Fuzzy Sets Syst 117:215–230. doi:10.1016/S0165-0114(98)00300-5 Fontana A, Formato F, Gerla G (1998) Fuzzy unification as a foundation of fuzzy logic programming. In: Logic programming and soft computing. RSP-Wiley, England, pp 51–68 Formato F, Gerla G, Sessa MI (2000) Similarity-based unification. Fundamenta Informaticae 41(4):393–414 Gerla G (2001) Fuzzy logic: mathematical tools for approximate reasoning. Kluwer, Norwell Gerla G (2005) Fuzzy logic programming and fuzzy control. Stud Log 79:231–254. doi:10.1007/s11225-005-2977-0 Gerla G (2006) Effectiveness and multivalued logics. J Symbolic Log 71:137–162. doi:10.2178/jsl/1140641166 Hill PM, Gallagher J (1998) Meta-programming in logic programming. Handbook of logic in artificial intelligence and logic programming, vol 5. Oxford University Press, New York, pp 421–497 Medina J, Ojeda-Aciego M, Vojtáš P (2004) Similarity-based unification: a multi-adjoint approach. Fuzzy Sets Syst 146:43– 62. doi:10.1016/j.fss.2003.11.005 Pavelka J (1979) On fuzzy logic I: many-valued rules of inference. Z Math Logik Grundlagen Math 25:45–52. doi:10.1002/malq. 19790250304 Valverde L (1985) On the structure of F-indistinguishability operators. Fuzzy Sets Syst 17:313–328. doi:10.1016/0165-0114(85) 90096-X Vojtáš P (2001) Fuzzy logic programming. Fuzzy Sets Syst 124:361– 370. doi:10.1016/S0165-0114(01)00106-3 Wiedermann J (2002) Fuzzy turing machines revised. Comput Inf 21(3):251–263 Ying M (1994) A logic for approximate reasoning. J Symbolic Log 59:830–837. doi:10.2307/2275910 123