@prefix list: <http://www.w3.org/2000/10/swap/list#>.
@prefix : <https://eyereasoner.github.io/eye/ns#>.

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

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

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

{() :headBody ({() :mi ?A} ?B ?Rs)} <= {
    ?A list:firstRest (?G ?Gs).
    ?B list:firstRest ({() :headBody (?G ?Goals ?Gs)} ?C).
    ?C list: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 list:firstRest ({() :natnum ?X} ?Rs).
}.
