@@ -100,12 +100,12 @@ As a consequence, ``A != B`` has a very different meaning to the :ref:`negation
100100 - ``1 = [1 .. 2] `` holds, because ``1 = 1 ``.
101101 - ``not 1 = [1 .. 2] `` doesn't hold, because there is a common value (``1 ``).
102102
103- #. Compare ``1 `` and ``none() `` (the " empty set" ):
104- - ``1 != none () `` doesn't hold, because there are no values in ``none () ``, so no values
103+ #. Compare ``1 `` and ``int empty() { none() } `` (a predicate defining the empty set of integers ):
104+ - ``1 != empty () `` doesn't hold, because there are no values in ``empty () ``, so no values
105105 that are not equal to ``1 ``.
106- - ``1 = none () `` also doesn't hold, because there are no values in ``none () ``, so no values
106+ - ``1 = empty () `` also doesn't hold, because there are no values in ``empty () ``, so no values
107107 that are equal to ``1 ``.
108- - ``not 1 = none () `` holds, because there are no common values.
108+ - ``not 1 = empty () `` holds, because there are no common values.
109109
110110.. index :: instanceof
111111.. _type-checks :
@@ -295,9 +295,48 @@ necessary, since they highlight the default precedence. You usually only add par
295295override the default precedence, but you can also add them to make your code easier to read
296296(even if they aren't required).
297297
298+ QL also has two nullary connectives indicating the always true formula,
299+ ``any() ``, and the always false formula, ``none() ``.
300+
298301The logical connectives in QL work similarly to Boolean connectives in other programming
299302languages. Here is a brief overview:
300303
304+ .. index :: any, true
305+ .. _true :
306+
307+ ``any() ``
308+ =========
309+
310+ The built-in predicate ``any() `` is a formula that always holds.
311+
312+ **Example **
313+
314+ The following predicate defines the set of all expressions.
315+
316+ .. code-block :: ql
317+
318+ Expr allExpressions() {
319+ any()
320+ }
321+
322+ .. index :: none, false
323+ .. _false :
324+
325+ ``none() ``
326+ ==========
327+
328+ The built-in predicate ``none() `` is a formula that never holds.
329+
330+ **Example **
331+
332+ The following predicate defines the empty set of integers.
333+
334+ .. code-block :: ql
335+
336+ int emptySet() {
337+ none()
338+ }
339+
301340 .. index :: not, negation
302341.. _negation :
303342
0 commit comments