Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 27 |
Nodes: | 6 (0 / 6) |
Uptime: | 43:26:07 |
Calls: | 631 |
Calls today: | 2 |
Files: | 1,187 |
D/L today: |
24 files (29,813K bytes) |
Messages: | 175,386 |
Here is an implementation that doesnrCOt suffer from
the same anomaly. I get these results:
?- test1(X), term_vars(X, [V,W]).
X = f(g(X, W), V).
?- test2(X), term_vars(X, [V,W]).
X = f(_S1, V), % where
-a-a-a _S1 = g(f(_S1, V), W).
Only the algorithm is a little expensive. Whats
annonying that I backtrack over a bisimulation
equals. And can only collect the union find store
during a sucesss. But a failure of the bisimulation
equals does a local union find store rollback, without
keeping any partial union find results that were
from successful sub-equals calls:
term_vars(T, L) :-
-a-a term_vars([], T, []-[], L-_).
% term_vars(+List, +Term, +Pair, -Pair)
term_vars(_, V, L-P, L-P) :- var(V),
-a-a member(W, L), W == V, !.
term_vars(_, V, L-P, [V|L]-P) :- var(V), !.
term_vars(M, T, L-P, L-Q) :- compound(T),
-a-a member(S, M), equals(T, S, P, Q), !.
term_vars(M, T, L, R) :- compound(T), !,
-a-a T =..[_|A],
-a-a foldl(term_vars([T|M]), A, L, R).
term_vars(_, _, L, L).
The bisimulation equals itself is:
equals(X, Y) :-
-a-a equals(X, Y, [], _).
% equals(+Term, +Term, +List, -List)
equals(X, Y, L, R) :- compound(X), compound(Y), !,
-a-a union_find(X, L, Z),
-a-a union_find(Y, L, T),
-a-a equals2(Z, T, L, R).
equals(X, Y, L, L) :- X == Y.
equals2(X, Y, L, L) :-
-a-a same_term(X, Y), !.
equals2(X, Y, _, _) :-
-a-a functor(X, F, N),
-a-a functor(Y, G, M),
-a-a F/N \== G/M, !, fail.
equals2(X, Y, L, R) :-
-a-a X =.. [_|A],
-a-a Y =.. [_|B],
-a-a foldl(equals, A, B, [X-Y|L], R).
And the union find trivially:
union_find(X, L, T) :-
-a-a member(Y-Z, L),
-a-a same_term(X, Y), !,
-a-a union_find(Z, L, T).
union_find(X, _, X).
Mild Shock schrieb:
Take this test case:
test1(X) :- X = f(g(X,_B),_A).
test2(X) :- Y = g(f(Y,A),_B), X = f(Y,A).
Now try this (numbervars/3):
/* SWI-Prolog 9.3.26 */
?- test1(X), numbervars(X,0,_).
X = f(g(X, A), B).
?- test2(X), numbervars(X,0,_).
X = f(_S1, A), % where
-a-a-a-a _S1 = g(f(_S1, A), B).
And try this (nonground/2):
?- test1(X), nonground(X, V).
X = f(g(X, V), _).
?- test2(X), nonground(X, V).
X = f(_S1, V), % where
-a-a-a-a _S1 = g(f(_S1, V), _).
And try this (term_variables/2):
?- test1(X), term_variables(X, [V,W]).
X = f(g(X, V), W).
?- test2(X), term_variables(X, [V,W]).
X = f(_S1, V), % where
-a-a-a-a _S1 = g(f(_S1, V), W).
All 3 predicates suffer from an similar anomaly,
namely, in the first query V appears 2nd
argument of g/2, and in the second query V
appears 2nd argument of f/2. Can this be fixed?
Hi,
We are happy to announce:
Go Fund Me for ISO Core Standard of Prolog ===========================================
"The power of PrologrCoits elegant logic and unique
approach to problem-solvingrCoshould be accessible
to every curious mind, regardless of their
financial situation. Yet for many talented
students worldwide, the high cost of the
official ISO standard (approximately $220 USD)
creates a prohibitive barrier to a deep and
formal understanding of the language.
This Go Fund Me seeks to shatter that barrier.
Your contribution will directly sponsor access
to the ISO Prolog standard for students who
cannot afford it, ensuring that the next
generation of programmers, AI researchers,
and logic enthusiasts can learn from the
definitive source.
By investing in their education, you're
not just donating a document; you're fueling
innovation, diversifying the field, and
empowering the future pioneers of logic
programming. Let's ensure that a price tag
never stands in the way of a great idea."
For more information contact us at:
https://r.mtdv.me/giveaways/getisoprolog
Bye
P.S.: This Go Fund Me is not affiliated with
PEG 2.0 "The Prolog Education Group".
Mild Shock schrieb:
Here is an implementation that doesnrCOt suffer from
the same anomaly. I get these results:
?- test1(X), term_vars(X, [V,W]).
X = f(g(X, W), V).
?- test2(X), term_vars(X, [V,W]).
X = f(_S1, V), % where
-a-a-a-a _S1 = g(f(_S1, V), W).
Only the algorithm is a little expensive. Whats
annonying that I backtrack over a bisimulation
equals. And can only collect the union find store
during a sucesss. But a failure of the bisimulation
equals does a local union find store rollback, without
keeping any partial union find results that were
from successful sub-equals calls:
term_vars(T, L) :-
-a-a-a term_vars([], T, []-[], L-_).
% term_vars(+List, +Term, +Pair, -Pair)
term_vars(_, V, L-P, L-P) :- var(V),
-a-a-a member(W, L), W == V, !.
term_vars(_, V, L-P, [V|L]-P) :- var(V), !.
term_vars(M, T, L-P, L-Q) :- compound(T),
-a-a-a member(S, M), equals(T, S, P, Q), !.
term_vars(M, T, L, R) :- compound(T), !,
-a-a-a T =..[_|A],
-a-a-a foldl(term_vars([T|M]), A, L, R).
term_vars(_, _, L, L).
The bisimulation equals itself is:
equals(X, Y) :-
-a-a-a equals(X, Y, [], _).
% equals(+Term, +Term, +List, -List)
equals(X, Y, L, R) :- compound(X), compound(Y), !,
-a-a-a union_find(X, L, Z),
-a-a-a union_find(Y, L, T),
-a-a-a equals2(Z, T, L, R).
equals(X, Y, L, L) :- X == Y.
equals2(X, Y, L, L) :-
-a-a-a same_term(X, Y), !.
equals2(X, Y, _, _) :-
-a-a-a functor(X, F, N),
-a-a-a functor(Y, G, M),
-a-a-a F/N \== G/M, !, fail.
equals2(X, Y, L, R) :-
-a-a-a X =.. [_|A],
-a-a-a Y =.. [_|B],
-a-a-a foldl(equals, A, B, [X-Y|L], R).
And the union find trivially:
union_find(X, L, T) :-
-a-a-a member(Y-Z, L),
-a-a-a same_term(X, Y), !,
-a-a-a union_find(Z, L, T).
union_find(X, _, X).
Mild Shock schrieb:
Take this test case:
test1(X) :- X = f(g(X,_B),_A).
test2(X) :- Y = g(f(Y,A),_B), X = f(Y,A).
Now try this (numbervars/3):
/* SWI-Prolog 9.3.26 */
?- test1(X), numbervars(X,0,_).
X = f(g(X, A), B).
?- test2(X), numbervars(X,0,_).
X = f(_S1, A), % where
-a-a-a-a _S1 = g(f(_S1, A), B).
And try this (nonground/2):
?- test1(X), nonground(X, V).
X = f(g(X, V), _).
?- test2(X), nonground(X, V).
X = f(_S1, V), % where
-a-a-a-a _S1 = g(f(_S1, V), _).
And try this (term_variables/2):
?- test1(X), term_variables(X, [V,W]).
X = f(g(X, V), W).
?- test2(X), term_variables(X, [V,W]).
X = f(_S1, V), % where
-a-a-a-a _S1 = g(f(_S1, V), W).
All 3 predicates suffer from an similar anomaly,
namely, in the first query V appears 2nd
argument of g/2, and in the second query V
appears 2nd argument of f/2. Can this be fixed?
Hi,
How it started:
@jp-diegidio started obstructing my posts on
SWI-Prolog discourse forum, where I proposed
solutions to the new line problem, detailed
the quirks of Python universal newline.
How its going:
EricGT morons and other ban me from the
SWI-Prolog discourse forum on pretense of
aggressive behaviour. Still SWI-Prolog is
stuck with a brittle stream subsystem:
Random colorized code looks nice but isnrCOt helpful
@jp-diegidio: with a sole CR at the end https://swi-prolog.discourse.group/t/random-colorized-code-looks-nice- but-isnt-helpful/9347
"a sole CR" is exactly the newline case
that SWI-Prolog cannot handle well automatically.
How do we call this, FAFO, Fuck Around and Find Out?
F around and Find Out
https://www.youtube.com/watch?v=AOPZuXh-f5M
With morons on board like @jp-diegidio and
EricGT things only slow down, and will not
be fixed in due time.
Have Fun!
Bye
Mild Shock schrieb:
Hi,
We are happy to announce:
Go Fund Me for ISO Core Standard of Prolog
===========================================
"The power of PrologrCoits elegant logic and unique
approach to problem-solvingrCoshould be accessible
to every curious mind, regardless of their
financial situation. Yet for many talented
students worldwide, the high cost of the
official ISO standard (approximately $220 USD)
creates a prohibitive barrier to a deep and
formal understanding of the language.
This Go Fund Me seeks to shatter that barrier.
Your contribution will directly sponsor access
to the ISO Prolog standard for students who
cannot afford it, ensuring that the next
generation of programmers, AI researchers,
and logic enthusiasts can learn from the
definitive source.
By investing in their education, you're
not just donating a document; you're fueling
innovation, diversifying the field, and
empowering the future pioneers of logic
programming. Let's ensure that a price tag
never stands in the way of a great idea."
For more information contact us at:
https://r.mtdv.me/giveaways/getisoprolog
Bye
P.S.: This Go Fund Me is not affiliated with
PEG 2.0 "The Prolog Education Group".
Mild Shock schrieb:
Here is an implementation that doesnrCOt suffer from
the same anomaly. I get these results:
?- test1(X), term_vars(X, [V,W]).
X = f(g(X, W), V).
?- test2(X), term_vars(X, [V,W]).
X = f(_S1, V), % where
-a-a-a-a _S1 = g(f(_S1, V), W).
Only the algorithm is a little expensive. Whats
annonying that I backtrack over a bisimulation
equals. And can only collect the union find store
during a sucesss. But a failure of the bisimulation
equals does a local union find store rollback, without
keeping any partial union find results that were
from successful sub-equals calls:
term_vars(T, L) :-
-a-a-a term_vars([], T, []-[], L-_).
% term_vars(+List, +Term, +Pair, -Pair)
term_vars(_, V, L-P, L-P) :- var(V),
-a-a-a member(W, L), W == V, !.
term_vars(_, V, L-P, [V|L]-P) :- var(V), !.
term_vars(M, T, L-P, L-Q) :- compound(T),
-a-a-a member(S, M), equals(T, S, P, Q), !.
term_vars(M, T, L, R) :- compound(T), !,
-a-a-a T =..[_|A],
-a-a-a foldl(term_vars([T|M]), A, L, R).
term_vars(_, _, L, L).
The bisimulation equals itself is:
equals(X, Y) :-
-a-a-a equals(X, Y, [], _).
% equals(+Term, +Term, +List, -List)
equals(X, Y, L, R) :- compound(X), compound(Y), !,
-a-a-a union_find(X, L, Z),
-a-a-a union_find(Y, L, T),
-a-a-a equals2(Z, T, L, R).
equals(X, Y, L, L) :- X == Y.
equals2(X, Y, L, L) :-
-a-a-a same_term(X, Y), !.
equals2(X, Y, _, _) :-
-a-a-a functor(X, F, N),
-a-a-a functor(Y, G, M),
-a-a-a F/N \== G/M, !, fail.
equals2(X, Y, L, R) :-
-a-a-a X =.. [_|A],
-a-a-a Y =.. [_|B],
-a-a-a foldl(equals, A, B, [X-Y|L], R).
And the union find trivially:
union_find(X, L, T) :-
-a-a-a member(Y-Z, L),
-a-a-a same_term(X, Y), !,
-a-a-a union_find(Z, L, T).
union_find(X, _, X).
Mild Shock schrieb:
Take this test case:
test1(X) :- X = f(g(X,_B),_A).
test2(X) :- Y = g(f(Y,A),_B), X = f(Y,A).
Now try this (numbervars/3):
/* SWI-Prolog 9.3.26 */
?- test1(X), numbervars(X,0,_).
X = f(g(X, A), B).
?- test2(X), numbervars(X,0,_).
X = f(_S1, A), % where
-a-a-a-a _S1 = g(f(_S1, A), B).
And try this (nonground/2):
?- test1(X), nonground(X, V).
X = f(g(X, V), _).
?- test2(X), nonground(X, V).
X = f(_S1, V), % where
-a-a-a-a _S1 = g(f(_S1, V), _).
And try this (term_variables/2):
?- test1(X), term_variables(X, [V,W]).
X = f(g(X, V), W).
?- test2(X), term_variables(X, [V,W]).
X = f(_S1, V), % where
-a-a-a-a _S1 = g(f(_S1, V), W).
All 3 predicates suffer from an similar anomaly,
namely, in the first query V appears 2nd
argument of g/2, and in the second query V
appears 2nd argument of f/2. Can this be fixed?
In general, on Windows or else, I suggestsetting up your code editor(s) to only use \n
Hi,
BTW: Most Prolog Systems didn't solve it yet.
Unlike the Java solution with a state machine.
There are also solutions, especially for the terminal,
that use a timer. Like if a CR arrives, and inside
a certain time internal no LF arrives, then its
recognized as sole CR inducing a <NEWLINE>.
Sounds good, doesn't work well. What if a the
content gets piped to the stdin and has this
"abnormal" sole CR, from an old Mac file maybe,
or from an editor that produces old Mac file format?
Bye
P.S.: The Java solution is quite straight
forward from Java class LineNumberReader since
JDK 1.1. I have used the realization trick
for a while in Jekejeke Prolog, with compressing
the CR, CR LF and LF unto LF. And in Dogelog
Player I even don't compress it anymore,
which of course challenges the Prolog tokenizer.
Mild Shock schrieb:
Hi,
How it started:
@jp-diegidio started obstructing my posts on
SWI-Prolog discourse forum, where I proposed
solutions to the new line problem, detailed
the quirks of Python universal newline.
How its going:
EricGT morons and other ban me from the
SWI-Prolog discourse forum on pretense of
aggressive behaviour. Still SWI-Prolog is
stuck with a brittle stream subsystem:
Random colorized code looks nice but isnrCOt helpful
@jp-diegidio: with a sole CR at the end
https://swi-prolog.discourse.group/t/random-colorized-code-looks-nice-
but-isnt-helpful/9347
"a sole CR" is exactly the newline case
that SWI-Prolog cannot handle well automatically.
How do we call this, FAFO, Fuck Around and Find Out?
F around and Find Out
https://www.youtube.com/watch?v=AOPZuXh-f5M
With morons on board like @jp-diegidio and
EricGT things only slow down, and will not
be fixed in due time.
Have Fun!
Bye
Mild Shock schrieb:
Hi,
We are happy to announce:
Go Fund Me for ISO Core Standard of Prolog
===========================================
"The power of PrologrCoits elegant logic and unique
approach to problem-solvingrCoshould be accessible
to every curious mind, regardless of their
financial situation. Yet for many talented
students worldwide, the high cost of the
official ISO standard (approximately $220 USD)
creates a prohibitive barrier to a deep and
formal understanding of the language.
This Go Fund Me seeks to shatter that barrier.
Your contribution will directly sponsor access
to the ISO Prolog standard for students who
cannot afford it, ensuring that the next
generation of programmers, AI researchers,
and logic enthusiasts can learn from the
definitive source.
By investing in their education, you're
not just donating a document; you're fueling
innovation, diversifying the field, and
empowering the future pioneers of logic
programming. Let's ensure that a price tag
never stands in the way of a great idea."
For more information contact us at:
https://r.mtdv.me/giveaways/getisoprolog
Bye
P.S.: This Go Fund Me is not affiliated with
PEG 2.0 "The Prolog Education Group".
Mild Shock schrieb:
Here is an implementation that doesnrCOt suffer from
the same anomaly. I get these results:
?- test1(X), term_vars(X, [V,W]).
X = f(g(X, W), V).
?- test2(X), term_vars(X, [V,W]).
X = f(_S1, V), % where
-a-a-a-a _S1 = g(f(_S1, V), W).
Only the algorithm is a little expensive. Whats
annonying that I backtrack over a bisimulation
equals. And can only collect the union find store
during a sucesss. But a failure of the bisimulation
equals does a local union find store rollback, without
keeping any partial union find results that were
from successful sub-equals calls:
term_vars(T, L) :-
-a-a-a term_vars([], T, []-[], L-_).
% term_vars(+List, +Term, +Pair, -Pair)
term_vars(_, V, L-P, L-P) :- var(V),
-a-a-a member(W, L), W == V, !.
term_vars(_, V, L-P, [V|L]-P) :- var(V), !.
term_vars(M, T, L-P, L-Q) :- compound(T),
-a-a-a member(S, M), equals(T, S, P, Q), !.
term_vars(M, T, L, R) :- compound(T), !,
-a-a-a T =..[_|A],
-a-a-a foldl(term_vars([T|M]), A, L, R).
term_vars(_, _, L, L).
The bisimulation equals itself is:
equals(X, Y) :-
-a-a-a equals(X, Y, [], _).
% equals(+Term, +Term, +List, -List)
equals(X, Y, L, R) :- compound(X), compound(Y), !,
-a-a-a union_find(X, L, Z),
-a-a-a union_find(Y, L, T),
-a-a-a equals2(Z, T, L, R).
equals(X, Y, L, L) :- X == Y.
equals2(X, Y, L, L) :-
-a-a-a same_term(X, Y), !.
equals2(X, Y, _, _) :-
-a-a-a functor(X, F, N),
-a-a-a functor(Y, G, M),
-a-a-a F/N \== G/M, !, fail.
equals2(X, Y, L, R) :-
-a-a-a X =.. [_|A],
-a-a-a Y =.. [_|B],
-a-a-a foldl(equals, A, B, [X-Y|L], R).
And the union find trivially:
union_find(X, L, T) :-
-a-a-a member(Y-Z, L),
-a-a-a same_term(X, Y), !,
-a-a-a union_find(Z, L, T).
union_find(X, _, X).
Mild Shock schrieb:
Take this test case:
test1(X) :- X = f(g(X,_B),_A).
test2(X) :- Y = g(f(Y,A),_B), X = f(Y,A).
Now try this (numbervars/3):
/* SWI-Prolog 9.3.26 */
?- test1(X), numbervars(X,0,_).
X = f(g(X, A), B).
?- test2(X), numbervars(X,0,_).
X = f(_S1, A), % where
-a-a-a-a _S1 = g(f(_S1, A), B).
And try this (nonground/2):
?- test1(X), nonground(X, V).
X = f(g(X, V), _).
?- test2(X), nonground(X, V).
X = f(_S1, V), % where
-a-a-a-a _S1 = g(f(_S1, V), _).
And try this (term_variables/2):
?- test1(X), term_variables(X, [V,W]).
X = f(g(X, V), W).
?- test2(X), term_variables(X, [V,W]).
X = f(_S1, V), % where
-a-a-a-a _S1 = g(f(_S1, V), W).
All 3 predicates suffer from an similar anomaly,
namely, in the first query V appears 2nd
argument of g/2, and in the second query V
appears 2nd argument of f/2. Can this be fixed?
Hi,
How it started:
@jp-diegidio started obstructing my posts on
SWI-Prolog discourse forum, where I proposed
solutions to the new line problem, detailed
the quirks of Python universal newline.
How its going:
EricGT morons and other ban me from the
SWI-Prolog discourse forum on pretense of
aggressive behaviour. Still SWI-Prolog is
stuck with a brittle stream subsystem:
Random colorized code looks nice but isnrCOt helpful
@jp-diegidio: with a sole CR at the end https://swi-prolog.discourse.group/t/random-colorized-code-looks-nice- but-isnt-helpful/9347
"a sole CR" is exactly the newline case
that SWI-Prolog cannot handle well automatically.
How do we call this, FAFO, Fuck Around and Find Out?
F around and Find Out
https://www.youtube.com/watch?v=AOPZuXh-f5M
With morons on board like @jp-diegidio and
EricGT things only slow down, and will not
be fixed in due time.
Have Fun!
Bye
Mild Shock schrieb:
Hi,
We are happy to announce:
Go Fund Me for ISO Core Standard of Prolog
===========================================
"The power of PrologrCoits elegant logic and unique
approach to problem-solvingrCoshould be accessible
to every curious mind, regardless of their
financial situation. Yet for many talented
students worldwide, the high cost of the
official ISO standard (approximately $220 USD)
creates a prohibitive barrier to a deep and
formal understanding of the language.
This Go Fund Me seeks to shatter that barrier.
Your contribution will directly sponsor access
to the ISO Prolog standard for students who
cannot afford it, ensuring that the next
generation of programmers, AI researchers,
and logic enthusiasts can learn from the
definitive source.
By investing in their education, you're
not just donating a document; you're fueling
innovation, diversifying the field, and
empowering the future pioneers of logic
programming. Let's ensure that a price tag
never stands in the way of a great idea."
For more information contact us at:
https://r.mtdv.me/giveaways/getisoprolog
Bye
P.S.: This Go Fund Me is not affiliated with
PEG 2.0 "The Prolog Education Group".
Mild Shock schrieb:
Here is an implementation that doesnrCOt suffer from
the same anomaly. I get these results:
?- test1(X), term_vars(X, [V,W]).
X = f(g(X, W), V).
?- test2(X), term_vars(X, [V,W]).
X = f(_S1, V), % where
_S1 = g(f(_S1, V), W).
Only the algorithm is a little expensive. Whats
annonying that I backtrack over a bisimulation
equals. And can only collect the union find store
during a sucesss. But a failure of the bisimulation
equals does a local union find store rollback, without
keeping any partial union find results that were
from successful sub-equals calls:
term_vars(T, L) :-
term_vars([], T, []-[], L-_).
% term_vars(+List, +Term, +Pair, -Pair)
term_vars(_, V, L-P, L-P) :- var(V),
member(W, L), W == V, !.
term_vars(_, V, L-P, [V|L]-P) :- var(V), !.
term_vars(M, T, L-P, L-Q) :- compound(T),
member(S, M), equals(T, S, P, Q), !.
term_vars(M, T, L, R) :- compound(T), !,
T =..[_|A],
foldl(term_vars([T|M]), A, L, R).
term_vars(_, _, L, L).
The bisimulation equals itself is:
equals(X, Y) :-
equals(X, Y, [], _).
% equals(+Term, +Term, +List, -List)
equals(X, Y, L, R) :- compound(X), compound(Y), !,
union_find(X, L, Z),
union_find(Y, L, T),
equals2(Z, T, L, R).
equals(X, Y, L, L) :- X == Y.
equals2(X, Y, L, L) :-
same_term(X, Y), !.
equals2(X, Y, _, _) :-
functor(X, F, N),
functor(Y, G, M),
F/N \== G/M, !, fail.
equals2(X, Y, L, R) :-
X =.. [_|A],
Y =.. [_|B],
foldl(equals, A, B, [X-Y|L], R).
And the union find trivially:
union_find(X, L, T) :-
member(Y-Z, L),
same_term(X, Y), !,
union_find(Z, L, T).
union_find(X, _, X).
Mild Shock schrieb:
Take this test case:
test1(X) :- X = f(g(X,_B),_A).
test2(X) :- Y = g(f(Y,A),_B), X = f(Y,A).
Now try this (numbervars/3):
/* SWI-Prolog 9.3.26 */
?- test1(X), numbervars(X,0,_).
X = f(g(X, A), B).
?- test2(X), numbervars(X,0,_).
X = f(_S1, A), % where
_S1 = g(f(_S1, A), B).
And try this (nonground/2):
?- test1(X), nonground(X, V).
X = f(g(X, V), _).
?- test2(X), nonground(X, V).
X = f(_S1, V), % where
_S1 = g(f(_S1, V), _).
And try this (term_variables/2):
?- test1(X), term_variables(X, [V,W]).
X = f(g(X, V), W).
?- test2(X), term_variables(X, [V,W]).
X = f(_S1, V), % where
_S1 = g(f(_S1, V), W).
All 3 predicates suffer from an similar anomaly,
namely, in the first query V appears 2nd
argument of g/2, and in the second query V
appears 2nd argument of f/2. Can this be fixed?