Next: RELFUN Up: Transforming Relational Languages Previous: Transforming Relational Languages

### REL RELFUN Functions In this first step, all deeply deterministic functional predicates are transformed into functional RELFUN specifications. For our example, this results in:

```
1+) fac(X1, X2) :- X2 is fac/2-1(X1).

1a) fac/2-1(0) :- !& 1.

1b) fac/2-1(X) :-
X1 is -(X, 1),
FX1 is fac/2-1(X1),
Y is *(X, FX1)
& Y.

2+) f(X1, X2) :- X2 is f/2-1(X1).

2a) f/2-1(s[X, Y]) :-
A is -(B, A),
s[A, B] is s[X, Y],
A is fac/2-1(X),
B is fac/2-1(Y) !
& u[s[X, Y], s[A, B]].

2b) f/2-1(X) :-& [X, X].```

The rules 1+ and 2+ are needed in order to allow to call the binary fac and f predicates from the toplevel. The original predicates are transformed into unary function definitions, renaming them by adding the suffix /2-1.

In general, this suffix has the form / - where is the original arity and is the number of output arguments (specified by in the mode declaration). For , the output values are embedded in a values structure, e.g.
f(X,Y,A,B) :- A is +(X,Y), B is *(X,Y). with the modes f( , , , ) is transformed into f(X,Y,A,B) :- values[A,B] is f/4-2(X,Y). f/4-2(X,Y) :- A is +(X,Y), B is *(X,Y) &values[A,B].

This also works for non-adjacent output arguments: g(X,A,Y,B) :- with modes g( , , , ) is transformed into g/4-2(X,Y) :- &values[A,B].

Such value structures can be viewed as representing multiple-valued functions as described in [\protect\citeauthoryearStein and Sintek1991] .

Harold Boley & Michael Sintek (sintek@dfki.uni-kl.de)
{"ft_lang_label":"__label__en","ft_lang_prob":0.79440874,"math_prob":0.99725676,"size":1347,"snap":"2019-13-2019-22","text_gpt3_token_len":460,"char_repetition_ratio":0.11913626,"word_repetition_ratio":0.017857144,"special_character_ratio":0.37416482,"punctuation_ratio":0.22527473,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98253655,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,3,null,null,null,null,null,2,null,2,null,2,null,2,null,5,null,null,null,null,null,1,null,4,null,4,null,5,null,5,null,4,null,5,null,4,null,5,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-05-22T18:50:43Z\",\"WARC-Record-ID\":\"<urn:uuid:3c2b0dfa-fe5b-4a53-94f8-3b9c4039621e>\",\"Content-Length\":\"4375\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:21d489f1-ae95-403a-afc2-a76c3bc2532e>\",\"WARC-Concurrent-To\":\"<urn:uuid:df470276-9129-49c4-87d3-b035ffada9e4>\",\"WARC-IP-Address\":\"131.246.195.10\",\"WARC-Target-URI\":\"http://www.dfki.uni-kl.de/~sintek/flip/paper/flip-pure/subsubsection2_5_2_3_1.html\",\"WARC-Payload-Digest\":\"sha1:YWPR7C22VC4PEZQNG4KYB4XOZI2ZUAZY\",\"WARC-Block-Digest\":\"sha1:UYWRJPLYGNEFONJJBXFHT7IHSLDTUKJX\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-22/CC-MAIN-2019-22_segments_1558232256948.48_warc_CC-MAIN-20190522183240-20190522205240-00260.warc.gz\"}"}