Boolean operators

The notation a r ba\ r\ b means that the pair (a,b) is in relation rr. This page defines when pair (a,b) is in relation rsr ∩ s (the intersection of rr and ss), rsr ∪ s (the union of rr and ss), rsr-s (the difference of rr and ss).

  • intersection : a (rs) b  a r b  a s ba\ (r ∩ s)\ b\ \Leftrightarrow\ a\ r\ b\ ∧\ a\ s\ b . In other words: if the pair (a,b)(a,b) is both in relation rr and ss, then it is in the intersection of rr and ss.

  • union : a (rs) b  a r b  a s ba\ (r ∪ s)\ b\ \Leftrightarrow\ a\ r\ b\ \vee\ a\ s\ b . In words: if the pair (a,b)(a,b) is in the relation rr or in ss, then it is in the union of rr and ss.

  • difference : a (rs) b  a r b  ¬(a s b)a\ (r-s)\ b\ \Leftrightarrow\ a\ r\ b\ ∧\ \neg(a\ s\ b). In other words, the term rsr-s contains all pairs from rr that are not in ss.

The complement (or negation) of a relation r[AxB]r_{[A x B]} is defined by means of the difference operator:

  • complement : If rr is defined as rA×Br_{A\times B}, then r\overline{r} is the set of all tuples in A×BA\times B (the Cartesian product) that are not contained in rr. So r=V[A×B]r\overline{r} = V_{[A\times B]} - r

Note that the complement is defined in terms of AA and BB. So, two relations with an identical population yet a different type may have different complements.

How to type boolean operators in your script

This page shows how you can type boolean (and other) operators in your Ampersand script.

Other explanation

Would you like a different explanation of the boolean operators? This page explains the boolean operators in terms of set theory.

Last updated