# 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 →

If*x*

and *y*

are set filters, then
matches the current position if a piece onx→y

*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 ofis the set of squares inX→Y

*Y*

that attack a square in *Y*

.
This is equivalent to

x∊Xx→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 filteris true exactly whenx←y

is true.y→x

However, the value of

is the set of squares iny←x

*y*that are attacked by a piece in

*x*.

For example, if the current position is the start position, then

♙←♘ ≡ [e2,d2]

# ternary →

Suppose that*x*

, *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

as being a sort of generalized pin. In fact, this matches a position exactly whenx→y→z

pin frommatches the position.xthroughytoz

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*

, and *y*

denoted a single square.
*z*

In general there can be multiple squares denoted by each of these set filters. In the case, we say that

matches a position if there are squaresx→y→z

*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 ofis the set of squaresx→y→z

*X*

in *x*such that

.X→y→z

This can be written

.X∊xX→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 chainfor some integerx_{1}→x_{2}→x_{3}→...→x_{n}

*n*≥4.

First, suppose each

has only one square.
The the chain matches a position in that case that, if empty squares were placed on each square
*x*_{i}

thenx_{2},x_{3},...,x_{n-1}

*x*_{1}

would attack *x*_{n}

.
But if any one of those
squares were occupied, then
*x*_{1}

would not attack *x*_{n}

.
As before, in the general case where each

could hold more than one square, we say that
*x*_{i}

if there are squaresx_{1}→x_{2}→x_{3}→...→x_{n}

such thatX_{1}inx_{1},X_{2}inx_{2}, ... ,X_{n}inx_{n}

For example, suppose the current position is the chess starting position. Then the following filters are all true:X_{1}→X_{2}→X_{3}→...→X_{n}

♕→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 chainis the set of squaresx_{1}→x_{2}→x_{3}→...→x_{n}

*X* in *x*_{1}

such that

X_{1}→x_{2}→x_{3}→...→x_{n}

For example, the set of white pieces pinning some black piece is:

△→▲→♚

# ← chains

matches a position if and only ifz←y←z

matches the position.x→y→z

The value returned by

is the set of squaresz←y←z

*Z*in

*z*such that

matches the position.Z←y←x

Likewise,

matches a position if and only ifx_{1}→x_{2}→x_{3}→...→x_{n}

matches the position.x_{n}←x_{n-1}←...←x_{1}

As before, the value of

is the set ofx_{n}←x_{n-1}←...←x_{1}

*X*in

*x*

_{n}such that

X←x_{n-1}←...←x_{1}

# 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.