Please solve this with logic:
When Alice entered the forest of forgetfulness, she did not
forget everything, only certain things. She often forgot her
name, and the most likely thing for her to forget was the day
of the week. Now, the lion and the unicorn were frequent
visitors to this forest. These two are strange creatures. The
lion lies on Mondays, Tuesdays, and Wednesdays and tells
the truth on the other days of the week. The unicorn, on the
other hand, lies on Thursdays, Fridays, and Saturdays, but tells
the truth on the other days of the week.
One day Alice met the lion and the unicorn resting under a tree.
They made the following statements:
Lion: Yesterday was one of my lying days.
Unicorn: Yesterday was one of my lying days.
From these statements, Alice, who was a bright girl, was able to
deduce the day of the week. What was it?
P.S.: Please no DC Proof solutions where animals outside
of the forest appear because of Russell Paradox.
I got the puzzle from a discussion here,--- Synchronet 3.20a-Linux NewsLink 1.114
which was about Prolog versus Theorem Proving:
The lion and the unicorn met PROLOG
Bruce D. Ramsey, 1986 - Free Access https://dl.acm.org/doi/10.1145/382278.382395
This gives immediately the following database:
yesterday(monday , sunday ).
yesterday(tuesday , monday ).
yesterday(wednesday, tuesday ).
yesterday(thursday , wednesday).
yesterday(friday , thursday ).
yesterday(saturday , friday ).
yesterday(sunday , saturday ).
lies(lion, monday ).
lies(lion, tuesday ).
lies(lion, wednesday).
lies(unicorn, thursday).
lies(unicorn, friday ).
lies(unicorn, saturday).
Now what?
Picking up an idea by @jamesnvc , abstracting a pattern--- Synchronet 3.20a-Linux NewsLink 1.114
behind lying_day_lie_or_nonlying_day_truth/3 into something
with more meta calls:
contrary(S, T) :- S, \+ T.
contrary(S, T) :- \+ S, T.
solve(D) :- yesterday(D, Y),
contrary(lies(lion, D), lies(lion, Y)),
contrary(lies(unicorn, D), lies(unicorn, Y)).
Here some benchmark:
/* SWI-Prolog 9.1.17 */
?- time((between(1,1000000,_), solve(_), fail; true)).
% 45,999,999 inferences, 2.719 CPU in 2.712 seconds (100% CPU, 16919540 Lips)
true.
/* Dogelog Player 1.1.3, Java */
?- time((between(1,1000000,_), solve(_), fail; true)).
% Zeit 9282 ms, GC 0 ms, Lips 10019403, Uhr 06.11.2023 16:34
true.
/* GNU Prolog 1.5.0 */
?- between(1,1000000,_), solve(_), fail; true.
(10782 ms) yes
Quite amazing the speed of SWI-Prolog, here I can only beat GNU Prolog
with my new Dogelog Player for Java. Mostlikely an argument in favor of inlining
negation as failure somehow, as SWI-Prolog does. Only lets do it correctly! Mild Shock schrieb am Montag, 6. November 2023 um 16:43:13 UTC+1:
I got the puzzle from a discussion here,
which was about Prolog versus Theorem Proving:
The lion and the unicorn met PROLOG
Bruce D. Ramsey, 1986 - Free Access https://dl.acm.org/doi/10.1145/382278.382395
This gives immediately the following database:
yesterday(monday , sunday ).
yesterday(tuesday , monday ).
yesterday(wednesday, tuesday ).
yesterday(thursday , wednesday).
yesterday(friday , thursday ).
yesterday(saturday , friday ).
yesterday(sunday , saturday ).
lies(lion, monday ).
lies(lion, tuesday ).
lies(lion, wednesday).
lies(unicorn, thursday).
lies(unicorn, friday ).
lies(unicorn, saturday).
Now what?
Its also a test case where my sys_trans_allowed/1 is totally useless. But--- Synchronet 3.20a-Linux NewsLink 1.114
I guess this is a problem of my sys_trans_allowed/1, maybe we can make an exception for \+ A where A is a variable and arrive at something useful?
If A is a variable, and if we would replace it by (A->fail; true) this would be compiled with call(A), and thus give a correct translation of negation as failure again. Its a similar special case like call/1 has the special case that
at runtime call(A) with A variable throws an exception to avoid call/1 wrapping at infinitum and that the Prolog interpreter runs into nirvana.
So the revised sys_trans_allowed/1 would read as follows:
/* Version 2.0 */
sys_trans_allowed(V) :- var(V), !.
sys_trans_allowed(A) :- sys_trans_allowed2(A).
sys_trans_allowed2(V) :- var(V), !, fail.
sys_trans_allowed2((A,B)) :- sys_trans_allowed2(A), sys_trans_allowed2(B). sys_trans_allowed2((A;B)) :- sys_trans_allowed2(A), sys_trans_allowed2(B). sys_trans_allowed2((A->B)) :- sys_trans_allowed2(A), sys_trans_allowed2(B). sys_trans_allowed2(A) :- callable(A).
But I guess a little more is needed. Namely make (A->fail; true) cheap.
Mild Shock schrieb am Montag, 6. November 2023 um 16:47:40 UTC+1:
Picking up an idea by @jamesnvc , abstracting a pattern
behind lying_day_lie_or_nonlying_day_truth/3 into something
with more meta calls:
contrary(S, T) :- S, \+ T.
contrary(S, T) :- \+ S, T.
solve(D) :- yesterday(D, Y),
contrary(lies(lion, D), lies(lion, Y)),
contrary(lies(unicorn, D), lies(unicorn, Y)).
Here some benchmark:
/* SWI-Prolog 9.1.17 */
?- time((between(1,1000000,_), solve(_), fail; true)).
% 45,999,999 inferences, 2.719 CPU in 2.712 seconds (100% CPU, 16919540 Lips)
true.
/* Dogelog Player 1.1.3, Java */
?- time((between(1,1000000,_), solve(_), fail; true)).
% Zeit 9282 ms, GC 0 ms, Lips 10019403, Uhr 06.11.2023 16:34
true.
/* GNU Prolog 1.5.0 */
?- between(1,1000000,_), solve(_), fail; true.
(10782 ms) yes
Quite amazing the speed of SWI-Prolog, here I can only beat GNU Prolog with my new Dogelog Player for Java. Mostlikely an argument in favor of inlining
negation as failure somehow, as SWI-Prolog does. Only lets do it correctly!
Mild Shock schrieb am Montag, 6. November 2023 um 16:43:13 UTC+1:
I got the puzzle from a discussion here,
which was about Prolog versus Theorem Proving:
The lion and the unicorn met PROLOG
Bruce D. Ramsey, 1986 - Free Access https://dl.acm.org/doi/10.1145/382278.382395
This gives immediately the following database:
yesterday(monday , sunday ).
yesterday(tuesday , monday ).
yesterday(wednesday, tuesday ).
yesterday(thursday , wednesday).
yesterday(friday , thursday ).
yesterday(saturday , friday ).
yesterday(sunday , saturday ).
lies(lion, monday ).
lies(lion, tuesday ).
lies(lion, wednesday).
lies(unicorn, thursday).
lies(unicorn, friday ).
lies(unicorn, saturday).
Now what?
Just for the fun of it, also benchmarking,--- Synchronet 3.20a-Linux NewsLink 1.114
was expecting same behaviour as contrary2:
contrary5(S, T) :- \+ (forall(S,T), forall(T,S)).¨
Not so good because forall/2 isn’t handled as a “control construct”, whereas (\+)/1 is handled as a “control construct” and inlined.
Maybe this is the reason:
/* contrary5 */
?- time((between(1,1000000,_), solve(_), fail; true)).
% 65,999,999 inferences, 2.812 CPU in 2.813 seconds (100% CPU, 23466666 Lips)
true.
So contrary is the XOR, i.e. ~(A ↔ B) == ~((A → B) & (B → A)).
What can a constraint programming system do to the Lion and Unicorn
example. Are there not special SAT solvers who are good in XOR?
Long live SMT. Long live meta-programmingThis article describes why and how I wrote absolut; a Rust
Could ChatGPT, the automatic programming Robot,--- Synchronet 3.20a-Linux NewsLink 1.114
help develop a solution with a SAT solver for XOR in mind?
My idea currently, use 3 variables X,Y,Z for weekday:
X,Y,Z weekday
0,0,0 monday
0,0,1 tuesday
0,1,0 wednesday
0,1,1 thursday
1,0,0 friday
1,0,1 saturday
1,1,0 sunday
Or maybe somebody, a human, did it already this way.
Mild Shock schrieb am Samstag, 11. November 2023 um 18:33:50 UTC+1:
Just for the fun of it, also benchmarking,
was expecting same behaviour as contrary2:
contrary5(S, T) :- \+ (forall(S,T), forall(T,S)).¨
Not so good because forall/2 isn’t handled as a “control construct”, whereas (\+)/1 is handled as a “control construct” and inlined.
Maybe this is the reason:
/* contrary5 */
?- time((between(1,1000000,_), solve(_), fail; true)).
% 65,999,999 inferences, 2.812 CPU in 2.813 seconds (100% CPU, 23466666 Lips)
true.
So contrary is the XOR, i.e. ~(A ↔ B) == ~((A → B) & (B → A)).
What can a constraint programming system do to the Lion and Unicorn example. Are there not special SAT solvers who are good in XOR?
Ok, I was using a SAT solver in a little unorthodox way.--- Synchronet 3.20a-Linux NewsLink 1.114
Used it as a compiler for a formula, so that I got:
yesterday(0,0,0,1,1,0).
yesterday(0,0,1,0,0,0).
yesterday(0,1,0,0,0,1).
yesterday(0,1,1,0,1,0).
yesterday(1,0,0,0,1,1).
yesterday(1,0,1,1,0,0).
yesterday(1,1,0,1,0,1).
two_liars(T1,T2,T3,Y1,Y2,Y3) :-
T1=\=Y1,
T1=:=(T1/\Y2) xor (T1/\Y3) xor (Y2/\Y3),
Y1=:=(T2/\T3) xor (T2/\Y1) xor (T3/\Y1),
T1=\=(T1/\T2) xor (T1/\T3) xor T2 xor (T2/\T3) xor T3,
Y1=\=(Y1/\Y2) xor (Y1/\Y3) xor Y2 xor (Y2/\Y3) xor Y3.
solve_for(T1,T2,T3) :-
yesterday(T1,T2,T3,Y1,Y2,Y3),
two_liars(T1,T2,T3,Y1,Y2,Y3).
Works fine:
/* SWI-Prolog 9.1.17, optimise=false */
?- time(solve_for(T1,T2,T3)).
% 16 inferences, 0.000 CPU in 0.000 seconds (0% CPU, Infinite Lips)
T1 = 1,
T2 = T3, T3 = 0 ;
% 10 inferences, 0.000 CPU in 0.000 seconds (0% CPU, Infinite Lips)
false.
But I guess I always miss launching SWI-Prolog with optimise=true,--- Synchronet 3.20a-Linux NewsLink 1.114
and the version I am using has default optimise=false.
Because I get these varying results:
/* SWI-Prolog 9.1.17, optimise=false */
?- time((between(1, 1000000, _), solve_for(T1,T2,T3), fail; true)).
% 22,999,999 inferences, 2.016 CPU in 2.016 seconds
(100% CPU, 11410852 Lips)
/* SWI-Prolog 9.1.17, optimise=true */
?- time((between(1, 1000000, _), solve_for(T1,T2,T3), fail; true)).
% 9,999,999 inferences, 1.203 CPU in 1.199 seconds
(100% CPU, 8311687 Lips)
Whereas in Dogelog Player I have now practically always
optimise=true, which then gives me the following:
/* Dogelog Player 1.1.4, JDK 8 */
?- time((between(1, 1000000, _), solve_for(T1,T2,T3), fail; true)).
% Zeit 1892 ms, GC 0 ms, Lips 13213582, Uhr 13.11.2023 23:54
Mild Shock schrieb am Dienstag, 14. November 2023 um 00:11:37 UTC+1:
Ok, I was using a SAT solver in a little unorthodox way.
Used it as a compiler for a formula, so that I got:
yesterday(0,0,0,1,1,0).
yesterday(0,0,1,0,0,0).
yesterday(0,1,0,0,0,1).
yesterday(0,1,1,0,1,0).
yesterday(1,0,0,0,1,1).
yesterday(1,0,1,1,0,0).
yesterday(1,1,0,1,0,1).
two_liars(T1,T2,T3,Y1,Y2,Y3) :-
T1=\=Y1,
T1=:=(T1/\Y2) xor (T1/\Y3) xor (Y2/\Y3),
Y1=:=(T2/\T3) xor (T2/\Y1) xor (T3/\Y1),
T1=\=(T1/\T2) xor (T1/\T3) xor T2 xor (T2/\T3) xor T3,
Y1=\=(Y1/\Y2) xor (Y1/\Y3) xor Y2 xor (Y2/\Y3) xor Y3.
solve_for(T1,T2,T3) :-
yesterday(T1,T2,T3,Y1,Y2,Y3),
two_liars(T1,T2,T3,Y1,Y2,Y3).
Works fine:
/* SWI-Prolog 9.1.17, optimise=false */
?- time(solve_for(T1,T2,T3)).
% 16 inferences, 0.000 CPU in 0.000 seconds (0% CPU, Infinite Lips)
T1 = 1,
T2 = T3, T3 = 0 ;
% 10 inferences, 0.000 CPU in 0.000 seconds (0% CPU, Infinite Lips)
false.
Please solve this with logic:--- Synchronet 3.20a-Linux NewsLink 1.114
When Alice entered the forest of forgetfulness, she did not
forget everything, only certain things. She often forgot her
name, and the most likely thing for her to forget was the day
of the week. Now, the lion and the unicorn were frequent
visitors to this forest. These two are strange creatures. The
lion lies on Mondays, Tuesdays, and Wednesdays and tells
the truth on the other days of the week. The unicorn, on the
other hand, lies on Thursdays, Fridays, and Saturdays, but tells
the truth on the other days of the week.
One day Alice met the lion and the unicorn resting under a tree.
They made the following statements:
Lion: Yesterday was one of my lying days.
Unicorn: Yesterday was one of my lying days.
From these statements, Alice, who was a bright girl, was able to
deduce the day of the week. What was it?
P.S.: Please no DC Proof solutions where animals outside
of the forest appear because of Russell Paradox.
Please solve this with logic:--- Synchronet 3.20a-Linux NewsLink 1.114
When Alice entered the forest of forgetfulness, she did not
forget everything, only certain things. She often forgot her
name, and the most likely thing for her to forget was the day
of the week. Now, the lion and the unicorn were frequent
visitors to this forest. These two are strange creatures. The
lion lies on Mondays, Tuesdays, and Wednesdays and tells
the truth on the other days of the week. The unicorn, on the
other hand, lies on Thursdays, Fridays, and Saturdays, but tells
the truth on the other days of the week.
One day Alice met the lion and the unicorn resting under a tree.
They made the following statements:
Lion: Yesterday was one of my lying days.
Unicorn: Yesterday was one of my lying days.
From these statements, Alice, who was a bright girl, was able to
deduce the day of the week. What was it?
P.S.: Please no DC Proof solutions where animals outside
of the forest appear because of Russell Paradox.
Ha Ha, board fired Sam Altman of OpenAI.--- Synchronet 3.20a-Linux NewsLink 1.114
What now? What will become of ChatGPT?
Mild Shock schrieb am Montag, 6. November 2023 um 01:42:59 UTC+1:
Please solve this with logic:
When Alice entered the forest of forgetfulness, she did not
forget everything, only certain things. She often forgot her
name, and the most likely thing for her to forget was the day
of the week. Now, the lion and the unicorn were frequent
visitors to this forest. These two are strange creatures. The
lion lies on Mondays, Tuesdays, and Wednesdays and tells
the truth on the other days of the week. The unicorn, on the
other hand, lies on Thursdays, Fridays, and Saturdays, but tells
the truth on the other days of the week.
One day Alice met the lion and the unicorn resting under a tree.
They made the following statements:
Lion: Yesterday was one of my lying days.
Unicorn: Yesterday was one of my lying days.
From these statements, Alice, who was a bright girl, was able to
deduce the day of the week. What was it?
P.S.: Please no DC Proof solutions where animals outside
of the forest appear because of Russell Paradox.
Comedy on the horizon and lots of tech penny stocks to buy!--- Synchronet 3.20a-Linux NewsLink 1.114
Before you criticize the board at OpenAI, walk a mile in their shoes:
VCs Congratulating Themselves 👏👏👏 https://twitter.com/VCBrags/status/1725976543585784022
LoL
Mild Shock schrieb am Sonntag, 19. November 2023 um 03:57:40 UTC+1:
Ha Ha, board fired Sam Altman of OpenAI.
What now? What will become of ChatGPT?
Mild Shock schrieb am Montag, 6. November 2023 um 01:42:59 UTC+1:
Please solve this with logic:
When Alice entered the forest of forgetfulness, she did not
forget everything, only certain things. She often forgot her
name, and the most likely thing for her to forget was the day
of the week. Now, the lion and the unicorn were frequent
visitors to this forest. These two are strange creatures. The
lion lies on Mondays, Tuesdays, and Wednesdays and tells
the truth on the other days of the week. The unicorn, on the
other hand, lies on Thursdays, Fridays, and Saturdays, but tells
the truth on the other days of the week.
One day Alice met the lion and the unicorn resting under a tree.
They made the following statements:
Lion: Yesterday was one of my lying days.
Unicorn: Yesterday was one of my lying days.
From these statements, Alice, who was a bright girl, was able to
deduce the day of the week. What was it?
P.S.: Please no DC Proof solutions where animals outside
of the forest appear because of Russell Paradox.
Fuck around find out. Guess who is a board reporting--- Synchronet 3.20a-Linux NewsLink 1.114
to? Well the stock holders, and they are reinstantiating
the board every year. So if stock holders want Sam
Altman, stock holders will have Sam Altman, they simply
send the board into /dev/null and create a new one.
BTW: Interesting information about the board,
didn't think they have relation to Sam Bankman-Fired,
and hence its rewarding to listen to TiffanyFong:
s Sam Altman BACK as CEO of OpenAI?
Board Resigning & “Effective Altruism” Ties [UPDATE] https://www.youtube.com/watch?v=LXDWy5-bc-c
Yeah, get your finger off EA, see FTX fiasko.
Mild Shock schrieb am Sonntag, 19. November 2023 um 04:08:02 UTC+1:
Comedy on the horizon and lots of tech penny stocks to buy!
Before you criticize the board at OpenAI, walk a mile in their shoes:
VCs Congratulating Themselves 👏👏👏 https://twitter.com/VCBrags/status/1725976543585784022
LoL
Mild Shock schrieb am Sonntag, 19. November 2023 um 03:57:40 UTC+1:
Ha Ha, board fired Sam Altman of OpenAI.
What now? What will become of ChatGPT?
Mild Shock schrieb am Montag, 6. November 2023 um 01:42:59 UTC+1:
Please solve this with logic:
When Alice entered the forest of forgetfulness, she did not
forget everything, only certain things. She often forgot her
name, and the most likely thing for her to forget was the day
of the week. Now, the lion and the unicorn were frequent
visitors to this forest. These two are strange creatures. The
lion lies on Mondays, Tuesdays, and Wednesdays and tells
the truth on the other days of the week. The unicorn, on the
other hand, lies on Thursdays, Fridays, and Saturdays, but tells
the truth on the other days of the week.
One day Alice met the lion and the unicorn resting under a tree.
They made the following statements:
Lion: Yesterday was one of my lying days.
Unicorn: Yesterday was one of my lying days.
From these statements, Alice, who was a bright girl, was able to deduce the day of the week. What was it?
P.S.: Please no DC Proof solutions where animals outside
of the forest appear because of Russell Paradox.
Some actors are messing real hard with OpenAI.--- Synchronet 3.20a-Linux NewsLink 1.114
My prediction, the only goal is to dissolve OpenAI.
Take the nomination of Emmett Shear. It shows
how unprepared and desperate the board is.
Mostlikely he will not accept the nomination, since
we wont hear anything of OpenAI anymore in the
future. Well he might lead its liquidation. But It
was just a start-up, a short episode, not the
beginning of a new behemoth.
Mild Shock schrieb am Montag, 20. November 2023 um 02:24:29 UTC+1:
Fuck around find out. Guess who is a board reporting
to? Well the stock holders, and they are reinstantiating
the board every year. So if stock holders want Sam
Altman, stock holders will have Sam Altman, they simply
send the board into /dev/null and create a new one.
BTW: Interesting information about the board,
didn't think they have relation to Sam Bankman-Fired,
and hence its rewarding to listen to TiffanyFong:
s Sam Altman BACK as CEO of OpenAI?
Board Resigning & “Effective Altruism” Ties [UPDATE] https://www.youtube.com/watch?v=LXDWy5-bc-c
Yeah, get your finger off EA, see FTX fiasko.
Mild Shock schrieb am Sonntag, 19. November 2023 um 04:08:02 UTC+1:
Comedy on the horizon and lots of tech penny stocks to buy!
Before you criticize the board at OpenAI, walk a mile in their shoes:
VCs Congratulating Themselves 👏👏👏 https://twitter.com/VCBrags/status/1725976543585784022
LoL
Mild Shock schrieb am Sonntag, 19. November 2023 um 03:57:40 UTC+1:
Ha Ha, board fired Sam Altman of OpenAI.
What now? What will become of ChatGPT?
Mild Shock schrieb am Montag, 6. November 2023 um 01:42:59 UTC+1:
Please solve this with logic:
When Alice entered the forest of forgetfulness, she did not
forget everything, only certain things. She often forgot her
name, and the most likely thing for her to forget was the day
of the week. Now, the lion and the unicorn were frequent
visitors to this forest. These two are strange creatures. The
lion lies on Mondays, Tuesdays, and Wednesdays and tells
the truth on the other days of the week. The unicorn, on the
other hand, lies on Thursdays, Fridays, and Saturdays, but tells
the truth on the other days of the week.
One day Alice met the lion and the unicorn resting under a tree. They made the following statements:
Lion: Yesterday was one of my lying days.
Unicorn: Yesterday was one of my lying days.
From these statements, Alice, who was a bright girl, was able to deduce the day of the week. What was it?
P.S.: Please no DC Proof solutions where animals outside
of the forest appear because of Russell Paradox.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 920 |
Nodes: | 10 (1 / 9) |
Uptime: | 77:48:01 |
Calls: | 12,187 |
Calls today: | 2 |
Files: | 186,526 |
Messages: | 2,236,890 |