Hey Daniel,

Thanks for the link!  I'll check that out!

I think any path through a state machine can be described, at least if you
have a way of encoding state and a transition relation/goal.  I was playing
with Dan F's missionary/cannibal problem last night, and I came up with a
`steps` goal, the first argument of which is a "transition" goal of 2
arguments. It builds lists of 0+ elements, and if there are 2 or more
elements, all the "neighboring" pairs must satisfy the "transition" goal
given.

Here's the definition:
https://gist.github.com/jonsmock/3e4abf488bfcc064f33373a3d090e027#file-missionary-cannibal-clj-L15-L25
And the usage:
https://gist.github.com/jonsmock/3e4abf488bfcc064f33373a3d090e027#file-missionary-cannibal-clj-L123

So I think what you're talking about is possible. I'll have to check out
your link, though. One thing I'm running into with this puzzle is that I
can't get my solution to come back.  I know the solution to this puzzle is
11 steps instead of 7 for the fox-goose-beans one. For each step, there are
more possibilities as well. So if you have a big model, you may run into
practical questions of performance, if the path through the space is too
long or there are too many possibilities at each step. I'm not very
experienced in making these things go fast, though. I would really like to
get this puzzle to work!

Btw, Dan F.,encoding-wise, it was a little bit tricky to figure out how to
make sure missionaries outnumber cannibals. I managed, but I'd be
interested if anyone has any other creative ideas here!

Thanks! Great puzzles!
Jon



On Tue, Jul 4, 2017 at 3:47 AM, Daniel S <[email protected]> wrote:

>
> edit:
> lets say "Start State" instead of "some State A"
>
> Am Dienstag, 4. Juli 2017 09:35:49 UTC+2 schrieb Daniel S:
>>
>> Hey Jon,
>>
>> thanks for the code. I will work through it.
>>
>> I am wondering in general if its possible to encode any arbitrary "state
>> machine" in minikanren and let minikanren search for a path
>> between some State A and some State B.
>>
>> Similar like Lesslie Lamport can do it with his TLA+ Model checker.
>>
>> He explains this principle nicely in this video, with the "Water Jug
>> Puzzle" as example:
>>
>> https://lamport.azurewebsites.net/video/video4.html
>>
>> What do you think?
>>
>> bye,
>>
>> Daniel
>>
>>
>> Am Montag, 3. Juli 2017 22:16:06 UTC+2 schrieb Smock Jonathan:
>>>
>>> Hey Daniel,
>>>
>>> I realized I could put it behind a gist link:
>>> https://gist.github.com/jonsmock/3e4abf488bfcc064f33373a3d090e027
>>>
>>> Don't look if you want to think it through, but feel free if you're
>>> stuck. The invitation to offer hints is still open as well.
>>>
>>> I think my code could be cleaned up, but I did get my recursive version
>>> working (once I noticed I had hardcoded the order of the final solution
>>> list).
>>>
>>> Let me know if you need help!
>>>
>>> Thanks,
>>> Jon
>>>
>>> On Mon, Jul 3, 2017 at 3:36 PM, Smock Jonathan <[email protected]>
>>> wrote:
>>>
>>>> Hi Daniel,
>>>>
>>>> I did this one just now:  https://en.wikipedia.org/wiki
>>>> /Fox,_goose_and_bag_of_beans_puzzle
>>>>
>>>> It looks like I can solve it, but I'm having trouble making my solution
>>>> fully recursive. Instead I had to create 8 fresh variables for the initial
>>>> state, the 6 intermediate states, and the final solution state. With that,
>>>> my solution comes back very quickly.
>>>>
>>>> Do you want to see code, or do you want hints? I don't want to spoil
>>>> it, if you want to keep working through it.
>>>>
>>>> I will say the final gotcha for me was in encoding the final solution.
>>>> I keep a list of which animals/items are on each side of the river, and
>>>> while I can give a list of animals/items of the initial state, I can't
>>>> hardcode the list on the ending state.  Instead I use a list with 3 fresh
>>>> variables. This ensures the farmer ends with all 3 items on the other side,
>>>> but it doesn't constraint the the order of the list to any particular
>>>> order. Does that make sense?
>>>>
>>>> Let me know how I can help! Good luck!
>>>>
>>>> Jon
>>>>
>>>> On Mon, Jul 3, 2017 at 11:06 AM, Daniel S <[email protected]> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> anyone solved the River Crossing Puzzle (https://en.wikipedia.org/wiki
>>>>> /River_crossing_puzzle)
>>>>> with minikanren yet?
>>>>>
>>>>> bye
>>>>>
>>>>> Daniel
>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "minikanren" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> Visit this group at https://groups.google.com/group/minikanren.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "minikanren" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/minikanren.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"minikanren" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/minikanren.
For more options, visit https://groups.google.com/d/optout.

Reply via email to