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

OT: Distance Learning Prolog

211 views
Skip to first unread message

Mostowski Collapse

unread,
Mar 13, 2020, 11:48:04 AM3/13/20
to
From monday most countries in Europe will have
school lockdown because of coronavirus crisis.

What are the newest Prolog offerings?

Supertramp - Crime Of The Century - School
https://www.youtube.com/watch?v=mYP7RpZqAs8

Mostowski Collapse

unread,
Mar 13, 2020, 11:58:55 AM3/13/20
to
For example if your university is affected,
what is your university doing?

Mostowski Collapse

unread,
Mar 17, 2020, 8:18:08 AM3/17/20
to
Zoom trending on twitter:

"I never get asked about how to use Zoom -
people just get accounts and I never hear
from them again, all I see is the usage on
the dashboard go up continuously."
https://zoom.us/de-de/gartner.html

LoL

But the above link shows some other players as well.

Mostowski Collapse

unread,
Mar 17, 2020, 8:36:31 AM3/17/20
to

donate one tree
climate friendly distant learning:

Introducing SAP Live Class
https://www.youtube.com/watch?v=pdwpGdNfNKE

LoL

Mostowski Collapse

unread,
Mar 23, 2020, 8:00:19 PM3/23/20
to

R Kym Horsell

unread,
Mar 23, 2020, 8:56:49 PM3/23/20
to
Mostowski Collapse <burs...@gmail.com> wrote:
> New!
>
> The COVID-19 High Performance Computing Consortium
> https://www.zdnet.de/88378098/kampf-gegen-die-pandemie-usa-gruenden-covid-19-high-performance-computing-consortium/

A lot of people are working on things.

I got an email from kaggle a few days back about a data mining project
started by the Whitehouse.

They have 2 GB of text from all the papers on covid19 and a list
of questions they want answered. You're meant to use NLP and AI
techniques to mine the papers and get robust answers.
Some of the questions are very complex; some are simple and could
be done using standard epidemiology technique rather than AI.

The time pressure is immmense. Some questions that want answers
to within 2 wks.

Hard to write an AI program to examine 1000s of technical papers
to get a robust answer to "Is there evidence for more than one
strain of SARS-Cov-2"?

They are paying $US1000 per answer but it will cost you 10x more
to just do the programming. ;)

There are other projects on the virus also running at kaggle
and some are more interesting than the big "featured" Whitehouse one.

I got a bit diverted (as usual) into an AI project trying to
develop techniques to learn to solve abstract problems
from only 3 example. "Real AI" I think they were calling it. :)

> Am Dienstag, 17. M"arz 2020 13:36:31 UTC+1 schrieb Mostowski Collapse:
>> donate one tree
>> climate friendly distant learning:
>>
>> Introducing SAP Live Class
>> https://www.youtube.com/watch?v=pdwpGdNfNKE
>>
>> LoL
>>
>> Am Dienstag, 17. M"arz 2020 13:18:08 UTC+1 schrieb Mostowski Collapse:
>> > Zoom trending on twitter:
>> >
>> > "I never get asked about how to use Zoom -
>> > people just get accounts and I never hear
>> > from them again, all I see is the usage on
>> > the dashboard go up continuously."
>> > https://zoom.us/de-de/gartner.html
>> >
>> > LoL
>> >
>> > But the above link shows some other players as well.
>> >
>> > Am Freitag, 13. M"arz 2020 16:58:55 UTC+1 schrieb Mostowski Collapse:
>> > > For example if your university is affected,
>> > > what is your university doing?
>> > >
>> > > Am Freitag, 13. M"arz 2020 16:48:04 UTC+1 schrieb Mostowski Collapse:
>> > > > From monday most countries in Europe will have
>> > > > school lockdown because of coronavirus crisis.
>> > > >
>> > > > What are the newest Prolog offerings?
>> > > >
>> > > > Supertramp - Crime Of The Century - School
>> > > > https://www.youtube.com/watch?v=mYP7RpZqAs8
>

--
Pocket Guide to Handling Political Harassment & Legal Intimidation
<http://climatesciencedefensefund.org/>

1. Take a deep breath & remember other scientists have gone through this before
2. Call a lawyer if in doubt
3. Understand whether state and/and federal open records laws may apply to you
4. Separate personal and professional emails
5. Remember that emails are not always private
6. Understand record-keeping requirements
7. Exercise discretion when talking to a journalist
8. If you receive harassing messages, do not respond and do not delete
9. If you receive threatening messages, contact your employer / law enforcement
10. For more information on particular legal situations, check out our new
Pocket Guide to Handling Political Harassment & Legal Intimidation

-- Lauren Kurtz, Realclimate.org, 10 Dec 2016

Mostowski Collapse

unread,
Mar 24, 2020, 2:21:13 PM3/24/20
to
You might also like (de novo design):

Small Organic Molecules Day
https://www.youtube.com/watch?v=yJcg-Ox7kKY

Mostowski Collapse

unread,
Mar 31, 2020, 5:54:57 PM3/31/20
to
A friend of mine wasn't impressed by Covid-19.
He said wait for Covid-20, Covid-21, etc..

which will be even much more worse.

What if we also evolve? Can we evolve the
Web of Tim Berners-Lee one step further?

Co-Immunology and the Web
https://medium.com/@bblfish/co-immunology-and-the-web-43379b46688e

Mostowski Collapse

unread,
Apr 1, 2020, 6:50:42 PM4/1/20
to
I wanted to post a list of FOSS software
for our times, but still working on it.

Meanwhile: Who led the digital
transformation in your company?

a) CEO

b) CTO

c) COVID-19

So how will mid-caps exit this crisis?

Mostowski Collapse

unread,
Apr 10, 2020, 5:27:00 PM4/10/20
to
Homeoffice aint so easy everywhere:

Wall Street Calls Traders Back to Office
7. April 2020, 11:00 MESZ
https://www.bloomberg.com/news/articles/2020-04-07/greed-and-fear-collide-wall-street-calls-traders-back-to-office

Mostowski Collapse

unread,
Apr 11, 2020, 2:52:57 PM4/11/20
to
There are some new videos about Picat:

Video-1: Motivating examples: scanning and parsing
Video-2: Picat's REPL environment, data types, operators, and basic built-ins
Video-3: Recursion on numbers
Video-4: Recursion on lists and binary trees
Video-5: Constraint solving

https://www.youtube.com/channel/UCE_jlvOzd8I2XAj3yo7eN9A

Mostowski Collapse

unread,
Apr 24, 2020, 7:08:08 PM4/24/20
to

Episode 1 - an interview with Robert Kowalski is out!

#1 - The Poet of Logic Programming
https://thesearch.space/episodes/1-the-poet-of-logic-programming

Mostowski Collapse

unread,
Apr 24, 2020, 7:31:56 PM4/24/20
to
Logische Programmierung - Elektronisches Schulbuch
https://www.inf-schule.de/deklarativ/logischeprogrammierung

Mostowski Collapse

unread,
Apr 26, 2020, 7:31:47 PM4/26/20
to

DecisionCAMP-2020

The first-ever DecisionCAMP LIVE is going
digital and will be Free and completely
Online! You can attend it from the comfort
of wherever you’re working. You’ll have
access to actionable insights delivered
by Business Rules and Decision Management
experts during in-depth technical sessions.
Take a deeper look and register now to
secure your spot today.

https://decisioncamp2020.home.blog/

Mostowski Collapse

unread,
Apr 29, 2020, 9:11:26 AM4/29/20
to
Good old Prolog teaching slides:

Prolog 2008–09
Principal lecturer: Dr David Eyers
https://www.cl.cam.ac.uk/teaching/0809/Prolog/

C
You shoot yourself in the foot.

C++
You accidentally create a dozen instances
of yourself and shoot them all in the foot.
Providing emergency medical care is impossible
since you can't tell which are bitwise copies
and which are just pointing at others and saying,
"That's me over there."

Prolog
You explain in your program that you want to
be shot in the foot. The interpreter figures
out all the possible ways to do it, but then
backtracks completely, instead destroying the gun.

LoL

Mostowski Collapse

unread,
May 1, 2020, 9:43:46 AM5/1/20
to
Andrej Bauer has announce a "series of
seminars titled 'Every proof assistant'
that would be devoted to all the
different proof assistants out there."

http://math.andrej.com/2020/04/28/every-theorem-prover/

Simon Forman

unread,
May 1, 2020, 12:22:50 PM5/1/20
to
Oh cool! Cheers!

Mostowski Collapse

unread,
May 1, 2020, 5:23:24 PM5/1/20
to
First video, but did not yet have
to watch it in full:

Valery Isaev: Arend proof assistant
https://vimeo.com/413726748

Some background:
"The 20th century saw the development of ZFC
set theory, which today is the standard foundation
of mathematics."

"HoTT is an alternative foundation that is based
on integrating concepts from topology into a
typed logic which avoids the need for ZFC set
theory and its troublesome axioms."

The Arend proof assistant tries to do
something with HoTT: "Arend implements a version of
homotopy type theory with an interval type, which
syntax is similar to cubical type theory."

Mostowski Collapse

unread,
May 12, 2020, 2:30:00 PM5/12/20
to
Is this a Corona induced trend? A couple
of ISPs (Internet Service Providers) are
now going Hyperconverged.

Appliances are for example Nutanix. Promis
more scalability, less management, less
cost. Looks like a software

based RAID solution, where everything
is in one box, and you just pile boxes
over boxes. See also:

How Nutanix Works (deutsch)
https://www.youtube.com/watch?v=XHJKNtwVLN4

Mostowski Collapse

unread,
May 12, 2020, 2:44:56 PM5/12/20
to
(*) Yes, its Corona induced. If all else fails the
simplest home office solution is a virtual desktop,
which puts a lot of pressure on traditional ISP.

See also:
nachgehakt: Was sind eigentlich hyperkonvergente Server?
https://www.youtube.com/watch?v=k73qT-1SZ8E

Mostowski Collapse

unread,
May 25, 2020, 3:56:13 PM5/25/20
to
Google translate gives me:

"Kiku-Hana" ist
ein KI-Chatbot-Dienst von Dentsu. Durch die
Übernahme der logischen Programmiersprache
AZ-Prolog, die für die Analyse, das Verständnis
und das Denken in natürlicher Sprache optimal
ist, und durch die Analyse der "Bedeutung des
Japanischen", die bisher als schwierig angesehen
wurde, werden menschliche Konversationen und
Informationen von den Benutzern benötigt Es
ist möglich zu liefern.

https://robotstart.info/2020/05/19/heart-conditioner-top.html

Mostowski Collapse

unread,
May 29, 2020, 6:57:11 PM5/29/20
to
The world is running out of IPv4 addresses.
Lets go IPv6. We might even see IPv6 only devices:

https://stadt-bremerhaven.de/deutsche-telekom-neuer-ipv6-only-zugang-zum-mobilen-internet/

Mostowski Collapse

unread,
May 29, 2020, 7:10:53 PM5/29/20
to
On Prolog side, I guess its time to enhance the
module library(system/uri) and maybe also have a
look at the module library(system/domain).

What concerns URIs, it would be bliss to also
have support for example http://[ipv6 adr]:8080/ .
The square brackets are needed, so that

the colons inside the ipv6 adr are not confused
with the colon that separates the port. What
will else be needed? I dunno yet.

Java supports dual stack in its sockets,
and didn't have problems to use OpenJDK and
tomcat on ubuntu as a server that can serve

ipv6. But maybe here and then will need some
smarts in calling the Java API or design of
a web site. Dunno yet. Also I don't have yet

really a good ipv6 test environment,
need a new ISP and router.

Mostowski Collapse

unread,
May 29, 2020, 7:30:24 PM5/29/20
to
Simple connectivity testing can be done via:

You as a client:
https://ipv6-test.com/

The web server you are accessing:
https://ipv6-test.com/validate.php

Mostowski Collapse

unread,
Jun 16, 2020, 7:15:21 PM6/16/20
to
Woa heavy development in Scryer and Tau.
Due to Corona? Was only looking at the

issue lists here and here:

Scryer Prolog
https://github.com/mthom/scryer-prolog

Tau Prolog
https://github.com/tau-prolog/tau-prolog

Maybe we come out of another lockdown,
the Logtalk Transpiler include/1 Brainwash
lockdown, and the SWI-Prolog is the

only Community lockdown.

LoL

Mostowski Collapse

unread,
Jun 16, 2020, 7:25:01 PM6/16/20
to
These projects invest indefinite number of
hours and hours programming. Often only by
a few people.

Something I learnt from Logtalk website.
You can go to https://www.openhub.net/ ,
register your GitHub project,

and it will do a COCOMO cost estimate.

Mostowski Collapse

unread,
Jun 25, 2020, 4:31:41 PM6/25/20
to
Is it a must/1 or a once/1 ?

LogicMoo made a video recently (08.06.2020)
https://www.youtube.com/watch?v=Sy32UXCV7dE

Mostowski Collapse

unread,
Jun 25, 2020, 4:45:45 PM6/25/20
to
For upcoming locking I just complete LogicMoos
redo_call_cleanup/3. Current name is try_call_finally/3,
but maybe I should adopt LogicMoos name?

But the problem is that redo_call_cleanup/3 cannot
be shortened to call_cleanup/2, whereas try_call_finally/3
can be shortened to call_finally/2.

Here is what setup_call_cleanup/3 does:

?- setup_call_cleanup((write(hello), nl),
member(X,[1,2,3]), (write(goodbye),nl)).
hello
X = 1 ;
X = 2 ;
goodbye
X = 3

And here is what try_call_finally/3 does:

?- try_call_finally((write(hello), nl),
member(X,[1,2,3]), (write(goodbye),nl)).
hello
goodbye
X = 1 ;
hello
goodbye
X = 2 ;
hello
goodbye
X = 3

I first though implementing it with setup_call_catcher_cleanup/3.
But this leads to nowhere, the cleanup is not called enough.
So thats also why I call it finally.

After setup_call_catcher_cleanup/3 was rejected, I made
a small prototype with pivots which did work. But later a
more simpler solution came up.

Mostowski Collapse

unread,
Jun 25, 2020, 4:51:38 PM6/25/20
to
The more simpler solution has a new lower level
API. The old lower level API only consists of:

Add a cleanup choice point
% sys_cleanup(+Goal)

The new lower level API adds the following two
new builtins to the the module library(advanced/signal):

Add a cleanup choice point and return a handle to it
% sys_sys_cleanup_catcher(+Goal, -Catcher)

Enable or disable the choice point by the given handle
% sys_catcher_enable(+Catcher, +Boolean)

Why this effort. Well we want a try_call_finally/3
that is as robost as setup_call_cleanup/3 and that can
also correctly react to interrupts etc..

So this is the source of setup_call_cleanup/3:

setup_call_cleanup(A, G, C) :-
sys_mask((once(A), sys_cleanup(C))),
current_prolog_flag(sys_choices, X),
G,
current_prolog_flag(sys_choices, Y),
(X == Y, !; true).

And try_call_finally/3 is a slight variation using the new API:

try_call_finally(A, G, C) :-
sys_mask((once(A), sys_cleanup_catcher(C, P))),
current_prolog_flag(sys_choices, X),
G,
current_prolog_flag(sys_choices, Y),
(X == Y, !;
sys_mask((sys_catcher_enable(P, false), must(C)));
sys_mask((once(A), sys_catcher_enable(P, true))) -> fail;
!, fail).

The try part is allowed to fail, and can control
whether a redo is performed or not. Also we make
use of a new must/1, which is a once/1 that

throws an error if the goal fails.

Mostowski Collapse

unread,
Jun 25, 2020, 5:04:04 PM6/25/20
to
But not yet sure whether final words have
been spoken. The goal is to find something
that mimics this Java idiom:

lock_lock();
try {
/* critical region, deterministic */
} finally {
lock_unlock();
}

And give it some extra non-determinism. So we
could the do the folllowing:

try_call_finally(
lock_lock,
/* critical region, non-deterministic */,
lock_unlock)

This is basically then an iterator, or a Tarau Engine,
which has automatically lock_lock/lock_unlock around
its next method.

R Kym Horsell

unread,
Jun 25, 2020, 5:17:11 PM6/25/20
to
Mostowski Collapse <burs...@gmail.com> wrote:
> But not yet sure whether final words have
> been spoken. The goal is to find something
> that mimics this Java idiom:
>
> lock_lock();
> try {
> /* critical region, deterministic */
> } finally {
> lock_unlock();
> }
>
> And give it some extra non-determinism. So we
> could the do the folllowing:
>
> try_call_finally(
> lock_lock,
> /* critical region, non-deterministic */,
> lock_unlock)
>
> This is basically then an iterator, or a Tarau Engine,
> which has automatically lock_lock/lock_unlock around
> its next method.
...

Of course there is the concept of non-lock continual progress (no-wait).

Many years ago Maurice Herlihy wrote some seminal papers on the idea.
Not looked at it but maybe Prolog can better be framed in that way
rather than the old "grand mall lock/unlock" paradigm.

One idea is to do some action then re-test it has happened.
Another is the idea of using very basic atomic operations.
Herlihy was interested in pointer moving -- i.e. a "write"
on a normal computer architecture is indivisible.
In Prolog a variable unification might be usable in the same way
with the additional wrinkle they get wiped on backtracking.

Mostowski Collapse

unread,
Jun 25, 2020, 6:37:31 PM6/25/20
to
A lock is not a global lock. A lock here,
like in Java, can be very fine grained.

I don't see any problems using locks. Todays
CPUs have many cores and pre-emptive threads
means true parallelism on the METAL. You don't

get this with coroutines. I don't know why
people don't understand this. if you then
program something embarassingly parallel,

where critical regions are anyway mutual
exclusive, you get more or less number of
cores speed up, provided your memory caching

doesn't kill it. You should try it.

Mostowski Collapse

unread,
Jun 25, 2020, 6:43:06 PM6/25/20
to
Possibly you would anyway program the
embarassingly parallel part with thread
local state, where Prolog is very good.

It then can be that you need a lock to
distribute work and collect results, this
lock is then less fine grained. We did

some testing with prime numbers in the
past. You find it on SO. You need to make
the work not too small, otherwise you

get indeed a locking overhead. See also:

Parallel Primes in Prolog?
https://stackoverflow.com/a/57060301/502187

Mostowski Collapse

unread,
Jun 25, 2020, 7:08:39 PM6/25/20
to
Was testing with JDK 13, which has also
thread local Java garbage collection.
Not 100% sure, but there are some new

garbage collectors that keep garbage
affine to threads, improving speed.
See also this paper for example:

"This paper discusses thread-local garbage
collection (GC), a technique of automatic
memory management aimed at improving GC
throughput and reducing GC pauses in
managed runtimes. It exploits the observation
that most objects do not escape the scope
of the thread allocated them;"
https://link.springer.com/article/10.1134/S0361768819010043

I didn't read it, but just to have
some authorative reference that such
things now exist.

I don't know about the state of the
Art for Rust, C++, etc..

R Kym Horsell

unread,
Jun 25, 2020, 7:23:48 PM6/25/20
to
Mostowski Collapse <burs...@gmail.com> wrote:
> A lock is not a global lock. A lock here,
> like in Java, can be very fine grained.
> I don't see any problems using locks.

You sometimes have to wait for it.
In a multi-cpu context losing a cycles now and then
can flatten utilization. There's some law that shows
losses can be dis-proportionate to number of waiting
synchronizations needed.

Hence the idea from M.H. and others to "always make progress".

I.e. instead of (for instance)

LOCKANDMAYBEWAIT
increment counter
UNLOCK

==>
take copy of counter
increment counter
swing point to new counter location
check it the counter is still the value we thought we set it to
if not, repeat

When contention is low there is almost zero overhead
when contention is high there is no waiting

>Todays
> CPUs have many cores and pre-emptive threads
> means true parallelism on the METAL. You don't
>...

Mostowski Collapse

unread,
Jun 25, 2020, 9:07:52 PM6/25/20
to
Do you mean:

public int next() {
AtomicInteger atomic = counter;
int oldcount;
do {
oldcount = atomic.get();
} while (!atomic.compareAndSet(oldcount, oldcount + 1));
return oldcount;
}

http://www.jekejeke.ch/idatab/doclet/blog/en/docs/05_run/05_frequent/basic/Counter.html

Mostowski Collapse

unread,
Jun 25, 2020, 9:23:54 PM6/25/20
to
But best realized with hardware support:

https://en.wikipedia.org/wiki/Compare-and-swap

But try_call_finally/2 does not address
the locking primitives. A lock can also in
a first step do a CAS and so on,

the Java ReentrantLock uses CAS. These are
just the lock primitives, lock() and unlock(),
and maybe more. Thats just encapsulated somewhere.

The question is more right now, with try_call_finally/2
how can a Prolog system realize this construct
found in Java:

/* call port=lock() */
sychronized (lock) {
/* deterministic code */
}
/* exit port=unlock() */


What I would like to have is a Prolog-ish version,
which also supports redo and fail:

/* call port=lock(), fail port=unlock() */
sychronized (lock) {
/* non-deterministic code */
}
/* exit port=unlock(), redo port=lock() */

Mostowski Collapse

unread,
Jun 25, 2020, 9:35:25 PM6/25/20
to
Javas compilation of synchronization block
has some similarity to setup_call_cleanup/3.
Namely there are also pathways for exceptions:

0: aload_0
1: dup
2: astore_1
3: monitorenter
4: aload_1
5: monitorexit
6: goto 14
9: astore_2
10: aload_1
11: monitorexit
12: aload_2
13: athrow
14: return

The monitorenter and monitorexit are the primitive
lock and unlock operations on the intrinsic locks
of the intrinsic monitors for every object in Java.

An option would be to use Unsafe.monitorEnter()
and Unsafe.monitorExit(). Unfortunately this option
ceases to exist in JDK 13. So I guess I will just

synchronize a Tarau Engine at the next() and cut()
method. And not use try_call_finally/3. The try_call_finally/3
is for all other locks, that expose lock() and unlock().

The Tarau Engine approach will be not that expensive.
Its just a call/1 with synchronized in it. Although
call/1 is practically a no-op, whereas for the

new sychronized we will need a choice point and
little Java stack. If JDK 13 does not offer monitorEnter()
and monitorExit() anymore, then we are forced to use the

Java stack. This will probably be the faith of
the intrinsic monitor locks. For the other locks
and using try_call_finally/3, we can use the Prolog

stack, no Java stack needed. Lets see...

R Kym Horsell

unread,
Jun 25, 2020, 9:37:45 PM6/25/20
to
Mostowski Collapse <burs...@gmail.com> wrote:
> Do you mean:
>
> public int next() {
> AtomicInteger atomic = counter;
> int oldcount;
> do {
> oldcount = atomic.get();
> } while (!atomic.compareAndSet(oldcount, oldcount + 1));
> return oldcount;
> }

Almost but not quite.

Pointer shifting is what I mentioned.
It doesnt atomic primitives other than "memory write".

//global
const int count0 = 0;
int* countp = (int*)&count0;

// for each thread [N]
{
int countvN = -999; //i.e. thread-local "count value" cell

// increment a shared counter the Herlihy way
do {
countvN = *countp + 1; // increment counter via global pointer
countp = &countvN; // shift the global pointer to my new local value
} while (*countp != countvN); // repeat until the update sticks -- i.e.
// no other thread got in there
// while thread N was doing the increment
}

This only increments a shared counter with N threads. Doing operations
on other shared structures might have some neat simplifications
using pointer shifting and other ideas e.g. Andrews' "passing the flag" &ct.

The advantages of no-wait/no-lock in the low machine-level case --
no waiting, no wait queue, no context switching overhead, no need
for any special atomic instructions.

But at the Prolog level an analogous set of ideas might have a cleaner
logical reading than locksomelock...dosomething...unlockhopefullythesamelock.
At one point the 2nd syllable of the name was more important than the first. :)

There are also other technique for synchronizing threads that
each may or may not underneath use the M.H. ideas and may or may not
be "more logical".

E.g. barriers (a bit messy -- like gotos :)
or critical regions (avoid the biz of mis-matching start and end code)
or assuming there is only one "big lock" like the Edison parallel
language (maybe has died -- there was a double issue on it
in Software Practice and Experience about 30 years back :)
with it's "if/while/when" constructs.

And probably many many many more I havent read about.
I havent been on any university grounds for 10 years and
not in a university library for 20y or whenever they started to
cancel subscriptions to journals.


> http://www.jekejeke.ch/idatab/doclet/blog/en/docs/05_run/05_frequent/basic/Counter.html
>...

R Kym Horsell

unread,
Jun 25, 2020, 9:43:00 PM6/25/20
to
Oops. This (obviously!) wont work.
Has to be
} while (countp != &countvN) //make sure global pointer
// indicates MY value and not
// some other thread

> }
>...

Mostowski Collapse

unread,
Jun 26, 2020, 3:31:33 AM6/26/20
to
What if some of the thread dies,
and the countp then points to a dealocated
memory section.

Doesn't look a very secure replacement
for a CAS instruction. But I guess the
official name for what you try

to do is a thread winning mechanism.

R Kym Horsell

unread,
Jun 26, 2020, 4:07:54 AM6/26/20
to
Mostowski Collapse <burs...@gmail.com> wrote:
> What if some of the thread dies,
> and the countp then points to a dealocated
> memory section.
>
...


I'll just assume you're joking.

Mostowski Collapse

unread,
Jun 26, 2020, 5:50:15 AM6/26/20
to
Nope, thats standard. The thread might also not
die, but repurposed. For example in a web server
you got a worker pool. And each worker might

continually change the work that it is doing,
put back into the pool, and then taken from
the pool for another task.

But your code is unsafe in this respect:

//global
int* countp = (int*)&count0;

// for each thread [N]
int countvN = -999; //i.e. thread-local "count value" cell

countp = &countvN; // shift the global pointer to my new local value

At least it would require that a worker
has the union of all thread local state of
all possible worker tasks.

Not very useful. Also when I mentioned
thread local, I didn't mean thread local state
that can be nevertheless referenced

from the outside. Thats not really thread
local state that could profit from embarassingly
parallelism. You are refering a thread local

cell, making it not anymore properly thread local.
But for example in Prolog a predictae:

/* available in XSB, SWI, Jekejeke, etc..?
called thread private in XSB, which makes it
possibly more apparent that it is protected */
:- thread_local queue/1.

Its facts cannot be referenced from outside of
a thread. There is no way that a thread
A can assert/retract queue/1 from thread B,

thread local in context of Prolog means also
protected. Further thread local and protected
data structures in Prolog are:

- choice points
- variable bindings
- call frames

Thats why Prolog is rather safe concerning
multi-threaded programming. Its not possible
to make the dirty things like C. MAybe the

situation would be different in Rust, but
I am not sure. Prolog is far more safer than
any other language concerning thread safety.

Mostowski Collapse

unread,
Jun 26, 2020, 6:05:51 AM6/26/20
to
The problem is that there are no good tutorials
about multi-threading in Prolog. Prolog is
an excelent language for multi-threading,

and there are also excelent implementations around.
But there is a lot of confusion around. People
tend to not identify Prolog with multi-threading

and fall for Erlang or Haskell, which are admitedly
also quite safe languages. But it is often overlooked
that Prolog is also a safe language.

SWI-Prolog didn't improve the situation, since
it tried to pitch their web server and their pengines.
So there are some tutorialas by AnniePoo about

who knows what generating web pages and accessing
a pengine. But still after such a tutorial nobody
knows how locking is done on web server. But web

servers are typical candidates for a variety of
locking techniques beyond a simple mutex, whereas
clever programming can considerably improve the

performance of a web server and at the same time
providing the required concurrent business logic.
Even as of now SWI-Prolog, in discussion from last

week on discourse, is discovering condition variables
for the first time only now. There are even no built-ins
API yet for a variety of industry standard multi-threading

primitives. Same with other Prolog systems, they lack
the typical industry standard set of multi-threading
primitives concerning locking. I wonder whether Tau Prolog

could do some lock library in the browser. It looks that
JavaScript has mixed it lockes with futures dunno what.
But this will also have locks under the hood,

futures are just locks in disguise. Should have
a look into what is called Web Locks. I am also not
yet sure whether CheerpJ fills the gap.

Web Locks API
This is an experimental technology
https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_API

Will conduct some CheerpJ tests, with my new
library(experiment/monitor), which should provide
intrinsic locks. But was already happy in the

past that the thread tabs did work in the GUI,
and that some threads could work in parallel
in the browser. That was already a milestone in 2019.

Mostowski Collapse

unread,
Jun 26, 2020, 6:13:52 AM6/26/20
to
Locks are not always about that one thread
wins. For example in a read-write lock the
read part might have multiple threads
winning at the same time. The better view

of the "general lock" is the semaphore,
which has a certain set of tickets,
to give away. From this you can derive
binary locks and read-write locks etc...

R Kym Horsell

unread,
Jun 26, 2020, 6:16:39 AM6/26/20
to
Mostowski Collapse <burs...@gmail.com> wrote:
> Nope, thats standard. The thread might also not
> die, but repurposed. For example in a web server
> you got a worker pool. And each worker might
>
> continually change the work that it is doing,
> put back into the pool, and then taken from
> the pool for another task.
>
> But your code is unsafe in this respect:
>
> //global
> int* countp = (int*)&count0;
>
> // for each thread [N]
> int countvN = -999; //i.e. thread-local "count value" cell
>
> countp = &countvN; // shift the global pointer to my new local value
>
> At least it would require that a worker
> has the union of all thread local state of
> all possible worker tasks.
...

A valid "criticism" would be how to manage pointers in
a language that doesnt have them.

Equally trivial to resolve.

If you think it's impossibe for you to implement what I indicated in
a threading enviro (I'm used to pthreads where the sample code is stunningly
close :) then so be it. You are stuck with what you know and can't proceed
any further.

Mostowski Collapse

unread,
Jun 26, 2020, 6:30:06 AM6/26/20
to
You don't like critique, don't you.

LoL

Mostowski Collapse

unread,
Jul 19, 2020, 2:24:08 PM7/19/20
to
Its happening, corona disaster baby boom is real:

The SonntagsBlick newspaper has uncovered a
surge in pregnancy tests in Switzerland this spring.
https://twitter.com/swissinfo_en/status/1284832486808264704

LoL

Mostowski Collapse

unread,
Aug 3, 2020, 4:42:18 AM8/3/20
to
Check this out:

Introduction to Artificial Intelligence
Autoren: Ertel, Wolfgang - 2017
https://www.springer.com/de/book/9783319584867

From a first glimps more logic and Prolog in it.

Mostowski Collapse

unread,
Aug 3, 2020, 5:02:11 AM8/3/20
to

Mostowski Collapse

unread,
Aug 24, 2020, 6:40:12 PM8/24/20
to
!!!! This is a post for all teachers out there !!!!
ISO glossary is a little suble. It has also an entry:

3.133 predication : A predicate with arity N
and a sequence of N arguments .

Since control constructs such as (’,’)/2, etc… are
also predicates in Prolog, the above, i.e. the
notion predication, is not a prime formula, and
this here is correct:

3.81 goal : A predication which is to be executed
(see body , query , and 7.7.3).`

This differs considerable from the first order logic
vocabulary, where logical connectives such as
conjunction (∧) are not considered predicates and
are therefore not part of the language signature.
This ISO core standard specific language, has to
do with the homoiconicity of Prolog. Basically we
can freely switch between terms, with for example
(’,’)/2 as functor and goals which have the same
functor. Here is an example what can be done in Prolog:

?- expand_goal(H, G), G.

The later is not available in first order logic,
since first order logic doesn’t allow this kind
of “meta-programming”. There was an attempt by
John W. Lloyd to create a different language, Prolog
inspired language, which would also handle “meta-
programming” a different way. The language was:

Gödel’s meta-logical facilities provide support
for meta-programs that do analysis, transformation,
compilation, verification, and debugging, among other tasks.
https://en.wikipedia.org/wiki/G%C3%B6del_(programming_language)

The ISO core standard should be seen in this context,
that it reflects the very specific capabilities of
Prolog concerning “meta-programming”, which is remote
from first order logic. This means the terminology in
the ISO core standard belongs to an artificial
vocabulary, respectively constructed terminology,
especially created for Prolog and the ISO core standard.

Mostowski Collapse

unread,
Aug 24, 2020, 6:46:39 PM8/24/20
to

Its not a language that is found elsewhere in
computer science, mathematical logic or the
real world. In as far there is nothing to
correct or tweak, since it is a terminology
created for the purpose of the ISO core standard,
and every ammendment with respect to some use
elsewhere in computer science, mathematical
logic or the real world is simply baseless.

A similar constructed terminology emerged
for the DCG draft standard, the many years
people were working on it, up to the point
that the beloved “push back” was replaced by
“semi context”. :frowning: :slight_smile:
Since Ulrich Neumerkel saved all versions
of the DCG draft standard, you can watch
the evolution of the constructed terminology.

I don’t know whether its possible to dig up
a document collection that would show the
evolution of the terminology in the ISO core
standard. Predicate indicator is a Prolog term
of the form N/A, predicate is not a Prolog
term, but abstractly the pair <N,A>. 3.133
predication is a nice example that can be easier
formulated with predicate than with
predicate indicator.

Mostowski Collapse schrieb:

Mostowski Collapse

unread,
Aug 26, 2020, 5:30:42 AM8/26/20
to
BTW: This paper confirms the view that Prologs
meta-programming is not strictly first order logic.
You don't see from the title, but its Prologish:

In Praise of Impredicativity: A Contribution to the
Formalisation of Meta-Programming - François Bry
https://arxiv.org/abs/1807.06051

The ISO core standard is probably not extremly off.
The transition from "predication" to "goal" involves
call/1 wrapping. So this "predication":

?- expand_goal(H, G), call(G).

The built-in call/1 can be viewed as transfering
from function symbols to predicate symbols. It can
be viewed as in infinite list of rules:

call(f(...)) :- f(...).
...

Have Fun!

Mostowski Collapse

unread,
Aug 26, 2020, 6:26:31 AM8/26/20
to
Well the infinite rule for call/1 is a simplification,
call/1 does body conversion again, thus uses var/1
which is non-logical. :-( :-)

But I wouldn't fear inconsistency in Prolog, since it
doesn't have classical negation. What one would need
to show is Currys paradox in Prolog.

This would show explosion as known from classical
negation, without the need for classical negation.

Mostowski Collapse

unread,
Sep 2, 2020, 3:20:55 PM9/2/20
to
How about some new SWI-Prolog merchandise.
Go Programming Language has something:

https://www.redbubble.com/de/shop/golang+masks

I dont know about the possible profit margin.

Mostowski Collapse

unread,
Sep 6, 2020, 7:14:50 AM9/6/20
to
This would be a nice educational site,
if and only if, it were not written in
SWI-Prolog dialect:

How to Build an Automated Theorem Prover
http://www.jens-otten.de/tutorial_tableaux19/

Maybe I should write an E-Mail whether Jen
Otten could please publish versions that also
run in Tau Prolog. But I guess the problem

is deeper rooted, probably the whole FOF
endeavour is foobar. I do not intend to fix
FOF or lobby a certain fix. They must

find out by themselves whats going wrong and
how they could fix it. I am not paying
their lunch.

Mostowski Collapse

unread,
Sep 6, 2020, 7:21:54 AM9/6/20
to
Here is what is going wrong in the
SWI-Prolog dialect, and which causes
some unnessary headache.

Take this Prolog text:

:- op(1110, xfy, =>).

Now observe:

Tau Prolog, this behaviour is Ok, I guess
the ISO core standard rather requires that:

Tau Prolog 0.3.0 (beta)

?- X = prove(p => q).
error parsing query:throw(error(syntax_error(', or ) expected'),[line(1),column(12),found(=>)]))

http://tau-prolog.org/sandbox/

SWI-Prolog, has provided a relaxation, I
do not think its ISO core standard conform:

Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.6)

?- X = prove(p => p).
X = prove((p=>p)).

The crazy thing about SWI-Prologs relaxation,
it still writes the parenthesis in the output.
It still writes prove((p=>p)).

I really do not have some words for this
incompatiblity. The Prolog text leanseq_v5.pl
cannot be entered in Tau Prolog as is,

because Jens Otten unknowingly used this
syntax relaxation feature of SWI-Prolog while
writing leanseq_v5.pl and unknowingly produced

Prolog code that isn't portable.

Mostowski Collapse

unread,
Sep 8, 2020, 1:41:06 PM9/8/20
to
Woa! This is a stunner:

Picat version 3.0 beta is available

"A major addition to the new version
is the support of Prolog-style Horn
clauses and DCG rules, and four Prolog
built-ins, including arg/3, functor/3, =../2,
and !/0. The new addition will facilitate
porting Prolog programs to Picat. For example,
the following program runs with Picat as it is:"

concat([],Ys,Ys).
concat([X|Xs],Ys,[X|Zs]) :-
concat(Xs,Ys,Zs).

What does it mean 'certain terms need to be
preceded by the $ symbol'? Could there be
an example? Is this needed for Prolog
facts and rules?

Will there be a (is)/2?

Mostowski Collapse

unread,
Sep 10, 2020, 4:51:30 AM9/10/20
to
Q: What did you do during 2020 Corona:
March, April, May, June, Juli, August?

A: I don't remember. Maybe this:

lofi beats to code
https://www.youtube.com/watch?v=f02mOEt11OQ

Mostowski Collapse

unread,
Sep 10, 2020, 6:29:08 AM9/10/20
to
Jan W. closed the issue with the advice:

> So, simply suggests Jens politely that an extra
pair of parenthesis makes his program more
portable and everything is solved.

It would be better if SWI-Prolog had a compatibility
flag, and the default would be non-relaxed parsing.
It seems you guys want to see the world

burn down. this is from joseph-vidal-rosset:

[p => p]

This aint working in GNU Prolog:

?- [user].
:- op(1110, xfy, =>).

?- X = [p => q].
uncaught exception: error(syntax_error('user_input:2 (char:9) , | ] or operator expected in list'),read_term/3)

The syntax productions of the ISO core standard are as follows:

expression(M) --> "(" term(1200) ")"
list --> "[" arguments [ "|" term(999) ] "]"
arguments --> term(999) { "," term(999) }.

A list doesn’t leverage the operator priority enough to
accept an operator such as (=>)/2 how joseph-vidal-rosset
defined it.

Maybe SWI-Prolog should be unbranded into
SWI-PrologLikeLanguage. Too much fiddling with
syntax gives a new languaage.

Mostowski Collapse

unread,
Sep 10, 2020, 6:33:32 AM9/10/20
to
Ha Ha, somebody on SWI-Prolog discourse
censored my comment:

"Maybe SWI-Prolog should be unbranded into
SWI-PrologLikeLanguage. Too much fiddling with
syntax gives a new languaage."

LoL

Mostowski Collapse

unread,
Sep 10, 2020, 6:56:06 AM9/10/20
to
To EricGT, who did the censoring, I try
to make it very quick:

There is nothing wrong with my comment. Its
true, too much fiddling gives a new
language. There is no proof yet, that

the syntax relaxation is conservative, i.e.
comparision to new features in GCC. Its
even nowhere specified. Where is a

documentation and some review made?
The relaxation has a few exceptions,
here I can remove parenthesis:

Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.7)

?- X = [(p=>q)], write_canonical(X), nl.
[=>(p,q)]
X = [(p=>q)].

?- X = [p=>q], write_canonical(X), nl.
[=>(p,q)]
X = [(p=>q)].

But surprise surprise, this here goes
awfully wrong:

?- X = [(a :- b,c)], write_canonical(X), nl.
[:-(a,','(b,c))]
X = [(a:-b, c)].

?- X = [a :- b,c], write_canonical(X), nl.
[:-(a,b),c]
X = [(a:-b), c].

Suddently the list is not anymore a singleton,
but has two elements. The operator (',')/2
is for example used in the Beckert & Posegga

algorithm. So a joseph-vidal-rosset prompt
would generate some subtle bugs, that are hard
to debug. The user would maybe input:

[a :- b,c]

And the program wouldn't work.

Mostowski Collapse

unread,
Sep 10, 2020, 7:20:51 AM9/10/20
to
Ha Ha, Boris got also censored. And my
account is now blocked, I cannot respond
anymore. Yikes, thats typical EricGT.

Just making an elephant from a fly.

Mostowski Collapse

unread,
Sep 10, 2020, 7:27:24 AM9/10/20
to
Oho, SWI-Prolog discrourse attempts to cherry picking,
just for the record here the proof that EricGT censored
the SWI-PrologLikeLanguage:

Screenshot from the censoring:
https://gist.github.com/jburse/820783d6e0fbfd55b907bdbe0e3e2c7e#gistcomment-3448928

I really wonder how SWI-Prolog wants to harden its Prolog
system. It seems that some people want to really see
the world burn down.

It is not to expect that in the long run SWI-Prolog will
be the only Prolog systems. There are already new systems
like Tau Prolog and for example Picat started supporting

Prolog syntax again. So safety and compatibility across
Prolog systems will be king in the future.

Mostowski Collapse schrieb:

Mostowski Collapse

unread,
Oct 1, 2020, 9:47:12 AM10/1/20
to
Picat slowly coming back to the ring of
Prolog systems. Maybe even ISO Prolog systems.

Performance of Picat v3 is nice:

Scroll down to Program for Picat v3
See various Benchmark results
http://www.hakank.org/picat/

Tests were performed idependently by Hakan. The
links were first seen on Picat Google group.

Mostowski Collapse

unread,
Oct 22, 2020, 5:59:12 AM10/22/20
to
New Prolog TPL in Town?

------------|---------|-----------|-----------|---------|----------
| tpl | swipl | gprolog | yap | scryer
| 1.1.7 | 8.2.1 | 1.45 | 6.5 | 0.8.127
------------|---------|-----------|-----------|---------|----------
sieve | 0.36 | 0.27 | 0.52 | 0.31 | 7.63
fibonacci | 0.59 | 0.30 | 0.56 | 0.79 | 6.74
hanoi | 1.15 | 0.39 | 1.18 | 0.85 | 9.9
queens | 1.27 | 0.88 | 1.40 | 1.46 | 10.9
puzzle | 0.35 | 0.17 | 0.28 | 0.22 | 3.08
chess | 10.7 | 4.9 | 4.9 | 4.9 |
------------|---------|-----------|-----------|---------|----------
testindex1a | 1.35 | 1.31 | 0.70 | 4.94 |
testindex1b | 1.47 | 1.38 | >300 | 5.10 |
testindex5 | 9.3 | 11.8 | 4.2 | 49.7 |
------------|---------|-----------|-----------|---------|----------

https://github.com/infradig/trealla

Mostowski Collapse

unread,
Oct 22, 2020, 6:09:22 AM10/22/20
to
The GitHub picture of the author Andrew Davison
looks a little bit as if Jan W. is taking vacation
in Brisbane, Australia.

Is this some skunk work?

LoL

Mostowski Collapse

unread,
Nov 11, 2020, 2:18:03 PM11/11/20
to

The Empirical Metamathematics of Euclid and Beyond
September 28, 2020
https://writings.stephenwolfram.com/2020/09/the-empirical-metamathematics-of-euclid-and-beyond/

Mostowski Collapse

unread,
Nov 15, 2020, 5:36:07 AM11/15/20
to
Kuniak Mukai wrote (concerning ZDD library):
"I have no idea to attract readers"

Here my penny of thought.ZDD seems to be nowadays student
mainstream stuff. Here is an example:

https://q2a.cs.uni-kl.de/597/regarding-construction-of-reed-muller-normal-form-from-zdd

How to attract reads on SWI-Prolog discourse?

I have no idea. I am more concerned whether there is
possibly a nice little book, that has its exercises based
on ISO Prolog. That could maybe generate some traction,
and as a spill over also some traction for SWI-Prolog discourse.

But the above example shows that universities also
use their own discourse systems. So for this forum
here you can probably only attract experts in the
intersection of Prolog or SWI-Prolog and CLP(B) or SAT solver.

But I am affraid that experts from GNU, ECLiPSe,
Picat, etc… will not step by. Since they have their
own mailing lists. In the old times you might have
found comp.lang.prolog as common ground, but
nobody uses it nowadays.

So since SWI-Prolog discourse is not really a student
forum, and since you aim at a SWI-Prolog specific
setarg etc… and since it requires CLP(B) expertise,
no you wont find any readers.

Mostowski Collapse

unread,
Dec 1, 2020, 7:11:25 PM12/1/20
to
Woa! Jan W. got himself a full time job to make SWI-
Prolog the greatest scripting language on this planet:

"As a result, a great deal of the development work as well
as positioning SWI-Prolog primarily as a robust and scalable
application development platform fits poorly in an academic
setting. This is why I started SWI-Prolog Solutions b.v."
http://swi-prolog.com/about.html

Mostowski Collapse

unread,
Jan 9, 2023, 4:44:45 AM1/9/23
to
I guess the logic component of ChatGPT
needs some improvement. a) lets first
assure ourselvs that p & q → p is tautology.

p q ((p ∧ q) → p)
F F T
F T T
T F T
T T T
Truth Table Generator
https://web.stanford.edu/class/cs103/tools/truth-table-tool/

b) Now what is ChatGPTs opinion on that:

No, “p and q” does not imply “p.”

The statement “p and q” means that both p
and q are true. However, this does not
necessarily mean that p is true on its own.
For example, consider the following statements:

“It is raining and the sun is shining.”
“The earth is round and the moon is round.”
In both of these cases, “p and q” is true,
but neither “p” nor “q” is true on its own.

I made a screenshot.

Mostowski Collapse

unread,
Jan 9, 2023, 5:02:15 AM1/9/23
to
Credits: Fritz Feldhase, he suggested this question:

Does p and q imply p?

On de.sci.mathematik

Mostowski Collapse

unread,
Jan 27, 2023, 10:50:22 AM1/27/23
to
I guess ChatGBT is more ChatCBD:

Cannabidiol (CBD) is a phytocannabinoid discovered in 1940.
Phytocannabinoids are cannabinoids that occur naturally
in the cannabis plant.
https://en.wikipedia.org/wiki/Cannabidiol

LoL

Mostowski Collapse

unread,
Jan 27, 2023, 10:50:56 AM1/27/23
to
Do not forget that you can ask CheatCBD to
use a certain text style. Like here:

Q: Write an article in BuzzFeed style about how
BuzzFeed workers will be fired due to use of ChatGPT by BuzzFeed

A: "Say Goodbye to BuzzFeedEmployees: ChatGPT Is Taking Over,
In a shocking turn of events, BuzzFeed has announced that they
will be replacing their human workers with the cutting-edge language
model, ChatGPT.

Yes, you read that right. The popular news and entertainment
website will now be relying on a machine to create content
instead of their trusty human employees.

According to a statement from BuzzFeed, the decision to implement
ChatGPT was made in order to increase efficiency and reduce costs.
With the ability to generate high-quality content at lightning speed,
ChatGPT will be able to produce a larger volume of articles than
any human team could ever dream of.

But what does this mean for the dedicated employees of BuzzFeed?
Unfortunately, it means that many of them will be losing their jobs. The
company has stated that they will be offering severance packages and
job placement assistance to those affected by the layoffs.

While it's a tough pill to swallow for the loyal BuzzFeed team, the
company is confident that this decision will ultimately lead to a better
and more successful future for the website. So, say goodbye to the
human writers and editors of BuzzFeed, and hello to the new era of
content creation with ChatGPT. The future is here and it's all about
the machines!. As a reminder, I am an Al language model and
I can not predict the future.

Credits:

Fascinating. Are we entering the singularity ? Are we already in it?
https://9gag.com/gag/aA0b9Mg#comment

Mostowski Collapse

unread,
Mar 17, 2023, 5:05:13 AM3/17/23
to
R.I.P. Roger Carl Schank! († January 29, 2023)

> The central focus of Schank’s theory has been
the structure of knowledge, especially in the context
of language understanding. Schank (1975) outlined
contextual dependency theory which deals with the
representation of meaning in sentences. Building upon
this framework, Schank & Abelson (1977) introduced
the concepts of scripts, plans and themes to handle
**story-level** understanding. Later work (e.g., Schank,
1982,1986) elaborated the theory to encompass other
aspects of cognition.
> https://www.instructionaldesign.org/theories/script-theory
0 new messages