nLab
complement

The complement of a subset S of a set X is the set

S˜={a:XaS}.\tilde{S} = \{ a: X \;|\; a \notin S \} .

(Besides S˜, there are many other notations, such as XS, S¯, ¬S, and so forth.)

Notice that SS˜=, while SS˜=X by the principle of excluded middle.

The complement of an element S of a lattice is (if it exists) the unique element S˜ such that SS˜= and SS˜=. Such complements always exist in a Boolean algebra.

More generally, the pseudocomplement of an element S of a Heyting algebra is given by S˜=S. This satisfies SS˜= but not SS˜= in general. This case includes the complement of a subset even in constructive mathematics.

In another direction, the complement of a complemented subobject S of an object X in a coherent category is the unique subobject S˜ such that SS˜ is the initial object and SS˜=X.

The complement of a truth value (seen as a subset of the point) is called its negation.