Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Two percent of zero is almost nothing.


devel / comp.lang.prolog / Re: Prolog code for alpha variants

SubjectAuthor
* Prolog code for alpha variantsMild Shock
`* Prolog code for alpha variantsMild Shock
 `* Prolog code for alpha variantsMild Shock
  `- Prolog code for alpha variantsMild Shock

1
Re: Prolog code for alpha variants

<b0a4a41e-0bf8-4779-ae41-9e1b75e65213n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ad4:588b:0:b0:66d:3b0:2ce7 with SMTP id dz11-20020ad4588b000000b0066d03b02ce7mr104711qvb.6.1697633965345;
Wed, 18 Oct 2023 05:59:25 -0700 (PDT)
X-Received: by 2002:a05:6808:1594:b0:3b2:e219:5525 with SMTP id
t20-20020a056808159400b003b2e2195525mr1315717oiw.1.1697633965149; Wed, 18 Oct
2023 05:59:25 -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: Wed, 18 Oct 2023 05:59:24 -0700 (PDT)
In-Reply-To: <ad6bef9c-7097-41a0-a812-b31d0a926f9dn@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: <2912ca15-ac99-4dca-abb4-c25f3a2dc7dfn@googlegroups.com>
<cfe5c0fc-a877-46a3-8abe-17d4f415e44an@googlegroups.com> <eb6ea0cc-dd8a-42ef-b834-630a5a4a43cdn@googlegroups.com>
<e6e4f15e-e049-4b5e-ac9d-f8ef58972355n@googlegroups.com> <6dff3512-a3a9-4547-8676-a92b65102aedn@googlegroups.com>
<tetnlh$p70r$1@solani.org> <1a604c60-bd8d-4b3a-ab98-0ec0936bba48n@googlegroups.com>
<tevts1$pgld$1@solani.org> <9ba53a71-5d99-4582-b496-ceb939539b19n@googlegroups.com>
<3e69764e-32a6-4b71-9095-f5b84ccbe808n@googlegroups.com> <128555c2-5ab1-4b7f-a861-46628a0e5d80n@googlegroups.com>
<db8d317d-7851-4085-815c-9b8953d10157n@googlegroups.com> <ad6bef9c-7097-41a0-a812-b31d0a926f9dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b0a4a41e-0bf8-4779-ae41-9e1b75e65213n@googlegroups.com>
Subject: Re: Prolog code for alpha variants
From: burse...@gmail.com (Mild Shock)
Injection-Date: Wed, 18 Oct 2023 12:59:25 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mild Shock - Wed, 18 Oct 2023 12:59 UTC

Things that are not in the ISO core standard are more
likely to behave differently across Prolog systems?

GNU Prolog behaves already differently to SWI-Prolog in
numbervars/3. I find this discrepancy:

/* GNU Prolog 1.5.0 */
?- X = f(A,X), numbervars(X, 0, _), write_canonical(A), nl.
_24
cannot display cyclic term for X

/* SWI-Prolog 9.1.16 */
?- X = f(A,X), numbervars(X, 0, _), write_canonical(A), nl.
'$VAR'(0)
X = f(A, X),
A = A.

LoL

Re: Prolog code for alpha variants

<96b17c04-0800-4814-8ad4-ce02be0a7e1bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:801c:b0:412:1e76:f3e1 with SMTP id jr28-20020a05622a801c00b004121e76f3e1mr132464qtb.3.1697644611567;
Wed, 18 Oct 2023 08:56:51 -0700 (PDT)
X-Received: by 2002:a4a:d1a7:0:b0:582:786:26dc with SMTP id
z7-20020a4ad1a7000000b00582078626dcmr341081oor.1.1697644611347; Wed, 18 Oct
2023 08:56:51 -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: Wed, 18 Oct 2023 08:56:51 -0700 (PDT)
In-Reply-To: <b0a4a41e-0bf8-4779-ae41-9e1b75e65213n@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: <2912ca15-ac99-4dca-abb4-c25f3a2dc7dfn@googlegroups.com>
<cfe5c0fc-a877-46a3-8abe-17d4f415e44an@googlegroups.com> <eb6ea0cc-dd8a-42ef-b834-630a5a4a43cdn@googlegroups.com>
<e6e4f15e-e049-4b5e-ac9d-f8ef58972355n@googlegroups.com> <6dff3512-a3a9-4547-8676-a92b65102aedn@googlegroups.com>
<tetnlh$p70r$1@solani.org> <1a604c60-bd8d-4b3a-ab98-0ec0936bba48n@googlegroups.com>
<tevts1$pgld$1@solani.org> <9ba53a71-5d99-4582-b496-ceb939539b19n@googlegroups.com>
<3e69764e-32a6-4b71-9095-f5b84ccbe808n@googlegroups.com> <128555c2-5ab1-4b7f-a861-46628a0e5d80n@googlegroups.com>
<db8d317d-7851-4085-815c-9b8953d10157n@googlegroups.com> <ad6bef9c-7097-41a0-a812-b31d0a926f9dn@googlegroups.com>
<b0a4a41e-0bf8-4779-ae41-9e1b75e65213n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <96b17c04-0800-4814-8ad4-ce02be0a7e1bn@googlegroups.com>
Subject: Re: Prolog code for alpha variants
From: burse...@gmail.com (Mild Shock)
Injection-Date: Wed, 18 Oct 2023 15:56:51 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3243
 by: Mild Shock - Wed, 18 Oct 2023 15:56 UTC

So what goodies are there in library(compat) as well?

Check this out:

/* SWI-Prolog 9.1.16 */
?- numlist(1,100000,A), numlist(1,100000,B),
time((between(1,1000,_), subsumes((f(_),X,X),(_,A,B)),
fail; true)), fail.
% 2,999 inferences, 2.375 CPU in 2.498 seconds (95% CPU, 1263 Lips)
false.

/* Dogelog Player 1.1.3 for Java (new!) */
?- numlist(1,100000,A), numlist(1,100000,B),
time((between(1,1000,_), subsumes((f(_),X,X),(_,A,B)),
fail; true)), fail.
% Zeit 2 ms, GC 0 ms, Lips 1550000, Uhr 18.10.2023 17:40
fail.

Dogelog Player for Java came out a few days ago. To get
subsumes/2 you have to use ensure_loaded(library(compat)).
I am using Richard O’Keefes algorithm from 1984 for subsumes/2.

Mild Shock schrieb am Mittwoch, 18. Oktober 2023 um 14:59:26 UTC+2:
> Things that are not in the ISO core standard are more
> likely to behave differently across Prolog systems?
>
> GNU Prolog behaves already differently to SWI-Prolog in
> numbervars/3. I find this discrepancy:
>
> /* GNU Prolog 1.5.0 */
> ?- X = f(A,X), numbervars(X, 0, _), write_canonical(A), nl.
> _24
> cannot display cyclic term for X
>
> /* SWI-Prolog 9.1.16 */
> ?- X = f(A,X), numbervars(X, 0, _), write_canonical(A), nl.
> '$VAR'(0)
> X = f(A, X),
> A = A.
>
> LoL

Re: Prolog code for alpha variants

<7103c04c-aedf-4302-9fe4-1a3cf36064b1n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:7399:0:b0:41b:1957:55b with SMTP id t25-20020ac87399000000b0041b1957055bmr61064qtp.4.1697734942047;
Thu, 19 Oct 2023 10:02:22 -0700 (PDT)
X-Received: by 2002:a05:6870:238c:b0:1e9:659c:3819 with SMTP id
e12-20020a056870238c00b001e9659c3819mr1233470oap.9.1697734941653; Thu, 19 Oct
2023 10:02:21 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.swapon.de!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: Thu, 19 Oct 2023 10:02:21 -0700 (PDT)
In-Reply-To: <96b17c04-0800-4814-8ad4-ce02be0a7e1bn@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: <2912ca15-ac99-4dca-abb4-c25f3a2dc7dfn@googlegroups.com>
<cfe5c0fc-a877-46a3-8abe-17d4f415e44an@googlegroups.com> <eb6ea0cc-dd8a-42ef-b834-630a5a4a43cdn@googlegroups.com>
<e6e4f15e-e049-4b5e-ac9d-f8ef58972355n@googlegroups.com> <6dff3512-a3a9-4547-8676-a92b65102aedn@googlegroups.com>
<tetnlh$p70r$1@solani.org> <1a604c60-bd8d-4b3a-ab98-0ec0936bba48n@googlegroups.com>
<tevts1$pgld$1@solani.org> <9ba53a71-5d99-4582-b496-ceb939539b19n@googlegroups.com>
<3e69764e-32a6-4b71-9095-f5b84ccbe808n@googlegroups.com> <128555c2-5ab1-4b7f-a861-46628a0e5d80n@googlegroups.com>
<db8d317d-7851-4085-815c-9b8953d10157n@googlegroups.com> <ad6bef9c-7097-41a0-a812-b31d0a926f9dn@googlegroups.com>
<b0a4a41e-0bf8-4779-ae41-9e1b75e65213n@googlegroups.com> <96b17c04-0800-4814-8ad4-ce02be0a7e1bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7103c04c-aedf-4302-9fe4-1a3cf36064b1n@googlegroups.com>
Subject: Re: Prolog code for alpha variants
From: burse...@gmail.com (Mild Shock)
Injection-Date: Thu, 19 Oct 2023 17:02:22 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4132
 by: Mild Shock - Thu, 19 Oct 2023 17:02 UTC

I am not extremly convinced by Richard O'Keefes approach
for subsumes/2. Especially how I have implemented it in
Dogelog Player, avoiding term_variables/2 all togtether!

Possibly I can produce some drastic test cases where it
doesn't run very well. On the other hand Jan W. is conceptually
promoting this bootstrapping of subsumes/2:

subsumes(General, Specific) :-
term_variables(Specific, SVars),
General = Specific,
term_variables(SVars, SVars).

The above cannot fast fail like Richard O'Keefes approach
can do. The further boostrapping is identical:

subsumes_term(General, Specific) :-
\+ \+ subsumes(General, Specific).

Mild Shock schrieb am Mittwoch, 18. Oktober 2023 um 17:56:52 UTC+2:
> So what goodies are there in library(compat) as well?
>
> Check this out:
>
> /* SWI-Prolog 9.1.16 */
> ?- numlist(1,100000,A), numlist(1,100000,B),
> time((between(1,1000,_), subsumes((f(_),X,X),(_,A,B)),
> fail; true)), fail.
> % 2,999 inferences, 2.375 CPU in 2.498 seconds (95% CPU, 1263 Lips)
> false.
>
> /* Dogelog Player 1.1.3 for Java (new!) */
> ?- numlist(1,100000,A), numlist(1,100000,B),
> time((between(1,1000,_), subsumes((f(_),X,X),(_,A,B)),
> fail; true)), fail.
> % Zeit 2 ms, GC 0 ms, Lips 1550000, Uhr 18.10.2023 17:40
> fail.
>
> Dogelog Player for Java came out a few days ago. To get
> subsumes/2 you have to use ensure_loaded(library(compat)).
> I am using Richard O’Keefes algorithm from 1984 for subsumes/2.
> Mild Shock schrieb am Mittwoch, 18. Oktober 2023 um 14:59:26 UTC+2:
> > Things that are not in the ISO core standard are more
> > likely to behave differently across Prolog systems?
> >
> > GNU Prolog behaves already differently to SWI-Prolog in
> > numbervars/3. I find this discrepancy:
> >
> > /* GNU Prolog 1.5.0 */
> > ?- X = f(A,X), numbervars(X, 0, _), write_canonical(A), nl.
> > _24
> > cannot display cyclic term for X
> >
> > /* SWI-Prolog 9.1.16 */
> > ?- X = f(A,X), numbervars(X, 0, _), write_canonical(A), nl.
> > '$VAR'(0)
> > X = f(A, X),
> > A = A.
> >
> > LoL

Re: Prolog code for alpha variants

<78318911-f128-40b1-8702-4b74b47dc60bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:45a4:b0:770:58ab:afb4 with SMTP id bp36-20020a05620a45a400b0077058abafb4mr59286qkb.8.1697735061706;
Thu, 19 Oct 2023 10:04:21 -0700 (PDT)
X-Received: by 2002:a05:6870:a117:b0:1e9:a727:e1f with SMTP id
m23-20020a056870a11700b001e9a7270e1fmr1332692oae.8.1697735061479; Thu, 19 Oct
2023 10:04:21 -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: Thu, 19 Oct 2023 10:04:21 -0700 (PDT)
In-Reply-To: <7103c04c-aedf-4302-9fe4-1a3cf36064b1n@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: <2912ca15-ac99-4dca-abb4-c25f3a2dc7dfn@googlegroups.com>
<cfe5c0fc-a877-46a3-8abe-17d4f415e44an@googlegroups.com> <eb6ea0cc-dd8a-42ef-b834-630a5a4a43cdn@googlegroups.com>
<e6e4f15e-e049-4b5e-ac9d-f8ef58972355n@googlegroups.com> <6dff3512-a3a9-4547-8676-a92b65102aedn@googlegroups.com>
<tetnlh$p70r$1@solani.org> <1a604c60-bd8d-4b3a-ab98-0ec0936bba48n@googlegroups.com>
<tevts1$pgld$1@solani.org> <9ba53a71-5d99-4582-b496-ceb939539b19n@googlegroups.com>
<3e69764e-32a6-4b71-9095-f5b84ccbe808n@googlegroups.com> <128555c2-5ab1-4b7f-a861-46628a0e5d80n@googlegroups.com>
<db8d317d-7851-4085-815c-9b8953d10157n@googlegroups.com> <ad6bef9c-7097-41a0-a812-b31d0a926f9dn@googlegroups.com>
<b0a4a41e-0bf8-4779-ae41-9e1b75e65213n@googlegroups.com> <96b17c04-0800-4814-8ad4-ce02be0a7e1bn@googlegroups.com>
<7103c04c-aedf-4302-9fe4-1a3cf36064b1n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <78318911-f128-40b1-8702-4b74b47dc60bn@googlegroups.com>
Subject: Re: Prolog code for alpha variants
From: burse...@gmail.com (Mild Shock)
Injection-Date: Thu, 19 Oct 2023 17:04:21 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mild Shock - Thu, 19 Oct 2023 17:04 UTC

But Jan W. conceptualization can be used to develop
a funny variant/2 predicate. If we start from this here,
we will have two unifications, in each subsumes_term/2:

variant2(A,B) :-
subsumes_term(A,B),
subsumes_term(B,A).

We can also use only one unification:

equalizer(A, B) :-
term_variables(A, L),
term_variables(B, R),
A = B,
term_variables(L, L),
term_variables(R, R).

variant3(A, B) :-
\+ \+ equalizer(A, B).

Seems to work:

A B variant2(A,B) variant3(A,B)
f(X,g(Y,X),Y) f(Z,g(T,Z),T) true true
f(X,g(Y,X),Y) f(Z,g(Z,Z),T) false false
f(X,g(Y,X),X) f(Z,g(T,Z),T) false false
f(A,A,B) f(B,A,A) false false
X+Y Y+Z false false

Mild Shock schrieb am Donnerstag, 19. Oktober 2023 um 19:02:23 UTC+2:
> I am not extremly convinced by Richard O'Keefes approach
> for subsumes/2. Especially how I have implemented it in
> Dogelog Player, avoiding term_variables/2 all togtether!
>
> Possibly I can produce some drastic test cases where it
> doesn't run very well. On the other hand Jan W. is conceptually
> promoting this bootstrapping of subsumes/2:
>
> subsumes(General, Specific) :-
> term_variables(Specific, SVars),
> General = Specific,
> term_variables(SVars, SVars).
>
> The above cannot fast fail like Richard O'Keefes approach
> can do. The further boostrapping is identical:
>
> subsumes_term(General, Specific) :-
> \+ \+ subsumes(General, Specific).

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor