From Fuzzy Datalog to Multivalued Knowledge-Base

Human knowledge consists of static and dynamic knowledge chunks. The static ones include the so called lexical knowledge or the ability to sense similarities between facts and between predicates. Through dynamic attainments one can make deductions or one can give answers to a question. There are several and very different approaches to make a model of human knowledge, but one of the most common and widespread fields of research is based on fuzzy logic.


Introduction
Despite the fact that people have very different and ambiguous concepts and knowledge, they are able to talk to one another.How does human mind work?How can people give answers to questions? Modelling human conversation and knowledge demands to deal with uncertainty and deductions.
Human knowledge consists of static and dynamic knowledge chunks.The static ones include the so called lexical knowledge or the ability to sense similarities between facts and between predicates.Through dynamic attainments one can make deductions or one can give answers to a question.There are several and very different approaches to make a model of human knowledge, but one of the most common and widespread fields of research is based on fuzzy logic.
Fuzzy sets theory, proposed by Zadeh (1965), is a realistic and practical means to describe the world that we live in.The method has successfully been applied in various fields, among others in decision making, logic programming, and approximate reasoning.In the last decade, a number of papers have dealt with that subject, e.g.(Formato et al 2000, Sessa 2002, Medina et al 2004, Straccia et al 2009).They deal with different aspects of modelling and handling uncertainty.(Straccia 2008) gives a detailed overview of this topic with widespread references.Our investigations have begun independently of these works, and have run parallel to them.Of course there are some similar features, but our model differs from the others detailed in literature.
As a generalization of fuzzy sets, intuitionistic fuzzy sets were presented by Atanassov (Atanassov 1983), and have allowed people to deal with uncertainty and information in a much broader perspective.Another well-known generalization of an ordinary fuzzy set is the interval-valued fuzzy set, which was first introduced by Zadeh (Zadeh 1975).These generalizations make descriptions and models of the world more realistic, and practical.
In the beginning, our knowledge-base model was based on the concept of fuzzy logic, later on it was extended to intuitionistic and interval-valued logic.In this model, the static part is a background knowledge module, while the dynamic part consists of a Datalog based deduction mechanism.To develop this mechanism, it was necessary to generalize the Datalog language and to extend it into fuzzy and intuitionistic direction.(Achs 1995(Achs , 2007(Achs , 2010)).
In many frameworks, in order to answer a query, we have to compute the whole intended model by a bottom-up fixed-point computation and then answer with the evaluation of the query in this model.This always requires computing a whole model, even if not all the facts and rules are required to determine answer.Therefore a possible top-down like evaluation algorithm has been developed for our model.This algorithm is not a pure top-down one but the combination of top down and bottom up evaluations.Our aim is to improve this algorithm and perhaps to develop a pure top down evaluation based on fuzzy or multivalued unification algorithm.There are fuzzy unification algorithms described for example in (Alsinet et al 1998, Formato et al 2000, Virtanen 1994), but they are inappropriate for evaluating our knowledge-base.
However, the concept of (Julian-Iranzo et al 2009, 2010) is similar but not identical with one of our former ideas about evaluating of special fuzzy Datalog programs (Achs 2006).Reading these papers has led to the assumption that this former idea may be the base of a top-down-like evaluation strategy in special multivalued cases as well.Based on this idea, a multivalued unification algorithm was developed and used for to determine the conclusion of a multivalued knowledge-base.
In this chapter this possible model for handling uncertain information will be provided.This model is based on the multivalued extensions of Datalog.Starting from fuzzy Datalog, the concept of intuitionistic Datalog and bipolar Datalog will be described.This will be the first pillar of the knowledge-base.The second one deals with the similarities of facts and concepts.These similarities are handled with proximity relations.The third component connects the first two with each other.In the final part of the paper, an evaluating algorithm is presented.It is discussed in general, but in special cases it is based on fuzzy, or multivalued unification, which is also mentioned.

Extensions of datalog
this model it is impossible to make any true fact false and still have a model consistent with the database.
An interpretation assigns truth or falsehood to every possible instance of the program's predicates.An interpretation is a model, if it makes the rules true, no matter what assignment of values from the domain is made for the variables in each rule.Although there are infinite many implications, it is proved that it is enough to consider only the Herbrand interpretation defined on the Herbrand universe and the Herbrand base.
The Herbrand universe of a program P (denoted by H P ) is the set of all possible ground terms constructed by using constants and function symbols occurring in P. The Herbrand base of P (B P ) is the set of all possible ground atoms whose predicate symbols occur in P and whose arguments are elements of H P .
In general, a term is a variable, a constant or a complex term of the form f(t 1 , …, t n ), where f is a function symbol and t 1 , …, t n are terms.An atom is a formula of the form p(t), where p is a predicate symbol of a finite arity (say n) and t is a sequence of terms of length n (arguments).A literal is either an atom (positive literal) or its negation (negative literal).A term, atom or literal is ground if it is free of variables.As in fuzzy extension, we did not deal with function symbols, so in our case the ground terms are the constants of the program.
In the case of Datalog programs there are several equivalent approaches to define the semantics of the program.In fuzzy extension we mainly rely on the fixed-point base aspect.The above concepts are detailed in classical works such as (Ceri et al 1990, Loyd 1990, Ullman 1988).

Fuzzy Datalog
In fuzzy Datalog (fDATALOG) the facts can be completed with an uncertainty level, the rules with an uncertainty level and an implication operator.With the use of this operator and these levels deductions can be made.As in classical cases, logical correctness is extremely important as well, i.e., the consequence must be a model of the program.This means that for each rule of the program, the truth-value of the fuzzy implication following the rule has to be at least as large as the given uncertainty level.

Syntax and semantics of fuzzy datalog
More precisely, the notion of fuzzy rule is the following: Definition 1.An fDATALOG rule is a triplet r; β; I, where r is a formula of the form where A is an atom (the head of the rule), A 1 ,…,A n are literals (the body of the rule); I is an implication operator and β ∈ (0,1] (the level of the rule).
For getting a finite result, all the rules in the program must be safe.An fDATALOG rule is safe if all variables occurring in the head also occur in the body, and all variables occurring in a negative literal also occur in a positive one.An fDATALOG program is a finite set of safe fDATALOG rules.
There is a special type of rule, called fact.A fact has the form A ←; β; I. From now on, the facts are referred as (A,β), because according to implication I, the level of A easily can be computed and in the case of the implication operators detailed in this chapter it is β.
For defining the meaning of a program, we need again the concepts of Herbrand universe and Herbrand base, but this time they are based on fuzzy logic.Now a ground instance of a rule r; β; I in P is a rule obtained from r by replacing every variable in r with a constant of H P .The set of all ground instances of r; β; I is denoted by ground(r); β; I.The ground instance of P is ground(P) = ∪ (r; I; β)∈P (ground(r); I; β).
An interpretation of a program P is a fuzzy set of the program's Herbrand base, B P , i.e. it is: To be short α A1∧...∧An will be denoted as α body and α A as α head .
In the extensions of Datalog several implication operators are used, but all cases are restricted to min-max conjunction and disjunction, and to the complement to 1 as negation. So: The semantics of fDATALOG is defined as the fixed points of consequence transformations.Depending on evaluating sequences two semantics can be defined: a deterministic and a nondeterministic one.Further on only the nondeterministic semantics will be discussed, the deterministic one is detailed in (Achs 2010).It was proved that the two semantics are equivalent in the case of negation-and function-free fDatalog programs, but they differ if the program has any negation.In this case merely the nondeterministic semantics is applicable.The nondeterministic transformation is as follows: Definition 2. Let B P be the Herbrand base of the program P, and let F(B P ) denote the set of all fuzzy sets over B P .The consequence transformation NT P : F(B P ) → F(B P ) is defined as where |A i | denotes the kernel of the literal A i , (i.e., it is the ground atom A i , if A i is a positive literal, and ¬A i , if A i is negative) and α body = min(α A1 ,…, α An ).
It can be proved that this transformation has a fixed point.To prove it, let us define the powers of a transformation: For any T : F(B P ) → F(B P ) transformation let and let ...
An ordering relation can be defined over F(B P ).For G; H : It is clear that NT P is inflationary transformation over L, and if P is negation-free, then NT P is monotone as well.
In (Ceri et al 1990) it is shown that an inflationary transformation over a complete lattice has a fixed point and if it is monotone then it has a least fixed point (Loyd 1990).Therefore NT P has a fixed point, i.e. there exists an X ∈ F(B P ) for which NT P (X) = X.If P is positive, then X is the least fixed point.(That is for any Z=T(Z) : X ≤ Z.) The fixed point of the transformation will be denoted by lfp(NT P ).It can be shown (Achs 1995) that this fixed point is a model of P. In the case of a, b because of the construction of α A the condition I(α body , α A ) ≥ β is realized.
In the case of c because of the construction of T 0 A i is not negative, that is A i is not among the facts, so α Ai = 0, therefore α body = 0, so I(α body , α A ) = 1 ≥ β, namely lfp(NT P ) is a model.
Moreover, the next proposition is true as well.
Proposition 1.For negation-free fDATALOG program P lfp(NT P ) is the least model.

Proof
In the case of a positive Datalog program, the least fixed point is the least model (Ceri et al 1990, Ullman 1988).In the case of fuzzy Datalog, according to the definition of the consequence transformation, the level of the rule's head is the least value satisfying the criterion of modelness.The application of the transformations may arise only one problem.
A lower level would be ordered to the same rule's head, but according to the definitions we should accept the higher value.But such a case can arise only in the case of programs containing any negation.Therefore the proposition is true.
According to the above statements, the meaning of the programs can be defined by this fixed point: Definition 3. lfp(NT P ) is the nondeterministic semantics of fDATALOG P program.

www.intechopen.com
To compute the level of rule-heads, we need the concept of uncertainty level function.
Definition 4. The uncertainty-level function is: According to this function the level of a rule-head is: α head = f(I,α body , β).
It is an extremely important question whether the fixed-point algorithm terminates or not.It depends on the feature of uncertainty level function: Proposition 2. If f(I, α, β) ≤ α for∀α ∈ [0; 1] then the fixed point algorithm terminates.
Proof As P is finite, therefore in the fixed point there are only finite many ground atoms.
The only problem may occur with the level of recursive predicates, but according to the above property of the uncertainty-level function, the level of the rule's head cannot be greater than any former one, so this algorithm must terminate.
In former papers (Achs 1995, Achs 2006) several implications were detailed (the operators are detailed in (Dubois et al, 1991)), for now three are chosen from these.The values of their uncertainty-level functions can be easily computed.They are the following: Kleene-Dienes It is obvious that I G and I L satisfy the condition of Proposition 2, and it is easy to see that in the case of I K the fixed point algorithm terminates as well.(Among the operators of (Dubois et al, 1991) there is one for which the algorithm does not terminate and one for which the uncertainty-level function does not exists.)
As the next examples show, there some problems would arise if the program had any negation.
Example 2. Look at the next one-rule program: p(a) ← ¬ q(b); I G ; 0.7.
This program has no least model, only two minimal ones: (The result of the above fixed point algorithm is M 1 .)Example 3.This example shows that there is a difference between the fixed points.
According to the above examples, in the case of programs containing negation there are problems with the model's minimality.However, the nondeterministic semanticslfp(NT P ) -is minimal under certain conditions.These conditions are referred to as stratification.Stratification gives an evaluating sequence in which the literals are evaluated before negating them.

Stratified fuzzy datalog
To stratify a program, it is necessary to define the concept of dependency graph.This is a directed graph, whose nodes are the predicates of P.There is an arc from predicate p to predicate q if there is a rule whose body contains p or ¬p and whose head predicate is q.A program is recursive, if its dependency graph has one or more cycles.A program is stratified if whenever there is a rule with head predicate p and a negated body literal ¬q, there is no path in the dependency graph from p to q.
The stratification of a program P is a partition of the predicate symbols of P into subsets P 1 ,..., P n such that the following conditions are satisfied: a/ if p ∈ P i and q ∈ P j and there is an edge from q to p then i ≥ j; b/ if p ∈ P i and q ∈ P j and there is a rule with the head p whose body contains ¬q, then i > j.
Stratification specifies an order of evaluation.The rules whose head-predicates are in P 1 are evaluated first, then those whose head-predicates are in P 2 and so on.The sets P 1 ,..., P n are www.intechopen.comcalled the strata of the stratification.A program P is called stratified if and only if it admits stratification.There is a very simple method for finding stratification for a stratified program in (Ceri et al 1990, Ullman 1988).Because this algorithm groups the predicates of the program, this is suitable for the fDATALOG programs as well.
The first of the following Datalog programs is not stratified, the other one has more distinct stratifications.
Example 4. Consider the one-rule program: This is not stratified.
The next program has more stratification (Abiteboul et al 1995): The program has five distinct stratifications, namely: These lead to five different ways of reading the program.As will be seen later, each of them yields the same semantics.
Let P be a stratified fDATALOG program with stratification P 1 ,..., P n .Let P i * denote the set of all rules of P corresponding to stratum P i , that is the set of all rules whose head-predicate is in P i .Let where the starting point of the computation is T 0 defined earlier.
where the starting point of the computing is L 1 .

L n = lfp (NT P n * ) ,
where the starting point is L n-1 .
In other words: the least fixed point -L 1 -corresponding to the first stratum of P is computed at first.Once this fixed point has been computed, we can take a step to the next strata.
By induction it will be shown that L n is a minimal model of P. For this purpose, we need the next definition and lemma.Definition 5.An fDATALOG program P is semi-positive if its negated predicates are solely facts.
Lemma 1.A semi-positive program P has a minimal model: L = lfp(NT P ).
Proof.A semi-positive program is almost the same as a positive one, because if p is a negated predicate of a rule-body, then it can be replaced by the fact q = ¬p.As p is a fact predicate, therefore the uncertainty level of q may be easily calculated.So the negation can be eliminated from the program and this program has a least fixed point which is the least model.
According to the lemma, L 1 is the least fixed point for P 1 * .Generally L i-1 ∪ P i * is semi-positive, because according to the stratification each negative literal of the i-th strata belongs to a predicate of a lower level strata.So L i is the least fixed point for P i * , which is minimal model for the given stratification.Therefore the next theorem is true: This means that evaluating the rules in the order of stratification, the least fixed point of the program's nondeterministic transformation is the minimal model of the program as well.So: Proposition 3.For stratified fDATALOG program P, there is an evaluation sequence, in which lfp(NT P ) is a minimal model of P.
As shown in Example 4, a program can have more then one stratification.Will the different stratifications yield the same semantics?Fortunately, the answer is yes.(Ceri et al 1990) declares, (Abiteboul et al 1995) proves the theorem, according to which for stratified Datalog programs the resulting minimal model is independent of the actual stratification.That is, two stratifications of a Datalog program yield the same semantics on all inputs.As the order of stratification depends only on the predicates of the program and it is not influenced by the uncertainty levels, therefore this theorem is true in the case of fDATALOG programs as well.
Theorem 3. Let P be a stratifiable fDATALOG program.The least fixed point according to an arbitrary order of stratification is a unique minimal model of the program.

Multivalued datalog
In fuzzy theory, uncertainty is measured by a single value between zero and one, and negation can be calculated as its complement to 1.However, human beings sometimes hesitate expressing these values, that is, there may be some hesitation degree.This illuminates a well-known psychological fact that linguistic negation does not always correspond to the logical one.Based on this observation, as a generalization of fuzzy sets, the concept of intuitionistic fuzzy sets was introduced and developed by Atanassov in 1983 and later (Atanassov 1983, 1999, Atanassov & Gargov 1989).In the next paragraphs some possible multivalued extensions of Datalog will be discussed.

Intuitionistic-and interval-valued extensions of datalog
In intuitionistic fuzzy systems (IFS) and interval-valued systems (IVS) the uncertainty is represented by two values, µ = (µ 1 , µ 2 ) instead of a single one.In the intuitionistic case the two elements must satisfy the condition µ 1 +µ 2 ≤ 1, while in the interval-valued case the condition is µ 1 ≤ µ 2 .If µ = (µ 1 , µ 2 ) belonging to a predicate p is an IFS level, then p is definitely true on level µ 1 and definitely false on level µ 2 , while in IVS the truth value is between µ 1 and µ 2 .It is obvious that the relation µ' 1 = µ 1 , µ' 2 = 1 − µ 2 creates a mutual connection between the two systems.(The equivalence of IVS and IFS was stated first in (Atanassov & Gargov 1989).) The fixed point theory of programming is based on the theory of lattices.So does the theory of fuzzy Datalog as well, which is based on the lattice of fuzzy sets.The extension of the programs into an intuitionistic and interval-valued direction needs the extension of lattices as well.Definition 6. L F and L V are lattices of IFS and IVS respectively, where It can be proved that both L F and L V are complete lattices (Cornelis et al 2004), so it can be the base of intuitionistic Datalog (ifDATALOG) and interval-valued Datalog (ivDATALOG) as well.(If the distinction is not important, both of them will be denoted by iDATALOG.) The so called i-extended DATALOG is defined on these lattices, and the necessary concepts are generalizations of the ones presented in Definition 1 and Definition 2. Let us continue to denote by B P the Herbrand base of the program P, and let FV(B P ) the set of all IFS or IVS sets over B P .
Definition 7. The i-extended Datalog program (iDATALOG) is a finite set of safe iDATALOG rules r; β; I FV ; -the i-extended consequence transformation iNT P : FV(B P ) → FV(B P ) is formally the same as NT P in (1) except: where α, β, γ are elements of L F , L V respectively, As iNT P is inflationary transformation over the complete lattices L F or L V , thus according to (Ceri et al 1990) it has an inflationary fixed point denoted by lfp(iNT P ).If P is positive (without negation), iNT P is a monotone transformation, so lfp(iNT P ) is the least fixed point.
The next question is whether this fixed point is a model of P. The fixed point is an interpretation of P, which is a model, if for each Similarly to the proof of Theorem 1, it can easily be proved that this fixed point is a model of the program.For negation-free iDATALOG this is the least model of the program.(Achs 2010).
In fDATALOG a fact can be negated by completing its membership degree to 1.In iDATALOG the uncertainty level of a negated fact can be computed according to negators.
A negator on L F or L V is a decreasing mapping ordering 0 FV and 1 FV together (Cornelis et al 2004).The applied negators are relevant for the computational meaning of a program, but they have no influence on the stratification.So for a stratified iDATALOG program P there is an evaluation sequence in which lfp(iNT P ) is a unique minimal model of P. Therefore lfp(iNT P ) can be regarded as the semantics of iDATALOG.
After defining the syntax and semantics of extended fuzzy Datalog, it is necessary to examine the properties of possible implication operators and the extended uncertainty-level functions.A number of intuitionistic implications are discussed in (Cornelis et al 2004, Atanassov 2005, 2006) and other papers, four of them are the extensions of the above three fuzzy implication operators.Now these operators will be presented and completed by the suitable interval-value operators and the uncertainty-level functions.The computations will not be shown here, only the starting points and results are presented.
The coordinates of intuitionistic and interval-valued implication operators can be determined by each other.The uncertainty-level functions can be computed according to the applied implication.The connection between I F and I V and the extended versions of uncertainty-level functions are given below: For The studied operators and the related uncertainty-level functions are the following:

Extension of Kleene-dienes implication
One possible extension of Kleene-Dienes implication for IFS is: The appropriate computed elements are the following:

Extension of Lukasiewicz implication
One possible extension of Lukasiewicz implication for IFS is: The appropriate computed elements are as follows:

Extensions of Gödel implication
There are several alternative extensions of Gödel implication, two of them are presented here:  (,) , An important question is whether the resulting degrees satisfy the conditions referring to IFS and IVS respectively.Unfortunately, for implications other than G 2 , the answer is "no", or rather "not in all cases".For example, in the case of the Kleene-Dienes and the Lukasiewicz intuitionistic operators the levels of a rule-head satisfy the condition of intuitionism only if the sum of the levels of the rule-body is at least as large as the sum of the levels of the rule.That is, the solution is inside the scope of IFS, if the level of the rulebody is less "intuitionistic" than the level of the rule.In the case of the first Gödel operator, the solution is inside the scope of IFS only if the level of the rule-body is more certain than the level of the rule (Achs 2010).However, for the second Gödel operator the next proposition can easily be proven: Similarly to Proposition 2, it can be seen that the fixed-point algorithm terminates if f(I FV , α, β) ≤ FV α for each α ∈ L FV (Achs 2010).G2 satisfies this condition, so: Proposition 5.In the case of G2 operator the fixed-point algorithm terminates.

Bipolar extension of datalog
The intuitive background of intuitionistic levels is some psychological perception.
Experiments have shown that when making decisions people deal with positive and negative facts in different ways (Dubois et al 2000(Dubois et al , 2005)).Continuing this idea, it can be stated that there would be differences not only in the scaling of truth values, but in the way of concluding as well.This means that in a way similar to the facts, positive and negative inferences can be separated.The idea of bipolar Datalog is based on the above observation: two kinds of ordinary fuzzy implications are used for positive and negative deduction, namely, a pair of consequence transformations is defined instead of a single one.Since in the original transformations lower bounds are used with degrees of uncertainty, therefore starting from IFS or IVS facts, the resulting degrees will be lower bounds of membership and non-membership respectively, instead of the upper bound for non-membership.However, if each non-membership value µ is transformed into membership value µ' = 1 − µ, then both members of head-level can be deduced similarly.So the appropriate concepts are as follows.
The uncertainty-level function is: where It is evident that applying the transformation µ' 1 = µ 1 , µ' 2 = 1 -µ 2 , for all IFS levels of the program, the above definition can be applied to IVS degrees as well.As a simple computation can show, contrary to the results of iDATALOG, the resulting degrees for most variants of bipolar Datalog satisfy the conditions referring to IFS: From the construction of bipolar consequence transformations follows: Proposition 6.The nondeterministic bipolar consequence transformation has a least fixed point, which is a model of program P in the following sense: for each A←A 1 ,...,A n ; β; I ∈ ground(P) As the termination of the consequence transformations based on these three implication operators was proven in the case of fDATALOG (Achs 2006) and since this property does not change in bipolar case, the bipolar consequence transformations terminate as well.
The bipolar extension of Datalog has no influence on the stratification, so the propositions detailed in the case of stratified fDATALOG programs are true in the case of bipolar fuzzy Datalog programs as well, that is, for a stratified bDATALOG program P, there is an evaluation sequence, in which lfp(bNT P ) is a unique minimal model of P.
Let I 1 = I VG2 , I 2 = I VL , that is the appropriate uncertainty level functions are: Before showing the fixed point algorithm, two computations are set out.According to the first rule for q(x, y) the uncertainty level of q(a, b) is: (min(0.7, 0.85), min(0.8,0.95)) = (0.7, 0.8).
As fuzzy Datalog is a special kind of its multivalued extensions, so further on both fDATALOG and any of above extensions will be called multivalued Datalog (mDATALOG).

Multivalued knowledge-base
The facts of an mDATALOG program can be regarded as any kind of lexical knowledge including uncertainty as well, and from this knowledge other facts can be deduced according to the rules.Therefore a multivalued Datalog program is suitable to be the deduction mechanism of a knowledge base.Sometimes, however, it is not enough for getting answer to a question.For example, if there are rules describing the options of loving a good composer, and there is a fact declaring that Vivaldi is a good composer, what is the possible answer to the question inquiring about liking Bach?Getting an answer needs the use of synonyms and similarities.For handling this kind of information, our model includes a background knowledge module.

Background knowledge
Some "synonyms" and "similarities" will be defined between the potential predicates and between the potential constants of a given problem, so it can be examined in a larger context.More precisely, proximity relations will be defined on the sets of the program's predicates and terms.These relations will serve as the basis for the background knowledge.  y, x) ∀x ∈ D (symmetry).
A proximity is similarity if it is transitive, that is In the case of similarity, equivalence classifications can be defined over D. The effect of this classification is perhaps a simpler or more effective algorithm, but in many cases the requirement of similarity is a too strict constraint.Therefore this chapter deals only with the more general proximity.
Background knowledge consists of the "synonyms" of each terms and each predicates of the program.The "synonyms" of any element form the proximity set of the element, and all of the proximity sets compose the background knowledge.More precisely: Definition 10.Let d ∈ D any element of domain D. The proximity set of d is an IFS or IVS subset over D: Definition 11.Let G be any set of ground terms and S any set of predicate symbols.Let RG FV G and RS FV S be any proximity over G and S respectively.The background knowledge is the set of proximity sets:

Computing uncertainties
Up to now, the deduction mechanism and the background knowledge of a multivalued knowledge-base have been defined.Now, the question remains: how can the two parts be connected to each other?How can we find the "synonyms"?For example, if it is known that Ann loves the music of Bach very much ((love(Ann, Bach), (0.9, 0.95))) and the concept of love is similar to the concept of like (RS VS ("love", "like") = (0.8, 0.9)) and the music of Bach is more or less similar to the music of Vivaldi (RG VG (Bach, Vivaldi) = (0.7, 0.75)) then how strongly can be stated that Ann likes Vivaldi, that is, what is the uncertainty of the predicate like(Ann, Vivaldi)?
To solve this problem, the concept of proximity-based uncertainty function will be introduced.According to this function, the uncertainty levels of "synonyms" can be computed from the levels of original fact and from the proximity values of actual predicates and its arguments.It is expectable that in the case of identity, the level must be unchanged, but in other cases it is should be equal or less than the original level or than the proximity values.Furthermore, this function is required to increase monotonically.This function will be ordered to each atom of a program.
Let p be a predicate symbol with n arguments, then p/n is called the functor of the atom, characterized by this predicate symbol.
Definition 12.A proximity-based uncertainty function of p/n is: where Any triangular norm obeys the above constraints so they are appropriate proximity-based uncertainty functions.
Definition 13.Let P be a multivalued Datalog program, and F P be the set of the program's functors.The decoding-set of P is:

Deduction with background knowledge
The original deducing mechanism makes conclusions according to the rules of the program, but from now on the background knowledge must considered as well.So the original mechanism has to be modified.This modified deduction consists of two alternating parts: starting from the facts, their "synonyms" are determined, then applying the suitable rules, other facts are derived, followed by their "synonyms" determined, and again the rules are applied, etc.To define it in a precise manner the concept of modified consecution transformation will be introduced.
The consequence transformation of a mDATALOG P program is defined over the set of all multivalued sets of P's Herbrand base, that is, over FV(B P ).To define the modified transformation's domain, let us extend P's Herbrand universe with all possible ground terms of the background knowledge, obtaining the so called modified Herbrand universe, modH P .The modified Herbrand base, modB P is the set of all ground atoms, whose predicate symbols occur in P ∪ Bk and whose arguments are elements of modH P .However, it is possible, that there are some special predicates in P, which have no alternatives, even if their arguments have "synonyms".These predicates are named as bound predicates.For such predicates, the modified Herbrand base only includes atoms that are present in the original Herbrand base.Definition 14.The modified consequence transformation modNT P : FV(modB P ) → FV(modB P ) is defined as where and α p is computed according to the actual extension of (1).This transformation is inflationary over FV(modB P ) and it is monotone if P is positive.So, according to (Ceri et al 1990) it has a least fixed point.If P is positive, this is the least fixed point.This fixed point is a model of P, but because lfp(NT P ) ⊆ lfp(mod NT P ), it is not a minimal one (Achs 2010).
The modifying algorithm is irrelevant to the evaluation sequence, so stratification can be applied with the same condition.That is, the modified consequence transformation has a least fixed point in the case of stratified programs as well.This transformation makes connections between an mDATALOG program, the background knowledge and the decoding-set of the program.So these four components can form a knowledge-base.However, there should be other transformations connecting the three other parts with each other, therefore the universal concept of a multivalued knowledge-base can be defined with an arbitrary deduction algorithm: Definition 15.A multivalued knowledge-base (mKB) is a quadruple mKB = (P, Bk,Φ P , dA(P, Bk,Φ P )), where P is a multivalued Datalog program, Bk is a background knowledge, Φ P is a decoding-set of P and dA is any deduction algorithm connecting the three other part with each other.The least fixed point of the deduction algorithm is called the consequence of the knowledge-base, denoted by C(Bk, P, Φ P , dA) = lfp(dA(P, Bk,Φ P )).
Because the actual deduction algorithm is the modified consequence transformation, now the consequence is C(Bk, P, Φ P , dA) = lfp(modNT P ).
Note: If it is important to underline that there are bound predicates in P, then mKB can be denoted by mKB = (P, Bp, Bk,Φ P , dA(P, Bp, Bk,Φ P )), where Bp is the set of bound predicates.
Example 10.Let us suppose that an internet agent's job is to send a message to its clients if the cinema (C) presents a film, which its clients like.The agent knows that people generally go (go) to the cinema if they can pay (cp) for the ticket and are interested in (in) the film presented (pr) in the cinema.It also knows that people usually want to see (ws) a film if they like (li) its actor (ac).Moreover it knows that Paul (P) has enough money (hm) and he enjoys (en) Chaplin (Ch) very much.In the cinema, a film of Stan and Pan (SP) is presented.Should the agent inform Paul about this film?How much will he want to go to the cinema?This situation can be modelled, for example, by the following multivalued knowledge-base.
According to this result, the agent will know that the message can be sent, because Paul will probably enjoy Stan and Pan at a likelihood level of 85-90% (level (0.85, 0.9)), and there is a good chance (65%) that Paul will go to the cinema.

Evaluating algorithms
The fixed point-query is a bottom-up evaluation algorithm, which may involve many superfluous calculations.However, very often, only a particular question is of interest and the answer to this question needs to be searched.If a goal (query) is specified together with the multivalued knowledge-base, it is not necessary to evaluate all facts and rules, and it is www.intechopen.comenough to consider only a part of them.A goal is a pair (q(t 1 , t 2 , …, t n ); α), where q(t 1 , t 2 , …, t n ) is an atom, α is the fuzzy, the intuitionistic, the interval-valued or the bipolar level of the atom.q may contain variables, and its levels may be known or unknown values.The evaluation algorithm gives answer to this query.
In standard Datalog, the most common approach in top-down direction is called querysub-query framework.A goal, together with a program, determines a query.Literals in the body of any one of the rules defining the goal predicate are sub-goals of the given goal.Thus, a sub-goal together with the program yields a sub-query.In order to answer the query, each goal is expanded in a list of sub-goals, which are recursively expanded in their turn.That is, considering a goal, all rule-heads unifying with the goal are selected and the literals of the rule-body are the new sub-goals of given goal, which are evaluated one by one in an arbitrary order.This procedure continues until the facts have been obtained.
The situation is the same with a multivalued knowledge-base as well, but in this case the algorithm is completed with the computation of the unification levels.However, it is possible that such rules do not exist, but perhaps they do exist for the synonyms.For example, the goal is to know if Ann likes Bach, but there are rules only for describing the options of loving somebody and there are facts only about Vivaldi.In such cases, the synonyms are used.Therefore, the algorithm has to consider the proximities and has to compute the uncertainty levels.It is a bidirectional evaluation: firstly, the uncertainty-free rules and the proximities are evaluated in a top-down manner, obtaining the required starting facts, then the computing of uncertainties is executed in the opposite direction, that is, according to the fixed-point algorithm.

Evaluation of a general knowledge-base
The uncertainty levels are not required in the top-down part of the evaluation, so, this part of the algorithm can be based on the concept of classical substitution and unification (Ceri et al 1990, Ullman 1988, etc.) However other kinds of substitutions may be necessary as well: to substitute some predicate p or term t with their proximity sets RS FVp and RG FVt , and to substitute some proximity sets with their members.
From now on, for the sake of a simpler terminology, the terms "goal", "rule" and "fact" will refer to these concepts without uncertainty levels.An AND/OR tree arises during the evaluation, this is the searching tree.Its root is the goal; its leaves are either YES or NO.The parent nodes of YES are the facts, and uncertainty can be computed moving towards the direction of the root.This tree is built up by a periodic change of three kinds of steps: a proximity-based unification, a rule-based unification and a splitting step.
Proximity-based unification unifies the predicate symbols of sub-goals and the members of their proximity sets.Rule-based unification unifies the sub-goals with the head of suitable rules, and continues the evaluating by the bodies of these rules.The splitting step splits the rule-body into sub-goals if the body contains more literals or splits a literal of proximity sets into literals of the suitable ground atoms.
During the construction process, the edges are labelled by necessary information for computing the uncertainties.The searching graph according to its depth is build up in the following way.
If the goal is on depth 0, then every successor of any node on depth 3k+2 (k = 0, 1, …) is in AND connection, and the others are in OR connection.The step after depth 3k (k = 0, 1, …) is a proximity-based unification, after depth 3k+1 (k=0, 1, …) is a rule-based unification and after depth 3k+2 (k=0,1,…) is a splitting step.In detail: If the atom p(t 1 , t 2 , …, t n ) is in depth 3k (k = 0, 1, …), then the successor nodes let be all possible p'(t 1 , t 2 , …, t n ), where p' ∈ RS FVp .The edges starting from these nodes are labelled by the proximity-based uncertainty functions ϕ p' .
If the atom L is in depth 3k+1 (k=0, 1, …), then the successor nodes will be

•
the bodies of suitable unified rules or • the unified facts if L is unifiable with any fact of the program, or • NO, if there is not any unifiable rule or fact.
That is, if the head of rule M ← M 1 ,…,M n , (n>0) is unifiable with L, then the successor of L will be M 1 θ,…,M n θ, where θ is the most general unification of L and M. The edges starting from these nodes are labelled by the uncertainty functions belonging to the implication operator of the applied rules and by the uncertainty level of the rule.
If n=0, that is, in the program there is any fact with the predicate symbol of L, then the successors will be the unified facts.If L = p(t 1 , t 2 , …, t n ) and in the program there is any fact with predicate symbol p, then let the successor nodes be all possible p(t' 1 , t' 2 ,…, t' n ), where t' i = t i if t i is a ground term or t' i = RG FVti θ if t i is a variable and θ is a suitable unification.The edges starting from these nodes are not labelled.
According to the previous paragraph, there are three kinds of nodes in depth 3k+2 (k=0,1,…): a unified body of a rule; a unified fact the arguments of with are ordinary ground terms or proximity sets; or the symbol NO.
In the first case, the successors are the members of the body.They are in AND connection.The connected edges will not be labelled, but because of the AND connection, during the computation, the minimum value of the successor's levels will be regarded.
In the second case, the successors are the so called facts-sets.This means, that if the node is p(t 1 , t 2 ,…, t n ), where t i is a ground term or a proximity set, then the facts-set is the set of all possible p(t' 1 , t' 2 ,…, t' n ), where t' i ∈ RG FVti .The edges starting from these nodes are labelled by the proximity-based uncertainty functions ϕ p .
The facts-set has a further successor, the symbol YES.
The NO-node has no successor.
A solution can be achieved in the graph along the path ending in the symbol YES.According to the unification algorithm, one of the literals that are located at the parent node of YES can also be found among the original facts of the program.Knowing its uncertainty and using the proximity-based uncertainty function of the label leading to this facts-set, the uncertainty of other members of the facts-set can be computed.However, it is not necessary to compute all of them, only those ones, which are appropriate for the pattern of the literal being in the parent node of facts-set.In this way each starting fact can be appointed.Then a solution can be determined by connecting the suitable unifications and computing in succession the uncertainties according to the labels of edges in the path from the symbol YES to the root of the graph.The union of these solutions is the answer to the given query.
From the construction of searching graph follows: Proposition 7.For a given goal and in the case of finite evaluation graph, the top-down evaluation terminates and gives the same answer as the fixed point query.
Example 11.Consider the IFS program of Example 6, and let it be completed by proximities and proximity-based uncertainty functions (p(a), (0.7, 0.2)).
Let the goal be: (r 1 (a 1 ,x); α), where x is a variable.Then the evaluation graph is on the next page.
The three facts-sets can easily be seen in the graph.From the first one, the uncertainty of r(a 1 , b) and r(a 1 , b 1 ) can be computed.

Special evaluation based on multivalued unification
The necessity of bidirectional evaluation is derived from the generality of implications and proximity functions, because their values can be computed only from known arguments, namely in bottom-up manner.However, in special cases, computation can be realized parallel with the evaluation of rules and proximities, so the algorithm could be a more efficient pure top-down evaluation.This is the situation if all of the functions are the minimum function.That is, all implications that are used are the second Gödel implication (G2) and all proximity-based uncertainty functions are the minimum function. www.intechopen.com As mentioned earlier, in the case of standard Datalog, the heart of the evaluation algorithm is the unification process.Our special evaluation of multivalued knowledge is based on unification as well, but on multivalued unification.The multivalued unification consists of two parts, one is the alternation of a rule-based-unification and the other is a proximity-based one.Both of them are the extensions of the classical unification algorithm.Now, the splitting step is inside these unifications: evaluating a fact, the last proximity-based unification unifies the fact with its facts-set, and a rule-based unification splits these sets into their members.

Rule-based unification
This unification algorithm is similar to the classical one, that is, the goal can be unified with the body of any one of the rules defining the goal predicate -if the body is not empty.The level of the unification is the level of the rule defining the goal predicate.In that case, a variable can be substituted with other variable or with a constant; a constant can be substituted with itself only.The next sub-goal of the evaluation process will be the first member of the body.It is possible that during the evaluation a variable of a later member is substituted by a proximity set.In such a case, in the course of later evaluation, this proximity set will be substituted with itself.
If the predicate symbol of the goal is the predicate symbol of a fact, its arguments can be substituted as follows: • The variables of the goal can be substituted with the proximity set of the constants being the corresponding arguments of the fact.(E.g.: if q(a,b) is a fact predicate and the goal is q(x, y), then x can be substituted with R FV a and y with R FV b .)

•
The constants of the goal can be substituted • with themselves, if the goal contains any variable or • with their proximity set if the goal does not contain any variable.

•
The proximity set argument of a goal can be substituted with itself.
The level of the unification is 1 FV .
If there is no fact with the same predicate symbol, the unification process fails.
There is a special case of unification: the facts-set of a predicate is unified with its members in the following way: According to the previous unifications, between the literals of these facts-set there is one from the facts of the program.Knowing its uncertainty and the level of proximities, the uncertainty of other members can be computed.Then these members can be unified respectively: • with the empty clause, if there is no other literal to evaluate in the parent-node; • with the remaining part of the body to be evaluated.
The level of this unification is the level of the fitting member, and the former proximity setsubstitution of a variable is replaced by the suitable member of this set.
(E.g.: if there is a former x|R FV a substitution for literal p(x), and R FV a = {a, b}, then the factsset of unification is {p(a), p(b)}, which is unified with empty clauses .The substitutions for x are x|a and x|b, and the levels are the computed levels of p(a) and p(b) respectively.)

Proximity-based unification
This unification serves for handling proximities.When these steps are implemented, the following substitutions can be realized: • A constant or a variable can be substituted with itself only.

•
A predicate symbol can be substituted with the elements of its proximity set.The level of the unification is the current proximity value.

•
A proximity set can be substituted with itself except in the last step of the evaluation of a literal.In this case, that is if each argument of the literal is a proximity set, the literal can be unified with its facts-set.The level of the unification is 1 FV .

The unification algorithm
The evaluation algorithm combines the two kinds of unification.It starts with the proximity based unification and after it is finished, they alternate.The query is successful if the unification algorithm ends with an empty clause or a failure.In the first case the variables get the values defined during the substitutions.If all uncertainties are regarded as a minimum value, the actual level of unification can be computed as the minimum of former levels and when the algorithm reaches the empty clause, its level will be the level of the goal as well.
If the unification algorithm ends with a failure, there is no answer on this path.
If more answers arise during the evaluation, their union will be the resolution of the query.
According to the construction of unifications, the following proposition is true.
Proposition 8.For a given goal, and in the case of a finite evaluation graph, the above topdown evaluation gives the same answer as the fixed point query. Notes: • Although this algorithm was described for a knowledge-base based on a negation free program, it is similar in the case of stratified programs; the only difference is the calculation of the uncertainty of the negated sub-goal, but the computing of minimum remains the same.• With a good depth limit this algorithm is suitable for evaluating recursive programs or infinite graphs as well.
Example 12. Let us consider a part of Example 10, and let it be completed with a new rule and new facts.That is now the internet agent knows that people usually want to see (ws) a film if they like (li) its actor (ac), or they like more or less the subject (su) of the film.Moreover, it knows that Paul (P) enjoys (en) Chaplin (Ch) very much and mostly enjoys the historical films (H).In the cinema, a film (F1) of Stan and Pan (SP) is presented.There are two other films (F2, F3).Both films' topics (to) are the war (W), but in different manner.The first one's central message is the war, the second one play in wartime, but it is only a background.From the former example it is known, that the agent wants to know the interest of Paul.Therefore let our goal be (in(P,x); α).
Then the evaluation graph is Fig. 2. Let each proximity-based uncertainty function be the minimum function.
According to the left path of the graph one can see, that (in (P, F1), (0.7, 0.8)) because the applied substitution is x|F1 and the minimum of levels is (0.7, 0.8).
The other paths are only half-drawn, and they are continued in a partial graph, because this part of evaluation is similar in all cases.The only differences are in uncertainty levels.

Conclusion
In this chapter, a possible multivalued knowledge-base was presented as a quadruple of background knowledge, a deduction mechanism, a decoding set and an algorithm connecting the background knowledge to the deduction mechanism.
The background knowledge is based on proximity relations between terms and between predicates and it serves as a mechanism handling "synonyms".
The deduction mechanism can be any of the extensions of Datalog.These extensions are the fuzzy Datalog, based on fuzzy logic, the intuitionistic-or interval-value Datalog, based on the suitable logics and bipolar Datalog, which is some kind of coexistence of the former ones.
The semantics of Datalog is a fixed-point semantics, so the algorithm, which connects the two main pillars of the knowledge-base is the generalization of the consequence transformation determining this fixed-point.This transformation is defined on the extended Herbrand base of the knowledge-base, which is generated from the ground terms of knowledge base and its background knowledge.
Applying this transformation it is necessary to compute the uncertainty levels of "synonyms".The proximity-based uncertainty functions can do it, giving uncertainty values from the levels of the original fact and from the proximity values.The set of this kind of functions is the decoding set.
Two possible evaluation strategies were presented as well.One of them evaluates a general knowledgebase with arbitrary proximity-based uncertainty functions and arbitrary implication operators.The other one allows minimum functions only as proximity based uncertainty functions, and the special extension of Gödel operator, but in this case a multivalued unification algorithm can be determined.This strategy is based on the alternating rule-based-and proximity-based unification.
The improvement of this strategy and/or the deduction algorithm and/or the structure of background knowledge is a subject of further investigations.
A well structured multivalued knowledge-base and an efficient evaluating algorithm determining its consequence could be the basis of making decisions based on uncertain information, or it would be useful for handling argumentation or negotiation of agents.An implementation of this model would be an interesting future development as well.

Definition 9 .
A multivalued proximity on a domain D is an IFS or IVS valued relation R FV D : D × D → [0 FV , 1 FV ] which satisfies the following properties:
This means, that if the literal is p(t 1 , t 2 ,…, t n ), and t i is a ground term, then it is enough to consider only p(t' 1 , t' 2 ,…, t i ,…, t' n ) from the facts-set, but if t i is a proximity set, then it is necessary to deal with all p(t' 1 , t' 2 ,…, t' i ,…, t' n ), where t' i ∈ RG FVti .