@prefix e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>.
@prefix : <https://josd.github.io/eye/ns#>.

{() :mi ()} <= true.

{() :mi ?A} <= {
    ?A e:firstRest (?G ?Gs).
    () :headBody (?G ?Goals ?Gs).
    () :mi ?Goals.
}.

{() :headBody ({() :mi ()} ?Rs ?Rs)} <= true.

{() :headBody ({() :mi ?A} ?B ?Rs)} <= {
    ?A e:firstRest (?G ?Gs).
    ?B e:firstRest ({() :headBody (?G ?Goals ?Gs)} ?C).
    ?C e:firstRest ({() :mi ?Goals} ?Rs).
}.

{() :headBody ({() :headBody (?Head ?Goals0 ?Goals)} ?Rs ?Rs)} <= {
    () :headBody (?Head ?Goals0 ?Goals).
}.

{() :headBody ({() :natnum (0)} ?Rs ?Rs)} <= true.

{() :headBody ({() :natnum (:s ?X)} ?A ?Rs)} <= {
    ?A e:firstRest ({() :natnum ?X} ?Rs).
}.
