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),
-a-a-a-a-a F = c(C, C), G = c(G, D), D = c(E, C), B = n],
-a-a-a-a [H = c(H, I), J = c(K, I), L = c(L, I), I = c(M, N),
-a-a-a-a-a 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
-a-a true.
/* Scryer Prolog 0.9.4-417 */
?- time((between(1,30,_), part, fail; true)).
-a-a % CPU time: 0.226s, 1_117_809 inferences
-a-a 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 :-
-a-a 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]) :-
-a-a Q0 = f(Q1, Q2),
-a-a Q1 = f(Q3, Q2),
-a-a Q2 = f(Q1, Q4),
-a-a Q4 = f(Q1, Q4),
-a-a 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-a 9.3.26 */
?- dfa(X, Y).
X = f(f(_S1, _S3), _S3), % where
-a-a-a _S1 = f(_S1, _S3),
-a-a-a _S2 = f(f(_S1, _S3), _S2),
-a-a-a _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),
-a-a-a-a-a-a F = c(C, C), G = c(G, D), D = c(E, C), B = n],
-a-a-a-a-a [H = c(H, I), J = c(K, I), L = c(L, I), I = c(M, N),
-a-a-a-a-a-a 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
-a-a-a true.
/* Scryer Prolog 0.9.4-417 */
?- time((between(1,30,_), part, fail; true)).
-a-a-a % CPU time: 0.226s, 1_117_809 inferences
-a-a-a 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 :-
-a-a-a 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
-a-a 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-a */
?- time((between(1,30,_), acyclic2, fail; true)).
% CPU time: 0.130s, 626_829 inferences
true.
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
-a-a 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-a */
?- time((between(1,30,_), acyclic2, fail; true)).
% CPU time: 0.130s, 626_829 inferences
true.
Bye
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 54 |
| Nodes: | 6 (1 / 5) |
| Uptime: | 23:41:43 |
| Calls: | 742 |
| Files: | 1,218 |
| D/L today: |
6 files (8,794K bytes) |
| Messages: | 186,855 |
| Posted today: | 1 |