logical and set-theoretic operations

Filters may be combined using standard logical operations: not, and and or:

filter syntax          logical operation example                                   description
{filter1 filter2...} and {check Ka3 ka1} each filteri must match the current position for this filter to match
not filter not not check matches only if the argument filter does not match
filter1 or filter2 or check or attack (A q) either filter1 or filter2 (or both) must match the current position.

CQL also supports certain set-theoretic operations when all the argument filters are set filters. Each of these filters is a set filter whose associated set is the result of applying the given set-theoretic operation to its arguments:

set filter syntax                    set operation example                                   description
not set_filter complementation not A set of squares not in the set set_filter
set_filter1 on set_filter2 intersection attack (Q a) on attack (R a) intersection of sets set_filter1 and set_filter2
set_filter1 or set_filter2 union attack (Q a) or attack (q A) union of sets denoted by set_filter1 and set_filter2

Note that not and or are each set filters only if each of their arguments is also a set filter.