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

{ ?MAP :color ?PLACES } <= {
    ((?PLACE ?X) { ?PLACE :neighbours ?Y } ?PLACES) log:collectAllIn ?SCOPE.
    ?PLACES :places true.
    true log:callWithCut true.
}.

{() :places true} <= true.

{?PLACES :places true} <= {
    ?PLACES list:firstRest ((?PLACE ?COLOR) ?TAIL).
    ?TAIL :places true.
    ?PLACE :neighbours ?NEIGHBOURS.
    (:red :green :blue :yellow) list:member ?COLOR.
    (1  {
            ?TAIL list:member (?NEIGHBOUR ?COLOR).
            ?NEIGHBOURS list:member ?NEIGHBOUR.
        } ()) log:collectAllIn ?SCOPE.
}.
