loneknightmate.cql

The CQL file loneknightmate.cql illustrates some more basic CQL features. We assume the reader knows the basic structure of CQL, as described in explain-QQqq.cql

loneknightmate.cql line by line

The first line (ignoring comments) is
==2
The symbol is a piece designator representing the set of squares on which there is a white piece. There are three similar such piece designators: , , and which denote white pieces, black pieces, and pieces generally.

As in explain-QQqq.cql, the filter here means that there are exactly two white pieces in the positions. Since one of these is the , there is one other white piece.

The second line

indicates that a white knight attacks the black king.

The new symbol indicates attacks. This means, therefore, that the black king is in check from a white knight.

The last line, or last filter in this case, is mate, which means that the position is mate. Since black is in check, it must be black who is in mate.

Each of the three filters in the body of this CQL file must be true for the current position to match. And this happens exactly when the only white piece other than the in the position, a , gives mate.