Hi,
Having fun with Bisimulation, and a new test
suite of nasty circular pairs. But how store
circular pairs, if clauses do not support
circular terms. Well chop it up into equations,
I create 1000 such equation pairs:
test([A = c(A, B), C = c(A, D), E = n, _ = c(F, B),
F = c(C, C), G = c(G, D), D = c(E, C), B = n],
[H = c(H, I), J = c(K, I), L = c(L, I), I = c(M, N),
O = c(K, J), N = n, K = c(K, J), M = c(K, O)]).
Etc..
The pairs are nasty because the usual compare_with_stack/2
chokes on them. Here some results:
/* SWI-Prolog 9.3.26 */
?- time((between(1,30,_), part, fail; true)).
% 540,118 inferences, 0.047 CPU in 0.041 seconds (115% CPU, 11522517 Lips) true.
/* Trealla Prolog 2.78.40 */
?- time((between(1,30,_), part, fail; true)).
% Time elapsed 0.113s, 1143903 Inferences, 10.157 MLips
true.
/* Scryer Prolog 0.9.4-417 */
?- time((between(1,30,_), part, fail; true)).
% CPU time: 0.226s, 1_117_809 inferences
true.
/* Dogelog Player 1.3.5 */
?- time((between(1,30,_), part2, fail; true)).
% Zeit 309 ms, GC 0 ms, Lips 8693718, Uhr 25.07.2025 13:47
true.
The amazing thing is, I compared a 100% Prolog
implementation, so there is a lot of head room
for improvement:
part2 :-
bitest(X,Y), X ~~ Y, fail; true.
The operator (~~)/2 is part of library(math),
and has been implemented with same_term/2 so far.
Bye
Hi,
Is Mild Shock going rogue? Not really,
I am only amused that a couple of academic
frauds like these here:
- Bart Demoen
- Ulrich Neumerkel
- Paulo Moura
- Joseph Vidal-Rosset
Think they can oppress what they view a
non-academic. Its more explicit in what
Bart Demoen wrote back then, but more
implicit how the above morons act. For
example blocking me from all repesitory,
making it impossible for me to raise issues,
and strangly discussion by dogmatic nonsense,
doesn't increase the willingness of the
harassed person to share something:
What occurs-check optimizations is SWI Prolog using? https://stackoverflow.com/a/65620337/17524790
Also that gists would be found on
archive.org is nonsense.
Bye
Mild Shock schrieb:
Hi,
Having fun with Bisimulation, and a new test
suite of nasty circular pairs. But how store
circular pairs, if clauses do not support
circular terms. Well chop it up into equations,
I create 1000 such equation pairs:
test([A = c(A, B), C = c(A, D), E = n, _ = c(F, B),
F = c(C, C), G = c(G, D), D = c(E, C), B = n],
[H = c(H, I), J = c(K, I), L = c(L, I), I = c(M, N),
O = c(K, J), N = n, K = c(K, J), M = c(K, O)]).
Etc..
The pairs are nasty because the usual compare_with_stack/2
chokes on them. Here some results:
/* SWI-Prolog 9.3.26 */
?- time((between(1,30,_), part, fail; true)).
% 540,118 inferences, 0.047 CPU in 0.041 seconds (115% CPU, 11522517
Lips)
true.
/* Trealla Prolog 2.78.40 */
?- time((between(1,30,_), part, fail; true)).
% Time elapsed 0.113s, 1143903 Inferences, 10.157 MLips
true.
/* Scryer Prolog 0.9.4-417 */
?- time((between(1,30,_), part, fail; true)).
% CPU time: 0.226s, 1_117_809 inferences
true.
/* Dogelog Player 1.3.5 */
?- time((between(1,30,_), part2, fail; true)).
% Zeit 309 ms, GC 0 ms, Lips 8693718, Uhr 25.07.2025 13:47
true.
The amazing thing is, I compared a 100% Prolog
implementation, so there is a lot of head room
for improvement:
part2 :-
bitest(X,Y), X ~~ Y, fail; true.
The operator (~~)/2 is part of library(math),
and has been implemented with same_term/2 so far.
Bye
Hi,
Is Mild Shock aka Mostowski Collapse a
professional mathematician. Well you can
figure out by yourself, just take this
piece by Peter Aczel:
NON-WELL-FOUNDED SETS
Peter Aczel - 24 December 1981 https://les-mathematiques.net/vanilla/uploads/editor/fh/v4pi6qyxfbel.pdf
Open the PDF, look at page 4:
Mostowski's Collapsing Lemma:
Every well-founded graph has a unique decoration.
While I had the nick name, you can still see
it in the comments section here: https://stackoverflow.com/q/65600226/17524790
I heard a lot of funny interpretations of the nickname:
- Is it derived from Wave Function Collapse?
- Is it derived from Bridge
- Etc..
Not a single person I met knew something
about good old set theory.
So much to anybody thinking he is superior:
I PISS AND SHIT ON YOU
Bye
Mild Shock schrieb:
Hi,
Is Mild Shock going rogue? Not really,
I am only amused that a couple of academic
frauds like these here:
- Bart Demoen
- Ulrich Neumerkel
- Paulo Moura
- Joseph Vidal-Rosset
Think they can oppress what they view a
non-academic. Its more explicit in what
Bart Demoen wrote back then, but more
implicit how the above morons act. For
example blocking me from all repesitory,
making it impossible for me to raise issues,
and strangly discussion by dogmatic nonsense,
doesn't increase the willingness of the
harassed person to share something:
What occurs-check optimizations is SWI Prolog using?
https://stackoverflow.com/a/65620337/17524790
Also that gists would be found on
archive.org is nonsense.
Bye
Mild Shock schrieb:
Hi,
Having fun with Bisimulation, and a new test
suite of nasty circular pairs. But how store
circular pairs, if clauses do not support
circular terms. Well chop it up into equations,
I create 1000 such equation pairs:
test([A = c(A, B), C = c(A, D), E = n, _ = c(F, B),
F = c(C, C), G = c(G, D), D = c(E, C), B = n],
[H = c(H, I), J = c(K, I), L = c(L, I), I = c(M, N),
O = c(K, J), N = n, K = c(K, J), M = c(K, O)]).
Etc..
The pairs are nasty because the usual compare_with_stack/2
chokes on them. Here some results:
/* SWI-Prolog 9.3.26 */
?- time((between(1,30,_), part, fail; true)).
% 540,118 inferences, 0.047 CPU in 0.041 seconds (115% CPU, 11522517
Lips)
true.
/* Trealla Prolog 2.78.40 */
?- time((between(1,30,_), part, fail; true)).
% Time elapsed 0.113s, 1143903 Inferences, 10.157 MLips
true.
/* Scryer Prolog 0.9.4-417 */
?- time((between(1,30,_), part, fail; true)).
% CPU time: 0.226s, 1_117_809 inferences
true.
/* Dogelog Player 1.3.5 */
?- time((between(1,30,_), part2, fail; true)).
% Zeit 309 ms, GC 0 ms, Lips 8693718, Uhr 25.07.2025 13:47
true.
The amazing thing is, I compared a 100% Prolog
implementation, so there is a lot of head room
for improvement:
part2 :-
bitest(X,Y), X ~~ Y, fail; true.
The operator (~~)/2 is part of library(math),
and has been implemented with same_term/2 so far.
Bye
Hi,
Having fun with Bisimulation, and a new test
suite of nasty circular pairs. But how store
circular pairs, if clauses do not support
circular terms. Well chop it up into equations,
I create 1000 such equation pairs:
test([A = c(A, B), C = c(A, D), E = n, _ = c(F, B),
F = c(C, C), G = c(G, D), D = c(E, C), B = n],
[H = c(H, I), J = c(K, I), L = c(L, I), I = c(M, N),
O = c(K, J), N = n, K = c(K, J), M = c(K, O)]).
Etc..
The pairs are nasty because the usual compare_with_stack/2
chokes on them. Here some results:
/* SWI-Prolog 9.3.26 */
?- time((between(1,30,_), part, fail; true)).
% 540,118 inferences, 0.047 CPU in 0.041 seconds (115% CPU, 11522517 Lips) true.
/* Trealla Prolog 2.78.40 */
?- time((between(1,30,_), part, fail; true)).
% Time elapsed 0.113s, 1143903 Inferences, 10.157 MLips
true.
/* Scryer Prolog 0.9.4-417 */
?- time((between(1,30,_), part, fail; true)).
% CPU time: 0.226s, 1_117_809 inferences
true.
/* Dogelog Player 1.3.5 */
?- time((between(1,30,_), part2, fail; true)).
% Zeit 309 ms, GC 0 ms, Lips 8693718, Uhr 25.07.2025 13:47
true.
The amazing thing is, I compared a 100% Prolog
implementation, so there is a lot of head room
for improvement:
part2 :-
bitest(X,Y), X ~~ Y, fail; true.
The operator (~~)/2 is part of library(math),
and has been implemented with same_term/2 so far.
Bye
Hi,
Take these definitions:
test1(X) :- X = f(g(X,_B),_A).
test2(X) :- Y = g(f(Y,A),_B), X = f(Y,A).
Then you get:
/* Scryer Prolog 0.9.4-417 */
?- test1(X), numbervars(X,0,_).
X = f(g(X,'$VAR'(0)),'$VAR'(1)).
?- test2(X), numbervars(X,0,_).
X = f(g(f('$VAR'(0),'$VAR'(1)),g(f(g('$VAR'(1),'$VAR'(0)), f(g(f('$VAR'(0),'$VAR'(1)),g(f(g('$VAR'(1),'$VAR'(0)), f(g(f('$VAR'(0),'$VAR'(1)),g(f(g('$VAR'(1),'$VAR'(0)), f(g(f('$VAR'(0),'$VAR'(1)),g(f(g('$VAR'(1),'$VAR'(0)), f(g(f('$VAR'(...),'$VAR'(...)),g(f(g(...),'$VAR'(...)), '$VAR'(...))),'$VAR'(0))),'$VAR'(1))),'$VAR'(0))),'$VAR'(1))), '$VAR'(0))),'$VAR'(1))),'$VAR'(0))),'$VAR'(1))),'$VAR'(0)).
What the heck is the '$VAR'(0) after the f(g(f( ?
Bye
Mild Shock schrieb:
Hi,
Having fun with Bisimulation, and a new test
suite of nasty circular pairs. But how store
circular pairs, if clauses do not support
circular terms. Well chop it up into equations,
I create 1000 such equation pairs:
test([A = c(A, B), C = c(A, D), E = n, _ = c(F, B),
F = c(C, C), G = c(G, D), D = c(E, C), B = n],
[H = c(H, I), J = c(K, I), L = c(L, I), I = c(M, N),
O = c(K, J), N = n, K = c(K, J), M = c(K, O)]).
Etc..
The pairs are nasty because the usual compare_with_stack/2
chokes on them. Here some results:
/* SWI-Prolog 9.3.26 */
?- time((between(1,30,_), part, fail; true)).
% 540,118 inferences, 0.047 CPU in 0.041 seconds (115% CPU, 11522517
Lips)
true.
/* Trealla Prolog 2.78.40 */
?- time((between(1,30,_), part, fail; true)).
% Time elapsed 0.113s, 1143903 Inferences, 10.157 MLips
true.
/* Scryer Prolog 0.9.4-417 */
?- time((between(1,30,_), part, fail; true)).
% CPU time: 0.226s, 1_117_809 inferences
true.
/* Dogelog Player 1.3.5 */
?- time((between(1,30,_), part2, fail; true)).
% Zeit 309 ms, GC 0 ms, Lips 8693718, Uhr 25.07.2025 13:47
true.
The amazing thing is, I compared a 100% Prolog
implementation, so there is a lot of head room
for improvement:
part2 :-
bitest(X,Y), X ~~ Y, fail; true.
The operator (~~)/2 is part of library(math),
and has been implemented with same_term/2 so far.
Bye
Hi,
Assume that we live in a world where we
have excess memory. So we can afford stacks!
And then make the crucial observation,
we can use the stack of the Prolog engine,
no need to create an artificial stack in C,
or use the native stack of C.
I guess SWI-Prolog has already groked the
first we can "afford stacks". But did anybody
already grok the "100% Prolog" idea?
Well we are not yet there 100% Prolog
has still an overhead. Here is a little
test acyclic_term/2:
/* SWI-Prolog 9.3.26, C Stacks and/or Agendas */
?- time((between(1,30,_), acyclic2, fail; true)).
% 330,150 inferences, 0.016 CPU in 0.023 seconds
(69% CPU, 21129600 Lips)
true.
/* Trealla Prolog 2.79.6, ?? */
?- time((between(1,30,_), acyclic2, fail; true)).
% Time elapsed 0.063s, 643413 Inferences, 10.166 MLips
true.
/* Dogelog Player 1.3.5, 100% Prolog */
?- time((between(1,30,_), acyclic2, fail; true)).
% Zeit 115 ms, GC 0 ms, Lips 11803904, Uhr 28.07.2025 10:03
true.
/* Scryer Prolog 0.9.4-417, Deutsch-Schorr-Waite */
?- time((between(1,30,_), acyclic2, fail; true)).
% CPU time: 0.130s, 626_829 inferences
true.
Bye
Hi,
So the 115 ms by Dogelog Player are faster than the
0.130s by Scryer Prolog. Quite amazing! From
Dogelog Player library(math):
/**
* acyclic_term(T): [TC2 8.3.11]
* The predicate succeeds when the Prolog term T is an acyclic term,
* otherwise the predicate fails.
*/
% acyclic_term(+Term)
acyclic_term(X) :- sys_cyclic_term(X, []), !, fail.
acyclic_term(_).
% sys_cyclic_term(+Term, +List)
sys_cyclic_term(X, S) :- compound(X),
member(Y, S),
same_term(X, Y), !.
sys_cyclic_term(X, S) :- compound(X),
X =.. [_|L],
member(Y, L),
sys_cyclic_term(Y, [X|S]).
Algorithms that implicitly detect sharing cannot
do much? Since we only need to find a first cycle?
Also a challenge to bring the association list to
native and lets say turn it into a hash table,
don't know yet when and how even somebody would
attempt that. Big advantage of anything not using
Deutsch-Schorr-Waite , no write operation into the
given term. Write operation are sometimes
poison for the CPU and the RAM.
Bye
Mild Shock schrieb:
Hi,
Assume that we live in a world where we
have excess memory. So we can afford stacks!
And then make the crucial observation,
we can use the stack of the Prolog engine,
no need to create an artificial stack in C,
or use the native stack of C.
I guess SWI-Prolog has already groked the
first we can "afford stacks". But did anybody
already grok the "100% Prolog" idea?
Well we are not yet there 100% Prolog
has still an overhead. Here is a little
test acyclic_term/2:
/* SWI-Prolog 9.3.26, C Stacks and/or Agendas */
?- time((between(1,30,_), acyclic2, fail; true)).
% 330,150 inferences, 0.016 CPU in 0.023 seconds
(69% CPU, 21129600 Lips)
true.
/* Trealla Prolog 2.79.6, ?? */
?- time((between(1,30,_), acyclic2, fail; true)).
% Time elapsed 0.063s, 643413 Inferences, 10.166 MLips
true.
/* Dogelog Player 1.3.5, 100% Prolog */
?- time((between(1,30,_), acyclic2, fail; true)).
% Zeit 115 ms, GC 0 ms, Lips 11803904, Uhr 28.07.2025 10:03
true.
/* Scryer Prolog 0.9.4-417, Deutsch-Schorr-Waite */
?- time((between(1,30,_), acyclic2, fail; true)).
% CPU time: 0.130s, 626_829 inferences
true.
Bye
Write operation are sometimes
poison for the CPU and the RAM.
Hi,
Interstingly there is an obvious way how
to do it without a braching association list,
that has different futures so to speack,
the below code repeatedly generates
dfferent association lists via [X|S].
We could of course instead do a threading
of the association list through some predicate,
and use some state on each entry inside the
association list, similar like in acyclic_decompose/3
we used a threading and entry state.
Bye
Mild Shock schrieb:
Hi,
So the 115 ms by Dogelog Player are faster than the
0.130s by Scryer Prolog. Quite amazing! From
Dogelog Player library(math):
/**
* acyclic_term(T): [TC2 8.3.11]
* The predicate succeeds when the Prolog term T is an acyclic term,
* otherwise the predicate fails.
*/
% acyclic_term(+Term)
acyclic_term(X) :- sys_cyclic_term(X, []), !, fail.
acyclic_term(_).
% sys_cyclic_term(+Term, +List)
sys_cyclic_term(X, S) :- compound(X),
member(Y, S),
same_term(X, Y), !.
sys_cyclic_term(X, S) :- compound(X),
X =.. [_|L],
member(Y, L),
sys_cyclic_term(Y, [X|S]).
Algorithms that implicitly detect sharing cannot
do much? Since we only need to find a first cycle?
Also a challenge to bring the association list to
native and lets say turn it into a hash table,
don't know yet when and how even somebody would
attempt that. Big advantage of anything not using
Deutsch-Schorr-Waite , no write operation into the
given term. Write operation are sometimes
poison for the CPU and the RAM.
Bye
Mild Shock schrieb:
Hi,
Assume that we live in a world where we
have excess memory. So we can afford stacks!
And then make the crucial observation,
we can use the stack of the Prolog engine,
no need to create an artificial stack in C,
or use the native stack of C.
I guess SWI-Prolog has already groked the
first we can "afford stacks". But did anybody
already grok the "100% Prolog" idea?
Well we are not yet there 100% Prolog
has still an overhead. Here is a little
test acyclic_term/2:
/* SWI-Prolog 9.3.26, C Stacks and/or Agendas */
?- time((between(1,30,_), acyclic2, fail; true)).
% 330,150 inferences, 0.016 CPU in 0.023 seconds
(69% CPU, 21129600 Lips)
true.
/* Trealla Prolog 2.79.6, ?? */
?- time((between(1,30,_), acyclic2, fail; true)).
% Time elapsed 0.063s, 643413 Inferences, 10.166 MLips
true.
/* Dogelog Player 1.3.5, 100% Prolog */
?- time((between(1,30,_), acyclic2, fail; true)).
% Zeit 115 ms, GC 0 ms, Lips 11803904, Uhr 28.07.2025 10:03
true.
/* Scryer Prolog 0.9.4-417, Deutsch-Schorr-Waite */
?- time((between(1,30,_), acyclic2, fail; true)).
% CPU time: 0.130s, 626_829 inferences
true.
Bye
Hi,
Having fun with Bisimulation, and a new test
suite of nasty circular pairs. But how store
circular pairs, if clauses do not support
circular terms. Well chop it up into equations,
I create 1000 such equation pairs:
test([A = c(A, B), C = c(A, D), E = n, _ = c(F, B),
F = c(C, C), G = c(G, D), D = c(E, C), B = n],
[H = c(H, I), J = c(K, I), L = c(L, I), I = c(M, N),
O = c(K, J), N = n, K = c(K, J), M = c(K, O)]).
Etc..
The pairs are nasty because the usual compare_with_stack/2
chokes on them. Here some results:
/* SWI-Prolog 9.3.26 */
?- time((between(1,30,_), part, fail; true)).
% 540,118 inferences, 0.047 CPU in 0.041 seconds (115% CPU, 11522517 Lips) true.
/* Trealla Prolog 2.78.40 */
?- time((between(1,30,_), part, fail; true)).
% Time elapsed 0.113s, 1143903 Inferences, 10.157 MLips
true.
/* Scryer Prolog 0.9.4-417 */
?- time((between(1,30,_), part, fail; true)).
% CPU time: 0.226s, 1_117_809 inferences
true.
/* Dogelog Player 1.3.5 */
?- time((between(1,30,_), part2, fail; true)).
% Zeit 309 ms, GC 0 ms, Lips 8693718, Uhr 25.07.2025 13:47
true.
The amazing thing is, I compared a 100% Prolog
implementation, so there is a lot of head room
for improvement:
part2 :-
bitest(X,Y), X ~~ Y, fail; true.
The operator (~~)/2 is part of library(math),
and has been implemented with same_term/2 so far.
Bye
Hi,
Looks like the pairs are really nasty.
I have them on the Novacore GIT.
This one is no problem for Scryer-Prolog:
test :-
share(X), share(Y), X == Y.
/* SWI-Prolog 9.3.26 */
?- time(test).
% 32,140 inferences, 0.000 CPU in 0.002 seconds (0% CPU, Infinite Lips)
true.
/* Scryer Prolog 0.9.4-417 */
?- time(test).
% CPU time: 0.006s, 32_042 inferences
true.
/* Trealla Prolog 2.79.6 */
?- time(test).
% Time elapsed 0.016s, 42012 Inferences, 2.582 MLips
true.
/* Dogelog Player 1.3.5 */
?- time(test2).
% % Zeit 83 ms, GC 0 ms, Lips 12117469, Uhr 30.07.2025 05:47
% true.
The Dogelog Player solutions uses a variant
of library(hash), called library(maps).
Both hash tables are itself 100% Prolog.
Bye
Mild Shock schrieb:
Hi,
Having fun with Bisimulation, and a new test
suite of nasty circular pairs. But how store
circular pairs, if clauses do not support
circular terms. Well chop it up into equations,
I create 1000 such equation pairs:
test([A = c(A, B), C = c(A, D), E = n, _ = c(F, B),
F = c(C, C), G = c(G, D), D = c(E, C), B = n],
[H = c(H, I), J = c(K, I), L = c(L, I), I = c(M, N),
O = c(K, J), N = n, K = c(K, J), M = c(K, O)]).
Etc..
The pairs are nasty because the usual compare_with_stack/2
chokes on them. Here some results:
/* SWI-Prolog 9.3.26 */
?- time((between(1,30,_), part, fail; true)).
% 540,118 inferences, 0.047 CPU in 0.041 seconds (115% CPU, 11522517
Lips)
true.
/* Trealla Prolog 2.78.40 */
?- time((between(1,30,_), part, fail; true)).
% Time elapsed 0.113s, 1143903 Inferences, 10.157 MLips
true.
/* Scryer Prolog 0.9.4-417 */
?- time((between(1,30,_), part, fail; true)).
% CPU time: 0.226s, 1_117_809 inferences
true.
/* Dogelog Player 1.3.5 */
?- time((between(1,30,_), part2, fail; true)).
% Zeit 309 ms, GC 0 ms, Lips 8693718, Uhr 25.07.2025 13:47
true.
The amazing thing is, I compared a 100% Prolog
implementation, so there is a lot of head room
for improvement:
part2 :-
bitest(X,Y), X ~~ Y, fail; true.
The operator (~~)/2 is part of library(math),
and has been implemented with same_term/2 so far.
Bye
Hi,
Having fun with Bisimulation, and a new test
suite of nasty circular pairs. But how store
circular pairs, if clauses do not support
circular terms. Well chop it up into equations,
I create 1000 such equation pairs:
test([A = c(A, B), C = c(A, D), E = n, _ = c(F, B),
F = c(C, C), G = c(G, D), D = c(E, C), B = n],
[H = c(H, I), J = c(K, I), L = c(L, I), I = c(M, N),
O = c(K, J), N = n, K = c(K, J), M = c(K, O)]).
Etc..
The pairs are nasty because the usual compare_with_stack/2
chokes on them. Here some results:
/* SWI-Prolog 9.3.26 */
?- time((between(1,30,_), part, fail; true)).
% 540,118 inferences, 0.047 CPU in 0.041 seconds (115% CPU, 11522517 Lips) true.
/* Trealla Prolog 2.78.40 */
?- time((between(1,30,_), part, fail; true)).
% Time elapsed 0.113s, 1143903 Inferences, 10.157 MLips
true.
/* Scryer Prolog 0.9.4-417 */
?- time((between(1,30,_), part, fail; true)).
% CPU time: 0.226s, 1_117_809 inferences
true.
/* Dogelog Player 1.3.5 */
?- time((between(1,30,_), part2, fail; true)).
% Zeit 309 ms, GC 0 ms, Lips 8693718, Uhr 25.07.2025 13:47
true.
The amazing thing is, I compared a 100% Prolog
implementation, so there is a lot of head room
for improvement:
part2 :-
bitest(X,Y), X ~~ Y, fail; true.
The operator (~~)/2 is part of library(math),
and has been implemented with same_term/2 so far.
Bye
Take this cute example:
?- [user].
dfa(Q0, [Q3,Q4]) :-
Q0 = f(Q1, Q2),
Q1 = f(Q3, Q2),
Q2 = f(Q1, Q4),
Q4 = f(Q1, Q4),
Q3 = f(Q3, Q2).
Try this example in Scryer-Prolog:
/* Scryer Prolog 0.9.4-547 */
?- dfa(X, Y).
%%% tons and tons of print out (...)))),f(f(f(...,f(...)),f(f(...),...)),f(f(...,...), f(f(...),...)))),f(f(f(f(...,f(...)),f(...,...)), f(f(...,f(...)),f(f(...),...))),f(f(f(...,f(...)),f(...,...)), f(f(...,f(...)),f(f(...),...)))))))))))))))))))].
Was more expecting something like
/* SWI-Prolog 9.3.26 */
?- dfa(X, Y).
X = f(f(_S1, _S3), _S3), % where
_S1 = f(_S1, _S3),
_S2 = f(f(_S1, _S3), _S2),
_S3 = f(f(_S1, _S3), _S2),
Y = [_S1, _S2].
Mild Shock schrieb:
Hi,
Having fun with Bisimulation, and a new test
suite of nasty circular pairs. But how store
circular pairs, if clauses do not support
circular terms. Well chop it up into equations,
I create 1000 such equation pairs:
test([A = c(A, B), C = c(A, D), E = n, _ = c(F, B),
F = c(C, C), G = c(G, D), D = c(E, C), B = n],
[H = c(H, I), J = c(K, I), L = c(L, I), I = c(M, N),
O = c(K, J), N = n, K = c(K, J), M = c(K, O)]).
Etc..
The pairs are nasty because the usual compare_with_stack/2
chokes on them. Here some results:
/* SWI-Prolog 9.3.26 */
?- time((between(1,30,_), part, fail; true)).
% 540,118 inferences, 0.047 CPU in 0.041 seconds (115% CPU, 11522517
Lips)
true.
/* Trealla Prolog 2.78.40 */
?- time((between(1,30,_), part, fail; true)).
% Time elapsed 0.113s, 1143903 Inferences, 10.157 MLips
true.
/* Scryer Prolog 0.9.4-417 */
?- time((between(1,30,_), part, fail; true)).
% CPU time: 0.226s, 1_117_809 inferences
true.
/* Dogelog Player 1.3.5 */
?- time((between(1,30,_), part2, fail; true)).
% Zeit 309 ms, GC 0 ms, Lips 8693718, Uhr 25.07.2025 13:47
true.
The amazing thing is, I compared a 100% Prolog
implementation, so there is a lot of head room
for improvement:
part2 :-
bitest(X,Y), X ~~ Y, fail; true.
The operator (~~)/2 is part of library(math),
and has been implemented with same_term/2 so far.
Bye
I like your vibe, clearing the mind of
everything existing has a touch of a mystic
human being living an eremitic solitary
vocation on a far out mountain top.
**cycle_detection.rs**Use the pointer reversal technique of the Deutsch-Schorr-
Hi,
Assume that we live in a world where we
have excess memory. So we can afford stacks!
And then make the crucial observation,
we can use the stack of the Prolog engine,
no need to create an artificial stack in C,
or use the native stack of C.
I guess SWI-Prolog has already groked the
first we can "afford stacks". But did anybody
already grok the "100% Prolog" idea?
Well we are not yet there 100% Prolog
has still an overhead. Here is a little
test acyclic_term/2:
/* SWI-Prolog 9.3.26, C Stacks and/or Agendas */
?- time((between(1,30,_), acyclic2, fail; true)).
% 330,150 inferences, 0.016 CPU in 0.023 seconds
(69% CPU, 21129600 Lips)
true.
/* Trealla Prolog 2.79.6, ?? */
?- time((between(1,30,_), acyclic2, fail; true)).
% Time elapsed 0.063s, 643413 Inferences, 10.166 MLips
true.
/* Dogelog Player 1.3.5, 100% Prolog */
?- time((between(1,30,_), acyclic2, fail; true)).
% Zeit 115 ms, GC 0 ms, Lips 11803904, Uhr 28.07.2025 10:03
true.
/* Scryer Prolog 0.9.4-417, Deutsch-Schorr-Waite */
?- time((between(1,30,_), acyclic2, fail; true)).
% CPU time: 0.130s, 626_829 inferences
true.
Bye
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,064 |
Nodes: | 10 (0 / 10) |
Uptime: | 148:00:35 |
Calls: | 13,691 |
Calls today: | 1 |
Files: | 186,936 |
D/L today: |
33 files (6,120K bytes) |
Messages: | 2,410,927 |