Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Totally illogical, there was no chance. -- Spock, "The Galileo Seven", stardate 2822.3


devel / comp.lang.prolog / Re: Autum Challenge, 42 is the Answer

SubjectAuthor
* Re: Autum Challenge, 42 is the AnswerMostowski Collapse
`* Re: Autum Challenge, 42 is the AnswerMostowski Collapse
 `* Re: Autum Challenge, 42 is the AnswerMostowski Collapse
  `* Re: Autum Challenge, 42 is the AnswerMostowski Collapse
   `* Re: Autum Challenge, 42 is the AnswerMostowski Collapse
    `* Re: Autum Challenge, 42 is the AnswerMostowski Collapse
     `* Re: Autum Challenge, 42 is the AnswerMostowski Collapse
      `* Re: Autum Challenge, 42 is the AnswerMostowski Collapse
       +- Re: Autum Challenge, 42 is the AnswerMostowski Collapse
       `* Re: Autum Challenge, 42 is the AnswerMarkus Triska
        `* Re: Autum Challenge, 42 is the AnswerMild Shock
         `* Re: Autum Challenge, 42 is the AnswerMild Shock
          `* Re: Autum Challenge, 42 is the AnswerMild Shock
           `* Re: Autum Challenge, 42 is the AnswerMarkus Triska
            `* Re: Autum Challenge, 42 is the AnswerMild Shock
             `- Re: Autum Challenge, 42 is the AnswerMild Shock

1
Re: Autum Challenge, 42 is the Answer

<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1715&group=comp.lang.prolog#1715

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:bd1:0:b0:6bc:6de1:efa7 with SMTP id 200-20020a370bd1000000b006bc6de1efa7mr16382137qkl.651.1661955833175;
Wed, 31 Aug 2022 07:23:53 -0700 (PDT)
X-Received: by 2002:a81:1058:0:b0:336:d111:278 with SMTP id
85-20020a811058000000b00336d1110278mr18426667ywq.140.1661955833004; Wed, 31
Aug 2022 07:23:53 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Wed, 31 Aug 2022 07:23:52 -0700 (PDT)
In-Reply-To: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=80.218.40.218; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 80.218.40.218
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 31 Aug 2022 14:23:53 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 12
 by: Mostowski Collapse - Wed, 31 Aug 2022 14:23 UTC

Any progress during Corona?

Can this be solved via ZZD and the axiom of extensionality?
Or maybe the new CLP(Z) from Scryer Prolog can do it?

Or are we in the mist of Hilbert’s 10-th problem. Maybe Poincaré
would have objected we simply need new problem specific rules?

Mostowski Collapse schrieb am Montag, 16. September 2019 um 21:49:35 UTC+2:
> Find x, y, z such that:
>
> x^3 + y^3 + z^3 = 42

Re: Autum Challenge, 42 is the Answer

<142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1740&group=comp.lang.prolog#1740

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:424a:b0:6be:74ee:f093 with SMTP id w10-20020a05620a424a00b006be74eef093mr11159478qko.175.1662745371663;
Fri, 09 Sep 2022 10:42:51 -0700 (PDT)
X-Received: by 2002:a25:840c:0:b0:6a9:41dc:ca4d with SMTP id
u12-20020a25840c000000b006a941dcca4dmr12959761ybk.359.1662745371512; Fri, 09
Sep 2022 10:42:51 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 9 Sep 2022 10:42:51 -0700 (PDT)
In-Reply-To: <977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=80.218.40.218; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 80.218.40.218
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com> <977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 09 Sep 2022 17:42:51 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2302
 by: Mostowski Collapse - Fri, 9 Sep 2022 17:42 UTC

Does SWI-Prolog have modpow/4, a function popular in cryptography?
Isn’t this already in GMP, so that a verify fast implementation
would be available?

modpow(B, E, M, R):
The predicate succeeds in R with B^E mod M.

I guess we have also:

(modpow(X,3,M)+modpow(Y,3,M)+42 mod M) mod M =:= modpow(Z,3,M)

But not sure whether this will lead to anywhere. From Fermats
Last Theorem we know, whenever 42 mod M is zero, we
don’t have a non-trivial tripple (X,Y,Z) anyway.

Mostowski Collapse schrieb am Mittwoch, 31. August 2022 um 16:23:54 UTC+2:
> Any progress during Corona?
>
> Can this be solved via ZZD and the axiom of extensionality?
> Or maybe the new CLP(Z) from Scryer Prolog can do it?
>
> Or are we in the mist of Hilbert’s 10-th problem. Maybe Poincaré
> would have objected we simply need new problem specific rules?
> Mostowski Collapse schrieb am Montag, 16. September 2019 um 21:49:35 UTC+2:
> > Find x, y, z such that:
> >
> > x^3 + y^3 + z^3 = 42

Re: Autum Challenge, 42 is the Answer

<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1741&group=comp.lang.prolog#1741

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:145:b0:35a:64a2:2d65 with SMTP id v5-20020a05622a014500b0035a64a22d65mr8468806qtw.376.1662748223901;
Fri, 09 Sep 2022 11:30:23 -0700 (PDT)
X-Received: by 2002:a81:8a87:0:b0:333:a706:2734 with SMTP id
a129-20020a818a87000000b00333a7062734mr12686910ywg.431.1662748223669; Fri, 09
Sep 2022 11:30:23 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 9 Sep 2022 11:30:23 -0700 (PDT)
In-Reply-To: <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=80.218.40.218; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 80.218.40.218
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com> <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 09 Sep 2022 18:30:23 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2720
 by: Mostowski Collapse - Fri, 9 Sep 2022 18:30 UTC

No was talking nonsense, FLT doesn’t exclude non-trivial solutions. For
example we have this solution modulo 6, where it is 42 module 6 = 0:

1^3 + 1^3 + 42 = 2^3 (mod 6)

Mostowski Collapse schrieb am Freitag, 9. September 2022 um 19:42:52 UTC+2:
> Does SWI-Prolog have modpow/4, a function popular in cryptography?
> Isn’t this already in GMP, so that a verify fast implementation
> would be available?
>
> modpow(B, E, M, R):
> The predicate succeeds in R with B^E mod M.
>
> I guess we have also:
>
> (modpow(X,3,M)+modpow(Y,3,M)+42 mod M) mod M =:= modpow(Z,3,M)
>
> But not sure whether this will lead to anywhere. From Fermats
> Last Theorem we know, whenever 42 mod M is zero, we
> don’t have a non-trivial tripple (X,Y,Z) anyway.
> Mostowski Collapse schrieb am Mittwoch, 31. August 2022 um 16:23:54 UTC+2:
> > Any progress during Corona?
> >
> > Can this be solved via ZZD and the axiom of extensionality?
> > Or maybe the new CLP(Z) from Scryer Prolog can do it?
> >
> > Or are we in the mist of Hilbert’s 10-th problem. Maybe Poincaré
> > would have objected we simply need new problem specific rules?
> > Mostowski Collapse schrieb am Montag, 16. September 2019 um 21:49:35 UTC+2:
> > > Find x, y, z such that:
> > >
> > > x^3 + y^3 + z^3 = 42

Re: Autum Challenge, 42 is the Answer

<3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1755&group=comp.lang.prolog#1755

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:4502:b0:6b4:6c2f:e7b7 with SMTP id t2-20020a05620a450200b006b46c2fe7b7mr16406676qkp.11.1663675666544;
Tue, 20 Sep 2022 05:07:46 -0700 (PDT)
X-Received: by 2002:a25:9888:0:b0:6ae:b84f:1004 with SMTP id
l8-20020a259888000000b006aeb84f1004mr18100006ybo.20.1663675666306; Tue, 20
Sep 2022 05:07:46 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 20 Sep 2022 05:07:46 -0700 (PDT)
In-Reply-To: <4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=80.218.40.218; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 80.218.40.218
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com> <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 20 Sep 2022 12:07:46 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2107
 by: Mostowski Collapse - Tue, 20 Sep 2022 12:07 UTC

Furtther question, does SWI-Prolog have modinv/3, also a function popular
in cryptography? It can be used for a Chinese Remainder algorithm.

But currently banging my head on a slow (^)/2 for smallints. In modular
algorithms the arguments for (^)/2 are small. So I now get:

/* SWI-Prolog 8.5.17 */
?- time((modular([11,7,5], X, Y, Z), fail; true)).
% 15,388,917 inferences, 3.969 CPU in 3.963 seconds (100% CPU, 3877522 Lips)
true.

/* Jekejeke Prolog 1.5.4 */
?- time((modular([11,7,5], X, Y, Z), fail; true)).
% Threads 2,078 ms, GC 10 ms, Up 2,122 ms (Current 09/20/22 11:03:10)
true.

But I only solved this k=9 equation, not yet the k=42 problem:

/* x^3 + y^3 + 9 = z^3 */
?- modular([11,7,5], X, Y, Z).
X = 216,
Y = 52,
Z = 217 ;
X = 52,
Y = 216,
Z = 217 ;
false.

Re: Autum Challenge, 42 is the Answer

<e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1756&group=comp.lang.prolog#1756

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:28cf:b0:6b5:e32f:febb with SMTP id l15-20020a05620a28cf00b006b5e32ffebbmr16765072qkp.258.1663698513006;
Tue, 20 Sep 2022 11:28:33 -0700 (PDT)
X-Received: by 2002:a25:e785:0:b0:6ae:3a3f:2a4 with SMTP id
e127-20020a25e785000000b006ae3a3f02a4mr21392686ybh.38.1663698512724; Tue, 20
Sep 2022 11:28:32 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 20 Sep 2022 11:28:32 -0700 (PDT)
In-Reply-To: <3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=80.218.40.218; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 80.218.40.218
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com> <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com> <3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 20 Sep 2022 18:28:32 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2912
 by: Mostowski Collapse - Tue, 20 Sep 2022 18:28 UTC

Using modular operations again, you can make it a tick faster by using
only two modules instead of three modules. But it still depends
heavily on the performance of ar_pow():

/* SWI-Prolog 8.5.17 */
?- time((modular([15,16], X, Y, Z), fail; true)).
% 3,816,486 inferences, 1.766 CPU in 1.762 seconds (100% CPU, 2161550 Lips)
true.

/* Jekejeke Prolog 1.5.4 */
?- modular([15,16], X, Y, Z).
X = 216, Y = 52, Z = 217;
X = 52, Y = 216, Z = 217;
fail.

?- time((modular([15,16], X, Y, Z), fail; true)).
% Threads 594 ms, GC 5 ms, Up 591 ms (Current 09/20/22 20:21:30)
true.

Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 14:07:47 UTC+2:
> Furtther question, does SWI-Prolog have modinv/3, also a function popular
> in cryptography? It can be used for a Chinese Remainder algorithm.
>
> But currently banging my head on a slow (^)/2 for smallints. In modular
> algorithms the arguments for (^)/2 are small. So I now get:
>
> /* SWI-Prolog 8.5.17 */
> ?- time((modular([11,7,5], X, Y, Z), fail; true)).
> % 15,388,917 inferences, 3.969 CPU in 3.963 seconds (100% CPU, 3877522 Lips)
> true.
>
> /* Jekejeke Prolog 1.5.4 */
> ?- time((modular([11,7,5], X, Y, Z), fail; true)).
> % Threads 2,078 ms, GC 10 ms, Up 2,122 ms (Current 09/20/22 11:03:10)
> true.
>
> But I only solved this k=9 equation, not yet the k=42 problem:
>
> /* x^3 + y^3 + 9 = z^3 */
> ?- modular([11,7,5], X, Y, Z).
> X = 216,
> Y = 52,
> Z = 217 ;
> X = 52,
> Y = 216,
> Z = 217 ;
> false.

Re: Autum Challenge, 42 is the Answer

<030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1757&group=comp.lang.prolog#1757

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6214:f24:b0:4ac:a9fd:8b42 with SMTP id iw4-20020a0562140f2400b004aca9fd8b42mr19977412qvb.22.1663698639657;
Tue, 20 Sep 2022 11:30:39 -0700 (PDT)
X-Received: by 2002:a25:6c06:0:b0:6b3:b370:44b5 with SMTP id
h6-20020a256c06000000b006b3b37044b5mr13296830ybc.281.1663698639215; Tue, 20
Sep 2022 11:30:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 20 Sep 2022 11:30:38 -0700 (PDT)
In-Reply-To: <e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=80.218.40.218; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 80.218.40.218
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com> <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com> <3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
<e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 20 Sep 2022 18:30:39 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4323
 by: Mostowski Collapse - Tue, 20 Sep 2022 18:30 UTC

Thats the source code, it is ultimately intended to beat CLP(Z)
from Scryer Prolog some time in the future into dust, it also uses
ar_pow(), maybe better would be ar_modpow(), but for the small

values ar_modpow() wouldn't give some bang:

modular([P|L], X, Y, Z) :-
find(P, A, B, C),
many(L, A-P, B-P, C-P, X-_, Y-_, Z-_),
X^3+Y^3+9-Z^3 =:= 0.

many([], A, B, C, A, B, C).
many([P|L], U, V, W, A, B, C) :-
find(P, X, Y, Z),
cra_combine(X-P, U, S),
cra_combine(Y-P, V, T),
cra_combine(Z-P, W, R),
many(L, S, T, R, A, B, C).

find(M, X, Y, Z) :-
N is M-1,
between(0, N, X), A is X^3,
between(0, N, Y), B is Y^3,
between(0, N, Z),
(A+B+9-Z^3) mod M =:= 0.

/**
* Chinese Remainder Algorithm
* https://en.wikipedia.org/wiki/Chinese_remainder_theorem#Existence_%28constructive_proof%29
*/
% cra_combine(+Pair, +Pair, -Pair)
cra_combine(A-N, B-M, C-P) :-
cra_egcd(N, M, X, Y),
P is N*M,
C is (A*M*Y+B*N*X) mod P.

% cra_egcd(+Integer, +Integer, -Integer, -Integer)
cra_egcd(_, 0, 1, 0) :- !.
cra_egcd(A, B, X, Y) :-
divmod(A, B, Q, R),
cra_egcd(B, R, S, X),
Y is S - Q*X.

Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 20:28:33 UTC+2:
> Using modular operations again, you can make it a tick faster by using
> only two modules instead of three modules. But it still depends
> heavily on the performance of ar_pow():
>
> /* SWI-Prolog 8.5.17 */
> ?- time((modular([15,16], X, Y, Z), fail; true)).
> % 3,816,486 inferences, 1.766 CPU in 1.762 seconds (100% CPU, 2161550 Lips)
> true.
>
> /* Jekejeke Prolog 1.5.4 */
> ?- modular([15,16], X, Y, Z).
> X = 216, Y = 52, Z = 217;
> X = 52, Y = 216, Z = 217;
> fail.
>
> ?- time((modular([15,16], X, Y, Z), fail; true)).
> % Threads 594 ms, GC 5 ms, Up 591 ms (Current 09/20/22 20:21:30)
> true.
> Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 14:07:47 UTC+2:
> > Furtther question, does SWI-Prolog have modinv/3, also a function popular
> > in cryptography? It can be used for a Chinese Remainder algorithm.
> >
> > But currently banging my head on a slow (^)/2 for smallints. In modular
> > algorithms the arguments for (^)/2 are small. So I now get:
> >
> > /* SWI-Prolog 8.5.17 */
> > ?- time((modular([11,7,5], X, Y, Z), fail; true)).
> > % 15,388,917 inferences, 3.969 CPU in 3.963 seconds (100% CPU, 3877522 Lips)
> > true.
> >
> > /* Jekejeke Prolog 1.5.4 */
> > ?- time((modular([11,7,5], X, Y, Z), fail; true)).
> > % Threads 2,078 ms, GC 10 ms, Up 2,122 ms (Current 09/20/22 11:03:10)
> > true.
> >
> > But I only solved this k=9 equation, not yet the k=42 problem:
> >
> > /* x^3 + y^3 + 9 = z^3 */
> > ?- modular([11,7,5], X, Y, Z).
> > X = 216,
> > Y = 52,
> > Z = 217 ;
> > X = 52,
> > Y = 216,
> > Z = 217 ;
> > false.

Re: Autum Challenge, 42 is the Answer

<db4b30f2-2c33-42f6-9630-2828418aa146n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1758&group=comp.lang.prolog#1758

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6214:1ccc:b0:496:ab0a:896a with SMTP id g12-20020a0562141ccc00b00496ab0a896amr19551236qvd.36.1663700326703;
Tue, 20 Sep 2022 11:58:46 -0700 (PDT)
X-Received: by 2002:a25:778d:0:b0:6af:73a7:8e16 with SMTP id
s135-20020a25778d000000b006af73a78e16mr20513305ybc.91.1663700326469; Tue, 20
Sep 2022 11:58:46 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 20 Sep 2022 11:58:44 -0700 (PDT)
In-Reply-To: <030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=80.218.40.218; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 80.218.40.218
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com> <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com> <3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
<e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com> <030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <db4b30f2-2c33-42f6-9630-2828418aa146n@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 20 Sep 2022 18:58:46 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4803
 by: Mostowski Collapse - Tue, 20 Sep 2022 18:58 UTC

(Credits for the acronym cra for Chinese Remainder Algorithm in the
context of Prolog go to Amzi! Prolog, I found the acronym here:
https://amzi.com/manuals/amzi/pro/ref_math.htm )

Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 20:30:40 UTC+2:
> Thats the source code, it is ultimately intended to beat CLP(Z)
> from Scryer Prolog some time in the future into dust, it also uses
> ar_pow(), maybe better would be ar_modpow(), but for the small
>
> values ar_modpow() wouldn't give some bang:
>
> modular([P|L], X, Y, Z) :-
> find(P, A, B, C),
> many(L, A-P, B-P, C-P, X-_, Y-_, Z-_),
> X^3+Y^3+9-Z^3 =:= 0.
>
> many([], A, B, C, A, B, C).
> many([P|L], U, V, W, A, B, C) :-
> find(P, X, Y, Z),
> cra_combine(X-P, U, S),
> cra_combine(Y-P, V, T),
> cra_combine(Z-P, W, R),
> many(L, S, T, R, A, B, C).
>
> find(M, X, Y, Z) :-
> N is M-1,
> between(0, N, X), A is X^3,
> between(0, N, Y), B is Y^3,
> between(0, N, Z),
> (A+B+9-Z^3) mod M =:= 0.
>
> /**
> * Chinese Remainder Algorithm
> * https://en.wikipedia.org/wiki/Chinese_remainder_theorem#Existence_%28constructive_proof%29
> */
> % cra_combine(+Pair, +Pair, -Pair)
> cra_combine(A-N, B-M, C-P) :-
> cra_egcd(N, M, X, Y),
> P is N*M,
> C is (A*M*Y+B*N*X) mod P.
>
> % cra_egcd(+Integer, +Integer, -Integer, -Integer)
> cra_egcd(_, 0, 1, 0) :- !.
> cra_egcd(A, B, X, Y) :-
> divmod(A, B, Q, R),
> cra_egcd(B, R, S, X),
> Y is S - Q*X.
> Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 20:28:33 UTC+2:
> > Using modular operations again, you can make it a tick faster by using
> > only two modules instead of three modules. But it still depends
> > heavily on the performance of ar_pow():
> >
> > /* SWI-Prolog 8.5.17 */
> > ?- time((modular([15,16], X, Y, Z), fail; true)).
> > % 3,816,486 inferences, 1.766 CPU in 1.762 seconds (100% CPU, 2161550 Lips)
> > true.
> >
> > /* Jekejeke Prolog 1.5.4 */
> > ?- modular([15,16], X, Y, Z).
> > X = 216, Y = 52, Z = 217;
> > X = 52, Y = 216, Z = 217;
> > fail.
> >
> > ?- time((modular([15,16], X, Y, Z), fail; true)).
> > % Threads 594 ms, GC 5 ms, Up 591 ms (Current 09/20/22 20:21:30)
> > true.
> > Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 14:07:47 UTC+2:
> > > Furtther question, does SWI-Prolog have modinv/3, also a function popular
> > > in cryptography? It can be used for a Chinese Remainder algorithm.
> > >
> > > But currently banging my head on a slow (^)/2 for smallints. In modular
> > > algorithms the arguments for (^)/2 are small. So I now get:
> > >
> > > /* SWI-Prolog 8.5.17 */
> > > ?- time((modular([11,7,5], X, Y, Z), fail; true)).
> > > % 15,388,917 inferences, 3.969 CPU in 3.963 seconds (100% CPU, 3877522 Lips)
> > > true.
> > >
> > > /* Jekejeke Prolog 1.5.4 */
> > > ?- time((modular([11,7,5], X, Y, Z), fail; true)).
> > > % Threads 2,078 ms, GC 10 ms, Up 2,122 ms (Current 09/20/22 11:03:10)
> > > true.
> > >
> > > But I only solved this k=9 equation, not yet the k=42 problem:
> > >
> > > /* x^3 + y^3 + 9 = z^3 */
> > > ?- modular([11,7,5], X, Y, Z).
> > > X = 216,
> > > Y = 52,
> > > Z = 217 ;
> > > X = 52,
> > > Y = 216,
> > > Z = 217 ;
> > > false.

Re: Autum Challenge, 42 is the Answer

<868d4f75-c293-4929-83b7-e319f4dba451n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1759&group=comp.lang.prolog#1759

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:424c:b0:6be:78d5:ec73 with SMTP id w12-20020a05620a424c00b006be78d5ec73mr17463014qko.579.1663701199938;
Tue, 20 Sep 2022 12:13:19 -0700 (PDT)
X-Received: by 2002:a25:d310:0:b0:6ae:b886:c62b with SMTP id
e16-20020a25d310000000b006aeb886c62bmr21071932ybf.140.1663701199605; Tue, 20
Sep 2022 12:13:19 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 20 Sep 2022 12:13:19 -0700 (PDT)
In-Reply-To: <db4b30f2-2c33-42f6-9630-2828418aa146n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=80.218.40.218; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 80.218.40.218
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com> <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com> <3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
<e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com> <030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com>
<db4b30f2-2c33-42f6-9630-2828418aa146n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <868d4f75-c293-4929-83b7-e319f4dba451n@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 20 Sep 2022 19:13:19 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 5639
 by: Mostowski Collapse - Tue, 20 Sep 2022 19:13 UTC

Thats the performance of traditional CLP(FD) and CLP(Z)
for this kind of problem:

/* SWI-Prolog CLP(FD) */
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
% 36,572,338 inferences, 5.109 CPU in 5.117 seconds (100% CPU, 7157889 Lips)
true.

/* Scryer Prolog CLP(Z) */
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
% CPU time: 75.667s
true.

Wasnt using any bisection or somesuch option. Just the
defaults of CLP(FD) and CLP(Z).

Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 20:58:47 UTC+2:
> (Credits for the acronym cra for Chinese Remainder Algorithm in the
> context of Prolog go to Amzi! Prolog, I found the acronym here:
> https://amzi.com/manuals/amzi/pro/ref_math.htm )
> Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 20:30:40 UTC+2:
> > Thats the source code, it is ultimately intended to beat CLP(Z)
> > from Scryer Prolog some time in the future into dust, it also uses
> > ar_pow(), maybe better would be ar_modpow(), but for the small
> >
> > values ar_modpow() wouldn't give some bang:
> >
> > modular([P|L], X, Y, Z) :-
> > find(P, A, B, C),
> > many(L, A-P, B-P, C-P, X-_, Y-_, Z-_),
> > X^3+Y^3+9-Z^3 =:= 0.
> >
> > many([], A, B, C, A, B, C).
> > many([P|L], U, V, W, A, B, C) :-
> > find(P, X, Y, Z),
> > cra_combine(X-P, U, S),
> > cra_combine(Y-P, V, T),
> > cra_combine(Z-P, W, R),
> > many(L, S, T, R, A, B, C).
> >
> > find(M, X, Y, Z) :-
> > N is M-1,
> > between(0, N, X), A is X^3,
> > between(0, N, Y), B is Y^3,
> > between(0, N, Z),
> > (A+B+9-Z^3) mod M =:= 0.
> >
> > /**
> > * Chinese Remainder Algorithm
> > * https://en.wikipedia.org/wiki/Chinese_remainder_theorem#Existence_%28constructive_proof%29
> > */
> > % cra_combine(+Pair, +Pair, -Pair)
> > cra_combine(A-N, B-M, C-P) :-
> > cra_egcd(N, M, X, Y),
> > P is N*M,
> > C is (A*M*Y+B*N*X) mod P.
> >
> > % cra_egcd(+Integer, +Integer, -Integer, -Integer)
> > cra_egcd(_, 0, 1, 0) :- !.
> > cra_egcd(A, B, X, Y) :-
> > divmod(A, B, Q, R),
> > cra_egcd(B, R, S, X),
> > Y is S - Q*X.
> > Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 20:28:33 UTC+2:
> > > Using modular operations again, you can make it a tick faster by using
> > > only two modules instead of three modules. But it still depends
> > > heavily on the performance of ar_pow():
> > >
> > > /* SWI-Prolog 8.5.17 */
> > > ?- time((modular([15,16], X, Y, Z), fail; true)).
> > > % 3,816,486 inferences, 1.766 CPU in 1.762 seconds (100% CPU, 2161550 Lips)
> > > true.
> > >
> > > /* Jekejeke Prolog 1.5.4 */
> > > ?- modular([15,16], X, Y, Z).
> > > X = 216, Y = 52, Z = 217;
> > > X = 52, Y = 216, Z = 217;
> > > fail.
> > >
> > > ?- time((modular([15,16], X, Y, Z), fail; true)).
> > > % Threads 594 ms, GC 5 ms, Up 591 ms (Current 09/20/22 20:21:30)
> > > true.
> > > Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 14:07:47 UTC+2:
> > > > Furtther question, does SWI-Prolog have modinv/3, also a function popular
> > > > in cryptography? It can be used for a Chinese Remainder algorithm.
> > > >
> > > > But currently banging my head on a slow (^)/2 for smallints. In modular
> > > > algorithms the arguments for (^)/2 are small. So I now get:
> > > >
> > > > /* SWI-Prolog 8.5.17 */
> > > > ?- time((modular([11,7,5], X, Y, Z), fail; true)).
> > > > % 15,388,917 inferences, 3.969 CPU in 3.963 seconds (100% CPU, 3877522 Lips)
> > > > true.
> > > >
> > > > /* Jekejeke Prolog 1.5.4 */
> > > > ?- time((modular([11,7,5], X, Y, Z), fail; true)).
> > > > % Threads 2,078 ms, GC 10 ms, Up 2,122 ms (Current 09/20/22 11:03:10)
> > > > true.
> > > >
> > > > But I only solved this k=9 equation, not yet the k=42 problem:
> > > >
> > > > /* x^3 + y^3 + 9 = z^3 */
> > > > ?- modular([11,7,5], X, Y, Z).
> > > > X = 216,
> > > > Y = 52,
> > > > Z = 217 ;
> > > > X = 52,
> > > > Y = 216,
> > > > Z = 217 ;
> > > > false.

Re: Autum Challenge, 42 is the Answer

<4ae07623-b9b7-4dd7-bc01-0295d23e5bc8n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1760&group=comp.lang.prolog#1760

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:590f:0:b0:35c:c247:9731 with SMTP id 15-20020ac8590f000000b0035cc2479731mr21546691qty.114.1663721394863;
Tue, 20 Sep 2022 17:49:54 -0700 (PDT)
X-Received: by 2002:a25:1641:0:b0:684:d31a:feff with SMTP id
62-20020a251641000000b00684d31afeffmr22978263ybw.538.1663721394644; Tue, 20
Sep 2022 17:49:54 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 20 Sep 2022 17:49:54 -0700 (PDT)
In-Reply-To: <868d4f75-c293-4929-83b7-e319f4dba451n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=80.218.40.218; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 80.218.40.218
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com> <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com> <3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
<e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com> <030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com>
<db4b30f2-2c33-42f6-9630-2828418aa146n@googlegroups.com> <868d4f75-c293-4929-83b7-e319f4dba451n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4ae07623-b9b7-4dd7-bc01-0295d23e5bc8n@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 21 Sep 2022 00:49:54 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2794
 by: Mostowski Collapse - Wed, 21 Sep 2022 00:49 UTC

Even Dogelog player is speedier than CLP(FD) and CLP(Z),
using the modular approach. I find:

?- modular([15,16], X, Y, Z).
X = 216, Y = 52, Z = 217;
X = 52, Y = 216, Z = 217;
fail.

?- time((modular([15,16], X, Y, Z), fail; true)).
% Wall 3925 ms, gc 7 ms, 1544404 lips
true.

https://jsfiddle.net/Jean_Luc_Picard_2021/d2njehtp/3/

I don't have divmod/4 yet, so one needs to use the
following variant of Extended GCD:

cra_egcd(A, B, X, Y) :-
Q is A div B,
R is A mod B,
% divmod(A, B, Q, R),
cra_egcd(B, R, S, X),
Y is S - Q*X.

Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 21:13:20 UTC+2:
> Thats the performance of traditional CLP(FD) and CLP(Z)
> for this kind of problem:
>
> /* SWI-Prolog CLP(FD) */
> ?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
> % 36,572,338 inferences, 5.109 CPU in 5.117 seconds (100% CPU, 7157889 Lips)
> true.
>
> /* Scryer Prolog CLP(Z) */
> ?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
> % CPU time: 75.667s
> true.
>
> Wasnt using any bisection or somesuch option. Just the
> defaults of CLP(FD) and CLP(Z).

Re: Autum Challenge, 42 is the Answer

<m2r0njgghs.fsf@logic.at>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2118&group=comp.lang.prolog#2118

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx34.iad.POSTED!not-for-mail
From: triska@logic.at (Markus Triska)
Newsgroups: comp.lang.prolog
Subject: Re: Autum Challenge, 42 is the Answer
Organization: man
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com>
<142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com>
<3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
<e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com>
<030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com>
<db4b30f2-2c33-42f6-9630-2828418aa146n@googlegroups.com>
<868d4f75-c293-4929-83b7-e319f4dba451n@googlegroups.com>
Message-ID: <m2r0njgghs.fsf@logic.at>
User-Agent: Emacs/27.0.50
Cancel-Lock: sha1:Kd9siVC6xm5FiN2QXMJTL4p1vA8=
MIME-Version: 1.0
Content-Type: text/plain
Lines: 39
X-Complaints-To: abuse@blocknews.net
NNTP-Posting-Date: Thu, 31 Aug 2023 19:20:10 UTC
Date: Thu, 31 Aug 2023 21:26:55 +0200
X-Received-Bytes: 2406
 by: Markus Triska - Thu, 31 Aug 2023 19:26 UTC

Mostowski Collapse <bursejan@gmail.com> writes:

> /* Scryer Prolog CLP(Z) */
> ?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
> % CPU time: 75.667s
> true.
>
With the newly release Scryer Prolog version 0.9.2, I now get:

?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
% CPU time: 41.658s
true.

On my machine, that's within a factor of 6 of SWI. That's quite
comparable to many other applications when it comes to time performance:
At the current state of Scryer Prolog development, its performance tends
to be within an order of magnitude of SWI's.

One neat feature of the Scryer Prolog toplevel is that we can press "a"
to obtain *all* solutions, one after the other. In this case:

?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]))).
% CPU time: 16.080s
X = 52, Y = 216, Z = 217
; % CPU time: 25.942s
X = 216, Y = 52, Z = 217
; % CPU time: 0.250s
false.

It's often nice to get the Prolog system to enumerate all solutions
automatically. The GNU Prolog toplevel also has this feature, and I
highly recommend adding it in system where it is not yet available.

All the best,
Markus

--
comp.lang.prolog FAQ: http://www.logic.at/prolog/faq/
The Power of Prolog: https://www.metalevel.at/prolog

Re: Autum Challenge, 42 is the Answer

<37516061-91b6-4129-8221-4bdb0fa59f42n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2120&group=comp.lang.prolog#2120

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:290:b0:403:da2f:a9c with SMTP id z16-20020a05622a029000b00403da2f0a9cmr116557qtw.4.1693594025374;
Fri, 01 Sep 2023 11:47:05 -0700 (PDT)
X-Received: by 2002:aa7:88c7:0:b0:68a:fed3:823b with SMTP id
k7-20020aa788c7000000b0068afed3823bmr1382520pff.6.1693594024988; Fri, 01 Sep
2023 11:47:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 1 Sep 2023 11:47:04 -0700 (PDT)
In-Reply-To: <m2r0njgghs.fsf@logic.at>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.50.239; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.50.239
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com> <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com> <3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
<e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com> <030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com>
<db4b30f2-2c33-42f6-9630-2828418aa146n@googlegroups.com> <868d4f75-c293-4929-83b7-e319f4dba451n@googlegroups.com>
<m2r0njgghs.fsf@logic.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <37516061-91b6-4129-8221-4bdb0fa59f42n@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mild Shock)
Injection-Date: Fri, 01 Sep 2023 18:47:05 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4845
 by: Mild Shock - Fri, 1 Sep 2023 18:47 UTC

One motivation to look at the problem, and to look at the
easier problem with 9 instead 42, is to elaborate a completely
new CLP(FD) solver, that is based on Chinese Remainder Theorem.

Actually I have already a prototype working, the timing was
also already published around 12 months ago. My system was much
faster than SWI-Prolog, since SWI-Prolog is slow with smallints and (^)/2:

Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 20:28:33 UTC+2:
> /* Jekejeke Prolog 1.5.4 */
> ?- modular([15,16], X, Y, Z).
> X = 216, Y = 52, Z = 217;
> X = 52, Y = 216, Z = 217;
> fail.
>
> ?- time((modular([15,16], X, Y, Z), fail; true)).
> % Threads 594 ms, GC 5 ms, Up 591 ms (Current 09/20/22 20:21:30)
> true.
https://groups.google.com/g/comp.lang.prolog/c/mjpxkE3xVYk/m/cn0FICAQAAAJ

So these 594 ms are 10x times faster than the 5.117 seconds from
SWI-Prolog using ordinary CLP(FD). And around 100x times faster than
the 41.658s from Scryer Prolog. But I didn't yet publish this new

CLP(FD) solver, maybe I did some blogging and also some code
went into comp.lang.prolog here, but its not currently some officially
released module somewhere. Its also a solver which isn't based on

attributed variables per se. It requires that the constraint store is
re-evaluated with different moduli, so I envision something totally
new, that drops attributed variables, but nevertheless has a constraint

store. Attributed variables have become less important. The dis-
advantage of not having attributed variables would be that the
constraints cannot be used on ordinary predicates. I have no solution

for the later problem yet, but the figures in the former testing show,
that the method can be much much faster than ordinary CLP(FD).

Markus Triska schrieb am Donnerstag, 31. August 2023 um 21:20:14 UTC+2:
> Mostowski Collapse <burs...@gmail.com> writes:
>
> > /* Scryer Prolog CLP(Z) */
> > ?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
> > % CPU time: 75.667s
> > true.
> >
> With the newly release Scryer Prolog version 0.9.2, I now get:
> ?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
> % CPU time: 41.658s
> true.
>
> On my machine, that's within a factor of 6 of SWI. That's quite
> comparable to many other applications when it comes to time performance:
> At the current state of Scryer Prolog development, its performance tends
> to be within an order of magnitude of SWI's.
>
> One neat feature of the Scryer Prolog toplevel is that we can press "a"
> to obtain *all* solutions, one after the other. In this case:
>
> ?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]))).
> % CPU time: 16.080s
> X = 52, Y = 216, Z = 217
> ; % CPU time: 25.942s
> X = 216, Y = 52, Z = 217
> ; % CPU time: 0.250s
> false.
>
> It's often nice to get the Prolog system to enumerate all solutions
> automatically. The GNU Prolog toplevel also has this feature, and I
> highly recommend adding it in system where it is not yet available.
>
> All the best,
> Markus
>
> --
> comp.lang.prolog FAQ: http://www.logic.at/prolog/faq/
> The Power of Prolog: https://www.metalevel.at/prolog

Re: Autum Challenge, 42 is the Answer

<6c9c0d39-8658-47b8-8526-2fd11e08fc71n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2122&group=comp.lang.prolog#2122

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6214:a91:b0:649:afa4:5cae with SMTP id ev17-20020a0562140a9100b00649afa45caemr76485qvb.6.1693604334298;
Fri, 01 Sep 2023 14:38:54 -0700 (PDT)
X-Received: by 2002:a05:6a00:9a9:b0:68a:546d:596c with SMTP id
u41-20020a056a0009a900b0068a546d596cmr1504028pfg.5.1693604333792; Fri, 01 Sep
2023 14:38:53 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 1 Sep 2023 14:38:53 -0700 (PDT)
In-Reply-To: <37516061-91b6-4129-8221-4bdb0fa59f42n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.50.239; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.50.239
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com> <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com> <3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
<e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com> <030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com>
<db4b30f2-2c33-42f6-9630-2828418aa146n@googlegroups.com> <868d4f75-c293-4929-83b7-e319f4dba451n@googlegroups.com>
<m2r0njgghs.fsf@logic.at> <37516061-91b6-4129-8221-4bdb0fa59f42n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6c9c0d39-8658-47b8-8526-2fd11e08fc71n@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mild Shock)
Injection-Date: Fri, 01 Sep 2023 21:38:54 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mild Shock - Fri, 1 Sep 2023 21:38 UTC

Actually its not that dim, one could integrate the Chinese
Reminder Algorithm (CRA) strategy into a CLP(FD) constraint
solver via a labeling variant. The labeling would

include not only running through values inside the current
modulo M, i.e. choosing values in the range 0..M-1, but also
choosing different moduli M1, .., Mk. But the question is

whether one should do that. The problem is that the solution
is obtained by backtracking over all moduli. So when E is the
equation, then its basically a large conjunction:

E_M1, ..., E_Mk

Where each element of the conjunction produces some bits,
and these bits are then combined via CRA. Currently when
E_Mj is a predicate, the equation sits in this predicate,

and each element of the conjunctions runs instances of
the clauses of the predicate, thus has a copy of the equation
available. This copying of the equation makes me think

that attribute variables don't work. But alternatively one
could also table the results of each E_Mj, and later do the
CRA combination. My current solution is not like that,

but this could have more affinity to attributed variables.

Mild Shock schrieb am Freitag, 1. September 2023 um 20:47:06 UTC+2:
> One motivation to look at the problem, and to look at the
> easier problem with 9 instead 42, is to elaborate a completely
> new CLP(FD) solver, that is based on Chinese Remainder Theorem.
>
> Actually I have already a prototype working, the timing was
> also already published around 12 months ago. My system was much
> faster than SWI-Prolog, since SWI-Prolog is slow with smallints and (^)/2:
> Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 20:28:33 UTC+2:
> > /* Jekejeke Prolog 1.5.4 */
> > ?- modular([15,16], X, Y, Z).
> > X = 216, Y = 52, Z = 217;
> > X = 52, Y = 216, Z = 217;
> > fail.
> >
> > ?- time((modular([15,16], X, Y, Z), fail; true)).
> > % Threads 594 ms, GC 5 ms, Up 591 ms (Current 09/20/22 20:21:30)
> > true.
> https://groups.google.com/g/comp.lang.prolog/c/mjpxkE3xVYk/m/cn0FICAQAAAJ
>
> So these 594 ms are 10x times faster than the 5.117 seconds from
> SWI-Prolog using ordinary CLP(FD). And around 100x times faster than
> the 41.658s from Scryer Prolog. But I didn't yet publish this new
>
> CLP(FD) solver, maybe I did some blogging and also some code
> went into comp.lang.prolog here, but its not currently some officially
> released module somewhere. Its also a solver which isn't based on
>
> attributed variables per se. It requires that the constraint store is
> re-evaluated with different moduli, so I envision something totally
> new, that drops attributed variables, but nevertheless has a constraint
>
> store. Attributed variables have become less important. The dis-
> advantage of not having attributed variables would be that the
> constraints cannot be used on ordinary predicates. I have no solution
>
> for the later problem yet, but the figures in the former testing show,
> that the method can be much much faster than ordinary CLP(FD).
> Markus Triska schrieb am Donnerstag, 31. August 2023 um 21:20:14 UTC+2:
> > Mostowski Collapse <burs...@gmail.com> writes:
> >
> > > /* Scryer Prolog CLP(Z) */
> > > ?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
> > > % CPU time: 75.667s
> > > true.
> > >
> > With the newly release Scryer Prolog version 0.9.2, I now get:
> > ?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
> > % CPU time: 41.658s
> > true.
> >
> > On my machine, that's within a factor of 6 of SWI. That's quite
> > comparable to many other applications when it comes to time performance:
> > At the current state of Scryer Prolog development, its performance tends
> > to be within an order of magnitude of SWI's.
> >
> > One neat feature of the Scryer Prolog toplevel is that we can press "a"
> > to obtain *all* solutions, one after the other. In this case:
> >
> > ?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]))).
> > % CPU time: 16.080s
> > X = 52, Y = 216, Z = 217
> > ; % CPU time: 25.942s
> > X = 216, Y = 52, Z = 217
> > ; % CPU time: 0.250s
> > false.
> >
> > It's often nice to get the Prolog system to enumerate all solutions
> > automatically. The GNU Prolog toplevel also has this feature, and I
> > highly recommend adding it in system where it is not yet available.
> >
> > All the best,
> > Markus
> >
> > --
> > comp.lang.prolog FAQ: http://www.logic.at/prolog/faq/
> > The Power of Prolog: https://www.metalevel.at/prolog

Re: Autum Challenge, 42 is the Answer

<bdad9f24-5b6a-49a8-98f9-3c2dd3e20be1n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2124&group=comp.lang.prolog#2124

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:289:b0:412:288:8941 with SMTP id z9-20020a05622a028900b0041202888941mr228318qtw.6.1693827088745;
Mon, 04 Sep 2023 04:31:28 -0700 (PDT)
X-Received: by 2002:a05:6a00:3997:b0:68a:58e1:ebf5 with SMTP id
fi23-20020a056a00399700b0068a58e1ebf5mr4089225pfb.2.1693827088167; Mon, 04
Sep 2023 04:31:28 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Mon, 4 Sep 2023 04:31:27 -0700 (PDT)
In-Reply-To: <6c9c0d39-8658-47b8-8526-2fd11e08fc71n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.50.239; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.50.239
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com> <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com> <3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
<e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com> <030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com>
<db4b30f2-2c33-42f6-9630-2828418aa146n@googlegroups.com> <868d4f75-c293-4929-83b7-e319f4dba451n@googlegroups.com>
<m2r0njgghs.fsf@logic.at> <37516061-91b6-4129-8221-4bdb0fa59f42n@googlegroups.com>
<6c9c0d39-8658-47b8-8526-2fd11e08fc71n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bdad9f24-5b6a-49a8-98f9-3c2dd3e20be1n@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mild Shock)
Injection-Date: Mon, 04 Sep 2023 11:31:28 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2272
 by: Mild Shock - Mon, 4 Sep 2023 11:31 UTC

Whats the Scryer Performance of this Example?

/* GNU Prolog 1.5.0 */
?- between(1,200,N), length(L,N), nth_member(I,L,E), fail; true.
(94 ms) yes

/* SWI-Prolog 9.1.14 */
?- time((between(1,200,N), length(L,N), nth_member(I,L,E), fail; true)).
% 94,504,524 inferences, 4.766 CPU in 4.767 seconds (100% CPU, 19830457 Lips)
true.

That was measured on my machine,
and was a factor ca. 50x slower in SWI-Prolog.

Source Code:

nth_member(1, [M|_], M).
nth_member(N, [_|T], M) :-
N #> 1, N1 #= N - 1,
nth_member(N1, T, M).

Re: Autum Challenge, 42 is the Answer

<m2msy1n81k.fsf@logic.at>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2125&group=comp.lang.prolog#2125

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx37.iad.POSTED!not-for-mail
From: triska@logic.at (Markus Triska)
Newsgroups: comp.lang.prolog
Subject: Re: Autum Challenge, 42 is the Answer
Organization: man
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com>
<142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com>
<3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
<e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com>
<030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com>
<db4b30f2-2c33-42f6-9630-2828418aa146n@googlegroups.com>
<868d4f75-c293-4929-83b7-e319f4dba451n@googlegroups.com>
<m2r0njgghs.fsf@logic.at>
<37516061-91b6-4129-8221-4bdb0fa59f42n@googlegroups.com>
<6c9c0d39-8658-47b8-8526-2fd11e08fc71n@googlegroups.com>
<bdad9f24-5b6a-49a8-98f9-3c2dd3e20be1n@googlegroups.com>
Message-ID: <m2msy1n81k.fsf@logic.at>
User-Agent: Emacs/27.0.50
Cancel-Lock: sha1:OnWrWyJ65nG/joO5yQ712bce6Ho=
MIME-Version: 1.0
Content-Type: text/plain
Lines: 32
X-Complaints-To: abuse@blocknews.net
NNTP-Posting-Date: Mon, 04 Sep 2023 17:41:57 UTC
Date: Mon, 04 Sep 2023 19:48:55 +0200
X-Received-Bytes: 2241
 by: Markus Triska - Mon, 4 Sep 2023 17:48 UTC

Mild Shock <bursejan@gmail.com> writes:

> Whats the Scryer Performance of this Example?
>
> /* GNU Prolog 1.5.0 */
> ?- between(1,200,N), length(L,N), nth_member(I,L,E), fail; true.
> (94 ms) yes
>
> /* SWI-Prolog 9.1.14 */
> ?- time((between(1,200,N), length(L,N), nth_member(I,L,E), fail; true)).
> % 94,504,524 inferences, 4.766 CPU in 4.767 seconds (100% CPU, 19830457 Lips)
> true.

With Scryer Prolog 0.9.2 on my machine, I get:

?- time((between(1,200,N), length(L,N), nth_member(I,L,E), false; true)).
% CPU time: 84.182s
true.

On my machine, that's ca. 15 times slower than SWI 8.3.15, which is the
last SWI version I found installed on this machine. Newer versions may
well be faster! For best performance, I recommend to build Scryer Prolog
with the optional --release flag, i.e.:

$ cargo build --release

All the best,
Markus

--
comp.lang.prolog FAQ: http://www.logic.at/prolog/faq/
The Power of Prolog: https://www.metalevel.at/prolog

Re: Autum Challenge, 42 is the Answer

<11039c8a-8b50-47fb-b0e9-3f09d08d46fbn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2126&group=comp.lang.prolog#2126

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ad4:5893:0:b0:63c:e9df:a46b with SMTP id dz19-20020ad45893000000b0063ce9dfa46bmr223564qvb.3.1693856777195;
Mon, 04 Sep 2023 12:46:17 -0700 (PDT)
X-Received: by 2002:a05:6a00:a0b:b0:68a:5acb:272b with SMTP id
p11-20020a056a000a0b00b0068a5acb272bmr4401574pfh.3.1693856776783; Mon, 04 Sep
2023 12:46:16 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Mon, 4 Sep 2023 12:46:16 -0700 (PDT)
In-Reply-To: <m2msy1n81k.fsf@logic.at>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.50.239; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.50.239
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com> <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com> <3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
<e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com> <030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com>
<db4b30f2-2c33-42f6-9630-2828418aa146n@googlegroups.com> <868d4f75-c293-4929-83b7-e319f4dba451n@googlegroups.com>
<m2r0njgghs.fsf@logic.at> <37516061-91b6-4129-8221-4bdb0fa59f42n@googlegroups.com>
<6c9c0d39-8658-47b8-8526-2fd11e08fc71n@googlegroups.com> <bdad9f24-5b6a-49a8-98f9-3c2dd3e20be1n@googlegroups.com>
<m2msy1n81k.fsf@logic.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <11039c8a-8b50-47fb-b0e9-3f09d08d46fbn@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mild Shock)
Injection-Date: Mon, 04 Sep 2023 19:46:17 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mild Shock - Mon, 4 Sep 2023 19:46 UTC

I am also slower than SWI-Prolog with formerly Jekejeke Prolog,
but sandwhich between Scryer Prolog and SWI-Prolog for this example.
I never know whether my CLP(FD) still works, so first some sanity checks:

?- nth_member(X, [5,4,6], 4).
X = 2;
fail.
?- nth_member(2, [5,4,6], X).
X = 4;
fail.

Then the benchmark results:

?- time((between(1,200,N), length(L,N), nth_member(I,L,E), fail; true)).
% Time 48513 ms, GC 373 ms, Wall 04/09/2023 21:41
true.

But I don't know whether its comparable with Scryer Prolog since
I didn't test Scryer Prolog, and the Scryer Prolog figures are from
Markus Triskas machine.

I am currently phasing out formerly Jekejeke Prolog. It should receive
the same core as Dogelog Player. And then maybe can also re-add
CLP(FD) and see what happens. But this might take months. Especially

since I want to reinvent CLP(FD), adding some CRA Strategy, and I
don't know yet eactly how to do it. I could optimized the non-labeling
behaviour exactly towards this test case, where GNU Prolog performs well.

Markus Triska schrieb am Montag, 4. September 2023 um 19:42:01 UTC+2:
> Mild Shock <burs...@gmail.com> writes:
>
> > Whats the Scryer Performance of this Example?
> >
> > /* GNU Prolog 1.5.0 */
> > ?- between(1,200,N), length(L,N), nth_member(I,L,E), fail; true.
> > (94 ms) yes
> >
> > /* SWI-Prolog 9.1.14 */
> > ?- time((between(1,200,N), length(L,N), nth_member(I,L,E), fail; true)).
> > % 94,504,524 inferences, 4.766 CPU in 4.767 seconds (100% CPU, 19830457 Lips)
> > true.
> With Scryer Prolog 0.9.2 on my machine, I get:
>
> ?- time((between(1,200,N), length(L,N), nth_member(I,L,E), false; true)).
> % CPU time: 84.182s
> true.
>
> On my machine, that's ca. 15 times slower than SWI 8.3.15, which is the
> last SWI version I found installed on this machine. Newer versions may
> well be faster! For best performance, I recommend to build Scryer Prolog
> with the optional --release flag, i.e.:
>
> $ cargo build --release
> All the best,
> Markus
>
> --
> comp.lang.prolog FAQ: http://www.logic.at/prolog/faq/
> The Power of Prolog: https://www.metalevel.at/prolog

Re: Autum Challenge, 42 is the Answer

<01a5138b-b619-4cf0-9d92-6984695a8b13n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2127&group=comp.lang.prolog#2127

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:9041:b0:76d:71f7:2692 with SMTP id rl1-20020a05620a904100b0076d71f72692mr218451qkn.11.1693857074570;
Mon, 04 Sep 2023 12:51:14 -0700 (PDT)
X-Received: by 2002:a05:6a00:3999:b0:68c:8eac:65bc with SMTP id
fi25-20020a056a00399900b0068c8eac65bcmr4751353pfb.1.1693857074039; Mon, 04
Sep 2023 12:51:14 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Mon, 4 Sep 2023 12:51:13 -0700 (PDT)
In-Reply-To: <11039c8a-8b50-47fb-b0e9-3f09d08d46fbn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.50.239; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.50.239
References: <f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com>
<977d5e9f-469f-4516-9260-26e917bbec2cn@googlegroups.com> <142ae65f-61ad-403e-8450-caebfddf6d0an@googlegroups.com>
<4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com> <3a23c78d-d4a1-472a-a460-776a5ca7d3een@googlegroups.com>
<e945e9c8-e72f-41a2-bb06-473d275396c0n@googlegroups.com> <030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com>
<db4b30f2-2c33-42f6-9630-2828418aa146n@googlegroups.com> <868d4f75-c293-4929-83b7-e319f4dba451n@googlegroups.com>
<m2r0njgghs.fsf@logic.at> <37516061-91b6-4129-8221-4bdb0fa59f42n@googlegroups.com>
<6c9c0d39-8658-47b8-8526-2fd11e08fc71n@googlegroups.com> <bdad9f24-5b6a-49a8-98f9-3c2dd3e20be1n@googlegroups.com>
<m2msy1n81k.fsf@logic.at> <11039c8a-8b50-47fb-b0e9-3f09d08d46fbn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <01a5138b-b619-4cf0-9d92-6984695a8b13n@googlegroups.com>
Subject: Re: Autum Challenge, 42 is the Answer
From: bursejan@gmail.com (Mild Shock)
Injection-Date: Mon, 04 Sep 2023 19:51:14 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mild Shock - Mon, 4 Sep 2023 19:51 UTC

Actually the test was done with JDK 21 as the Java Virtual
Machine. The older JDK 8 fares a little bit more favorable:

/* JDK 8 */
?- time((between(1,200,N), length(L,N), nth_member(I,L,E), fail; true)).
% Time 39146 ms, GC 254 ms, Wall 04/09/2023 21:49
true.

/* JDK 21 */
?- time((between(1,200,N), length(L,N), nth_member(I,L,E), fail; true)).
% Time 48513 ms, GC 373 ms, Wall 04/09/2023 21:41
true.

The formerly Jekejeke Prolog Minlog Extension, that has the
CLP(FD), isn't public anymore, because I am phasing it out.

Mild Shock schrieb am Montag, 4. September 2023 um 21:46:18 UTC+2:
> I am also slower than SWI-Prolog with formerly Jekejeke Prolog,
> but sandwhich between Scryer Prolog and SWI-Prolog for this example.
> I never know whether my CLP(FD) still works, so first some sanity checks:
>
> ?- nth_member(X, [5,4,6], 4).
> X = 2;
> fail.
> ?- nth_member(2, [5,4,6], X).
> X = 4;
> fail.
>
> Then the benchmark results:
> ?- time((between(1,200,N), length(L,N), nth_member(I,L,E), fail; true)).
> % Time 48513 ms, GC 373 ms, Wall 04/09/2023 21:41
> true.
>
> But I don't know whether its comparable with Scryer Prolog since
> I didn't test Scryer Prolog, and the Scryer Prolog figures are from
> Markus Triskas machine.
>
> I am currently phasing out formerly Jekejeke Prolog. It should receive
> the same core as Dogelog Player. And then maybe can also re-add
> CLP(FD) and see what happens. But this might take months. Especially
>
> since I want to reinvent CLP(FD), adding some CRA Strategy, and I
> don't know yet eactly how to do it. I could optimized the non-labeling
> behaviour exactly towards this test case, where GNU Prolog performs well.
> Markus Triska schrieb am Montag, 4. September 2023 um 19:42:01 UTC+2:
> > Mild Shock <burs...@gmail.com> writes:
> >
> > > Whats the Scryer Performance of this Example?
> > >
> > > /* GNU Prolog 1.5.0 */
> > > ?- between(1,200,N), length(L,N), nth_member(I,L,E), fail; true.
> > > (94 ms) yes
> > >
> > > /* SWI-Prolog 9.1.14 */
> > > ?- time((between(1,200,N), length(L,N), nth_member(I,L,E), fail; true)).
> > > % 94,504,524 inferences, 4.766 CPU in 4.767 seconds (100% CPU, 19830457 Lips)
> > > true.
> > With Scryer Prolog 0.9.2 on my machine, I get:
> >
> > ?- time((between(1,200,N), length(L,N), nth_member(I,L,E), false; true)).
> > % CPU time: 84.182s
> > true.
> >
> > On my machine, that's ca. 15 times slower than SWI 8.3.15, which is the
> > last SWI version I found installed on this machine. Newer versions may
> > well be faster! For best performance, I recommend to build Scryer Prolog
> > with the optional --release flag, i.e.:
> >
> > $ cargo build --release
> > All the best,
> > Markus
> >
> > --
> > comp.lang.prolog FAQ: http://www.logic.at/prolog/faq/
> > The Power of Prolog: https://www.metalevel.at/prolog

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor