On a class of fuzzy computable functions
Rafael Morales-Bueno
∗, Ricardo Conejo, Jos)e-Luis P)erez-de-la-Cruz,
Francisco Triguero-Ruiz
Dpto. Lenguajes y Ciencias de la Computacion, ETSI Informatica, Universidad de Malaga, Bulevar Luis Pasteur s=n, Malaga 29071, Spain
Received 22 February 1999; received in revised form 15 October 1999; accepted 15 October 1999
Abstract
We present in this paper a 2nitary approach to the concept of fuzzy computability. On this basis we de2ne the class FRof 'n-recursiveW-functions. We prove thatFRis a strict subset of the class of W-functions with recursive graph, as de2ned by Gerla. We show that it is possible to generate the classFR by means of programs written in the languageXL.
c
2001 Elsevier Science B.V. All rights reserved.
Keywords:Fuzzy relations; Fuzzy programming; Fuzzy computability; Fuzzy languages
1. Introduction
Fuzzy computability is a somewhat complex subject. There have been many proposals to de2ne computabil-ity [3,4,6,15], and some of them are too broad. A 2rst clari2cation was made by Gerla [5] with his hierarchy of classes. However, from a certain point of view, even Gerla’s smallest class WRG might be considered too extensive. In fact, since the complete image of an element u can be in2nite, a 2nite machine cannot compute it in 2nite time. For this reason, in this paper a new class FR of W-functions that re2nes Gerla’s hierarchy (FR⊂WRG) is de2ned. This class will be called the class of 2nitely recursive W-functions or, in short, 'n-recursive functions. The conditions for a function with recursive graph to be 'n-recursive are also studied in this paper.
In recent papers [10,12], we have introduced the fuzzy programming language XL with a small set of instructions; one of them is the fuzzy assignment. As it was pointed out there, it makes sense to study the possibilities arising when only a restricted 2nite subset of W-computable functions is allowed in the assignment, both from a practical and a theoretical point of view, in order to generate a given class of functions. When aW-functionf can be computed by anXL-program whose fuzzy assignments make use of
∗Corresponding author. Tel.: +34-952-131395; fax: +34-952-131397. E-mail address:[email protected] (R. Morales-Bueno).
0165-0114/01/$ - see front matter c2001 Elsevier Science B.V. All rights reserved. PII: S 0165-0114(00)00014-2
a set F of W-functions, we say that f is XL(F)-programmable. We will de2ne a certain 2nite set C and prove that a W-function f∈FR iF f is XL(C)-programmable.
The rest of this paper is structured as follows: in Section 2 some de2nitions concerning fuzzy Turing machines are presented and the class FR is de2ned in terms of these concepts. Some properties of FR are also proven. In Section 3 a short description of the XL language is given for the sake of completeness of this paper and the relationships between XL programs and multitape fuzzy Turing machines are shown. In Section 4 the class FR is de2ned in another way, via XL-programs. Finally, in Section 5 some conclusions are drawn and future lines of research are suggested.
2. Fuzzy Turing machines and nitely recursive functions
In the following, we will consider that the degrees are evaluated in a 2nite ordered semiringW({l0; : : : ; lr};
⊕;⊗;6). We will assume that the identity elements are l0 for ⊕ and l1 for ⊗. Sometimes we will write 1
for l1 and 0 for l0.
Let Z+ be the set of nonnegative integers. We will use W-sets over (Z+)n; n¿1, with the standard
representation: A=A(a)=a+· · ·+A(z)=z. If a= (a1; : : : ; an)∈(Z+)n then i represents the ith-projection i(a) =ai.
Let U and V be sets. A W-function f from U into V is a function from U×V into W. If f(u; v) =, then we say that the value of theW-function f atu is vwith weight or degree . The image Im(f; u) of f
atu is a subset of V given by Im(f; u) ={v: f(u; v)=0}.
For the concept of W-Turing machine (in the following, W-TM), we will use the de2nition of [1] with some minor modi2cations.
Denition 1. Let W be an ordered semiring. A W-TM is a 4-uple Z= (V; S; p; s0) where V and S are 2nite
nonempty sets,V∩S=∅; s0∈S andpis aW-function fromS×V to (V∪{L; R})×(S∪{h}); L; R ∈V; h ∈S.
In the de2nition above S is the state set, s0 the initial state, V the set of symbols. Moreover, p is the transition W-function, namely p(s ; C; z; s) which represents the degree of validity of the choice of the act (z; s) at state s and when the tape symbol C is scanned. Such an act is to move to the right (if z is R), to the left (if z is L) or to replace C by z (if z∈V) and successively to assume the state s (stop if s is h). We shall assume that in V there is a special symbol # that stands for blank.
For every u=0, we can write (s ; C)→u(z; s) to denote that p(s ; C; z; s) =u and (s ; C) →(z; s) to denote that p(s ; C; z; s) = 1. The W-function p is characterized by a 2nite set of arrows of this type.
Denition 2. Let us de2ne V={a: a∈V}. The empty string will be denoted by". Anelementary description
is an element of (S∪{h})×({"}∪(V−{#})V∗)V(V∗(V−{#})∪{"}), i.e., a pair of the form (s ; uaw), where
s is a state (or the halting state h), u is the empty string or a string over V whose 2rst symbol is not #; a
is a symbol of V, and w is the empty string or a string over V whose last symbol is not #. An elementary description expresses the present state (s), the content of the tape (uaw) and the position and content of the scanned square (a).
Elementary descriptions will be denoted byd; d1; d2; : : : :
Let D(T) be the set of elementary descriptions for the W-TM T= (V; S; p; s0). We will write D for D(T)
when T can be clearly determined from the context.
Now, the W-function p∗ can be de2ned. This function describes one step of computation.
Denition 4. Let T= (V; S; p; s0) b e a W-TM. Let D be the set of elementary descriptions of T. The W-function p∗:D→D is de2ned as follows: for each d; d∈D
p∗(d; d) =
p(s ; c; c; s) if d= (s ; ucw); d= (s; ucw)w;
p(s ; c; R; s) if d= (s ; uccw); d= (s; uccw) or d= (s ; uc) and d= (s; uc#);
p(s ; c; L; s) if d= (s ; uccw); d= (s; uccw) or d= (s ; cw) and d= (s;#cw); 0 otherwise;
where # is the blank, u; w∈V∗; s ; s ∈S and C; C∈V.
Comment. Santos [15] de2nes a computation with input x∈V∗ and output y∈V∗ as a 2nite sequence of elementary descriptions =d1d2: : : dn whered1= (s0; x#); y is obtained from dn by erasing all symbols not
inV∗, and d
n is a 2nal elementary description. The weight associated with a computation =d1d2: : : dn is
de2ned by
w() =p∗(d
1; d2)⊗p∗(d2; d3)⊗ · · · ⊗p∗(dn−1; dn):
Following this, he denotes byw(T; x; y) the multiset (possibly in2nite) of the weights of all the computations with inputxand outputy, and de2nesw(T; x; y) as the least upper bound of the partial sums of the elements inw(T; x; y). Then, aW-functionfisT-computableif aW-TM exists such thatf(x; y) = w(T; x; y). Notice that, since w(T; x; y) may arise from computations of unbounded length, no con2guration computed in any number of steps is guaranteed to have a degree equal to the corresponding degree in w(T; x; y). That is to say, no computed degree ) can be assumed to be the actual degree of f(x; y).
Our proposal here is to add the condition of total termination, i.e., to request that – sooner or later – all elementary descriptions in a description become 2nal elementary descriptions. The W-functions computable b y aW-TM satisfying this additional request will be called 'n-recursiveW-functions.
The preceeding informal remarks can be easily formalized. LetT= (V; S; p; s0) b e a W-TM and D(T) the
set of its elementary descriptions. We will denote the fuzzy subsets of D(T) b y *(T), *1(T), *2(T); : : : .
Each *(T) will be called a description. The machine T can be omitted if it is clear from the context.
Denition 5. * is an initial description iF *= 1=(s0; x#). * is a'nal description iF
(1) *(d)= 0, for at least one d∈D(T),
(2) For everyd∈D(T), with *(d)= 0, d is a 2nal elementary description.
We can now de2ne the function that computes a description * in one step. Since only a 2nite number of elementary descriptions can be generated in a 2nite number of steps, the de2nition assumes that the support of * is 2nite.
Denition 6. Let T b e a W-TM and let *=)=d and*=)1=d1+· · ·+)s=ds be descriptions of T. We say that T computes * from * in one step, and write *⇒T*, iF:
(a) )⊗p∗(d; di) =)i, i= 1; : : : ; s, (b) ∀d=di, i= 1; : : : ; s, p∗(d; d) = 0,
Denition 7. Let T b e a W-TM and let*=)1=d1+· · ·+)r=d and* be descriptions ofT. We say that T
computes * from * in one step, and write *⇒
T*, iF
(a) for each i= 1; : : : ; r, )i=di⇒T*i,
(b) *=
i∈{1;:::; r}*i, where the union is de2ned w.r.t. the operation ⊕.
We de2ne ⇒∗
T as the reLexive transitive closure of ⇒T.
Comment. De2nition 6 states the procedure to compute descriptions from elementary descriptions by means of the W-function p∗. De2nition 7 states the procedure to compute descriptions from descriptions as the union of the descriptions generated from every elementary description. The ⊕ operator is used to integrate the degrees.
Denition 8. Let T b e a W-TM. T halts with input x iF there exists a 2nal description * such that 1=(s0; x#)⇒∗T*.
Denition 9. Let I and O be alphabets. Let f b e a W-function from I∗ to O∗. We say that the W-TM
T= (V; S; p; s0) constructs f iF
(a) I; O⊆V.
(b) For each x∈I∗; T halts with input x and the 2nal description is * such that f(x; y) =*(d), with
d= (h; y#).
AW-functionfis 'n-recursiveiF there exists a W-TMthat constructs f.FR(I∗; O∗) will denote the class of all 'n-recursiveW-functions from I∗ to O∗.
Comment. Informally speaking, we are describing the following process: A W-TMstarts from the initial state with the input x written in the tape. Due to the fuzzy nature of the machine, many computations are carried out from this, beginning with diFerent degrees. However, after a 2nite number of steps every computation halts and the diFerent contents of the tape are exactly the y’s such that f(x; y)= 0. Moreover, the degrees of the halting computations are exactly f(x; y).
Note that in this way we could de2ne a crisp construct by settingW={0;1}. Then theW-TMwould be in fact a nondeterministic TM and the class of'n-recursive functions would be the class of crisp multivaluated functions computed by a nondeterministic TM such that it halts along every path of computation.
This process is essentially diFerent from Santos’ construct. In fact, Santos does not impose the halting condition; then, nonterminating computations can exist, and an external nonoracular observer cannot decide if a certain y will ever appear in the computations, so yielding a value f(x; y)= 0. He cannot decide even if the degree of a certainf(x; y) – computed in a 2nite number of steps – will be modi2ed.
Now, we de2ne the class of 'n-recursiveW-functions from Z+ toZ+.
Let | be some 2xed symbol other than the blank symbol; then the positive integer number n may be represented by the string |n. (Thus zero is represented by the empty string.)
Denition 10. A W-functionf from Z+ toZ+ is said to be constructed by aW-TM Z, if Z= (V; S; p; s 0), V={|;#}, and Z constructs the W-function f from V∗ to V∗, where f(|n) =|f(n) for each n∈Z+. FR(1, 1) will denote the class of all 'n-recursive W-functions fromZ+ to Z+.
Example 1. Let W be {l0; l2; l3; l4; l1} (remember thatl0 is the identity for ⊕and l1 is the identity for ⊗).
Let us show a W-TM that constructs the followingW-function g from Z+ toZ+: for every n∈Z+ g(n; n) =l2;
g(n; n+ 1) =l1; g(n; n+ 2) =l4; g(n; n+ 3) =l3;
We de2ne Z= (V; S; p; s0), where V={|;#}, S={s0; s1; s2} andp is given by
1. p(s0;#;#; h) =l2,
2. p(s0;#;|; s0) =l1,
3. p(s0;|; R; h) =l1,
4. p(s0;|; R; s1) =l1,
5. p(s1;#;|; s1) =l1,
6. p(s1;|; R; h) =l4,
7. p(s1;|; R; s2) =l1,
8. p(s2;#;|; s2) =l1,
9. p(s2;|; R; h) =l3.
Let us assume that the input is the number 3, i.e., the initial description is
*0=l1=(s0;|||#):
Transitions (1) and (2) yield a new description with two elementary descriptions:
*1=l1=(s0;||||) +l2=(h;|||#):
The following chain of descriptions represents the computation of the machine:
*2=l1=(s1;||||#) +l1=(h;||||#) +l2=(h;|||#); *3=l1=(s1;|||||) +l1=(h;||||#) +l2=(h;|||#);
*4=l1=(s2;|||||#) +l4=(h;|||||#) +l1=(h;||||#) +l2=(h;|||#); *5=l1=(s2;||||||) +l4=(h;|||||#) +l1=(h;||||#) +l2=(h;|||#); *6=l3=(h;||||||#) +l4=(h;|||||#) +l1=(h;||||#) +l2=(h;|||#):
In this way, we compute g for the input 3, i.e.,l3=6 +l4=5 +l1=4 +l2=3.
We prove now some properties of the class FR(I∗; O∗).
Proposition 1. Let f be a 'n-recursive W-function fromI∗ to O∗. Then for every x∈I∗; Im(f; x) is a 'nite
non-empty set.
Proof. Let T= (V; S; p; s0) b e the W-TM constructing f. Assume card(V) =n, card(S) =m. Then, we can
reach in one step starting from an elementary description at most (n+ 2)(m+ 1) =k elementary descriptions. Therefore, starting from 1=(s0; x#), and halting after r steps, the 2nal con2guration will have at most kr
elementary descriptions with nonzero degree. This is a 2nite number and hence Im(f; x) is a 2nite set. According to our de2nitions, each 2nal tape content can be interpreted as an output, hence Im(f; x) is nonempty.
Gerla [5] de2nes a hierarchy of recursiveW-functions. We will prove now that FR is strictly included in the bottom class of the hierarchy.
Denition 11(Gerla [5]). A W-functionffrom I∗ toO∗ ispartially recursive(belongs toPRclass) if every cut of fis a recursively enumerable subset ofI∗×O∗. Moreover fis strongly partially recursive (belongs to
SPRclass) if the restriction offto its support {(x; y): f(x; y)= 0} is a partially recursive map from I∗×O∗ toW. Finallyf is with recursive graph (belongs to class WRG) if it is a recursive map from I∗×O∗ to W.
Theorem 1(Gerla [5]). WRG⊆SPR⊆PR and the inclusions are strict.
Proposition 2. FR⊆WRG:
Proof(Sketch). Letf b e a'n-recursiveW-function. There exists aW-TM Twhich constructs f. It is proved in [5] that it is possible to de2ne a gNodelization in the set of W-TM’s. Note that the gNodelization of T
encodes the set of all its 5-uples (state, symbol,action, state, degree). Let t be the number of T.
We must prove thatf:I∗×O∗→W is recursive. So, we must de2ne a crisp Turing machine T such that it yields the degree f(x; y) as output when the input is the string x#y, with x∈I∗ and y∈O∗.
In the spirit of the universal Turing machine,T is de2ned by the following processes: with inputx andy, at 2rst machine T writes the number t in the tape. The content of the tape is now x#y#t. Then T goes on and, by decoding t, carries out every possible computation in one step that would be carried out by T, while storing in another tape (thedegree tape) the corresponding degrees also decoded from t. Immediately
T carries out every possible computation of T in exactly two steps, and so on, by using the well known “dovetailing” method. Since every computation of T halts, this process 2nishes in a 2nite number of steps. After the termination of the process, T has stored in the tapes both the outputs of T z
1; : : : ; zn and the
associated degrees. Then T compares every output z
i with the input y; if any zi matches, T outputs the
associated degree, otherwise T outputs 0. It is an easy, although cumbersome task, to de2ne T with total formality. Hencef(x; y) is (crisp) computable and f is a W-function of the class WRG.
Furthermore, the inclusion is strict, as shown by the following example:
Example 2. Let us consider the W-function f:I∗×I∗→W de2ned as follows:
f(x; y) =
l0 if dist(x; y) is even; l1 if dist(x; y) is odd;
where dist(x; y) is the distance according to the lexicographic order. Obviously, f∈WRG. However,f is not
fin-recursive, since for each x∈I∗,Im(f; x) is not 2nite (Proposition 1).
We now study the conditions for a WRG function to belong to FR. First notice that the values f(x; y)∈ {l0; : : : ; lr} can be easily codi2ed by a 2nite set Vd of additional symbols not in V, Vd={x0; : : : ; xr}. Let us
callV=V ∪V
d.
Denition 12. Let f b e a W-function from I∗ to O∗. We de2ne the (crisp) function s
f:I∗→O∗ in the
following way: if Im(f; x) is 2nite, then sf(x) = sup(f; x) = sup(Im(f; x)), where sup(A) is the least upper
bound ofA with respect to the lexicographic order; otherwise,sf(x) remains unde2ned.
Proposition 3. Let f be a W-function from I∗ to O∗. Then; if f∈WRG and s
f is total (crisp) recursive; then f∈FR.
Proof (Sketch): Since sf is total, Im(f; x) is 2nite for every x. Assume f∈WRG. Then the crisp function f:I∗×O∗→W is totally recursive and hence there exists a (crisp) Turing machineM
1 that computes f for
every input (x; y). Assume sf is (crisp) total recursive. Then there exists another (crisp) Turing machine M2
that computes sup(Im(f; x)) for every inputx. We have to show a (fuzzy) W-TM M that computesIm(f; x) with the associated degrees for every input x. First we de2ne an auxiliary (crisp) Turing machine M that, givenxas input, outputs the 2nite sequence of pairs (y; f(x; y)) for everyy∈Im(f; x). By suitably modifying
M, we will obtain the desired M. Construction ofM= (V; S; p; s
0):M2 is used with input x∈I∗ thus obtaining sup(f; x). Then a machine M generates sequentially all elements y∈V∗ from " to sup(f; x) in the lexicographic order, and writes them next to x. For every written pair x#y a suitable version of the machine M1 is applied thus obtaining y#f(x; y). The three machines M2; M; M1 together de2ne the machine M.
M is obtained fromM as follows:M= (V; S; p; s
0),V=V; S=S∪{Q; Q} whereQ; Q∈=S; pis obtained
from p by changing the state h into the new stateQ and adding the following transitions:
p(Q;#; L; Q) = 1; p(Q; x0;#; Q) =l0;
· · ·
p(Q; xr;#; Q) =lr; p(Q;#; L; h) = 1:
In this way, M obtains the description f(x; y)=(h; y#) from the previously computed description 1=(Q; y#f(x; y)#); to sum up, M outputs every y∈Im(f; y) with degree f(x; y). It is again an easy, although cumbersome task, to de2neM with total formality.M is theW-TM that constructs f, andf is 'n-recursive.
Since it is obvious that for everyf∈FR, sf is totally recursive, these two propositions can be merged in
the following theorem:
Theorem 2. For every f∈WRG; f∈FR i< sf is recursive.
3. The language XL
3.1. A short description ofXL
The languageXL[10,12] is a simple programming language whose data are fuzzy subsets of (Z+)n. In short,
the language can be described as follows: there are two crisp assignments, namelyX:= 0 andsuc(Y) and a set of fuzzy assignmentX:=FUZZn(Y), whereX; Y are variables. AW-functionfn:Z+→Z+ is associated with
each fuzzy assignment label FUZZn. There is a main control structure, namely an inde2nite loop WHILE X=0 DO: : :OD.X, as usual, is called the control variable of the loop. It is well known (see, for example, [16]) that conditional control (IF) and de2nite loops (FOR) can be expressed in terms of inde2nite loops. The meaning of an XL program is de2ned in [10,12] in terms of its operational semantics, i.e., considering a program as a device that computes a function 2P(a; b). An XL program has two sets of distinguished variables – input
variables and output variables – and computes a W-function from input into output variables.
Let us describe in a less formal way how a program is fuzzily executed and the concept of con2guration. Due to fuzzy inputs or assignments, a program can reach a point from which every instruction must be executed in a fuzzy way; this is specially important when considering loops or conditionals. When the program is
completed, a set of outputs is obtained, and there is a degree associated to every output; i.e., the output of a program is a fuzzy subset. The execution of a – crisp-program could be viewed as the generation of a sequence of “crisp con2gurations”. Every con2guration represents the set of pairs (variable; value) in a given instant of the execution. When considering XL programs, this sequence is not de2ned in a crisp way; in fact, arising from a certain point, there are several computing branches with an associated degree for each branch. In this way, the execution of an XL program could be viewed as the generation of a sequence of fuzzy con2gurations, where a fuzzy con2guration is a fuzzy set of crisp con2gurations. In the following we will call “con2guration element” to these crisp con2gurations and reserve the name “con2guration” for fuzzy con2gurations.
The semantics of a WHILE loop, informally speaking, could be described as follows.
Let X be the control variable of an inde2nite loop. For each con2guration element with X= 0, the body of the loop is executed. Results are grouped together with elements with X= 0, giving an intermediate con2guration. The process is iterated until every element in the con2guration hasX= 0. If such a con2guration is not reached, the process goes on forever. Notice that this fuzzy loop, when applied to crisp data, is equivalent to a crisp loop.
In [10,12] it was proved that every XL program without inde2nite loops de2nes a total W-function, in the sense that for every initial con2guration exactly one 2nal con2guration is reached. However, the situation is diFerent in the presence of inde2nite loops; in the general case there are nonterminating computations, and no 2nal con2guration is reached from a certain set of initial data.
More formally, letH be a set of recursive W-functions, H⊂PR. AW-functionf isXL(H)-programmable iF there exists anXL-programPthat computesf, provided that every assignment inP,X:=FUZZn(Y), is asso-ciated to aW-functionfn∈H. The class of XL(H)-programmable functions will be denoted F(XL(H)). Since
a programmable function can be partial, we also de2ne the set of total programmable functionsFT(XL(H)).
3.2. Multitape W-TMs and XL-programs
In this section we study the concept of multitape W-TM. Informally speaking, such a machine reads from and writes on several tapes. This construct is well known in crisp computability. The concept developed in this section will be used in Section 4.
Denition 13. Ak-tapeW-TM is a 4-upleZ= (V; S; p; s0) whereV andS are 2nite nonempty sets,V∩S=∅; s0∈S andp is aW-function fromS×(V)k to (V∪ {L; R})k×(S∪ {h});L; R =∈V; h =∈S.
An elementary description ofZ is ak+1-tuple (q; u1a1v1; : : : ; ukakvk) whereq∈S∪{h}anduiaivi∈({"}∪(V
-{#})V∗)V(V∗(V-{#})∪ {"}).
An elementary description is 2nal whenq=h.
The concepts of description, initial description, 2nal description, computation and halting are de2ned for multitape W-TM in a way analogous to the case of one-tape W-TM, as seen in Section 2.
Denition 14. Letfb e aW-function from (I∗)r to (O∗)s. We say that the W-TM T= (V; S; p; s
0)constructs f iF
(a) I; O⊆V.
(b) For eachx∈(I∗)r,T halts with inputxand the 2nal description reached is *such thatf(x; y) =7 *(d),
where 7 represents the application of ⊕ to the set of all elementary descriptions d such that *(d)= 0, d= (h; c1; : : : ; ck) andci=yi#, i= 1; : : : ; s, y= (y1; : : : ; ys).
FR(r; s) will denote the class of all fin-recursive W-functions from (Z+)r to (Z+)s. Notice that these
de2nitions are consistent with those given for a (one-tape)W-TM in Section 4:1.FR will be in the following the union of every FR(r; s) (r; s∈Z+, s¿0).
A natural mapping can be established betweenXL-programs and multitape machines. This idea is developed in the rest of the section. Obviously, we will focus on machines with alphabet V={|;#}, i.e., machines computing the class FR(r; s).
Notation. Let C be C= (c1; : : : ; ck)∈(Z+)k. The pair (q; C) will stand for an elementary description of a k-tape W-TM (q; C
1#; C2#; : : : ; Ck#) where Ci=|: : :|(ci times).
Denition 15. Let C be a con2guration of a k-program in XL and let *be a description of a k-tapeW-TM.
C and * are equivalent iF there exists a 2nite subset {b1; : : : ; bn} ⊂(Z+)k, a sequence ()1; : : : ; )n) inW, and
a state q such that
C=)1=b1+)2=b2+· · ·+)n=bn and *=)1=(q; b1) +)2=(q; b2) +· · ·+)n=(q; bn):
Denition 16. Let P b e a k-program in XL and let M b e a k-tape W-TM, M= (V; S; p; s0). P and M are
equivalent iF for each a; b∈(Z+)k either (i) or (ii) holds:
(i) 2P(a; b) is not de2ned and M does not halt with input a.
(ii) 2P(a; b) =9 and M halts with input a reaching a 2nal description * such that *(b) =9.
Comment. If P and M are equivalent, then there exists a one-to-one mapping between the pairs (initial description, 2nal description) in M and the pairs (initial con2guration, 2nal con2guration) in the derivation tree ofP. In other words, if the initial con2guration ofP and the initial description of M are equivalent, then both P and M either engage in a nonterminating computation or halt, and, if both P and M halt, then the 2nal con2guration ofP and the 2nal description of M are equivalent.
4. Programming characterization of FR
Denition 17. Let I1; : : : ; Ir and 01 be the following W-functions fromZ+ to Z+:
Ii(x; y) =
li if y=x;
0 otherwise; 01(x; y) =
1 if (y= 0) or (y= 1);
0 otherwise;
i= 1; : : : ; r.
We de2ne the family C={I1; : : : ; Ir; 01}. Notice thatC⊂FR.
For the proofs to be developed in this section, we need a theorem stated and proved in [16] whose roots may be found in [17,2] (see, for example, [13]). With the notation used in this paper, the theorem can be stated as follows:
Theorem 3(Sommerhalder and van Westrhenen [16]). A (crisp) function f is (crisp) recursive i< f is XL({I1})-programmable.
Proof.
P3;
begin
X5 := 0;
1 X2 := P2 (X1);
2 REPEAT X2 TIMES
3 IF X5=1 THEN
4X4:= P1 (X1, X3);
5 IF X4=0 THEN
6 X5 := FUZZ0 (X4);
7 IF X5 = 1 THEN
8 X6 := FLATTEN (X3, X4)
9 FI
10 FI
11 FI;
12 X3 := suc(X3)
13 SEMIT;
14IF X5=1 THEN
15 X4:= P1 (X1, X3);
16 X6 := FLATTEN (X3, X4)
17 FI;
18 X1 := X6
end
Program P3.
Letfb e a'n-recursiveW-function fromZ+ toZ+; then, by Proposition 2,f∈WRG, and by De2nition 11, fis a recursive total function fromZ+×Z+toW, and by Theorem 3 there exists anXL({I1}) (crisp) program
that computes f. Let P1= (2;1; Q1) be this program; P1 is also an XL(C) program. By considering that the
identi2er of this program is P1, this program can be used as a macro in the following way:
Xi := P1(Xj, Xk)
whose execution yields the following result: given a, b∈Z+, values for Xj y Xk respectively,Xi stores the
degreef(a; b)-encoded by a positive integer 0; : : : ; r.
On the other hand, the function sf : Z+ →Z+ is (crisp) recursive and there exists a XL({I1}) program
that computes sf. Let P2= (1;1; Q2) be this program inXL({I1}) and also in XL(C). Let its identi2er be P2.
By using these macros, it is possible to write an XL(C)-program P3= (1;1; Q3) that computes f. (Macro
expansion is fully described in [9]).
In this program, the function associated toFUZZ0 is 01. The macro FLATTENis associated to the program P4= (2;1; Q) whose code Q is:
FLATTEN;
begin
IF X2=1 THEN X1:=FUZZ1(X1) FI; IF X2=2 THEN X1:=FUZZ2(X1) FI; ...
IF X2=r THEN X1:=FUZZr(X1) FI
end
Program P4.
The W-functions associated to FUZZi (i= 1; : : : ; r) are Ii.
A formal proof of the theorem could be developed. This proof would use the semantic de2nitions of attributes coin and co' in every node of the derivation tree of P3 [9,12]. However, this proof would be tedious and hardly readable. For this reason, the proof presented here is not fully formalized. The proof will proceed by showing the con2gurations at the begining, at an intermediate point, and at the end of the computation of P3. Notice 2rst the role played by each variable in P3:
X1: stores the input and the output (line 18).
X2: stores the value of sf(X1) and controls the main loop (2–13)
X3: takes all the values from 0 to sf(X1); those with f(X1;X3)= 0 will be the output. X4: stores the degree f(X1;X3) encoded as a positive integer.
X5: stores either 0 or 1 to control a binary branching.
X6: auxiliary store for the outputs.
Let a be the input. The initial con2guration is 1=(a;0;0;0;0;0). Line 1 stores in X2 the greatest integer b
such thatf(a; b)= 0 and for everyb¿b; f(a; b) = 0. In fact, the utility ofb is to control the iterations of the main loop, by ensuring that the last value will beb. Notice that the degree corresponding to the computation with the value b is not 0.
Now the program must obtain the valuesb1¡b2¡· · ·¡bs=bwith degrees)1; )2; : : : ; )ssuch thatf(a; bi) = )i∈ {l1; : : : ; lr}.
This task is performed by the loop in lines 2–13. Inside the loop, if b¡b
1 then f(a; b) = 0, hence the
macro in line 4 makes X4=0 and no action is carried out in the statements embraced by the IF in line 5. Therefore the con2guration is not changed.
Let us assume that there have been computed and stored inX6some valuesbi:b1; : : : ; bj−1. After executing bj−1 times the main loop, the resulting con2guration will be
)1=(a; b; bj; n1;1; b1) +· · ·+)j−1=(a; b; bj; nj−1;1; bj−1) + 1=(a; b; bj; nj−1;0;0):
Notice thatX5=1, except for the last elementary con2guration. Then the 2rst j−1 elementary con2gurations never satisfy the condition in line 3, because the value of X5 is not changed outside the IFstatements.
Therefore, the only modi2ed con2guration is the last one. Let us describe a complete execution of the main loop with respect to the changed elementary con2gurations.
After the execution of line 4 the con2guration is
1=(a; b; bj; nj;0;0);
Then the condition in 5 is satis2ed and after 6 it is 1=(a; b; bj; nj;1;0) + 1=(a; b; bj; nj;0;0):
The condition in 7 is only satis2ed by the 2rst elementary con2guration; after line 8 the con2guration is
)j=(a; b; bj; nj;1; bj) + 1=(a; b; bj; nj;0;0):
Now, the 2rst elementary con2guration must remain unchanged, since X5=1; the other can be eventually modi2ed. To sum up, the complete con2guration is now
)1=(a; b; bj; n1;1; b1) +· · ·+)j−1=(a; b; bj; nj−1;1; bj−1) +)j=(a; b; bj; nj;1; bj) + 1=(a; b; bj; nj;0;0);
where a new partial result has appeared.
Let us study now the last step of the execution for bs=b. At this moment, the loop has been executed b
times for the values ofX30;1; : : : ; b−1. NowX3=b, andf(a; b)=0. The loop is 2nished and the con2guration is
)1=(a; b; b; n1;1; b1) +· · ·+)s−1=(a; b; b; ns−1;1; bs−1) + 1=(a; b; b; ns−1;0;0):
Since only the last elementary con2guration has X5=1, only the last elementary con2guration will be modi2ed. After 15 it is
1=(a; b; b; ns;0;0)
and after 16:
)s=(a; b; b; ns;0; b) (b=bs):
Finally, after 18 the con2guration is
)1=(b1; b; b; n1;1; b1) +· · ·+)s−1=(bs−1; b; b; ns−1;1; bs−1) +)s=(bs; b; b; ns;0; bs):
The semantic W-function associated to P3 is =P :Z+×Z+ →W such that for i= 1; : : : ; s =P(a; bi) =)i
and for any other b; =P(a; b) = 0, so =P=f and hence f is XL(G)-programmable.
Example 3. Letf b e a'n-recursiveW-functionf:Z+×Z+→W such that for argument 9, the images are
as follows: f(9;0) = 0; f(9;1) = 0; f(9;2) =l4; f(9;3) =l6; f(9;4) =l1; f(9;5) = 0; f(9;6) =l3, for every x ¿6; f(9; x) = 0. Let us consider the program P proposed in the above proof. We will show, for example, that =P(9) =f(9).
The initial con2guration is: 1=(9;0;0;0;0;0)
After the execution of 1, the con2guration is 1=(9;6;0;0;0;0)
Now, the de2nite loop (2–13) is iterated 6 times for X3 = 0; : : : ;5 (instruction 12). The 2nal value of X3
is 6.
According to 3, X5 = 0=1, hence 4 is executed; since f(9;0) = 0, the con2guration is not changed. Since
X4=0, the next statement must be 12, whose execution yields 1=(9;6;1;0;0;0)
and we come back to 3. Since f(9;1) = 0, the process is iterated and after 12 we have 1=(9;6;2;0;0;0):
Again in 3, it holds that X5=1, therefore 4 is executed, so computing for X4 the value 4 (encoding the degreel4), and the con2guration is
Now, in 5 it holds that X4=0, line 6 must be executed and it is 1=(9;6;2;4;1;0) + 1=(9;6;2;4;0;0):
The condition of 7 (X5=1) is satis2ed by the 2rst elementary con2guration and after the execution of 8 it is
l4=(9;6;2;4;1;2) + 1=(9;6;2;4;0;0):
Only X3 will change in the 2rst elementary con2guration; however, the degree and value of X6 remain unchanged. Now it is the second elementary con2guration which is essentially changed. After 12 we have
l4=(9;6;3;4;1;2) + 1=(9;6;3;4;0;0):
ForX5=1, after the execution of 4, X4stores the value 6 (encoding the degree l6), and we have l4=(9;6;3;4;1;2) + 1=(9;6;3;6;0;0)
X4=0, therefore after executing 6 we have
l4=(9;6;3;4;1;2) + 1=(9;6;3;6;1;0) + 1=(9;6;3;6;0;0):
For the second elementary con2guration X5=1, therefore line 8 is executed and we have
l4=(9;6;3;4;1;2) +l6=(9;6;3;6;1;3) + 1=(9;6;3;6;0;0):
After the following execution of the loop we have
l4=(9;6;4;4;1;2) +l6=(9;6;4;6;1;3) +l1=(9;6;4;1;1;4) + 1=(9;6;4;1;0;0):
Now X3is incremented in 12, and we have
l4=(9;6;5;4;1;2) +l6=(9;6;5;6;1;3) +l1=(9;6;5;1;1;4) + 1=(9;6;5;1;0;0):
Only the last elementary con2guration satis2es X5=1. After 4 we have
l4=(9;6;5;4;1;2) +l6=(9;6;5;6;1;3) +l1=(9;6;5;1;1;4) + 1=(9;6;5;0;0;0)
andX4=0 does not hold; line 12 is executed and the con2guration becomes
l4=(9;6;6;4;1;2) +l6=(9;6;6;6;1;3) +l1=(9;6;6;1;1;4) + 1=(9;6;6;0;0;0):
The main loop (2–13) has been executed 6 times; in line 14 it holds that X5=1 in the last elementary con2guration. Line 15 is executed and we have
l4=(9;6;6;4;1;2) +l6=(9;6;6;6;1;3) +l1=(9;6;6;1;1;4) + 1=(9;6;6;3;0;0):
After 16 we obtain
l4=(9;6;6;4;1;2) +l6=(9;6;6;6;1;3) +l1=(9;6;6;1;1;4) +l3=(9;6;6;3;0;6):
Finally, after 18 the 2nal con2guration becomes
l4=(2;6;6;4;1;2) +l6=(3;6;6;6;1;3) +l1=(4;6;6;1;1;4) +l3=(6;6;6;3;0;6):
Since P has only one output variable (X1), the output is
l4=2 +l6=3 +l1=4 +l3=6:
Therefore =P(9;2) =l4; =P(9;3) =l6; =P(9;4) =l1; =P(9;6) =l3; otherwise =P(9; x) = 0; hence it yields
Corollary 1. FR⊆FT(XL(C)):
Proof. Let f be an element of FR, i.e. f is a fin-recursive W-function from (Z+)n to (Z+)k. Let us
consider Cantor’s encodings (see for example [16]) cn: (Z+)n→Z+ and ck: (Z+)k→Z+. Both these
en-codings and their inverses are bijective crisp recursive functions. Then we can consider f from Z+ to Z+
de2ned by f(x; y) =f(c−1
n (x); c−k1(y)). Obviously, f is a fin-recursive function and by Theorem 4, f is XL(C)-programmable, hence f(u; v) =f(c
n(u); ck(v)) is also XL(C)-programmable, i.e., f is an element of F(XL(C)). Since every f∈FR is total, then f∈FT(XL(C)).
In the following, we will prove the reverse inclusion, i.e., that FT(XL(C))⊆FR. The proof will make use of multitapeW-TM’s. For every programP, we will show (Lemma 4) an equivalent machineM, in the sense of Section 3.2. The proof of Lemma 4 will be developed by structural induction on the program P, beginning from one-statement assignment programs (Lemma 3), and simulating sequence (Lemma 1) and nesting of statements (Lemma 2).
Lemma 1. Let P1 be a k-program in XL with code P1; begin B1 end. Let P2 be a k-program in XL with codeP2;begin B2end. Assume there exist twok-tape machines T1y T2 equivalent; respectively; to P1 y P2. Then there exists ak-tape machine T equivalent to the XL-program P whose code is P12; begin B1;B2end
Proof. Let Ti= (V; Si; pi; s0i) (i= 1;2) be the W-MT equivalent to the program Pi.
Then the k-tape W-TM T= (V; S; p; s0) is de2ned as follows:
S=S1∪S2; p(q; C; C; q) =p
1(q; C; C; q) if q; q∈S1 andq=h; p(q; C; C; s
02) =p1(q; C; C; h) if q∈S1; p(q; C; C; q) =p
2(q; C; C; q) if q; q∈S2; s0=s01
The transitions ofT are, roughly speaking, those ofT1 plus those ofT2: however, in the halting transitions
of T1; h is replaced bys02. T starts from the initial state of T1; operates as T1 would operate untilT1 would
halt (so simulating S1); then operates as T2 would operate (so simulating S2). It is easy to verify that T is
equivalent toP.
In the following, the machine T so de2ned will be represented as T1oT2 (T1 concatenated toT2).
Lemma 2. LetP1 be ak-program inXL with codeP1;beginB1end. Assume there exists ak-tape machine T1 equivalent to P1. Then there exists a k-tape machine T equivalent to the k-program P whose code is P1i; begin while Xi=0 doB1 od end
Proof. Let T1= (V; S1; p1; s01) b e the W-MT equivalent to the programP1.
Then the k-tape W-TM T= (V; S; p; s0) is de2ned as follows:
S=S1∪ {s0; s}; (s0; s∈=S1); p(s0;#(i); L(i); s) = 1;
p(s;|(i); R(i); s
01) = 1; p(s;#(i); R(i); h) = 1;
p(q; C; C; q) =p
1(q; C; C; q) if q; q∈S1 andq=h; p(q; C; C; s
0) =p1(q; C; C; h) if q∈S1;
That is to say, T veri2es if the content of the ith tape is = 0; in this case, the state of T becomes the state s01 – initial state for T1 – and T operates as T1 would operate until T1 would halt, the only diFerence
being the substitution of the halting state h by the initial state s0; otherwise, T halts. Obviously, T and P are
equivalents: T terminates iF P halts and, if P halts, the 2nal description reached by T is equivalent to the 2nal con2guration ofP after the execution of begin while Xi=0 do B1 od end.
In the following, the machine T so de2ned will be represented by w(T; i).
Lemma 3. For every program P without loops; there exists an equivalent W-TM.
Proof. We 2rst consider one-statement programs, and then we will consider programs with sequences of statements.
Let us assume thatP is
ident;beginassignmentend
andassignment is Xi:=0;
T is equivalent to P: T= (V; S; p; s0); S={s0; s1; s2}, and p is de2ned as follows:
p(s0;#(i); L(i); s1) = 1 p(s1;|(i);#(i); s2) = 1 p(s1;#(i);#(i); h) = 1 p(s2;#(i); L(i); s1) = 1
Assume now that assignment is Xi := suc(Xj); the machine T de2ned below is equivalent to the programP:
T= (V; S; p; s0); S={s0; : : : ; s6} p(s0;#(i); L(i); s1) = 1
p(s1;|(i);#(i); s2) = 1 p(s1;#(i);#(i); s3) = 1 p(s2;#(i); L(i); s1) = 1 p(s3;#(j); L(j); s4) = 1 p(s4;#(j); R(j); s5) = 1 p(s4;|(j); L(j); s4) = 1 p(s5;|(j);|(i); s6) = 1 p(s5;#(j);|(i); s6) = 1 p(s6;|(j); R(i; j); s5) = 1 p(s6;|(i); R(i); h) = 1
The 2rst 4 lines erase the ith tape. Transitions with states s3 and s4 put the machine at the begining of
contentaj of the jth tape.Transitions with states s5 ands6 copy the content of the jth tape onto the ith tape.
Finally, another “|” is written on the ith tape.
Assume now thatassignmentisXi := FUZZ0(Xj). Remember that the function associated toFUZZ0is 01.
The following machine T is equivalent to P:
T= (V; S; p; s0); S={s0; : : : ; s3}; p(s0;#(i); L(i); s1) = 1;
p(s1;|(i);#(i); s2) = 1; p(s1;#(i);#(i); h) = 1; p(s1;#(i);|(i); s3) = 1; p(s2;#(i); L(i); s1) = 1; p(s3;|(i); R(i); h) = 1:
The W-function 01 always yields the images 0 (degree 1) and 1 (degree 1). In fact, T erases the i-th tape
and then (a) halts with degree 1 and (b) writes a single “|” and halts with degree 1.
Assume now that assignmentis Xi:=FUZZk(Xj)(k= 1; : : : ; r). Remember that the W-function associated toFUZZk is Ik. The following machineT is equivalent to P:
T= (V; S; p; s0); S={s0; : : : ; s6}; p(s0;#(i); L(i); s1) = 1;
p(s1;|(i);#(i); s2) = 1; p(s1;#(i);#(i); s3) = 1; p(s2;#(i); L(i); s1) = 1; p(s3;#(j); L(j); s4) = 1; p(s4;#(j); R(j); s5) = 1; p(s4;|(j); L(j); s4) = 1; p(s5;|(j);|(i); s6) = 1; p(s5;#(j);#(i); h) =lk; p(s6;|(j); R(i; j); s5) = 1:
The W-function Ik yieldsx (degree lk) with inputx. In fact, the only actions performed by T are copying xj in the ith tape and halting with degree lk.
Let us now assume that P is
ident;beginassignment;: : :assignment;end
Notice that it suRces to prove the lemma for sequences of two statements. But, by Lemma 1, it is proved. Hence, Lemma 3 is also proved.
Proof. Let us assume that the program P has no nested loops. Then, by Lemma 3, there is a W-TM M
equivalent toP.
Let us assume that the theorem holds for every program with loops nested at bor less levels. We must prove that the theorem holds for every program with loops nested at b+ 1 levels. Let P be a program with loops nested at b+ 1 levels; then P can be written as
ident;beginS1;S2;: : : Snend
where each Si is either an assignment or a while statement of the form while Xi=0 do Qi od and the
programPiidentbeginQiend has loops nested atb or less levels. IfSi is an assignment then, by Lemma 3,
there exists a machine Mi equivalent to the program ident begin Si end; if Si is a while loop then, by Lemma 2 and the induction hypothesis, there also exists a machine Ti=w(T; i) equivalent to the program
identbegin while Xi=0 doQi od end. In any case, an argumentation similar to that of Lemma 1 shows that there exists a W-TM T=T1◦T2◦ · · · ◦Tn equivalent to P.
Theorem 5. FT(XL(C))⊆FR.
Proof. Letf b e aW-function inFT(XL(C)). By Lemma 4, there is aW-TM M equivalent to P . Sincef is total, P terminates with every input. Hence, M halts in a 2nite number of steps with every input. Therefore,
f∈FR.
We have
Theorem 6. FT(XL(C)) =FR.
5. Conclusions and future work
The results presented in this paper are part of a continuing research on the foundations of fuzzy imperative languages and fuzzy computability [7–9,11,12,14]. From the computability side, this paper indroduces a new, narrower sense of the concept of a fuzzy computable function, given by the classFR. From the programming side, we have shown that a close relationship exists between the class FR and the family of programming languages XL(C) generated when the fuzzy assignment inXL is constrained to be a function belonging to a certain set C; in fact, we have shown that FR=FT(XL(C)).
Future works will extend the programming characterisation to broader classes of fuzzy functions, likeWRG. On the other hand, practical implementations of certain extensions of XL(H) are currently the object of our research.
Acknowledgements
The authors would like to thank the anonymous referees whose comments greatly improved the readability of the paper.
References
[1] L. Biacino, G. Gerla, Fuzzy subsets: a constructive approach, Fuzzy Sets and Systems 45 (1992) 161–168.
[2] C. BNohm, G. Jacopini, Flow diagrams, Turing machines and languages with only two formation rules, Communications ACM 9 (1966) 366–371.
[3] B. Clares, Una introducci)on a laW-calculabilidad: operaciones b)asicas, Stochastica 7 (1983) 111–135.
[4] B. Clares, M. Delgado, Introduction of the concept of recursiveness of fuzzy functions, Fuzzy Sets and Systems 21 (1987) 301–310. [5] G. Gerla, Turing L-machines and recursive computability for L-maps, Studia Logica XLVIII (1989) 179–192.
[6] L. Harkleroad, Fuzzy recursion, ret’s and isols, Zeitschrift Fur Math. Logik Und Grundlagen Der Mathematik 30 (1984) 425–436. [7] R. Morales-Bueno, Calculabilidad mediante gram)aticas difusas., Unpublished Dissertation, Universidad de M)alaga, 1991.
[8] R. Morales-Bueno, B. Clares, Calculabilidad mediante gram)aticas difusas, Primer Congreso Espa˜nol Sobre Tecnolog)Vas y L)ogica Fuzzy, Granada, 1991, pp. 167–172.
[9] R. Morales-Bueno, B. Clares, R. Conejo, J.L. Perez de la Cruz, An elementary fuzzy programming language, Fuzzy Sets and Systems 58 (1993) 55–73.
[10] R. Morales Bueno, J.L. P)erez de la Cruz, R. Conejo, B. Clares, El lenguaje de programaci)on XL, in: R. Mar)Vn Morales (Ed.), Actas Del V Congreso Espa˜nol Sobre Tecnolog)Vas y L)ogica Fuzzy, Murcia, 1995, pp. 135–140.
[11] R. Morales, J.L. P)erez de la Cruz, B. Clares, R. Conejo, Acerca de la calculabilidad de las funciones difusas, In: F. Esteva, P. Garc)Va (Eds.), Actas Del IV Congreso De La Asociaci)on Espa˜nola De Tecnolog)Vas y L)ogica Fuzzy, Blanes (Gerona), 1994, pp. 115 –120.
[12] R. Morales, J.L. P)erez de la Cruz, R. Conejo, B. Clares, A family of fuzzy programming language, Fuzzy Sets and Systems 87 (1996) 167–179.
[13] P. Odifreddi, Classical Recursion Theory, North-Holland, Amsterdam, 1992.
[14] J.L. P)erez de la Cruz, R. Morales-Bueno, R. Conejo, B. Clares, Caracterizaci)on mediante programas de ciertas clases de funciones W-calculables, V Congreso Espa˜nol Sobre Tecnolog)Vas y L)ogica Fuzzy, Murcia, 1995, pp. 141–146.
[15] E.S. Santos, Fuzzy algorithms, Inform. Control 17 (1970) 326–339.
[16] R. Sommerhalder, S.C. van Westrhenen, The Theory of Computability, Addison-Wesley, Wokingham, 1988. [17] H. Wang, A variant of Turing’s theory of calculating machines, J. ACM 4 (1957) 63–92.