Overview of →
There are three kinds of →
filter: the binary form, the ternary form, and the n-ary form for n>3
.
The ASCII form of →
is ->
.
The binary form of the → filter denotes an attack by a piece on a square:
♖→d4 //♖ attacks d4
The ternary form deals with pins and simple interferences:
♖→♞→♚ //♞ pinned by ♖ ♕→♙→h8 //♙ is between ♕ and h8
The n-ary form, of which the ternary form is a special case, is less commonly used:
♕→♙→♙→h8means that there are two distinct white pawns preventing an attack of ♕ on
h8
.
Each of these forms are discussed in more detail below.
binary →
Ifx
and y
are set filters, then
x→y
matches the current position if a piece on x
attacks a piece on y
.
A piece u is said to attack a square v if a king of different color than u would be in check from u if that king was on v.
For example, suppose that the current position is the chess start position. The following filters are all true:
d1→e2 ♕→e2 e2→d3 not ♕→d4 ♘g1→f3
Note that the check filter can be written in terms of →:
check ≡ △→♚ or ▲→♔ ≡ ⬓△→♚
Now suppose we remove all the pawns from the start position. Then the following filters are all true:
♕→d8 ♕→♛ ♗→g5
Value returned by →
The value of
X→Y
is the set of squares in Y
that attack a square in Y
.
This is equivalent to
x∊X x→Y
For example, suppose the current position is the start position in chess. Then
♙→f3 ≡ [g2,e2]and
△→f3 ≡ [g2,e2,g1]
←, 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]
ternary →
Suppose thatx
, y
and z
are set filters each representing a single square in the current position. We will identify the set filter with the set of squares it represents as usual.
One can think of
x→y→zas being a sort of generalized pin. In fact, this matches a position exactly when
pin from x through y to zmatches the position.
The ternary → filter
x→y→z
matches a position if each of the following four conditions is true:
- There is a sliding piece on x which attacks y
- y is between x and z
- Any squares between x and y are empty
- Any squares between y and z are empty
The above discussion was limited to the case where x
, y
, and z
denoted a single square.
In general there can be multiple squares denoted by each of these set filters. In the case, we say that
x→y→zmatches a position if there are squares X, Y, Z, in x, y, z respectively such that
X→Y→Z
Examples of ternary →
♖→▲→♚matches positions where a black piece is pinned by a white rook.
♕→△→♚matches positions where there is a single white piece between a ♕ and the ♚.
If the current position is the start position, then following are true:
d1→d2→d7 ♗→♙→g5
The value of the ternary →
The value ofx→y→zis the set of squares
X
in x such that
X→y→z.
This can be written
X∊x X→y→z.
ternary → versus nested binary →
You can use parentheses to prevent ternary evaluation of →. For example,♝→♖→♔is true if a white rook is pinned by a black bishop. But
♝→(♖→♔)is true if a black bishop is attacking a white rook which is itself attacking the white king.
n-ary →
Chains with more than two → symbols are much rarer but are treated similarly (this section can be safely skipped unless necessary). More formally, consider a chainx1→x2→x3→...→xnfor some integer n≥4.
First, suppose each xi
has only one square.
The the chain matches a position in that case that, if empty squares were placed on each square
x2,x3,...,xn-1then
x1
would attack xn
.
But if any one of those
squares were occupied, then
x1
would not attack xn
.
As before, in the general case where each xi
could hold more than one square, we say that
x1→x2→x3→...→xnif there are squares
X1 in x1, X2 in x2, ... , Xn in xnsuch that
X1→X2→X3→...→XnFor example, suppose the current position is the chess starting position. Then the following filters are all true:
♕→d2→d7→d8 h1→h2→h4→h7→h8 h1→g1→f1→e1However:
not ♕→d2→d7→e7 not h1→h3→h7→h8
The value returned by → chains
The value of a filter returned by a chainx1→x2→x3→...→xnis the set of squares
X in x1
such that
X1→x2→x3→...→xn
For example, the set of white pieces pinning some black piece is:
△→▲→♚
← 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
There are many examples of simple → denoting attacks in the examples, for example, in turton.cql.There are also a number of examples of length-3 → chains
x→y→z.
One use is to detect moves crossing a particular square.
The filter
⊢ ―― from→d4→tomatches positions where the next move is a sliding move that crosses the square
d4
.
That is because, from
here is the departing square and to
is the arriving square of the move matching ――
.
In many studies derived from problem themes, such as Bristol and Turton, a critical square must be crossed by a particular move. This usage occurs in turton.cql and bristol-universal.cql.
There are only two themes in our corpus where length-4 → chains arise naturally: in indian.cql and likeinterference.cql. We have yet to see a true length-5 → chain arise naturally however.