• No se han encontrado resultados

Fuzzy logic programs as hypergraphs. Termination results ?

N/A
N/A
Protected

Academic year: 2023

Share "Fuzzy logic programs as hypergraphs. Termination results ?"

Copied!
21
0
0

Texto completo

(1)

ScienceDirect

Fuzzy Sets and Systems 445 (2022) 22–42

www.elsevier.com/locate/fss

Fuzzy logic programs as hypergraphs. Termination results

Juan Carlos Díaz-Moreno

a

, Jesús Medina

a,

, José R. Portillo

b

aDepartmentofMathematics, UniversityofCádiz,Spain

bDepartamentodeMatemáticaAplicadaIandInstitutoUniversitariodeInvestigacióndeMatemáticasdelaUniversidaddeSevilla(IMUS), UniversidaddeSevilla,Spain

Received 8February2021;receivedinrevisedform 19January2022;accepted 1February2022 Availableonline 7February2022

Abstract

Graphtheoryhasbeenausefultoolforlogicprogramminginmanyaspects.Inthispaper,weproposeanequivalentrepre- sentationofmulti-adjointlogicprogramsusinghypergraphs,whichareageneralization ofclassicalgraphsthatallowstheuseof hypergraphtheoryinlogicprogramming.Specifically,thisrepresentationhasbeenconsideredinthispapertoincreasethelevel andflexibilityofdifferentterminationresultsofthecomputationoftheleastmodeloffuzzylogicprogramsviatheimmediate consequenceoperator.Consequently,theleastmodelofmoregeneralandversatilefuzzylogicprogramscanbeobtainedafter finitelymanyiterations,althoughinfiniteprogramsorprogramswithloopsandgeneralaggregatorswillbeconsidered.

©2022TheAuthors.PublishedbyElsevierB.V.ThisisanopenaccessarticleundertheCCBY-NC-NDlicense (http://creativecommons.org/licenses/by-nc-nd/4.0/).

Keywords: Logicprogramming;Fuzzysets;Termination;Hypergraphs

1. Introduction

Logic programming [45] is an important framework to obtain information from a dataset, which has been modeled by a set of logic rules that are called either ‘logic program’ or simply ‘program.’ Therefore, logic programming is a core part of decision and recommendation systems, among others.

Many researchers have studied logic programming from a theoretical point of view and it has been applied to many frameworks [8,9,12,13,15,35,40,43,55]. Several fuzzy extensions have been introduced to handle imprecise, incom- plete or imperfect data [21,36,44,23,48–50]. Multi-adjoint logic programming arose as a general logic-programming framework, which embeds residuated and monotonic logic programming, fuzzy logic programming, probabilistic logic programming, and so on. The main idea behind this general framework is to consider the most general mathe- matical setting from which the most useful results can be proved. Consequently, the semantics is based on a complete

Partiallysupportedbythe2014-2020ERDFOperationalProgrammeincollaborationwiththeStateResearchAgency(AEI)inprojectPID2019- 108991GB-I00,andwiththeDepartmentofEconomy,Knowledge,BusinessandUniversityoftheRegionalGovernmentofAndalusiainproject FEDER-UCA18-108612,andbytheEuropeanCooperationinScience&Technology(COST)ActionCA17124.

* Correspondingauthor.

E-mailaddress:[email protected](J. Medina).

https://doi.org/10.1016/j.fss.2022.02.001

0165-0114/© 2022TheAuthors.PublishedbyElsevierB.V.ThisisanopenaccessarticleundertheCCBY-NC-NDlicense (http://creativecommons.org/licenses/by-nc-nd/4.0/).

(2)

lattice in which (for example) the operators can be neither commutative nor associative, and different implications can be taken into account in the same logic program. These general structures allow the consideration of a more flexible and suitable set of rules to better simulate the behavior of a given knowledge system.

An important issue in multi-adjoint logic programming is to compute the consequences (least model) that are associated with the dataset modeled by the program (computed set of rules); that is, the values from which we can offer predictions and recommendations to the user. These values can be obtained in this and in many other frameworks by the immediate consequence operator TP for a program P [27,59]. Specifically, the least model is obtained by iterating the TP from the least interpretation (which associates the bottom of the lattice with every atom) until a fixed point is obtained. We must take into account that in many cases it is difficult to know whether the computation of the least fixed point of TP finishes for every query (e.g., when the considered program has infinite rules and/or has loops). Therefore, an important goal in these (fuzzy) logic programs is to know a priori when the computation of the least model will terminate in a finite number of iterations; that is, if TP terminates, which has been studied in many papers [18,22,25,44,23,52]. In [20], the authors introduced several interesting termination theorems that are based on the notion of dependency graph, together with useful applications to probabilistic programs, such as ordinary probabilistic logic programs, probabilistic deductive databases, and hybrid probabilistic logic programs.

This paper considers the theory of hypergraphs [10] to provide an efficient representation of a given logic program and to increase the level and flexibility of the termination theorems given in [20]. In particular, we use directed hy- pergraphs [6,30], which appear in a lot of different contexts, such as propositional logic [5,24,25,31,32,53], artificial intelligence [51], technological processing of product assembly [47], relational databases [7,62], probabilistic pars- ing [42], chemical reaction mechanisms [63], operations research [30], transportation planning [54], Petri nets [1], and so on. Alongside this work, we will focus on a special kind of directed hypergraphs, namely B-graphs, which have been used as a tool to analyze deductive databases (see [3,6,30,61]) and to solve Horn formulae [11,26,56,57].

B-graphs are also used to study Leontiev substitution matrices and flow problems [34], and to plan urban transporta- tion [54].

Several relationships among graphs, hypergraphs and logic programs have been studied. Consequently, it has been possible to translate the information given in a program to a hypergraph, and vice versa. In fact, the proposed computa- tion of a labeled B-graph from a program keeps all of the information provided by the program, while the dependency graph, even when labeled, loses some information. Obviously, this loss can be avoided by relabeling the edges of the dependency graph. However, in that case the obtained structure is equivalent to a hypergraph but represented in a way that is more complex and computationally less manageable than this one. Hence, hypergraphs provide a simpler and more tractable representation of logic programs (i.e., there is only one labeled hyperarc for each rule instead of multiple edges with the same label). This representation facilitates visualizing, and gives additional insight into, the structure of multi-adjoint logic programs. This allows us to demonstrate new results and open up promising new lines of investigation.

The first termination theorem is proved based on the obtained hypergraph and other intermediate results. A variant of this hypergraph has been analyzed to prove the second termination theorem, which significantly increases the number of operators that can be used in the program. Both of these theorems generalize the main results presented in [20] and provide a broader range of applications, from which we can know in advance if the computation of the least model terminates in a finite number of iterations. Note that it is not possible to directly apply the result in [20]

only considering dependency graphs, they must be adapted and extra results are required. However, the underlying mathematical proofs are similar to those proved in this paper. Hence, hypergraphs have been considered not only because they improve the representation of the program but they also provide a better understanding of the hypotheses and (aesthetically) simplification of different parts of the proofs.

The rest of this paper is structured as follows. Section2 includes the preliminary notions to be used throughout the paper. Section3presents the results relating to graphs and hypergraphs, and the representation of programs by hypergraphs, which have been applied to the termination results given in Section4. In the final section, this paper draws the conclusions and looks to the prospects for future work.

2. Preliminaries

The main notions in hypergraph theory and multi-adjoint logic programming considered in this paper are recalled next.

(3)

Fig. 1. Example of B-graphH = (V, E).

2.1. Basic definitions of hypergraphs

This section recalls the notions related to hypergraphs that we will need throughout this paper. For the basic notions of (hyper)graph theory, see [10].

A graph is a pair of sets (V , E), where V is the set of vertices or nodes and E is a subset of unordered pairs of vertices, which are called edges. A hypergraph is a generalization of the notion of a graph in which an edge can join any number of vertices. The generalization is given through the notion of hyperedge. Specifically, a hypergraph is defined as a pair of sets (V , E), where V is a set of elements called nodes or vertices, and E is a set of non-empty subsets of V called hyperedges or edges (see [10] for more details). Note that a graph is a kind of hypergraph verifying that the cardinal of all hyperedges is two.

A directed graph or digraph is a graph whose edges are ordered pairs of vertices. The corresponding generalization of a directed graph is called a directed hypergraph [6,30]. Formally, a directed hypergraph is a pair of sets (V , E), where the elements of E are called directed hyperedges or hyperarcs and each of them is an ordered pair, e= (X, Y ), of disjoint subsets of vertices. We denote X as the tail of e and Y as its head. Hereinafter, the tail and the head of a hyperarc e will be denoted by T (e) and H (e), respectively. Hence, a directed hypergraph is a hypergraph with directed hyperedges. In the following, when no confusion arises, directed hypergraphs will simply be called hypergraphs.

Given a graph G = (V, E), a vertex labeling is a function of V to a set of labels. A vertex-labeled graph is a graph with one or more associated vertex labeling functions. Likewise, an edge labeling is a function from E to a set of labels and we say that a graph with an edge labeling is an edge-labeled graph. The definition of labeled graphs is extended to digraphs and (directed) hypergraphs, in a natural way.

A backward hyperarc, or simply B-arc, is a hyperarc e, where the head H (e) has exactly one vertex; that is, it is a singleton. In a similar way, forward hyperarc, or simply F-arc, is a hyperarc f where the tail T (e) exactly has one ver- tex. When all of the hyperarcs of a hypergraph are B-arcs (resp. F-arcs), then the hypergraph is called B-graph (resp.

F -graph) [30]. Note that a digraph is simultaneously a particular case of a B-graph and an F -graph. For example, the hypergraph H = (V, E) introduced in Fig.1, where V = {a, c, f, h, n, u} and E = {({c}, {n}), ({f}, {h}), ({f, h}, {n}), ({f, h}, {u}), ({f, u}, {a}), ({n, u}, {c}), ({u}, {f})} is a B-graph with six vertices and seven B-arcs. This paper will only consider this kind of directed hypergraph. Because hyperarcs provide a natural representation of Horn formulae and databases, B-graphs and F -graphs are useful for many applications [5,6,30–32,34,61]. Indeed, they have been pre- sented many times with different names in the literature. For example, the B-graphs are called “labeled graphs” (not to be confused with the two labeled graphs that were defined previously) in [26,32,57] to represent the Horn formulae.

Torres and Araoz [61] studied hypergraphs and B-graphs, called “rule hypergraphs”, to represent deduction properties in databases as paths in hypergraphs. Ausellio and Italiano [5] also used this kind of directed hypergraph, although they called them “FD-graphs”, for construct polynomial algorithms to solve satisfiability problems. In this work, we will use labeled B-arcs as a natural representation of rules in a multi-adjoint logic program.

The notion of a subgraph is extended to directed hypergraphs in [60].

Definition 1. Given a directed hypergraph H = (V, E), we say that H= (V, E)is a subhypergraph of H if Vis a subset of V and Eis a subset of E∩ (2V× 2V).

The definition of hypergraph induced by the set of vertices Vis adapted from [58] to directed hypergraphs and it is the subhypergraph H= (V, E), where E= E ∩ (2V× 2V).

The following definition has been adapted from [30,60].

(4)

Fig. 2. Directed graph subjacent to the directed hypergraph in Fig.1.

Definition 2. Given a directed hypergraph H = (V, E), two vertices s, t ∈ V , and a natural number q, a path in H from s to t of length q, denoted as Pst, is a sequence of nodes and hyperarcs: Pst= v1, E1, v2, E2, . . . , vq, Eq, vq+1 where: v1= s, vq+1= t, s ∈ T (E1), t∈ H(Eq), and vi∈ H (Ei−1) ∩ T (Ei), for all i∈ {2, ..., q}.

The trivial sequence v, with v ∈ V , will be a path of length 0.

Nodes s and t are the origin (source) and the destination (sink) of Pst, respectively, and we say that t is connected to s or that t is weakly reachable from s [29]. ‘Weakly’ is used because some applications of directed hypergraphs (e.g., assembly or databases) need a different and strong notion of reachability [7]. If t∈ T (E1), then Pst is said to be a cycle [30]. In particular, this is true when t= s. Note that if there is a cycle from s to t, then there is also a cycle from t to t .

There are different definitions for paths in directed hyperarcs in the literature [2–4,6,10,30,60]. We have considered the definition introduced in [30] and [60], which is better suited to the aims of this paper and is less restricted than the definitions given in other papers.

Given that we are considering B-graphs, a path Pst = s, E1, v2, E2, . . . , Eq, t is univocally determined by its B-arcs and its origin because vi is the only vertex in the head of Ei−1. In this case, we can denote the path as Pst= s, E1, E2, . . . , Eq, t. For example, in the B-graph shown in Fig.1, f, ({f}, {h}), ({f, h}, {u}), ({u}, {f}), f and

c, ({c}, {n}), ({n, u}, {c}), c are cycles.

Every directed hypergraph is associated with a digraph.

Definition 3. Given a directed hypergraph H = (V, E), the primal digraph (or subjacent digraph) D(H) = (V, A) of the hypergraph H has the same nodes that the hypergraph and an arc exists in A from the node u to the node v if and only if it exists a hyperedge e∈ E such that u ∈ T (e) and v ∈ H (e).

For example, Fig.2shows the subjacent digraph to the B-graph in Fig.1. The cycles f, ({f}, {h}), ({f, h}, {u}), ({u}, {f}), f and c, ({c}, {n}), ({n, u}, {c}), c in the B-graph correspond to the cycles f, h, u, f and c, n, c in the primal graph.

Note that the correspondence is not injective because two directed hypergraphs can be associated with the same digraph.

2.2. Multi-adjoint logic programming

In this section, we recall the notion of a multi-adjoint logic program and the most interesting termination theorems that were introduced in [20]. We will first present the so-called adjoint pairs. These are the basic operators considered in this framework. They generalize left-continuous t-norms and their residuated implications.

Definition 4. Given a partially ordered set (P , ≤), the pair (&, ←) is an adjoint pair with respect to (P, ≤) if the mappings &, ←: P × P → P satisfy that:

1. & is order-preserving in both arguments.

2. ← is order-preserving in the first argument (the consequent) and order-reversing in the second argument (the antecedent).

3. The equivalence x≤ z ← y if and only if x &y ≤ z holds, for all x, y, z ∈ P .

(5)

Note that the pairs composed of the product, Gödel and Lukasiewicz t-norms and its corresponding residuated implication, which will be denoted as (&P, P), (&G, G), (&Ł, Ł), and are defined, for each x, y, z∈ [0, 1], as

x&Py= x · y zPy=

 1 if y≤ z z

y if y > z x&Gy= min{x, y} zGy=

1 if y≤ z z if y > z x&Ły= max{0, x + y − 1} z ←Ły= min{1, 1 − y + z}

are adjoint pairs. Clearly, these operators have infinite range (i.e., the image set is infinite). The following examples show particular cases of adjoint pairs, which correspond to operators with finite range.

Example 5. Let [0, 1]m be a regular partition of [0, 1] into m pieces; for example, [0, 1]4= {0, 0.25, 0.5, 0, 75, 1}

divides the unit interval into four pieces. A discretization of a t-norm &: [0, 1] × [0, 1] → [0, 1] is the operator

&: [0, 1]m× [0, 1]n→ [0, 1]k, where n, m, k∈ N, defined for each x ∈ [0, 1]mand y∈ [0, 1]nas:

x&y= k · (x & y) k

where _ is the ceiling function.

The discretization of the corresponding residuated implication ←: [0, 1]k× [0, 1]n→ [0, 1]mis defined as:

zy= m · (z ← y)

m

where _  is the floor function and ← is the residuated implication of the t-norm &. We have that (&, )is an adjoint pair in the unit interval [16,48], and &, ←have finite range. 

The considered algebraic structure contains this general kind of operators and is called a multi-adjoint lattice.

Definition 6. A multi-adjoint lattice is a tuple (L, , ←1, &1, . . . , n, &n)verifying the following properties:

1. (L, ) is bounded lattice (i.e., it has bottom (⊥) and top () elements);

2. (&i, i)is an adjoint pair in (L, ), for all i ∈ {1, . . . , n};

3.  &iϑ= ϑ &i = ϑ, for all ϑ ∈ L and i ∈ {1, . . . , n}.

Multi-adjoint lattices were fundamental in [20, Definition 26] to define the general algebraic structure taken into account in the aforementioned paper, which is called local sorted multi-adjoint -algebra. To simplify the notation, in this paper only one sort will be considered.

Definition 7. A local multi-adjoint -algebra L is a multi-adjoint lattice (L,, ←1,&1, . . . ,n,&n)

on which other operator is defined, such as conjunctors ∧1, . . . , k, disjunctors ∨1, . . . , l and general aggregators

@1, . . . , @h. The set of those monotonic operators (aggregator operators, in particular) in the -algebra will be denoted as A; that is,

A= {&1, . . . ,&n,1, . . . ,k,1, . . . ,l,@1, . . . ,@h}

and each operator @: Lm→ L in A satisfies the boundary condition with the top element:

@(, . . . ,   

s

, x,, . . . ,   

m−s−1

) x (1)

for all x∈ L.

(6)

From now on, a local multi-adjoint -algebra L, a set of propositional symbols  and a language denoted as F will be fixed. From these notions, we can introduced the definition of multi-adjoint logic program (set of rules).

Definition 8. A multi-adjoint logic program is a set of rules of the form A ←iB, ϑ such that:

1. The rule A iB is a formula of F.

2. The confidence factor ϑ is an element (a truth-value) of L.

3. The head of the rule A is a propositional symbol of .

4. The body formula B is a formula of F built from propositional symbols B1, . . . , Bn(n ≥ 0) by the use of conjunc- tors &1, . . . , &r and ∧1, . . . , k, disjunctors ∨1, . . . , l, aggregators @1, . . . , @mand elements of L.

5. Facts are rules with body .

For a body formula B, as in point 4 of this definition, we can express it by @[B1, . . . , Bn], where B1, . . . , Bnare all propositional symbols in B and @ the composition of the operators in B. For example, if B = (B1& B2) ∧ B3, then it can be written as @[B1, B2, B3]; that is, @[B1, B2, B3] = (B1& B2) ∧ B3= B. The following example introduces a particular multi-adjoint logic program.

Example 9. We will consider the local multi-adjoint -algebra F composed of the unit interval as a complete lattice, the adjoint pairs corresponding to the product, Gödel and Lukasiewicz t-norms, (&P, P), (&G, G), (&Ł, Ł), and the weighted sums @(3,1) and @(1,2) defined as @(3,1)(x, y) = 3x+ y

4 and @(1,2)(x, y) = x+ 2y

3 , for every (x, y) ∈ [0, 1]2. On this -algebra F, the following program P is defined, which simulates the behavior related to flu symptoms:

c ←Pn &Pu, 0.8

n ←Pc, 0.8

n ←P@(1,2)(h, f), 0.6

h ←Pf, 0.7

u ←Gh &Łf, 0.7

f ←Pu, 0.9

a ←P@(3,1)(u, f), 1.0

f ←P1.0, 0.8

n ←P1.0, 0.5

where c, n, h, f, u and a correspond to cough, nasal ache, headache, fever, flu and muscle ache. 

As we reported in the introduction, this paper is focused on the most important theorems introduced in [20]. Before recalling these results, we need several definitions.

Definition 10. An interpretation is a mapping I:  → L. The set of all interpretations is denoted as IL.

Notice that each of these interpretations, by the unique homomorphic extension theorem, can be uniquely extended to the set of formulae F. The function obtained in this way from an interpretation I is denoted by ˆI.

The ordering  on the truth-values lattice L can be extended to the set of interpretations IL.

Proposition 11. Let  be the ordering defined on ILas, I1 I2iff I1(p)  I2(p), for I1, I2∈ ILand p∈ . The pair (IL, ) is a bounded lattice. The least interpretation  maps every propositional symbol to the least element ⊥ ∈ L.

The semantic of multi-adjoint logic programming is based on the following notions of satisfiability and model.

Definition 12. Given an interpretation I∈ IL, a weighted rule A ←iB, ϑ is satisfied by I , if ϑ  ˆI(A ←iB). An interpretation I∈ ILis a model of a multi-adjoint logic program P if all weighted rules in P are satisfied by I .

The immediate consequences operator, which was given by van Emden and Kowalski [27], is defined in this framework as follows.

(7)

Definition 13. Given a multi-adjoint logic program P , the immediate consequences operator TP maps interpretations to interpretations, and for an interpretation I and an arbitrary propositional symbol A is defined as

TP(I )(A)= sup{ϑ &i ˆI(B) | A ←iB, ϑ ∈ P}

The main feature of TP is that its least fixed-point, denoted by lfp(TP), coincides with the least model of the program P [49] and is obtained iterating the TP operator from the least interpretation . As we also highlighted in the introduction, it is important to know when this iteration finishes in a finite number of steps.

Definition 14. Let P be a multi-adjoint program, and A ∈ . The set RPI(A)of relevant values for A with respect to an interpretation I is the set of maximal values of the set {ϑ &i ˆI(B) | A ←i B, ϑ ∈ P}. The culprit set for A with respect to I is the set of rules A ←i B, ϑ of P such that ϑ &i ˆI(B) belongs to RPI(A). Rules in a culprit set are called culprits. The culprit collection for TPn()(A) is defined as the set of culprits used in the recursive computation of TPn()(A).

The notion of termination used in [20], which we will also consider in this paper, is the definition of fixpoint- reachability of Kifer and Subrahmanian [41].

Definition 15. Let P be a multi-adjoint logic program with respect to a multi-adjoint -algebra L and a set of propo- sitional symbols . We say that TP terminates for every query if for every propositional symbol A, there is a finite n such that TPn()(A) is identical to lfp(TP)(A).

An interesting termination theorem given in [20] was based on the notions of dependency graph and finite depen- dences.

Definition 16. The dependency graph of a multi-adjoint logic program P is a digraph where the vertices are the propositional symbols in , and there is an arc from a propositional symbol A to a propositional symbol B for each rule with head A and the body containing an occurrence of B. The dependency graph for a propositional symbol A is the subgraph of the dependency graph containing all of the vertices connected to A and corresponding edges.

We say that a multi-adjoint logic program P has finite dependences if the number of edges in the dependency graph for A is finite for every propositional symbol A.

Notice that a program can have finite dependences, even though the program has an infinite set of rules. A particular case was shown in Example 23 of [20], in which a countable infinite program with finite dependences was presented.

Based on this definition, the following theorem was introduced in [20], which is one of the most important termination results given in the aforementioned paper.

Theorem 17 ([20]). Let P be a multi-adjoint logic program with respect to a local multi-adjoint -algebra L and the set of propositional symbols , and having finite dependences. If for every iteration n and propositional symbol A the set of relevant values for A with respect to TPn() is a singleton, then TP terminates for every query.

Because we assume finite dependences, when the unit interval or any linear lattice is considered, for every iteration n, TPn()(A) is a maximum for all propositional symbol A and so, the previous theorem can be applied.

Corollary 18 ([20]). Given a local multi-adjoint -algebra L, where the lattice is the unit interval [0, 1], and a multi-adjoint logic program P , having finite dependences, we have that TP terminates for every query.

In addition, if the theorem cannot be applied to show termination results (e.g., in the case of Hybrid Probabilistic Logic Programs (HPLPs) appearing in [23], because operators employed to capture disjunctive probabilistic strategies do not satisfy the boundary conditions), then we have the following result, which is based on the notion of range dependency graph.

(8)

Definition 19. The range dependency graph of a multi-adjoint logic program P has a vertex for each propositional symbol in . There is an arc from a propositional symbol A to a propositional symbol B if A is the head of a rule with body containing an occurrence of B, which does not appear in a sub-term rooted by a function symbol having finite range.

This definition reduces the dependency graph of a multi-adjoint logic program P removing arcs associated with operators with finite range. Consequently, arcs involved in infinite loops can be removed, and so the loops can be broken. For example, &Ł: [0, 1]10× [0, 1]10→ [0, 1]10 has a finite range because at most only 11 values can be obtained when this operator is used. Hence, if we have the rule A ← &Ł(&P(A, B), B) ⊗ &P(B, D), then the range dependency graph will not consider the subterm &Ł(&P(A, B), B)and so the representation of the previous rule in the range dependency graph will be equivalent to the representation of the rule: A ← &P(B, D).

We will say that a multi-adjoint program P has range finite dependences, if for every propositional symbol A, the number of edges in the associated range dependency graph for A is finite. On this notion, we have the following result.

Theorem 20 ([20]). If P is a multi-adjoint logic program with an acyclic range dependency graph having range finite dependences, then TP terminates for every query.

Finally, the last result merges Theorems17and20to allow more flexible logic programs.

Theorem 21 ([20]). Let P be a multi-adjoint logic program with respect to a local multi-adjoint -algebra with finite operators L and the set of propositional symbols , and having range finite dependences.

If for every iteration n and propositional symbol A the set of relevant values for A with respect to TPn() is a singleton, then TP terminates for every query.

Although these results are useful and general, as we will show next, they do not allow the use of aggregator operators (e.g., weighted sums or disjunctive operators) in general, which is very suitable in many applications.

Example 22. Given the program introduced in Example9, the least model of the program through the immediate consequence operator TP will be computed next.

A simple implementation of the TP operator can be done (e.g., in Python):

c=n=h=f=u=a =0;

c1 = n1 = h1 = f1 = u1 = a1 =0;

count =0;

while [c ,n ,h ,u ,f ,a] < > [c1 ,n1 ,h1 ,u1 ,f1 , a1 ] or count ==0:

c= c1 ;n= n1;h= h1 ;u= u1;f= f1 ;a= a1 ; c1=n∗u0.8;

n1=max(c∗0.8 ,(h+2f )∗0.6/3 ,0.5);

h1=f∗0.7;

u1=min(max(0 ,(h+f−1)),0.7);

f1=max(0.8 ,0.9∗u) a1 =(3∗u+f )/4

print count ,’ ’,f ,’ ’,h ,’ ’,u ,’ ’,c ,’ ’,n ,’ ’,a count += 1;

print count ,’ ’,f ,’ ’,h ,’ ’,u ,’ ’,c ,’ ’,n ,’ ’,a The results of the iterations of this program are depicted in Table1.

Therefore, the least model of the program is obtained after a finite number of iterations. However, the program does not satisfy the hypotheses of Theorems17and21. Specifically, the weighted sums @(3,1)and @(1,2)do not verify the boundary condition with the top element. For example, we have @(3,1)(1, 0.5) = 0.875  0.5 and @(1,2)(0.4, 1) = 0.8  0.4. 

(9)

Table 1

IterationofTPoperatorfromtheleastinterpretation.

f h u c n a

 0 0 0 0 0 0

TP() 0.8 0 0 0 0.5 0

TP2() 0.8 0.56 0 0 0.5 0.2

TP3() 0.8 0.56 0.36 0 0.5 0.2 TP4() 0.8 0.56 0.36 0.144 0.5 0.47 TP5() 0.8 0.56 0.36 0.144 0.5 0.47

Hence, Theorems17and21present interesting and useful termination results, but there are some cases in which the hypotheses are not satisfied, even though TP terminates for every query. Therefore, one important goal is to weaken the hypotheses or introduce new termination results that can be applied to a bigger range of logic programs. Therefore, hypergraphs instead of graphs will be taken into account to reformulate these theorems. The use of hypergraphs for representing logic programs is studied in the following section.

3. Representing programs by labeled directed hypergraphs

The dependency graph of a program has been a useful tool for the termination results recalled above [20]. However, important information in the program is missing in the dependency graph. This is one of the most important reasons why hypergraphs are useful in this framework. Specifically, in this section we will use labeled directed hyperarcs instead of edges to capture more information about the relationships among the variables in the body of a rule, which are lost when only edges are considered. Consequently, we will show that the consideration of hyperarcs, and so hypergraphs, will provide a richer representation of the program than the dependency graph.

3.1. Edge-labeled B-graphs for representing multi-adjoint logic programs

The notion of associated B-graph of a multi-adjoint logic program P is first introduced. We then present the natural steps for computing such a hypergraph on an example.

Definition 23. Given a multi-adjoint logic program P , the associated B-graph of P is the edge-labeled B-graph HP= (, {(({B1, . . . , Bn}, {A}), @) | A ←i@[B1, . . . , Bn], ϑ ∈ P})

where (({B1, . . . , Bn}, {A}), @) denotes the hyperarc ({B1, . . . , Bn}, {A}) with the label @.

The B-graph HP associated with a given program P , which is obtained from Definition23, is constructed as follows:

1. The vertex set of the hypergraph is the propositional symbol set  of the program. For instance, in Example9, we have V (HP) = {a, c, f, h, n, u}.

2. Each program rule provides a hyperarc e, as follows: the propositional symbols of the body of the rule will be the tail T (e) of the hyperarc, and the propositional symbol of the head of the rule will be the only element of the head H (e). This hyperarc is labeled with the composition operator in the body of the rule. When no operator appears in the body of the rule, we will consider the identity mapping and we will avoid including the symbol in the representation of the hypergraph. For example, from the rule u ←Ph &Lf, 0.7 in Example9, we obtain the hyperarc ({f, h}, {u}) with label &L.

Due to the considered mechanism, the obtained hypergraph is always an edge-labeled B-graph. Moreover, it is possible to obtain the original program from the hypergraph. Hence, both representations are equivalent. However, this fact does not hold for dependency graphs. Fig.3shows the B-graph HP associated with the program P given in Example9. Notice that HP is an edge-labeled hypergraph of the one associated with the example given in page24.

(10)

Fig. 3. Edge-labeled B-graph associated with the program given in Example9.

Moreover, in this particular labeled hypergraph, the hyperarc from f to h has been labeled by the identity mapping (which is not depicted) and the other hyperarcs have the operators in the body of the rules as labels, specifically the symbols @3,1, @1,2, &Łand &P.

As a consequence of the representation of programs by hypergraphs, the manifold results and algorithms develop- ment in directed hypergraphs can be applied to study fuzzy logic programs. For example, it will be used to improve different termination theorems. These theorems do not consider the whole graph associated with a program but only the local notion of dependency graph of a particular propositional symbol. Indeed, infinite programs can be consid- ered with infinite propositional symbols, such as shown by Example 23 in [20]. The next section will introduce an extension of the dependency graph of a propositional symbol to hypergraphs.

3.2. Antecedent sets and associated hypergraphs

The first notion that we need to present collects all of the vertices ‘affecting’ a given vertex, which has been adapted from [33].

Definition 24. Given a vertex v of a directed hypergraph H = (V, E), the antecedent set of v (denoted as AntSetH(v)) is the set of all vertices u ∈ V verifying that there exists a path from u to v.

For example, in the hypergraph in Fig.1, we have AntSetH(a)= {a, f, h, u}

AntSetH(c)= {c, f, h, n, u}

AntSetH(f)= {f, h, u}

AntSetH(h)= {f, h, u}

AntSetH(n)= {c, f, h, n, u}

AntSetH(u)= {f, h, u}

The left-hand side of Fig. 4 displays the hypergraph induced by the vertices in the antecedent set of vertex n, AntSetH(n), of the hypergraph in Fig.1. The right-hand side of this figure displays the hypergraph induced by the vertices in AntSetH(a). The vertices and hyperarcs not included in both induced subhypergraphs are painted in dotted lines. Clearly, the AntSetHP(A)is the set of vertices in the dependency graph for the propositional symbol A in a program P .

Given a multi-adjoint logic program P and a propositional symbol A ∈ , we will denote by PAthe subprogram of P containing the rules with head in AntSetHP(A); that is,

PA= {E ←iB, ϑ ∈ P | E ∈ AntSetHP(A)}

This subset allows the local computation of the least fixed-point of a specific propositional symbol.

Proposition 25. Let P be a multi-adjoint logic program and A ∈  a propositional symbol. The value of the least fixed point of TP on A is equal to the obtained value considering only the rules in PA; that is, lfp(TP)(A) = lfp(TPA)(A).

Proof. The proof holds because PAincludes all of the rules in P that are required to compute lfp(TP)(A).

(11)

Fig. 4. Subhypergraphs induced by AntSetH(n) (left-hand) and AntSetH(a) (right-hand) from the hypergraph depicted in Fig.1.

The fundamental hypothesis of “finite dependences” has a direct translation in terms of PA. Specifically, from this program the associated B-graph HPAcan be defined, obtaining the following equivalence.

Proposition 26. A multi-adjoint logic program P has finite dependences if and only if for every propositional symbol A, the hypergraph HPAis finite.

Proof. The proof follows from the fact that E∈ AntSetHP(A)if and only if E is a vertex of the dependency graph for A. Because the number of propositional symbols in the body of each rule is finite, if HPAis finite, then the number of vertices and edges in the dependency graph for A is also finite, and so P has finite dependences. The other implication holds analogously. 

Clearly HPA is a subhypergraph of HP. Indeed, it is the hypergraph induced by AntSetHP(A). From Propo- sition 26, we also have that the computation of HPA is only needed to check whether P has finite dependences.

Therefore, the dependency graph of a program is not required to be computed but only HPA. In the following, based on this equivalence, we will preserve the terminology “finite dependences” to help the reading and use of the termi- nation theorems given in [20].

Once the definition of dependency graph has been translated to a hypergraph, we will study the obtained associated B-graph to reach new properties for weakening the hypotheses in the theorems recalled in Section2.2.

3.3. Strongly path-connected components

The notion of strongly path-connected component in hypergraphs allows us to obtain a partition of the set of vertices, which will be considered for defining two fundamental definitions in this paper. We first need to recall a similar notion in digraph.

Given a digraph D= (W, A), we say that a vertex u reaches another vertex v, if there is a directed path from u to v.

If they are mutually reachable, then we have that u and v are strongly connected. As connectivity in undirected graphs, strong connectivity in digraphs induces an equivalence relation on the set of vertices. Therefore, strong connectivity provides a partition in the set of vertices into equivalence classes. In particular, these classes are maximal subsets of vertices that are strongly connected to each other and each vertex is in exactly one subset. They are translated to hypergraph theory using the notion of weakly reachable vertices given in page25, as follows.

Definition 27. A pair of vertices u and v of a directed hypergraph are said to be strongly path-connected if u is weakly reachable from v and v is weakly reachable from u. The binary relation R, which is defined as

R= {(u, v) ∈ V × V | u and v are strongly path-connected in H},

is an equivalence relation. The equivalence classes associated with R are called strongly path-connected components, spc-components in short.

It is easy to see that the vertices in each cycle Pst, where s= t, in a hypergraph belong to the same strongly path- connected component. Strongly path connected components can only have one vertex. Notice that the hypergraph in

(12)

Fig. 5. Strongly path-connected components of the hypergraph in Fig.1.

Fig. 6.Aggregatoroperators@(3,1)and@(1,2) labeld-hyperarcs,shownwithdashedlines.Operators&P and&Landnon-labeledrulesare associatedwiths-hyperarcs.

Fig.1has three spc-components, which are depicted in Fig.5. One of them is the singleton {a}, and the other two are {f, h, u} and {c, n}.

We can also observe that if an arbitrary vertex v belongs to the antecedent set of another vertex w—that is, v∈ AntSetH(w)—, then all vertices in the same spc-component of v also belong to AntSetH(w). Moreover, if v and w belong to the same spc-component, then AntSetH(v) = AntSetH(w). From these comments, we obtain the following result.

Proposition 28. Given a directed hypergraph H = (V, E) and a vertex v ∈ V , we have that AntSetH(v) is a spc- component of H or the union of spc-components of H.

Proof. The proof straightforwardly follows from the previous statements. 

From the notion of spc-component, we can also split the hyperarcs of a B-graph into two types:

d-hyperarcs: every vertex of its tail belongs to a different spc-component from the one containing the vertex of its head; that is, no vertex of its tail belongs to the spc-component of its head. These hyperarcs are not involved in any cycle Pst, where s= t.

s-hyperarcs: some vertex of its tail belongs to the same spc-component as the vertex of its head. These hyperarcs are involved in one or more cycles of the form Pst, where s= t. (corresponding to cycles of the primal graph).

For example, ({f, h}, {n}) and ({f, u}, {a}) are d-hyperarcs of the B-graph in Fig. 5, and ({f}, {h}) ({f, h}, {u}), ({n, u}, {c}), and ({u}, {f}) are s-hyperarcs. Fig.6depicts the edge-labeled B-graph that is associated with the multi- adjoint logic program P in Example9, in which the spc-components are highlighted: the d-hyperarcs are shown with dashed lines, and the s-hyperarcs are represented in continuous lines. Moreover, the labels of each hyperarc have been highlighted. Specifically, we have that the d-hyperarcs are labeled by the symbols of the aggregator operators @3,1

and @1,2. We must take into account that these operators do not satisfy the boundary condition of Equation (1).

As was remarked in Example 22, although the hypotheses in Theorem17are not satisfied, the iteration in the computation of the least fixed point of the immediate consequence operator terminates. The next section will show that this fact holds because the aggregator operators @3,1and @1,2are associated with d-hyperarcs, and so they are not involved in any “cycle” that can produce an incremental loop in the values of some propositional symbol.

(13)

4. Termination results

This section will introduce the main results of this paper, using directed hypergraphs to enhance the termination theorems given in [20]. Consequently, we will increase the number of logic programs in which the termination theo- rems can be applied.

The following result modifies Theorem17considering any interpretation in the first step of the iteration of the TP operator instead of the bottom interpretation.

Theorem 29. Given a local multi-adjoint -algebra L, a multi-adjoint logic program P with finite dependences and an interpretation I . If for every iteration n and propositional symbol A, the set of relevant values for A with respect to TPn(I ) is a singleton, then there is a finite n such that TPn(I ) is a fixed point of TP.

Proof. We will first prove that for every A ∈ , such that TPn(I )(A) ≺ TPn+1(I )(A)holds, we have that the culprit collection for TPn+1(I )(A)has cardinality at least n + 1. We will proceed by induction in the cardinality of the culprit collection for TPn(I )(A).

For n = 0, given A ∈ , such that TP0(I )(A) ≺ TP1(I )(A), if the culprit collection for TP1(I )(A)is empty, then the computation of the TP(I )(A)is the supremum of the empty set, which is equal to the bottom element of the complete lattice (L, ). Therefore, because ⊥  I (A) = TP0(I )(A), we obtain a contradiction with ⊥  I (A) ≺ ⊥ and we can ensure that the culprit collection for TP1(I )(A)contains at least one element.

Now, we assume that the property holds for n and we need to prove it for n + 1. Hence, we have that given B ∈  with TPn−1(I )(B) ≺ TPn(I )(B), then the culprit collection for TPn(I )(B)has at least n different rules.

Given A ∈  with TPn(I )(A) ≺ TPn+1(I )(A), we will prove that the culprit collection for TPn+1(I )(A)has at least n + 1 different rules. Because, by hypothesis, TPn+1(I )(A)is a singleton, there is at least one rule in the program,

A ←iB, ϑ, such that

TPn+1(I )(A)= ϑ &iTPn(I )(B) Consequently, we have that

ϑ&iTPn−1(I )(B)(T∗) Pn(I )(A)≺ TPn+1(I )(A)= ϑ &iTPn(I )(B)

where (∗) holds because TPn(I )(A) is the supremum of all contributions of the rules in the program and ϑ &iTPn−1(I )(B) is the one associated with the rule A ←iB, ϑ.

Because the operators TP and &i are monotonic, we have that at least one propositional symbol Cj∈  occurring in the body B = @[C1, . . . , Cs] exists, such that TPn−1(I )(Cj) ≺ TPn(I )(Cj).

Therefore, by the induction hypothesis, at least n different rules are in the culprit collection of TPn(I )(Cj), and correspond to hyperarcs of the associated subhypergraph of PA, HPA because C occurs in the body of a rule with head A. We will prove by reduction at absurdum that A ←iB, ϑ is not in that culprit collection.

Hence, we suppose that A ←i B, ϑ is in the culprit collection of TPn(I )(Cj). Therefore, this rule is applied, and so Cj must be in the antecedent set of A. Consequently, we have that the term TPm(I )(A) must appear in the computation of TPn(I )(Cj); that is, TPn(I )(Cj) = f [TPm(I )(A)], where f is a mapping composed of all operators and values recursively appearing in the iterations of TP on I and Cj, which also satisfies the boundary condition with the top (Equation (1)).

Thus, we have that

TPn+1(I )(A)= ϑ &i@[TPn(I )(C1), . . . , TPn(I )(Cj), . . . , TPn(I )(Cs)]

= ϑ &i@[TPn(I )(C1), . . . , f[TPm(I )(A)], . . . , TPn(I )(Cs)]

 TPm(I )(A)

where the last inequality is given because all of the operators satisfy Equation (1). Consequently, by the monotonicity of TP, the assumed strict inequality and the inequality above, we obtain that

(14)

TPm(I )(A) TPn(I )(A)≺ TPn+1(I )(A) TPm(I )(A) which leads us to a contradiction.

Therefore, we have that the culprit collection for TPn+1(I )(A)has at least n + 1 rules. Consequently, the number of considered rules in each iteration of the TP increases. We can ensure that the iteration of the TP terminates for A because P has finite dependences, which proves the result. 

The following result introduces an useful termination theorem, which generalizes Theorem17and greatly increases the spectrum of applications.

Theorem 30. Given a multi-adjoint -algebra L and a multi-adjoint logic program P with finite dependences, where the s-hyperarcs of the associated B-graph correspond to rules with an aggregator in the body satisfying Equation (1).

If for every iteration n and propositional symbol A the set of relevant values for A with respect to TPn() is a singleton, then TP terminates for every query.

Proof. We will proceed by strong induction in the number n of strongly path-connected components of the B-graph associated with PA; that is, of HPA.

We first assume that n = 1; that is, HPAhas only one spc-component. Hence, in this case, no d-hyperarc exists, and so all operators satisfy Equation (1) and we can apply Theorem17, obtaining that TP terminates for A.

Let us assume that the hypothesis when the number of components is k∈ N, with 1 ≤ k ≤ n, is true and we need to prove the case n + 1. Therefore, we consider a propositional symbol A such that HPAhas n + 1 spc-components.

We can write each rule with head A in P , as follows:

r= A ←i@[B1, . . . , Bn, C1, . . . , Cm], ϑ

where B1, . . . , Bnare the propositional symbols in the body of the rule, which are in the same spc-component than A and C1, . . . , Cmare in other components.

Therefore, we can ensure that the number of spc-components of HPCj for each propositional symbol Cj (which is a subhypergraph of HPA), with j ∈ {1, . . . , m}, has at most n components because B1, . . . , Bn and A are not in the antecedent set of Cj. Otherwise, Cj will be in the same spc-component of A, as we will show next. Because for every i∈ {1, . . . , n} we have that Bi and A are in the same spc-component, then there exist two paths PBiA and PABi, from Bi to A, and vice versa, respectively. Now, if i∈ {1, . . . , n} exists such that Bi is in the antecedent set of Cj, then there exists one path PBiCj and so by connecting PABi with PBiCj, we obtain a path from A to Cj, PACj. Meanwhile, this rule provides another path from Cj to A, PCjA, which implies that A and Cj are in the same spc- component, by definition. This fact contradicts the definition of Cj because this propositional symbol is in a different spc-component from A. Finally, if we assume that A is in the antecedent set of Cj, then clearly A and Cj are in the same spc-component.

Consequently, we can apply the induction hypothesis and we have that TP terminates for every Cj, with j{1, . . . , m}. Let Mr be the maximum iteration of all TP()(Cj)in which the least fixed point is obtained; that is, TPMr()(Cj) = lfp(TP)(Cj), for all j∈ {1, . . . , m}. Hence, we can write the rule:

A ←i@[B1, . . . , Bn], ϑ

where @is the aggregator operator defined on [0, 1]nas

@[x1, . . . , xn] = @[x1, . . . , xn,lfp(TP)(C1), . . . ,lfp(TP)(Cm)]

for all x1, . . . , xn∈ [0, 1], and the value associated with each propositional symbol Bi in the body, at iteration Mr, is TPMr()(Bi), for all i∈ {1, . . . , n}.

This procedure can be applied to every rule r with head A or propositional symbol B in the same spc-component of A in HPA. Let M be the maximum natural number of iterations Mr associated with such rules. Consequently, a new set of rules is obtained, denoted as PA1, which also has finite dependences and verifies that the propositional symbols appearing in the body of the rules are in the same spc-component of A. This last fact implies that there is no d-hyperarc in HP1

Aand so all operators satisfy Equation (1). Therefore, we can apply Theorem29to this program and the interpretation IA:  → L defined for all D ∈  as:

(15)

Fig. 7. Edge-labeled B-graph associated with the program given in Example32.

IA(D)=



TPM()(D) if D and A are in the same component lfp(TP)(D) otherwise

obtaining that TP1

Aterminates for A.

Because the computation of TP1

A(IA)(B)is equivalent to TPM+1()(B), for every propositional symbol B in the subprogram PA1we obtain that lfp(TP1

A)(A) = lfp(TP)(A)and so TP terminates for A. 

The assumption that the set of relevant values for A with respect to TPn(I )be a singleton is trivially fulfilled in the unit interval.

Corollary 31. Given a multi-adjoint -algebra L, on the unit interval [0, 1], and a multi-adjoint logic program P with finite dependences, where the s-hyperarcs of the associated B-graph correspond to rules, with an aggregator in the body satisfying Equation (1). We have that TP terminates for every query.

These results can be applied to Example22because the operators not satisfying Equation (1); that is, aggregator operators @(3,1) and @(1,2), are associated with d-hyperarcs, as Fig.6 shows. Consequently, we can ensure from these results that TP terminates for every query. Clearly, these results are more useful in larger programs in which the relationships between the variables are not very clear and the possible loops are not visually recognized.

The previous results will be complemented with the consideration of finite range operators, which remarkably increases the number of applications because any operator with finite range can be considered in the bodies of the rules, preserving the termination character of the immediate consequences operator. The next example presents a program with a new finite operator.

Example 32. We will consider the local multi-adjoint -algebra F as in Example9together with the discretization of the Łukasiewicz disjunction ∨Ł: [0, 1] × [0, 1] → [0, 1]100defined as

Ł(x, y)= min{x + y, 1} · 100

100

where _  is the floor function. On this -algebra F, the following program P is defined:

c ←Pn &Pu, 0.8

n ←Pc, 0.8

n ←P@(1,2)(h, f), 0.6

h ←Pf &GŁ(n, c), 0.7

u ←Gh &Lf, 0.7

f ←Pu, 0.9

a ←P@(3,1)(u, f), 1.0

f ←P1.0, 0.8

n ←P1.0, 0.5

where c, n, h, f, u and a are as in Example9.

We can see in Fig.7that operators @ and @(1,2)are associated with s-hyperarcs, where @ represents the composi- tion of &Gand ∨Ł. The previous results cannot be applied to this logic program because these operators do not satisfy Equation (1). However, the iteration of the immediate consequence operator from the least interpretation terminates, as Table2shows. Thus, a new termination theorem that allows the use of finite range operators in the logic programs must be studied. 

Referencias

Documento similar