This section is devoted to detail a simple, but powerful method for translating fuzzy programs into directly executable standard Prolog code. The final goal is that the compiled code be executed in any Prolog interpreter in a completely transparent way for the final user, i.e., our intention is that after introducing fuzzy programs and fuzzy goals to the system, it be able to return fuzzy computed answers (i.e., pairs including truth degrees and substitutions) even when all intermediate computations have been executed in a pure (not fuzzy) logic environment. The syntactic conventions that our system accepts when parsing multi-adjoint logic programs are very close to those seen in the previous section. During the parsing process, our system produces Prolog code following these guidelines:
and_prod(X,Y,Z):-Z is X * Y.
and_godel(X,Y,Z):-(X=<Y,Z=X;X>Y,Z=Y).
and_luka(X,Y,Z):-H is X+Y-1, (H=<0,Z=0;H>0,Z=H).
p(X,_TV0):- q(X,Y,_TV1),r(Y,_TV2),
and_godel(_TV1,_TV2,_TV3),and_prod(0.8,_TV3,_TV0).
q(a,Y,_TV0) :- s(Y,_TV1), and_prod(0.7,_TV1,_TV0).
q(b,Y,_TV0) :- r(Y,_TV1), and_luka(0.8,_TV1,_TV0).
?- p(X,_TV1),r(a,_TV2),and_godel(_TV1,_TV2,_TV3).
Following this method, the FLOPER tool translates to standard Prolog code the multi-adjoint logic program and goal shown before. In particular, we have used Sicstus Prolog v.3.12.5 for executing them as well as for implementing the tool that we are going to explain immediately.