Overview of ←
The ←
filter (ascii <-
) is the dual of → .
As with →
we can divide usages of ←
into binary, ternary, and n-ary forms.
A ←
filter is true exactly when the →
filter formed by reversing all the arrows and the order of the constituent filters is true:
y←x
is true exactly when
y→x
is true.
z←y←xis true exactly when
x→y→zis true.
value returned by ←
The reason to use ←
rather than →
is that the value returned by the filters is different.
The value returned by y→x
is all squares in y
that are attacked by x
.
In general, if Z is a set filter, then the value of a chain of ←
filters is loosely speaking, all the squares in the first filter in the chain that make the filter true.
←, binary case
The filter
x←y
is true exactly when
y→x
is true.
However, the value of
y←x
is the set of squares in y that are attacked by a piece in x.
For example, if the current position is the start position, then
♙←♘ ≡ [e2,d2]
← chains
z←y←zmatches a position if and only if
x→y→zmatches the position.
The value returned by
z←y←zis the set of squares Z in z such that
Z←y←xmatches the position.
Likewise,
x1→x2→x3→...→xnmatches a position if and only if
xn←xn-1←...←x1matches the position.
As before, the value of
xn←xn-1←...←x1is the set of X in xn such that
X←xn-1←...←x1
Examples
The black king's field, which is the set of squares attacked by the black king, is▦←♚
Thus, to check that a white pawn is guarding an empty square in the black king's field, use:
♙→(□←♚)
To check that the maximum 27 squares are attacked by a white queen, use
▦←♕==27(As in maxqueenattack.cql).