puremate

The puremate filter is true in a position if the position is a pure mate. A pure mate, loosely speaking, is one in which there is no unnecessary attack by the mating side on a square adjacent to the mated King or the king itself.

Participants: the value of the puremate filter

If the current position is a pure mate, the value of the puremate filter is the set of squares on which there is a participating piece. If the current position is not a pure mate, the value returned is the empty set.

If the current position is a pure mate of the black King, the participating white pieces are each white piece that either:

  1. is checking black;
  2. is checking a square adjacent to the black king;
  3. is pinned;
  4. when black is not in double check, is pinning a potential refuter; or
  5. when black is not in double check, lies between a potential refuter and a refutation square the refuter would otherwise attack.
A refutation square above is a square whose occupation by black would disrupt the mate, and is defined as either the white king, a checking piece, or a square between a checking piece and the black king. A potential refuter is a black piece that, but for checks and pins, could move to a refutation square (that is, it could make a pseudolegal move to the square).

A black piece is a participating piece in the case of a black pure mate if it is either:

  1. the black king;
  2. adjacent to the black king;
  3. blocking a check by black on the white king; or
  4. there is no double check and the piece is blocking a move by a black piece to a refutation square.

If white is in mate, the definitions above are modified accordingly.

Notes on the definition of pure mate

There are numerous mutually incompatible definitions of pure mate published and on the internet. Moreover, nearly all of these definitions are susceptible to multiple interpretations.

To begin the process of determining the definition to use with CQL, we use the following motivation (from The British Chess Magazine, August, 1898, p. 347), defining a "clean mate" as:

a mate in in which there is no unnecessary attack by the mating side on a square in the mated King's field or the king itself.

The author of this "clean mate" definition cites an early definition from the 1896 Brighton Society, but I have not been able to locate this.

The key here is that each (a) attack must be (b) necessary.

As to (a): we are looking at attacks by the attacking side. As will be seen below, some authors have suggested in their definitions that it is the attacking piece that must be necessary in some cases, or in one case the attacking move. We disagree: we think it is more intuitive to consider actual attacks, rather than the piece causing the attacks or the move leading to the attack. (By contrast, in model mates we do consider the necessity of a piece itself).

As to (b): the attack must be necessary. Many authors allow any number of attacks on attacking pieces in the king's field. For example, consider the following position:

Here, black h8 is in mate from the h7. Each empty square in the king's field is guarded once. But the h7 is attacked three times: by the g6, the h2, and the g5. Obviously, these attacks are "unnecessary" so the position should not be pure mate. Calling this pure mate in our view is not consistent with the early definitions and also not with the spirit of term. It just doesn't make intuitive sense in our opinion to allow a mate with so much superfluous attacking force and call that pure.

However, some widely available sources permitted the apparent absurdity of allowing an attacker in the king's field to be defended multiple times, e.g. the Oxford Companion to Chess (2d) edition:

pure mate, or clean mate, a checkmate that meets the following criteria: unoccupied squares in the King's Field are attacked once only; pieces that function as self-blocks are not under attack unless necessarily pinned; and the mating move is not a double check unless this is necessary to prevent the defender from interposing a man or capturing a checking piece.

Note that this allows attacking pieces to be defended multiple times - only unoccupied and self-blocking squares are restricted.

We take our definition of pure mate from the Encyclopedia of Chess Problems. We believe that in most cases this is a more authoritative source: for one thing it is exclusively focused on problem themes. It goes into far more detail, and contains far more themes, than either Wikipedia or the Oxford Companion. More important, the Encyclopedia of Chess Problems' definition simply makes more sense to us:

Mate is called pure when there is only one guard or block on each square in the (mated) King's field. Double check is allowed if the mate could be parried without it. A pin-mate is allowed if pinning is needed in mate.
Note the key change from the word attack in Oxford Companion to the word guard. This difference is significant in the cases like the following:

Here, the square f8 is not attacked at all. Therefore, under the definition in the Oxford Companion (requiring squares to be attacked once only), this would not be considered pure mate Those sources do not allow squares in the king's field to be attacked 0 times. Again, we are sure this omission is unintentional, but it is there.

pins and double check

Sources differ on whether and when double check is permitted in a pure mate. Oxford Companion states that in a pure mate, "the mating move is not a double check unless this is necessary to prevent the defender from interposing a man or capturing a checking piece."

Under the Oxford definition, there might be two identical positions, one of which is a pure mate, and one of which is not, depending only on the previous move (for example, if the previous move captured a piece that would otherwise have interposed). We again concur with Encyclopedia of Chess Problems and with the The British Chess Magazine that pure mate should be based on the position itself, not on the move history leading up to it.

This motivates our treatment of double check, following the Encyclopedia of Chess Problems:

We preliminarily say that a white piece x guards a square y in the Black King's field (which we define to exclude the king itself) if either

  • x attacks y; or
  • x would attack y if the black king were on y.
For example, in the above position, the white rook on a8 guards (but does not attack) f8.

The conditions then are:

  • Every empty square in the King's field is guarded exactly once
  • Every square with a white piece in the King's field is guarded exactly once
  • Every square with a black piece in the King's field is either unguarded or guarded once by a necessary pin

A necessary pin is a pin whose absence would allow the pinned piece either to affect the mate, either by interposing between a checker and the king, or by capturing a checker. Thus, if the king is in double check, there are no necessary pins.

Finally, double check is allowed only if the double check itself is necessary, which we interpret to mean that each check could be refuted if not for the other check, where refuted means that its checker could be captured or prevented by interposition. (Of course, the mate can never be refuted by moving the black king, because removing just a check does not change the king's flight squares). The phrase if not for the other check here means that only the attack on the king's square by that checker is counterfactually eliminated in determining whether a black piece could interpose.

modelmate

The modelmate filter is true if the current position is a model mate: a pure mate in which each non-King, non-pawn piece of the mating side participates. Thus, modelmate is true in position whenever
  {
   btm puremate
   in puremate}

(Note that the first puremate in the CQL code above cannot be omitted, because otherwise any black-to-move position that is not a pure mate would match if the only white pieces were kings and pawns.)

The value of the modelmate filter, like the puremate filter, is the set of participants in the model mate (or the empty set if there is no model mate).

idealmate

The idealmate filter is true if the current position is an ideal mate: a pure mate in which each piece participates. The idealmate filter is equivalent to:
  ==puremate

examples

To find pure mates that are not model mates, use
  puremate
  not modelmate

To sort pure mates by the number of participating black pieces in a black mate, use

  puremate btm
  sort "# participating black pieces" &puremate