DCG Translation with Unification Spillling (Was: Is old school mode directed compilation dead?)

Liste des GroupesRevenir à cl prolog 
Sujet : DCG Translation with Unification Spillling (Was: Is old school mode directed compilation dead?)
De : janburse (at) *nospam* fastmail.fm (Mild Shock)
Groupes : comp.lang.prolog
Date : 25. Jan 2025, 20:44:02
Autres entêtes
Message-ID : <vn3eu1$fmq0$1@solani.org>
References : 1 2 3 4 5 6 7 8
User-Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0 SeaMonkey/2.53.20
Hi,
Lets say there are at least two unification
spilling rewriting techniques in a Prolog system
that would eliminate a (=)/2 call:
/* Left Spilling into the Head */
p(V, Q) :- V = T, ...         ~~>            p(T, Q) :- ...
/* Right Spilling into a Goal */
..., V = T, p(V, Q), ...      ~~>            ..., p(T, Q), ...
Maybe the head movement and the indexing benefit
in SWI-Prolog was discovered because of DCG translation
and not to eliminate mode directed compilation.
Take this DCG rule:
p --> [a], !, [b].
I find that SWI-Prolog does left spilling:
/* SWI-Prolog 9.3.19 */
?- listing(p/2).
p([a|A], B) :-
     !,
     C=A,
     C=[b|B].
Bye
Mild Shock schrieb:
Hi,
 Would need more testing but the
present example is immune:
 /* SWI-Prolog 9.3.19 */
?- X = f(g(1),h(2)), time((between(1,1000000,_), test1(X, Y), fail; true)).
% 1,999,998 inferences, 0.094 CPU in 0.100 seconds (93% CPU, 21333312 Lips)
 ?- X = f(g(1),h(2)), time((between(1,1000000,_), test2(X, Y), fail; true)).
% 1,999,998 inferences, 0.094 CPU in 0.100 seconds (93% CPU, 21333312 Lips)
 ?- Y = j(1,2), time((between(1,1000000,_), test1(X, Y), fail; true)).
% 1,999,998 inferences, 0.109 CPU in 0.100 seconds (109% CPU, 18285696 Lips)
 ?- Y = j(1,2), time((between(1,1000000,_), test2(X, Y), fail; true)).
% 1,999,998 inferences, 0.094 CPU in 0.102 seconds (92% CPU, 21333312 Lips)
 Not all Prolog systems are that lucky:
 /* Scryer Prolog 0.9.4-286 */
?- X = f(g(1),h(2)), time((between(1,1000000,_), test1(X, Y), fail; true)).
    % CPU time: 1.163s, 11_000_108 inferences
 ?- X = f(g(1),h(2)), time((between(1,1000000,_), test2(X, Y), fail; true)).
    % CPU time: 1.248s, 11_000_131 inferences
 ?- Y = j(1,2), time((between(1,1000000,_), test1(X, Y), fail; true)).
    % CPU time: 0.979s, 11_000_131 inferences
 ?- Y = j(1,2), time((between(1,1000000,_), test2(X, Y), fail; true)).
    % CPU time: 1.338s, 11_000_131 inferences
 Bye

Date Sujet#  Auteur
1 Sep 24 * Holy Shit: AI is cheaper than Humans (Was: The road to Artificial Intelligence)34Mild Shock
1 Sep 24 +* AI robots from Disney (Was: Holy Shit: AI is cheaper than Humans)10Mild Shock
3 Sep 24 i`* I can't stand Mira Murati's Eyewash (Was: AI robots from Disney (Was: Holy Shit: AI is cheaper than Humans))9Mild Shock
3 Sep 24 i `* After blue, green why not start yellow (Re: I can't stand Mira Murati's Eyewash)8Mild Shock
25 Sep 24 i  `* miramurati bye bye (Re: After blue, green why not start yellow)7Mild Shock
1 Dec 24 i   +- Im memoriam Doug Lenant (1950 - 2023) (Re: miramurati bye bye)1Mild Shock
1 Dec 24 i   `* "superhumaness" excels "stackoverflow reputation" (Was: Im memoriam Doug Lenant (1950 - 2023)5Mild Shock
1 Dec 24 i    +- para-governemental institution of violence (Re: "superhumaness" excels "stackoverflow reputation")1Mild Shock
14 Mar 25 i    `* Not only $TSLA is on fire sale! [The Decline of Prolog] (Was: "superhumaness" excels "stackoverflow reputation")3Mild Shock
14 Mar 25 i     +- Re: Not only $TSLA is on fire sale! [The Decline of Prolog] (Was: "superhumaness" excels "stackoverflow reputation")1Mild Shock
19 May09:54 i     `- Splitting up the Prologue to Prolog1Mild Shock
5 Sep 24 +* Safe Superintelligence (SSI): Now they are dancing9Mild Shock
5 Sep 24 i`* Re: Safe Superintelligence (SSI): Now they are dancing8Mild Shock
9 Sep 24 i +* Salem Aleikum: Maxwella's Equations2Mild Shock
10 Sep 24 i i`- non judicium, sed latrocinium (Re: Salem Aleikum: Maxwella's Equations)1Mild Shock
13 Sep 24 i `* Internet was made for cats (Re: Safe Superintelligence (SSI): Now they are dancing)5Mild Shock
13 Sep 24 i  +* I was there, 3000 years ago (Re: Internet was made for cats)2Mild Shock
13 Sep 24 i  i`- Even Haitians are now voting for Trump (Re: I was there, 3000 years ago (Re: Internet was made for cats))1Mild Shock
17 Sep 24 i  `* supply chain attack (Was: Internet was made for cats(2Mild Shock
11 Oct 24 i   `- Polyfill Supply Chain Attack (Was: supply chain attack)1Mild Shock
15 Sep 24 `* USA is shitting its pants (Was: Holy Shit: AI is cheaper than Humans)14Mild Shock
18 Sep 24  +* scryer prolog is dead, BILAI instead? (Was: USA is shitting its pants)11Mild Shock
8 Oct 24  i+* Microsoft is plagiarizing my Invention [LLMs under the hood]2Mild Shock
8 Oct 24  ii`- Geoffrey Hinton / Nobelpreis für Physik [Re: Microsoft is plagiarizing my Invention [LLMs under the hood]]1Mild Shock
1 Dec 24  i`* thank you for the FLOPs (Was: scryer prolog is dead, BILAI instead?)8Mild Shock
24 Jan 25  i +* Is old school mode directed compilation dead? (Was: thank you for the FLOPs)5Mild Shock
24 Jan 25  i i`* Re: Is old school mode directed compilation dead? (Was: thank you for the FLOPs)4Mild Shock
25 Jan 25  i i +- format/2 doesn't agree with Trealla or SWI (Was: Is old school mode directed compilation dead?)1Mild Shock
25 Jan 25  i i `* DCG Translation with Unification Spillling (Was: Is old school mode directed compilation dead?)2Mild Shock
25 Jan 25  i i  `- Re: DCG Translation with Unification Spillling (Was: Is old school mode directed compilation dead?)1Mild Shock
4 Mar 25  i `* Will WASM be fast some time? (Was: thank you for the FLOPs)2Mild Shock
4 Mar 25  i  `- Re: Will WASM be fast some time? (Was: thank you for the FLOPs)1Mild Shock
14 Nov 24  `* Book Project: WomanLogic (Re: USA is shitting its pants)2Mild Shock
14 Nov 24   `- Re: Book Project: WomanLogic (Re: USA is shitting its pants)1Mild Shock

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal