Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

50 Years of Prolog Nonsense

1,221 views
Skip to first unread message

Mostowski Collapse

unread,
Jan 28, 2022, 10:41:35 AM1/28/22
to

50 Years of Prolog and Beyond
26 Jan 2022 - SWOT analysis
https://arxiv.org/abs/2201.10816

No mention of self-hosting systems? Like the AQUARIUS
Prolog system. I am not sure whether it was 100% self-hosting,
but had many parts written in Prolog itself, interpreter and compiler:

Aquarius Prolog 1.0
https://www.info.ucl.ac.be/~pvr/aquarius.html

What is self-hosting? See Wikipedia:

"In computer programming, self-hosting is the use of a
program as part of the toolchain or operating system that
produces new versions of that same program—for example,
a compiler that can compile its own source code."
https://en.wikipedia.org/wiki/Self-hosting_%28compilers%29

Why isn't Prolog listed there?

Mostowski Collapse

unread,
Jan 28, 2022, 10:47:41 AM1/28/22
to
Shit!!!! I am like a blink from self-hosting Dogelog player.
I only need open(write) and open(append) ISO predicates,
and maybe 2-3 other predicates, and it will be self-hosting.

One itchy thing is, I would like to make the cross compiler
output pretty printed, like not occupying lines longer than
75 characters, so I need a more intelligent pretty printing first,

before I can generate "nice" and VCS friendly and debuger
friendly cross compiled output.

Mostowski Collapse

unread,
Jan 28, 2022, 10:49:10 AM1/28/22
to
Also I had some nice findings about style checks. The cross
compiler can also do a couple of them, although he fires and
forgets what he cross compiles. But the cross compiler can

keep the same meta data predicate property info like the
online system, and perform some style checks that go beyond
the trivial singleton check, makeing it ultimately show the same

warnings like the online system. Which would prevent a lot
of programming errors. The cross-compiler would then be a
little bit more restrictive what it accepts than the online system,

because it needs to interpret certain directives.

Mostowski Collapse

unread,
Jan 28, 2022, 10:59:10 AM1/28/22
to
Ha Ha, their SWOT Analysis is cringe:

Threats (Section 4.4)
post-desktop world of JavaScript web-applications

Good luck with sticking to C, Java or other nonsense,
and not having self-hosting system, where the backend
can easily be switched. Or even self-hosting system

that target high-level languages with their own garbage
collection, such as JavaScript or Python. I cannot predict
the future, but I have the impression that if you have

an item on your SWOT Analysis as a threat and do not
adress it for years, what will be the outcome?

Mostowski Collapse

unread,
Jan 28, 2022, 11:07:08 AM1/28/22
to
Also JavaScript and Python in the form of node.js and
PyPy make a quite good impression also server side, nothing
to do with desktop or client side. Thats also nonsense.

But there are dozen of open questions now. How to make
it multi-threaded, how to make an auto-tuning garbage collector,
that somehow adapts to the performance of the target system.

On my old system I was deteriming fixed parameters so that garbage
collection does it job 60 times per second. Now on my new
system with some AMD Ryzen, these parameters are not correct

anymore, and it does more than 60 times per second. I running
it on an Apple M1 will be even worse.

Mostowski Collapse

unread,
Jan 28, 2022, 11:10:35 AM1/28/22
to
But I need a notion that goes beyond wall time now, something
like user time and system time. In JavaScript user time would
be suspended when for example a wait for setTime() or some

fetch is ongoing. But interestingly because the target language
has a certain event loop architecture, we can cooperate with this
event loop architecture, and for example do our own Prolog

garbage collection before we relinquish to the event loop,
so that the target system is not in a troubled situation when ever
it processes its own tasks. And we can kind of define the

two notions user time and system time on our own, so that
it seems feasible to create an auto-tuning garbage collector
for such target systems. Not yet sure. Will see.

Mostowski Collapse

unread,
Jan 28, 2022, 11:15:36 AM1/28/22
to
TauProlog and SWI-Prolog might also be on a path
forward here. SWI-Prolog discourse had recently
an interesting post:

Yielding prolog engines from within a foreign predicate
https://swi-prolog.discourse.group/t/yielding-prolog-engines-from-within-a-foreign-predicate/4806/5

But this was in the context of Rust. What Scryer Prolog offers
here I don't know, the Rust and Crate build system is annyoingly
slow, and fails because of some OpenSSL issues on WSL.

No time to fix that and follow what Scryer Prolog is doing...

Mostowski Collapse

unread,
Jan 28, 2022, 11:33:46 AM1/28/22
to
But you see the problem with non-self-hosting Prolog systems.
If SWI-Prolog were self-hosting, there would be already a Rust
version of SWI-Prolog now. But SWI-Prolog is the anti-thesis

to a Prolog system that is 100% Prolog. Its rather a Prolog
system that is 100% C. And you cannot easily switch some
back-end from C to Rust, and have a top-level in Rust.

Its quite astonishingly how much SWI-Prolog relies on C,
even when you would only consider a very small subset. It
seems SWI-Prolog never trusted Prolog as an implementation

language because of performance issues. I don't know the
final judgement here, there is an old post by Richard O'Keefe
that says self hosting in principle shouldn't be a problem.

"John Griffith writes:
I know it will be slower.

Richard A. O'Keefe responds:
Are you sure? The measurements I did a couple of years ago
showed that tokenising was slower in Prolog than in C (typically
because Prolog implementors don't put the effort into making
get0/1 go as screamingly fast as it could go), but there was very
little difference in parsing if you had a good Prolog compiler."
7th November 1996 - Prolog Parser in Prolog
https://dtai.cs.kuleuven.be/projects/ALP/newsletter/archive_93_96/net/grammars/parser.html

Mostowski Collapse

unread,
Jan 28, 2022, 11:35:42 AM1/28/22
to
Disclaimer: Maybe SWI-Prolog does the parsing already in C,
and the C percentage is not that high. I am drawing some
extreme pictures here to make a point.

Mostowski Collapse

unread,
Jan 28, 2022, 11:52:38 AM1/28/22
to
Corr.: Typo

Disclaimer: Maybe SWI-Prolog does the parsing already in Prolog,
and the C percentage is not that high. I am drawing some
extreme pictures here to make a point.

Also instead of self-hosting, foreign-hosting, just using a
cross compiler, is of course also a solution. But ultimately
compiling your own system with your system,

is a nice bootstrapping test and decouples you from some
other system. Might be necessary to perform a certain
evolution through bootstrapping, when

you want to abandon the other system.

Mostowski Collapse

unread,
Jan 29, 2022, 9:56:35 AM1/29/22
to
There is a fear that a Corona Wave will be like a wall,
in that it overruns the infrastructure like a Tsunami. But
implementing a prolog system not in 100% Prolog but

in imperative language like C, even if its high-level like
Java, will also hit a wall. Its much more easier to add
functionality to a Prolog system if the Prolog

system in 100% Prolog.

Example:
TauProlog hasn't even a discontiguous check!

LoL

Mostowski Collapse schrieb:

Mostowski Collapse

unread,
Jan 29, 2022, 10:05:05 AM1/29/22
to
Maybe Unix, with its C language, and then
C-Prolog (1982) sent the wrong message.
But sooner or later every programming

language will provide some pattern matching,
and yearn to have Prolog logical variables.
So maybe the wall is lower if other

programming languages were used like JavaScript
or Python, that have some pattern matching,
for example Python introduce a new match

control construct in release 3.10. So how
is Tau Prolog classified:

"In other words, tProlog pursues a similar
intent with respect to tuProlog and JIProlog:
bringing Prolog interpreters to high-level
platforms and languages, except it focuses
on another platform, JavaScript."

This says nothing about the compiler and
runtime architecture, its just a naive
end-user view, of a blackbox.

Mostowski Collapse schrieb:

Mostowski Collapse

unread,
Jan 29, 2022, 10:56:10 AM1/29/22
to
Pitty Logtalk isn't self hosting. So Logtalk
doesn't trust Logtalk as an implementation
language of the Logtalk transpiler?

Proof that it isn't self hosting, this here
is still Prolog and not Logtalk:

core compiler and runtime
https://github.com/LogtalkDotOrg/logtalk3/blob/master/core/core.pl

LoL

Today I had a little use case, where I could
use some object orientation or some such on
Dogelog Player. A style check, which works

against different data models. So a future
version of Dogelog Player would be self hosting
and object oriented?

Mostowski Collapse schrieb:

Mostowski Collapse

unread,
Jan 31, 2022, 1:37:08 PM1/31/22
to
Can we squeeze McCune's Method into Dogelog
Player? Yes! Thanks to Josephs Vidal-Rosset, who asked
about Quine's Method (I call it Boole's Method),

we can do the squeeze. Just use Boole's Method as
the backend SAT Solver. And it can already do:

?- falsify_fol((?[X]:p(X) => ![Y]:p(Y)), 2), !.
p(0).
true.

?- falsify_fol((![Y]: ?[X]:p(X,Y) => ?[Z]:![T]:p(Z,T)), 2), !.
p(0, 1).
p(1, 0).
true.

See also:

McCune’s Method from 1994 in Dogelog Player
https://twitter.com/dogelogch/status/1488165681434697728

McCune’s Method from 1994 in Dogelog Player
https://www.facebook.com/groups/dogelog

Mostowski Collapse

unread,
Jan 31, 2022, 1:45:04 PM1/31/22
to

Just enjoying a TV show NOVA Alaska Dinosaurs, they
talk about small and big Dinosaurs. Didn't the big
Dinosaurs get extinct, and the small Dinosaurs

survived in the form of birds? But I wouldn't say
Dogelog is actually a Bird. It could also be a Snake
that bites its tail, in case it becomes self hosting.

Mostowski Collapse

unread,
Feb 2, 2022, 6:46:30 AM2/2/22
to
The beauty of 3 valued logic! Or is it linear logic? Like the
cut the new construct isn't commutative, but its implemented
with extending true/false inside the Prolog trampoline. Was
having a look at ECLiPSe Prolog engines.

yield(+ToParent, -FromParent)
Stop the running engine in the yielded-state, and wait for resume
https://eclipseclp.org/docs/7.0/bips/kernel/engines/

I made something simpler for Dogelog player, which
can be used to bootstrap a lot of things:

'$STOP'(R): Internal only
The built-in stops the interpreter loop with return value R.

This is a forever and ever stop! Can this be used for
anything? Well here is a sleep/1 implementation,
it is assumed that the integer return value is interpreted
as the delay of a timeout promise:

sleep(T) :- '$STOP'(T).
sleep(_).

Putting everything together and we get:

Async/Await Prolog Console for JavaScript/Python
https://twitter.com/dogelogch/status/1488831738348515334

Async/Await Prolog Console for JavaScript/Python
https://www.facebook.com/groups/dogelog

With video recording!

Mostowski Collapse

unread,
Feb 4, 2022, 6:18:50 AM2/4/22
to
If I dont stop now, in a few days I will have an
Erlang system running. What already works is
a yielding engine in the Browser.

Non-Blocking Browser for Dogelog Player
https://twitter.com/dogelogch/status/1489350992793677827

Non-Blocking Browser for Dogelog Player
https://www.facebook.com/groups/dogelog

With video recording and funky background
sound! Next will be bring this yielding engine
node.js and to Python as well.

Mostowski Collapse

unread,
Feb 8, 2022, 9:04:42 AM2/8/22
to
It will take some time until I have an Erlang system.
The small things use a lot of time. Now I have
an non-async/await Sandbox and a async/await Sandbox

online. The Audio Player example allows playing with
the async/await Sandbox. The Audio Example will
disable the Tryit button and enable it again, when finished.

But its non-blocking, you can interact with the browser,
and it will not show the warning display in Chrome. Unfortunately
there is still an unsolved problem, the LIPS go down.

But this here works fine:

longrunning :-
between(1,300,_),
between(1,300,_),
between(1,300,_),
fail.
longrunning.

?- time(longrunning).
% Wall 37203 ms, gc 25 ms, 2206445 lips
true.

http://www.xlog.ch/izytab/doclet/docs/18_live/10_reference/example03/package.html

The LIPS go down because setTimeout() is clamped by 4ms in
the browser, and I do ca. 60x per Second setTimeout(). To give the
browser the opportunity to do his own stuff.

Mostowski Collapse

unread,
Feb 8, 2022, 9:06:16 AM2/8/22
to

Maybe I should show a spinning wheel or
something, while the thingy runs? The color
change in the button is nearly not seen...

Mostowski Collapse schrieb:

Mostowski Collapse

unread,
Feb 8, 2022, 4:23:17 PM2/8/22
to
Since idiotic Tau Prolog is horsing around:
https://github.com/tau-prolog/tau-prolog/issues/291

Here my response:

Thats not what Erlang did. In Erlang there was a counter and long
running actors were automatically yielded. You can lookup the
Erlang documentation if you don't believe me.

Your suggestions from using sleep/1 to the other suggestion to
pressing enter in the top-level are ridiculous, you seem not to
understand what a yielding engine is.

Maybe hold back your nonsense suggestion and only respond
when you have a solution, or when a solution is dismissed for
some reasons. But I don't know why a yielding engine should

be imposible? I just had a look at your source code, especially
your async protocol with return true and again(). Quite impressive
and relatively simple solution. Maybe because catch/3 creates

another thread via new Thread() ? I don't know what the technical
issue is that after all these years a yielding engine isn't available?

Mostowski Collapse

unread,
Feb 8, 2022, 4:35:58 PM2/8/22
to
Again, whats so difficult in providing a yielding engine?

One can make it configurable, shouldn't be a problem for
somebody with that programming skills.

I have it easily switchable on and off:

/* Switch yielding engine on */
set_gc_flags(gc_flags | GC_MASK_ASYNC);

Maybe its some mental blockage?

Mostowski Collapse

unread,
Feb 8, 2022, 4:42:03 PM2/8/22
to
The next step is make it cancellable. So you would have
maybe some way in the GUI to cancel an engine. But this
would be most effective if it is combined with AbortController

stuff from node.js. Not sure what the browser offers.
Did not yet work on this. But since in a non-blocking sandbox
the GUI remains responsive, you can have a GUI control

similar to Ctrl-C that one is used from SWI-Prolog.

Mostowski Collapse

unread,
Feb 8, 2022, 4:48:36 PM2/8/22
to
So maybe lets start all-over and read my question in the
ticket again. How do your answers respond to my question:
> Is there another sandbox already online?

I don't want to change my Prolog code.
And I don't want to code a sandbox in JavaScript.

I understand that on the other hand it seems a yielding
engine is already there, by for example hooking into
the limit callback for example. But I don't find it

somewhere already wrapped into a sandbox. Or
maybe there is some other URL out in the wild?

Mostowski Collapse

unread,
Feb 8, 2022, 7:17:13 PM2/8/22
to
Woa! That was quick, there is now a stop option:
https://github.com/tau-prolog/sandbox/issues/10

I always admire Steve Jobs, how he introduced the MacIntosh
with a mouse that only had one button. Those times there were
mouses with 3 buttons.

So currently trying to figure out what a good GUI would be.
I cannot speak for Tau Prolog. But in my system Limit is a
system resource, that the end-user has nothing

to do with. It is planned that for non-blocking via some
auto-tuning the optimal value is found. Browsers have
a certain affinity to 60 frames per second.(*)

Not yet sure how this turns out. For the control buttons,
I am rather think of something else. Don't know yet what.
Was just having a look at SWISH,

it shows me an animation and an abort button. Maybe
thats where I got the animation idea from. after a while
it shows stats. the abort button shows again after redo.

(*)
I found some docu about that. A browser might also updrade
or downgrade the frequency. There is also something related
to animation, called requestAnimationFrame(), but this is

probably not needed for DOM updates.

Mostowski Collapse

unread,
Feb 8, 2022, 7:34:05 PM2/8/22
to

Does your browser stutter?
https://www.testufo.com/animation-time-graph

Mostowski Collapse

unread,
Apr 4, 2022, 4:01:07 AM4/4/22
to
Now my world view about Rust programming lanuage is in
pieces. Isn't Rust a safe programming language?

So I would expect more than only a "Segment Fault":

$ target/release/scryer-prolog --version
"v0.8.123-892-gd92d8bc"

$ target/release/scryer-prolog
?- catch(retract(true), error(E,_), true).
Segmentation fault

My expectation is biased by Java, which is an early supposedly
safe language, which has more tellîng exceptions.

Also where are the Log-Nonsense-Talk test cases,
that found this problem?

Mostowski Collapse

unread,
Apr 4, 2022, 4:03:14 AM4/4/22
to
Also for a Prolog system such as Scryer Prolog,
that has become the abode of ultra orthodox ISO

core standard prolog freedom fighters,
I wonder why this wrong behaviour exists:

$ target/release/scryer-prolog
?- retract(retract(_)).
false.

Mostowski Collapse

unread,
Apr 4, 2022, 4:10:46 PM4/4/22
to
This is also a nice one, Scryer-Prolog:

?- [user].
foo.
:- dynamic(foo/0).
^D

But a couple of Prolog systems do not permit change of
type of a predicate. For example GNU Prolog and
ECLiPSe Prolog perform a check.

A displaced dynamic directive could be indicative of
a typo, so I am rather in favor of such a check.

Mostowski Collapse

unread,
Apr 5, 2022, 6:32:12 PM4/5/22
to
Same problem in SWI-Prolog. This actually leads to a subtle
bug when reconsulting. The bug is seen here. Since the clear
is only done when some clause arrives and not already

during the directive, the clear also removes the directive.
So you can basically not reconsult and change from static
into dynamic. Whereby this would work correctly in GNU Prolog:

/* SWI-Prolog (threaded, 64 bits, version 8.5.8) */
?- [user].
|: foo.
|:
% user://1 compiled 0.02 sec, 1 clauses
true.

?- [user].
|: :- dynamic(foo/0).
|: foo.

Warning: user://2:15:
Warning: Redefined static procedure foo/0
Warning: Previously defined at user://1:8
|:
% user://2 compiled 0.00 sec, 1 clauses
true.

?- predicate_property(foo, X).
...
X = static ;
...

The bug is that the predicate is static and not dynamic.

Mostowski Collapse

unread,
Apr 16, 2022, 8:30:23 PM4/16/22
to
Oh my dear, Scryer Prolog lost the battle with its
char lists = strings idea and his preference for chars APIs.
I don't have a single chars API in Dogelog Player, was

fully betting on codes only, makes life much easier.
Now this here. BTW: A library charsio does not anymore
exist in SICStus Prolog 4.7.1:

| :- use_module(library(charsio)).
! Existence error in argument 1 of use_module/1
! file library(charsio) does not exist
! goal: use_module(user:library(charsio))

Oh the irony, I did find a library codesio:

| ?- use_module(library(codesio)).
% loading d:/software/logic/sics/library/codesio.po...
% module codesio imported into user
% loading d:/software/logic/sics/library/types.po...
% module types imported into codesio
% loaded d:/software/logic/sics/library/types.po in module types, 0 msec 6432 bytes
% loading foreign resource d:/software/logic/sics/library/x86_64-win32-nt-4/codesio.dll in module codesio
% loaded d:/software/logic/sics/library/codesio.po in module codesio, 0 msec 64768 bytes
yes
| ?- read_from_codes("X+Y.", T).
T = _A+_B ?

LoL

Mostowski Collapse

unread,
Apr 17, 2022, 8:10:27 AM4/17/22
to
Here is a challenge. From SWI-Prolog I am used to:

?- atomic_list_concat([a,b,c],',',A).
A = 'a,b,c'.

?- use_module(library(dialect/ifprolog)).
true.

?- atom_split(A, ',', [a,b,c]).
A = 'a,b,c'.

Something similar available for Scryer Prolog? These predicates
offer the opportunity for some O(n) implementation, compared
to a naive Prolog bootstrapping with atom_concat/3 which is O(n^2).

This holds for the modes atom_split(-, +, +) and atomic_list_concat(+, +, -).
The other mode I am not exactly sure whether there is really an opportunity.
The predicate mode atom_split(-, +, +) also brings back to Prolog

the join() idiom, widely discussed in JavaScript and Python places.

Mostowski Collapse

unread,
Apr 17, 2022, 4:39:14 PM4/17/22
to
Somehow flatten/2 can be used for atom_list_concat/3,
at least this would work, when atoms itself are lists.
But do chars perform better than codes?

I did a little test for Scryer Prolog:

$ target/release/scryer-prolog --version
"v0.9.0-101-gb4486818"
$ target/release/scryer-prolog
...
?- length(L,1000), maplist(=([97, 98, 99, 97, 98, 99, 97, 98, 99]),L),
time((between(1,1000,_), flatten(L,_,[]), fail; true)), fail.
% CPU time: 4.730s
false.

?- length(L,1000), maplist(=("abcabcabc"),L),
time((between(1,1000,_), flatten(L,_,[]), fail; true)), fail.
% CPU time: 4.956s
false.

Using:

flatten([]) --> !, [].
flatten([X|Y]) --> !, flatten(X), flatten(Y).
flatten(X) --> [X].

What is the explanation of the ca. 5% slow-down?

Mostowski Collapse

unread,
Apr 17, 2022, 4:53:26 PM4/17/22
to
In SWI-Prolog, there is no difference larger than 1%:

?- set_prolog_flag(double_quotes, codes).
true.

?- length(L,1000), maplist(=("abcabcabc"),L),
time((between(1,1000,_), flatten(L,_,[]), fail; true)), fail.
% 20,002,000 inferences, 1.000 CPU in 1.000 seconds (100% CPU, 20002000 Lips)
false.

?- set_prolog_flag(double_quotes, chars).
true.

?- length(L,1000), maplist(=("abcabcabc"),L),
time((between(1,1000,_), flatten(L,_,[]), fail; true)), fail.
% 20,002,000 inferences, 1.000 CPU in 0.999 seconds (100% CPU, 20002000 Lips)
false.

Although I didn't consult Scryer Prolog GitHub, I have
a suspicion why chars are slower than codes in Scryer
Prolog. But I wonder what the experts say.

Mostowski Collapse

unread,
Apr 23, 2022, 4:57:29 PM4/23/22
to
This could run for ever:

?- A=(1=1, call(A)), A.
But so far I find:

SWI Prolog: Fail ✗
SICStus Prolog: Pass ✓
Formerly Jekejeke Prolog: Fail ✗
Dogelog Player: Pass ✓
Scryer Prolog: Fail ✗

Maybe I can bring the same from Dogelog Player to formerly Jekejeke
Prolog as well? To see the Scryer Prolog Fail, you need to watch the
memory growing and growing.

The other Prolog systems that do Pass have constant memory.

Mostowski Collapse

unread,
Apr 24, 2022, 8:32:07 AM4/24/22
to
There are many libraries that use meta calls. For example
Bart Demoen et al. “Tor” and Ulrich Neumerkels “indexing dif”:

Tor: Extensible Search with Hookable Disjunction
https://www.swi-prolog.org/pack/list?p=tor

Many Prolog programs are unnecessarily impure
https://arxiv.org/abs/1607.01590

But the issue needs of course be also examined for call/n
and not only call/1. Currently Dogelog Player doesn’t have call/n,
only call/1, so I don’t know. I also don’t know why it doesn’t

work in formerly Jekejeke Prolog or in SWI-Prolog. In SWI-Prolog
if you create a temporary clause, last call optimization could skip
it, but you need also a mechanism to garbage collect it.

In formerly Jekejeke Prolog I create a temporary half clause,
only the body of a clause. I thought I made it so that it gets skip
and garbage collected, maybe there is a bug somewhere.

Mostowski Collapse

unread,
Apr 24, 2022, 2:47:05 PM4/24/22
to
Practically the example can be made run on most Prolog
systems by replacing call/1 by Vanilla Interpreter solve/1.
When I use this here:

solve(X=X).
solve(solve(A)) :- solve(A).
solve((A,B)) :- solve(A), solve(B).

I can run this query:

?- A=(1=1, solve(A)), solve(A).

Indefinitely. The test results are now:

SWI Prolog: Pass ✓
SICStus Prolog: Pass ✓
Formerly Jekejeke Prolog: Pass ✓
Dogelog Player: Pass ✓
Scryer Prolog: Pass ✓

Mostowski Collapse

unread,
Apr 24, 2022, 5:49:19 PM4/24/22
to

Finally on YouTube

ALAIN COLMERAUER L'AVENTURE PROLOG
11.04.2022 - Prolog Heritage
https://www.youtube.com/watch?v=74Ig_QKndvE

Mostowski Collapse

unread,
Apr 29, 2022, 7:27:22 AM4/29/22
to

Why is there no coverage of the ISO core standard, maybe
I didn't watch it closely... ? Do the French hate the British
so much, that they would like to beton the Channel Tunnel?

LoL

P.S.: I slowly start hating the Portuguese because of
Logtalk Nonsense. And recently a math troll...

Mostowski Collapse schrieb:

Mostowski Collapse

unread,
Apr 29, 2022, 7:37:40 AM4/29/22
to

Blame it on Robert Kowalski, he even creates
an artificial Schism between Edinburgh Prolog
and Colmerauer Prolog in the video,

But guess what the name "Kowalski" is not
British, thats rather something Polish.
There really exists something

like an academic Prolog idiot...

LMAO

P.S.: Please make an extended version of
the video, if you have more material. And
say something about the ISO core standard.

Mostowski Collapse schrieb:

Mostowski Collapse

unread,
Apr 30, 2022, 11:38:41 AM4/30/22
to

Maybe the war between French and British is nevertheless
over, the Lady showed in one scene a logic booklet by Lewis
Caroll. Or maybe the lady though Caroll is a french name?

Dont know where this name is from. Could be Czech?

P.S.: Could be also an interesting booklet for Dan Christensen,
too improve his skills in basic logic.

Mostowski Collapse

unread,
Apr 30, 2022, 11:45:51 AM4/30/22
to


Okay, typo Carroll, and only a clever artist name:

Charles Lutwidge Dodgson
https://de.m.wikipedia.org/wiki/Lewis_Carroll

Do I have permission from
https://math.stackexchange.com/users/742/arturo-magidin
To cite wikipedia?

Mostowski Collapse

unread,
May 4, 2022, 2:35:57 PM5/4/22
to
Woa! A moment of silence for Scryer Prolog.
It has become irreversibly unuseable, even
basic Prolog logic doesn't work anymore...

What the heck are they doing? Tons of unification
and char list tickets on GitHub. But elementary
things like switch_on_term / switch_on_constant

/ put_unsafe_value are troubled by random numbers?

Mostowski Collapse

unread,
May 5, 2022, 3:21:49 AM5/5/22
to
So I heard it through the grape wine, Scryer Prolog
does not have DCG (\+)/1. Dang! So far ECLiPSe Prolog,
SWI-Prolog, GNU Prolog, SICStus Prolog have it.

Why is this so? UWNs code doesn't make any sense:

dcg_cbody(\+ GRBody, S0, S, ( \+ phrase(GRBody1,S0,_), S0 = S ), M) :-
module_call_qualified(M, GRBody, GRBody1).

He does not compile (\+)/1, makes it a call to phrase/3.
You can check other Prolog systems, usually they call body
translation when they translate (\+)/1.

So people comment it out?

%% dcg_constr(\+ _). % 7.14.11 - not (existence implementation dep.)

LoL

Mostowski Collapse

unread,
May 5, 2022, 3:52:29 AM5/5/22
to
At least UWNs translation would be steadfast. Here you
see what is the difference between a steadfast, and
a non-steadfast translation:

Was running this test case:

p --> \+ q.
q --> {write('did you call me?'), nl}.

In Tau Prolog 0.3.2 (beta) I get:

p([a],[]).
false.

On the other hand SWI-Prolog gives me:

?- p([a],[]).
did you call me?
false.

Mostowski Collapse

unread,
May 5, 2022, 3:58:35 AM5/5/22
to

The SWI-Prolog behaviour is the steadfast one.

Mostowski Collapse

unread,
May 5, 2022, 4:23:15 AM5/5/22
to
Maybe the phrase/3 translation grows out of the
desire to a) make the translation not cut transparent,
b) make the translation similar to the translation

of ordinary (\+)/1 which does lazy body conversion
for the meta variables in its argument. b) is some luxury
and a) is guaranteed because (\+)/1 enters the

translation result. Just check out:

p --> \+ (q, !, r).

It gets translated as, in SWI-Prolog:

?- listing(p/2).
p(A, B) :-
\+ ( q(A, C),
!,
D=C,
r(D, _)
),
B=A.

The result is also not cut transparent, since the cut ! is inside
(\+)/1. So cut transparency is not an issue. About b), you
could device a more intelligent DCG translation, which

can do this. i.e. when it sees no meta variables, do directly
a translation. Otherwise do a translation that amounts to
something lazy. Such optimizations are also available for

(\+)/1 outside of the DCG context. You can pre-compile the
body conversion, if you see that it is stable. This can give
quite some speed up to ordinary Prolog, i.e. case you

have complex (\+)/1 arguments.

Mostowski Collapse

unread,
May 5, 2022, 6:04:07 AM5/5/22
to
When it is 2022, but you are still living in 2013:
https://stackoverflow.com/questions/12758567/legitimate-uses-of-1

The question has two former answers from me. Stackoverflow didn't
allow me to delete them. Nobody else has answered, and you are
asking the wrong question.

I find that ECLiPSe Prolog, SWI-Prolog, GNU Prolog and SICStus
Prolog support it. They all are able to support (\+)/1 inside DCG.
You can also add Tau-Prolog to the list and a couple

of more Prolog systems. The (\+)/1 is nowadays part of PEG.

parsing expression grammar (PEG)
Not-predicate: !e
https://en.wikipedia.org/wiki/Parsing_expression_grammar

It has million of uses, they are all legitimate.

Mostowski Collapse

unread,
May 5, 2022, 6:08:16 AM5/5/22
to
Its also nicely explained:

The not-predicate expression !e succeeds if e fails and fails if e
succeeds, again consuming no input in either case.

Mostowski Collapse

unread,
May 5, 2022, 6:19:59 AM5/5/22
to

Looks like UWN is confusing GitHub with Facebook, with his up votes.
And sometimes UWN thinks its YouTube, with his down votes?

Mostowski Collapse

unread,
May 5, 2022, 6:56:04 AM5/5/22
to
The declarative reading is relatively trivial.
Take this example from above:

p(A, B) :-
\+ q(A, _),
A = C,
r(C, B).

The declarative reading is as follows:

p(A, B) ←
¬ ∃D q(A, D) ∧
A = C ∧
r(C, B).

Its not really rocket science. But because its negation
as failure you might also need Clark Completion etc..

Mostowski Collapse

unread,
May 5, 2022, 7:08:00 AM5/5/22
to

Ok, the aspiring academic Prolog idiot might want
to know more. But from PEG context it should be clear,

that this is the declarative reading for parsing, i.e.
mode p(+,-). Not sure whether it is suitable for other

modes. Didn't use it in other modes...

P.S.: Maybe if you look long enough out of a window,
you might see a pink Unicorn fly by, its the same

with bidirectional DCG grammars....

Mostowski Collapse

unread,
Jun 2, 2022, 3:03:37 PM6/2/22
to
Look Ma, a FOL resolution theorem prover in Prolog:
See also: http://logic.stanford.edu/intrologic/chapters/chapter_14.html

many([], S, S).
many([C|T], S, R) :- next(C, T, S, R).

next(C, T, S, R) :- member(D, S), weaker(D, C), !, many(T, S, R).
next(C, T, S, R) :- filter(S, C, K), apply(C, K, H),
append(T, H, J), many(J, [C|K], R).

apply(C, S, T) :-
findall(E, (member(D, S), resolvent(C, D, E)), T).

resolvent(C, D, E) :-
select(A, C, H), factor(A, H, C2),
select(B, D, J), factor(B, J, D2),
opposite(A, B),
append(C2, D2, E).

opposite(pos(A), neg(A)).
opposite(neg(A), pos(A)).

factor(_, C, C).
factor(A, C, C2) :- select(A, C, H), factor(A, H, C2).

filter([], _, []).
filter([D|L], C, R) :- weaker(C, D), !, filter(L, C, R).
filter([D|L], C, [D|R]) :- filter(L, C, R).

weaker(C, D) :- \+ \+ (numbervars(D, 0, _), subset(C, D)).

subset([], _).
subset([X|L], R) :- member(X, R), subset(L, R).

% ?- many([[pos(p(X)),pos(p(Y))],[neg(p(U)),neg(p(V))]],[],S).
% S = [[]].

Mostowski Collapse

unread,
Jun 3, 2022, 5:44:20 AM6/3/22
to
Ok, forgot about the occurs check.

This should also have either:
:- set_prolog_flag(occurs_check, true)

Or then sprinkled with calls to:
unify_occurs_check(_,_)

When variables occur non-linearly in a clause.

Mostowski Collapse

unread,
Jun 3, 2022, 5:49:27 AM6/3/22
to
Corr.::

unify_with_occurs_check(_,_)

Mostowski Collapse

unread,
Jun 3, 2022, 6:11:18 AM6/3/22
to
My resolution theorem prover is an attempt to fix a bug
with Markus Triskas resolution theorem prover:

Resolution Calculus for Propositional Logic
pl_resolvent( ... ) :-
select(Q, As0, As),
select(not(Q), Bs0, Bs),
append(As, Bs, Rs0),
https://www.metalevel.at/logic/plres.pl

Mentioned here:

Theorem Proving with Prolog
https://www.metalevel.at/prolog/theoremproving

But when one reads the fine print by Markus Triska, it says
for propositional logic. Not sure whether it works for first
order logic (FOL) as well? There is a FOL example {p(X), p(Y)}

and {~p(U), ~p(V)} which hints that a full flegded resolution
theorem prover needs also “factoring”. Making a resolution
theorem prover only complete when it implements

resolution step with factoring:

> Φ
> ψ
> -------------------------------
> ((Φ’-{φ})∪(Ψ’-{¬ψ}))σ
> where τ is a variable renaming on Φ
> where Φ’ is a factor of Φτ and φ∈Φ’
> where Ψ’ is a factor of Ψ and ¬ψ∈Ψ’
> where σ=mgu(φ, ψ)
> http://logic.stanford.edu/intrologic/chapters/chapter_14.html

Any full fledged resolution theorem provers around written in Prolog?

Mostowski Collapse

unread,
Jun 10, 2022, 8:54:07 AM6/10/22
to

Its 2022 and Prolog is among the top 20

TIOBE Index for June 2022
https://www.tiobe.com/tiobe-index/

Woa!

Mostowski Collapse

unread,
Jun 25, 2022, 5:39:42 AM6/25/22
to
What would make sense, is a ISO core standard working
group, that would draft these stream creation properties:

- bom(Bool)
Specify detecting or writing a BOM.
- encoding(Atom)
Specify a file encoding.

After all we have already 2022 and 50 years of Prolog. But
can we be sure that Prolog texts are exchangeable, if
they use Unicode code points?

What if a UTF-16 file, handy for CJK, comes along?

Mostowski Collapse

unread,
Jun 25, 2022, 5:41:07 AM6/25/22
to
I feel I have not the according experience. Will redo this
stuff now for Dogelog Player after having it in formerly
Jekejeke Prolog and still discovering new corners. Maybe

can tell more in a few years. Also experience from formerly
Jekejeke Prolog are that things might look different for
UrlConnection, since the server might do the BOM detection

and the client doesn’t need. I guess SWI-Prolog has also
some experience here through http_open/3.

Mostowski Collapse

unread,
Jul 12, 2022, 3:45:36 AM7/12/22
to
An ode to the most annoying people in Prolog:

Markus Triska, this wasn't my question. On the same grounds
you could remove (\+)/1 from Prolog. Doesn't make any sense
what you write since Prolog has dual use, pure and impure.

If you want to provide a fully pure language you have to
rename Scryer Prolog into something Scryer XXX, where
XXX is this language. And if your attempt is at a pure language

that is also aimed at bootstrapping the system itself, then
you have to demonstrate this for your XXX. But to the best of
my knowledge it is still called Scryer Prolog and not

Scryer XXX and I do not find a single paper about some XXX
that would be the basis for this utopian Scryer XXX from nowhere
land. Scryer Prolog rather refers repeatedly to WAM which supports

the cut and friends. What is your XXX exactly? Your bragging seems
rather moot and annoying nonsense in the context of Scryer Prolog
which is based on WAM. If this were a repository of another language

dedicated to this Scryer XXX, your comments would make sense.
But as they are now distributed all over the place, they rather
look like disorganized debris to me, that landed in the wrong place.

Maybe open a new repository for your Scryer XXX instead of
bothering people with your ever repeating nonsense, that is
anyway trivially evident for any Prologer who knows his cut?


Mostowski Collapse

unread,
Jul 12, 2022, 4:03:58 AM7/12/22
to
Ignoring the users of a Prolog system was always a good strategy:

And? Whats your point exactly? The same happens here:

?- nonvar(X).
false.

?- X = a, nonvar(X).
X = a.

Do you also suggest to remove nonvar/1. nonvar/1 is part of the
ISO core standard. forall/2 can be found in this document:

New built-in flags, predicates, and functions proposal
8.10.4 forall/2
ISO/IEC DTR 13211-1:2006
https://www.complang.tuwien.ac.at/ulrich/iso-prolog/N208

Which had these people behind it, potential users of it:

Bart Demoen (Belgium)
Jan Wielemaker, (Netherlands)
Joachim Schimpf (UK)
Jonathan Hodgson (USA)
Katsuhiko Nakamura (Japan)
Klaus Daessler (Germany)
Mary Kroening (USA)
Michael Covington (USA)
Neng-Fu Zhou (USA)
Paulo Moura (Portugal)
Pierre Deransart (France)
Péter Szabó (Hungary)
Péter Szeredi (Hungary)
Rémy Haemmerlé (France)
Richard O'Keefe (NZ)
Roberto Bagnara (Italy)
Roger Scowen (UK)
Ulrich Neumerkel (Austria)

So its one, Markus Triska, against many. I am only
voicing what many expect anyway from a Prolog system.

Make a GitHub search, you find many places where it is used
by some Prolog programmer. Its kind of staple food.

Mostowski Collapse

unread,
Jul 12, 2022, 4:28:22 AM7/12/22
to
Here is a suggestion to stop this madness:


SWI-Prolog has an iso marker, which is seen in its
documentation. Scryer Prolog seems to have two
kinds of users. a) Ordinary Prolog users, and b)

Users that project some more Declarative Language into
Scryer Prolog, although Scryer Prolog is based on
WAM which is not designed for that. Maybe introduce

an impure marker so that we can identify the subset
of this upcoming more Declarative Language. This
could be more helpful than distracting GitHub issues

that adresse the ordinary needs of Prolog programmers
by posting trivialities that anyway any Prologer knows. Here
is my suggestion, predicates could be marked as follows:

','/2: no marker
(\+)/1: impure marker
nonvar/1: impure marker
Etc...

One could then generate an index with the pure predicates
that do not have the impure marker. Is there already a booklet
about this new extra ordinary language somewhere?

It would be interesting to see what language results by this index.
Is it possible to bootstrap a Prolog system with this language?
Does it contain some novel declarative predicates?

Mostowski Collapse

unread,
Jul 12, 2022, 4:29:00 AM7/12/22
to

Also the idea that Scryer Prolog would not support the
needs of ordinary Prolog programmers and is kind of
extra ordinary language runs counter to its own slogan.

It says the first line of the GitHub readme:

Scryer Prolog
Scryer Prolog aims to become to ISO Prolog what GHC is to Haskell:
https://github.com/mthom/scryer-prolog

So it subscribes to ISO Prolog which is anyway dual use,
impure and pure. I do not find that the ISO core standard
would only promote pure Prolog.

Scryer Prolog might be a test bed for some new upcoming
declarative programming language. But then the slogan has
probably to be changed if this test bed gets hijacked into

an exclusive discriminating venture. If the marking doesn't
work, maybe a side project with new Prolog system
XXX could be interesting. Where effectively the

impure predicates are blocked. This could be an interesting
idea, so there would be also download of XXX, which
is pure, and end-users would have no way to change that,

kind of relaunch of the Gödel language idea:

The Gödel Programming Language (Logic Programming)
von Patricia Hill (Author), John W. Lloyd (Author)
https://www.amazon.com/dp/0262082292

which had a similar aim.

Mostowski Collapse

unread,
Jul 12, 2022, 4:40:52 AM7/12/22
to

Even in 2018 People ask:

I want to start programming with Gödel language
Kurt Gödel, LQ Newbie - 02-24-2018, 09:41 AM
"I don’t know anything about computer programming.
So here I need help please explain to me how computers work.
I found this language called gödel,
but is this the language i can create a game with?
And I do want to know where can I go to learn programming."
https://www.linuxquestions.org/questions/programming-9/i-want-to-start-programming-with-g%F6del-language-4175624376/

Call the Scryer derived language Gödel II, how about that?

Markus Triska

unread,
Jul 12, 2022, 1:21:23 PM7/12/22
to
Mostowski Collapse <burs...@gmail.com> writes:

> Which had these people behind it, potential users of it:

However, not everyone in this list supports everything in the document.
And the document is from 14 years ago: Back then, important constructs
such as if_/3, tfilter/3 etc. were not even found, and the quest for
better constructs was quite stalled. We can do better today than many of
us thought possible in 2008, or even in 2016: For example, just in these
last 6 years, we got 4 new Prolog systems (Scryer, Trealla, Tau and
ichiban/prolog) where double_quotes is set to chars by default. Who
thought that this was possible in 2008? I think even in 2012 or even
later, implementors advocated for JavaScript-style "strings" in Prolog
and even added them to their systems, until a new representation
pioneered by Scryer Prolog made chars viable in newer systems. forall/2
probably likewise seemed necessary in 2008, but does it still seem so
today? A better, not yet found construct, could likewise make it
obsolete, just like JavaScript-style strings have now become obsolete.

> Make a GitHub search, you find many places where it is used
> by some Prolog programmer. Its kind of staple food.

You will find a lot on GitHub, a lot of Java and C code too. It could
make for an interesting analysis, however I find decisions based on such
statistics subject to certain doubts: For example, is a construct that
violates elementary logical properties good because it appears in a lot
of programs? Or does this rather show that many programs could be
improved by removing this construct entirely from the language?

All the best,
Markus

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

Mostowski Collapse

unread,
Jul 12, 2022, 5:50:20 PM7/12/22
to
Well the error is always the programmer, in this
case the programmer doesnt know that in Prolog
bound variables have to be „ purified“ i.e. given

different names. For example spinning your nonsense
further far ahead, you could also demand to ban
findall from Prolog, because:

?- findall(X, member(X, [1,4,2], L).
L = [1, 4, 2]

X is not instantiated in the answer, so by monotonicity,
we should be able to instantiate it, but it goes wrong:

?- X = 3, findall(X, member(X, [1,4,2], L).
fail

Separating away variable names is bread and butter in
theorem proving. I dont think double_quotes chars value
is a contribution here, neither if_ etc.

I dont find any proposal for an improvement either in
the new Prolog systems like Trealla, Scryer, etc..

I only find turds on GitHub all over the place forbid
this forbid that despite there is not a single outcry
by other Prolog programmers that variable

purification is not a body convesion step in ISO standard
Prolog. Write please an amendmend to the ISO standard
or define a new language with automatic variable

separation and then we can talk again.

P.S.: Lambda Prolog can do it. But you would write
findall invocation slightly differently.

Mostowski Collapse

unread,
Jul 12, 2022, 6:01:29 PM7/12/22
to
In Lambda Prolog you could define a findall
by accempting a higher order closure using
some lambda binder, here I am using (\)/2 for

this purpose. findall would only have arity 2:

?- findall(X\member(X, [1,4,2]), L).
L = [1, 4, 2]
?- X = 3, findall(X\member(X, [1,4,2]), L).
X = 3,
L = [1, 4, 2]

But you have to rethink your logic programming
language from ground up. You might need a different
read term, or some post processing of read term.

Lambda Prolog does all that. But posting turds on GitHub
does nothing. It only shows that you are ignorant about
possible solutions that exist since Alonzo Church,

https://en.m.wikipedia.org/wiki/Alonzo_Church

The solutions are older than the 50 years of prolog.

Mostowski Collapse

unread,
Jul 12, 2022, 6:17:00 PM7/12/22
to
Corr.: Currently in Prolog we would have:

?- X = 3, findall(X, member(X, [1,4,2]), L).
X = 3,
L = []

In as far forall/2 has a similar „problem“
which is usually taken care by the programmer,
similarly like the programmer watches

that his findalls are purified according to the
use case he has. Etc.. etc… But compared
to Lambda Prolog ordinary prolog is

more primitive and has primafacie some inference
rules missing, although a lot can be compensated by
meta interpreters, little theorem provers, little

new languages written in Prolog itself. But these little
tools might be impure. Some lamda Prolog through its
HOAS can enforce meta circular purity. Here I

totally agree that Prolog lacks this feature. But you cannot
add this feature by forbidding things as you do. Compared
to Lamda Prolog your approach of turding Prolog

by disrupting GitHub with crazy comments and
no contribution has zero impact on improving the
situation. Its just nonsense.

Mostowski Collapse

unread,
Jul 12, 2022, 7:02:47 PM7/12/22
to

Also the uses of forall/2 have increased in the past.
Some people use it as a replacement for failure driven loop:

?- G, C, fail; true.

They write it as:

?- forall(G, C).

It has the advantage/disadvantage that it signals
failure of C. Which the failure driven loop does not do.
You find it in the wild here:

main :-
forall(number_fizzbuzz_below_100(_, FizzBuzz),
(write(FizzBuzz), write('\n'))).

https://github.com/triska/clpz/issues/12

Its from some of your users of Scryer Prolog
and some of your users of CLP(Z). So I guess
you dont know who your users are?

Good luck with that…
You are Genius like Putin.

Mostowski Collapse

unread,
Jul 12, 2022, 7:22:27 PM7/12/22
to

Also there are quite capable people in the SWI Prolog
discourse group, that where discussing forall/2
versus foreach/2, repeatedly showing some

deep understanding of the constructs, which I find
lacking if somebody critizises the construct based
on a usage error in the form

of lack of purification. That paints one into a corner
of not understanding the construct at all. Last but
not least s(CASP) starting with s(ASP),

have also found uses for some forms of forall/2.
Just read the papers follow the forums and
inspect the systems. forall/2 has

come to amazing new life. forall is also
not the worst name of the predicate, since it can
provide the so called bounded universal quantifier,

under certain circumstances you can tranlate it
(this is left as an exercise):

ALL(x):[A => B]

But I have recently started calling it Peano
implication, since Giuseppe Peano used the
following notation for it:

A =>x B

putting more emphasis on the underlying
implication than on the universally
bound variable.

Have Fun!

Mostowski Collapse

unread,
Jul 12, 2022, 7:32:58 PM7/12/22
to
Peanos conditional made it
even into the Principia Mathematica:

Before we look at a wider range of examples, a detailed
example involving quantified variables will prove to be
instructive. Whitehead and Russell follow Peano’s

practice of expressing universally quantified conditionals
(such as “All ps are qs”) with the bound variable
subscripted under the conditional sign.

https://plato.stanford.edu/entries/pm-notation/#Exam

Lets make Peano great again!

Mostowski Collapse

unread,
Jul 13, 2022, 10:08:49 AM7/13/22
to
Small addendum. In certain situations (\+ A) acts
as ¬A, but in other situations it can also act as
¬∃x1..,∃xnA for some variables x1,..,xn.

Same for forall/2, in certain situations forall(A,B)
acts as A → B, but it can also act as ∀x1..,∀xn(A →
∃y1..∃ymB). So its more complicated than only

forall quantifier, its forall quantifier implication
existential quantifier. But when is it Peano implication?
Well, for example if the second formula, i.e. B is

ground negation, if during execution, from the
bindings after A the currently invoked B is already
ground. The the result of forall/2 is not this:

∀x1..,∀xn(A → ∃y1..∃ymB)

But only this:

∀x1..,∀xn(A → B)

Mostowski Collapse

unread,
Aug 4, 2022, 8:58:17 PM8/4/22
to
Ciao Prologs “State of the Art” is rather the
night mare of “The Art of loosing State”.

?- assertz(foo).
yes

?- foo.
yes

?- repeat, fail.
{ Execution aborted }

?- foo.
{ERROR: No handle found for thrown exception error(existence_error(procedure,'user:foo'/0),'user:foo'/0)}
aborted

https://ciao-lang.org/playground/

I hope SWI-Prolog will not blindly immitate
every nonsense from Ciao Prolog.

Mostowski Collapse

unread,
Aug 4, 2022, 9:01:16 PM8/4/22
to
Workers do still synchronously process message
they receive. As a result Ciao cannot send an “abort”
control to a worker, since Ciao Prolog itself inside

the worker is not asyncified. As a result I see one
Worker going down and another Worker comming
up, when I press Abort button in Ciao, and the

dynamic database state is gone. Bye Bye.

BTW: As soon as you have asyncified your Prolog
interpreter, you don't need the single worker anymore.

Mostowski Collapse

unread,
Aug 5, 2022, 4:16:49 AM8/5/22
to
Question was, what means syncify?

It means that you turn your Prolog interpreter into an Engine
that can yield, but that you also have some auto-yielding.
So that the the browser or node.exe can process operating

system tasks while the Prolog system is running. Basically the
JavaScript async/await is an extended iterator code rewriting
of a form of yield, which yields promises. If you take this path

you would also need to extended the engine concept so that
you can voluntarily yield promises, like for example for a fetch.
In such a scenario the Prolog system might appear to block,

this is the other illusion the asyncification can create. Basically
you can create the following illusions by asyncification
without the need of a pre-emptive scheduler:

- Non-blocking parallelism between Prolog system and operating system
- Blocking wait for completion of some operating system tasks

Optionally you can also use it for multiple Prolog threads, but
I don’t see a point in doing this. So I branded this “misuse”.
But you could do this as well and it has certainly some use

cases if the multiple Prolog threads do a lot of operating
system tasks. But it is missing in the above list for the moment,
so conceptionally there are only “two” co-routines the single

threaded Prolog system and the operating system tasks event
loop provided by the browser or node.exe. In the same way its
possible to make a Python variant of such an engine.

Mostowski Collapse

unread,
Aug 5, 2022, 4:19:46 AM8/5/22
to
It was two questions already, or a different question altogether,
namely asking for WASM as well.

Disclaimer: Oh my, I invented the word “asyncify” spontanously
yesterday. But it has also some meaning in relation to WASM.
My previous portraying is from experience with CheerpJ, Tau-

Prolog and Dogelog, and only CheerpJ has WASM (the recent
version using 64-bit). Maybe for more WASM specific questions
you need to consult other source, I find for example:

https://web.dev/asyncify/

Possibly when the above community is talking about asyncification
it has a total different meaning then what I described. Attention! Attention!

Also CheerpJ comes without auto-yielding. You can add it
yourself, by calling Java Thread.yield(), it was an undocumented
feature of CheerpJ. But in CheerpJ I could not yield promises so

easily, maybe there is an exotic Java API, and then there
is a danger that CheerpJ doesn’t support it, since it is rather
tailord towards bringing some convetional Swing/Standalone

applications to the web, so this is a specific new feature of the
Dogelog engine, breaking out of a particular Java world.

Mostowski Collapse

unread,
Aug 5, 2022, 7:07:29 AM8/5/22
to

Thanks to my testing sixth sense, the first Ciao Playground issue:
https://github.com/ciao-lang/ciao_playground/issues/1

I hope its not ending like Scryer Prolog, which has a wooping
223 open tickets, tendency is not yet that the number of open
tickets goes down.

My favorite formula for such an explosion of tickets is:

The Ticket Backlog Curve
https://www.wolframalpha.com/input?i=1+-+exp%28-x%29+-+x%2F3+from+0+to+3

So an initial explosion of tickets is linearly reduced.
Where in this curve is Scryer Prolog right now?

Mostowski Collapse

unread,
Aug 5, 2022, 7:25:37 AM8/5/22
to
Many WASM projects now coming out of the closet. My expectation,
this is only a win win situation in the long run, but it might be
painful at the beginning.

For a stealth project, which wasn’t on GitHub from the beginning,
and which has some non-public tickets somewhere, its more
difficult to estimate the current standing from the outside.

For Scryer Prolog the struggle is minutely documented:

Compiling and running scryer as a WebAssembly binary?
https://github.com/mthom/scryer-prolog/issues/615

Mostowski Collapse

unread,
Aug 5, 2022, 10:56:06 AM8/5/22
to
How it started:

Somebody wrote yesterday:
"For anyone finding this project interesting, we kindly as
everyone to try and explore our system, file issue reports,
contribute, and of course star our repository :wink: .

BTW, this reminds me that it is really a pity that we do
not have a common Prolog forum to discuss, like in the old days.
Newsgroups do not work, and a “single system”

discourse group is not a solution."

How its going:

A few hours ago, when starting to make visible some
limitations, everything diverted in a blink from “hello
community” to “bilateralism”.

Somebody wrote today:
"I’m happy to have a discussion on exchanging code and
ideas between our projects. I think a telco is a better medium
for that than here. Just drop me a personal message."

Mostowski Collapse

unread,
Aug 5, 2022, 10:56:57 AM8/5/22
to
Anyway, I have an admin questions, so playground tickets
don’t go into the Ciao Playground repo but into the Ciao repo?
Historically Bilateralism does not have a good Reputation

"The first rejection of bilateralism came after the First World War
when many politicians concluded that the complex pre-war
system of bilateral treaties had made war inevitable."
https://en.wikipedia.org/wiki/Bilateralism#History

So we might see some Prolog Web API wars in the near future?
Because of some coalition formation between SWI-Prolog and
Ciao Prolog? And then them against the rest of the Prolog world?

Mostowski Collapse

unread,
Aug 5, 2022, 11:14:45 AM8/5/22
to
So for how long should we buy popcorn? How long will
this Prolog Web API wars last, months to years?

LoL

Thats actually the most astonishing und upredictable
thing here, the time scale. Can the unknown be planned?
Is a late adopter in a more advantageous position. What

if his system, like for example SWI-Prolog, is rather larger
Prolog system, organically grown for certain target systems,
and also moved away over the past from the

small ISO core standard.

Mostowski Collapse

unread,
Aug 6, 2022, 3:45:44 PM8/6/22
to
I have bad news for Ciao Prolog concerning:

Just in case it is useful, we published this paper back in
2012 about translation of Prolog to JS. We had some
libraries to interact with the DOM and JS and some
kind of JS foreign interface:
[1210.2864] Lightweight compilation of (C)LP to JavaScript
https://arxiv.org/abs/1210.2864

Its not extremly relevant, since the presented Ciao JS is not asyncified.
For example if I go to this page, I do not find that it is asyncified:

8-Queens Demo
http://cliplab.org/~jfran/ptojs/queens_ui/queens_ui.html

It doesn’t count as a prior art of an asyncified Prolog system.
asyncified Prolog systems basically started with Tau-Prolog
to some extend, they use a kind of continuation style asyncification.

The milestone was when they started demonstrating some
async task stuff a few years ago.

Mostowski Collapse

unread,
Aug 6, 2022, 3:47:15 PM8/6/22
to
But meanwhile Tau Prolog has evolved and now also
provide a modern async/await interface, similar like
Dogelog player has since a few months. So you

can now use Tau Prolog without ugly Promise chains
and with elegant async/await. At least I find
something like this now documented here:

Promises interface
http://tau-prolog.org/manual/promises-interface

But they do not 100% follow the naming convention for async
functions. I also do not 100% follow the naming convention.
In Dogelog I use async_XXX and Tau Prolog uses promiseXXX,

but according to this web article the naming convention would be XXXAsync:

JavaScript Method Naming Convention for Async Functions
https://blog.8bitzen.com/posts/13-06-2019-javascript-method-naming-convention-for-async-functions

Mostowski Collapse

unread,
Aug 7, 2022, 8:24:49 AM8/7/22
to
Maybe one can build an asyncified SWI-Prolog WASM
around eyebrow. The code currently contains
Promise chains:

fetch('https://josd.github.io/eye/eye.pl')
.then(response => response.text())
.then(data => (Module.FS.writeFile('/eye.pl', data)));
https://github.com/josd/eyebrow/blob/master/socrates.html

But in principle the SWI-Prolog WASM should have a
consult, and could intiate this fetch by itself, by suspending
with the new js_yield/2 or a variant of it. So the page is

not 100% asyncified, since the SWI-Prolog WASM itself
is not yet asyncified. BTW: There would be another style
to asyncify the above fetch, instead as an old style

How to use the Fetch API with async/await
https://rapidapi.com/guides/fetch-api-async-await

Promise chain, it could be also realized with the newer style
async/await above. Brainwriting here helps me develop the
same for Dogelog, which is asyncified but has still

some synchronous parts.

Mostowski Collapse

unread,
Aug 7, 2022, 8:26:25 AM8/7/22
to
If the eyebrow SWI-Prolog WASM were 100% asyncified,
by the new style async/await or by the old style
Promise chains, then we would not see:

var SWIPL = (() => {

But rather this here in the new style:

var SWIPL = (async() => {

But I am not 100% sure how to asyncify it. Currently it
creates a promise, but this is rather pointless, since
the .then((module) => is only called once, I suspect.

But an asyncified SWI-Prolog WASM would resume again
and again, realize a await promise loop. It has also some
custom rolled async support, like for example addRunDependency

and removeRunDependency, not sure what it is doing, in
connection with asyncLoad().

Mostowski Collapse

unread,
Aug 7, 2022, 8:32:54 AM8/7/22
to
Corr.:
var is also deprecated nowadays

let SWIPL = (async() => {

Mostowski Collapse

unread,
Aug 7, 2022, 9:51:00 AM8/7/22
to
I am just writing down what comes to my mind.
For example when I read this here:

Reverse the burden of proof
http://josd.github.io/Talks/2022/06welding/#(7)

Then I think this is a too narrow view what
Jan Wielemaker work could do. Although I have
no clue how much work it is for SWI-Prolog and
where SWI-Prolog is going. But basically:

- Yielding plus asyncify can be also used on
the server and headless mode, via nodejs, its
not restricted to the client and the browser. (Works in Dogelog so far)
https://nodejs.org/en/

- Yielding plus asyncify can be also done for
Python, and some other languages, Python
even has the new async/await as well. (Works in Dogelog so far)

- Its an age old technique, practically every operating
system has coroutine rings inside threads

- In the Java world its usually called fibers

- It is what allowed Erlang to have millions of actors

In the broader view you can use it for peer to peer
communication between servers as well, like some
blockchain confirmation counts etc…

And the peer can be even a browser client, but you
need to change the same-origin credentials I guess.

Disclaimer: Somebody from the industry could
surely talk more competently about it. Like somebody
from https://tokio.rs/ ?

Mostowski Collapse

unread,
Aug 8, 2022, 6:07:47 PM8/8/22
to

Some results of a 48 hour SWIPL WASM Hackathon?
https://dev.swi-prolog.org/wasm/shell

?- assertz(foo).
true.

?- foo.
true.

?- repeat, fail.
ERROR: Execution Aborted
?- foo.
true.

ultimately superior to some polished academic papers,
that need 3 years from inception to publication

LoL

Mostowski Collapse

unread,
Aug 8, 2022, 6:16:44 PM8/8/22
to

(Possibly also a nice display of continuous integration (CI) and
continuous deployment (CD). For example the WASM thingy.)

Mostowski Collapse

unread,
Aug 9, 2022, 6:23:32 AM8/9/22
to
When I write something I mean it dead serious, including

“The proof is in the pudding. Prove it!”.

I know that SWI-Prolog and some other Prolog systems
started in 1980’s. Which would give 40 years accumulated work.
My personal feeling about the web problem is that I am still in

my baby pampers. Although there was some quick progress,
possibly the progress will now slow down. I could like list 1’000
unresolved challenges I am facing right now. For example

the abort problem is related to the implementation of concurrent_and/2
via workers, if you want the concurrent_and/2 make gracefully
abortable itself and handing the abort gracefully to its slave

workers. etc… etc… Maybe Ciao Prolog has already a solution?
Doing a worker is not so difficult. But I got the idee fix, that it should
have many features of Prolog threads, including thread_signal/2.

Mostowski Collapse

unread,
Aug 9, 2022, 3:27:27 PM8/9/22
to
Cooperative multitasking is not for the faint-hearted.
Quickly a mountain of unsolved problems appears,
which is much easier to solve with real multi-threading.

But who knows, maybe just wait and do nothing. I am just reading,
looks pretty similar to Java bytecode and Java applets from 1995 back then:
(BTW Java applets could already do true multi threading,
but the integration with JavaScript through LiveScript was horrible):

"Its initial aim is to support compilation from C and C++,
though support for other source languages such as Rust,
.NET languages] and AssemblyScript (TypeScript-like) is
also emerging. After the MVP release, there are plans to
support multithreading and garbage collection which would
make WebAssembly a compilation target for garbage-collected
programming languages like C# (supported via Blazor),
F# (supported via Bolero with help of Blazor), Python, and
even JavaScript where the browser’s just-in-time compilation
speed is considered too slow. A number of other languages
have some support including Python, Java, Julia, and Ruby.
https://en.wikipedia.org/wiki/WebAssembly#Compilers

Which confirms Greenspuns 13. Amendment:
“Every environment morphs into a Java runtime sooner or later.”
But the new trend has possibly a more positive spin on it,
deliberating the technology both from Oracle and Microsoft?

Mostowski Collapse

unread,
Aug 9, 2022, 3:33:52 PM8/9/22
to
This never gets old, the article starts with:

“The Stop Microsoft Corp bandwaggon is gathering pace, and
Netscape Communications Corp and Sun Microsystems Inc have
pooled their resources to create JavaScript, which combines Sun’s
Java and Netscape’s LiveScript.”
- December 5, 1995
https://techmonitor.ai/technology/sun_java_netscape_livescript_married_as_javascript

Who stops whom nowadays from what by what?

Mostowski Collapse

unread,
Aug 13, 2022, 7:13:12 AM8/13/22
to
Somebody wrote, deliberatively taken out of context here:

"All good ideas of academic systems are adopted by industrial
ones, which is really awesome, but unfortunately the origin of
those ideas is often lost."

When its only about vanity, I don’t see any practical use of PEPs.
Before you can write a PEP, you have to have something working.
I am very impressed by the recent SWI-Prolog WASM Hackathon.

An alternative name for Hackathon could be Mob Programming:

Mob Programming and the Power of Flow - Woody Zuill, 2019
https://www.youtube.com/watch?v=28S4CVkYhWA

Mostowski Collapse

unread,
Aug 13, 2022, 7:41:55 AM8/13/22
to

Interestingly Woody Zuill supports my idea of ticketless development,
he says somewhere to the point of “no inventory”. I have switched in
Dogelog to ticketless development. I think Scryer Prolog and maybe other

Prolog systems suffer from a big backlog on GitHub issues. Everytime I
watch Scryer Prolog GitHub issues, their number has increased.
Probably their is only 1 Developer and 10 Advisors, creating noise.

Mostowski Collapse

unread,
Aug 13, 2022, 8:19:23 AM8/13/22
to
Where is Scryer Prolog on this curve now?

Ticket Explosion and Reduction over Time
https://www.wolframalpha.com/input?i=1+-+exp%28-x%29+-+x%2F3+from+0+to+3

I see 54 Open Tickets by UWN, thats around 25% of the Tickets
I see 51 Open Tickets by triska, thats also around 25% of the Tickets

Should rename Scryer Prolog to Troll Prolog. I had contact
with a Logician recently trying to port fCube by Ferrari, Fiorentini
and Fiorino to Scryer Prolog. But Scryer Prolog crashed,

exact same code worked in Dogelog. I then adviced the Logician
to make Ticket. He refused to do so, he told me that he rather not
use Scryer Prolog for the moment. Its not me who thinks these

Tickets and the behaviour of some People is repellant.

Mostowski Collapse

unread,
Aug 13, 2022, 10:20:40 AM8/13/22
to
Now I have blocked Ulrich Neumerkel and Markus Triska.
My original plan was to not block any people anymore
on GitHub. But they are full of nonsense.

Here is an example of some gibberisch:

> More properties are preserved in application code, the easier it is to
reason about the code, also via automated reasoning. [...] Using (==)/2
prevents such optimization, and (=)/2.
https://github.com/mthom/scryer-prolog/pull/468#issuecomment-625388237

Here is my response to the uninformed pestillence:

Why would it prevent such optimizations?
For example if you index on the main functor you can apply the
same indexing for (==)/2 and (=)/2, thats implemented in Jekejeke Prolog.

See for yourself:
http://pages.xlog.ch/srctab/doclet/docs/05_run/common/jekpro/model/rope/IndexFront.html

Its not a code transformation indexing, but indexing is possible.

Mostowski Collapse

unread,
Aug 13, 2022, 10:30:21 AM8/13/22
to
Non-code transformation body guard indexing isn't any
secret. Is was for example documented here:

Demand-Driven Indexing of Prolog Clauses
Vıtor Santos Costa, Konstantinos Sagonas, and Ricardo Lopes
http://user.it.uu.se/~kostis/Papers/iclp07.pdf

SWI-Prolog made it also wrong, it now has a code
transformation for (=)/2 indexing:

?- [user].
p(X) :- X=a.

?- listing(p/1).
p(a).

Thats just nonsense as well. Does this say it cannot
index (==)/2, functor/3, etc..?

LoL

Mostowski Collapse

unread,
Aug 13, 2022, 10:46:49 AM8/13/22
to
Maybe in SWI-Prolog it makes sense, since their
JIT indexes might also move down and not only
move right, when they make it multi argument index,

not sure what would be the cost do adopt ICLP07
approach. The ICLP07 paper talks also about some
multi-argument indexing. Maybe every (new) Prolog

system should list the paper it was using while
implementing its Prolog system. For example Ichiban
does that. I find, when I scroll down:

A PORTABLE PROLOG COMPILER (Bowen et al. 83)
[...]
https://github.com/ichiban/prolog#acknowledgments

I also try to give references, best is even to put references
in the source code. What are the references for Scryer
Prolog? Some nonsense word of mouth by two idiots?

Mostowski Collapse

unread,
Aug 18, 2022, 10:16:49 AM8/18/22
to
Ok, Scryer Prolog, you got list_to_set/2. Woa!
Was ticking along with this O(n^2) version:

/* Folklore Solution */
list_to_set(L, R) :-
sys_list_to_set(L, [], R).

sys_list_to_set([], _, []).
sys_list_to_set([X|L], R, H) :-
memberchk(X, R), !,
sys_list_to_set(L, R, H).
sys_list_to_set([X|L], R, [X|H]) :-
sys_list_to_set(L, [X|R], H).

Then I found nevertheless in Scryer Prolog this one:

/* Scryer Prolog Solution */
list_to_set(Ls0, Ls) :-
maplist(lists:with_var, Ls0, LVs0),
keysort(LVs0, LVs),
same_elements(LVs),
pick_firsts(LVs0, Ls).

Is the above faster than the SWI-Prolog version,
which does two sorts?

Mostowski Collapse

unread,
Aug 18, 2022, 10:17:41 AM8/18/22
to
BTW: Theoretical Computer Science tells me that a hash table with an
input order overlay wouldn’t be so bad, basically O(n), faster than O(n*log(n)).
I had this in Jekejeke Prolog for ages, still have it, it works like that:

/* Jekejeke Prolog Solution */
?- sort([2,1,3,1], X).
X = [1, 2, 3]
?- sort([2,1,3,1], X, [type(hash)]).
X = [2, 1, 3]

The hash table with an input order overlay is the age old Java:
https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashMap.html
The O(n) complexity assumes amortized complexity O(1) of a hash table lookup.

Right? Yes or no?

Mostowski Collapse

unread,
Aug 18, 2022, 6:13:37 PM8/18/22
to
This is the more fun solution:

/* Folklore Solution */
list_to_set([], R) :- append(R, [], _), !.
list_to_set([X|L], R) :- member(X, R), !,
list_to_set(L, R).

Only for mode (+,-).
It is loading more messages.
0 new messages