# Towers of Hanoi

@prefix math: <http://www.w3.org/2000/10/swap/math#>.
@prefix list: <http://www.w3.org/2000/10/swap/list#>.
@prefix e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>.
@prefix : <https://eyereasoner.github.io/eye/reasoning#>.

# ?M is the sequence of moves to move ?N disks from ?X to ?Y using ?Z as intermediary
{(?N ?X ?Y ?Z) :moves ?M} <=
{   ?N math:greaterThan 1.
    (?N 1) math:difference ?N1.
    (?N1 ?X ?Z ?Y) :moves ?M1.
    (?N1 ?Z ?Y ?X) :moves ?M2.
    (?M1 ((?X ?Y)) ?M2) list:append ?M.
}.
{(1 ?X ?Y ?Z) :moves ((?X ?Y))} <= true.

{(3 :left :right :center) :moves ?M} => {3 :answer ?M}.
