arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Boolean operators

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

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

  • union : . In words: if the pair is in the relation or in , then it is in the union of and .

  • difference : . In other words, the term contains all pairs from that are not in .

The complement (or negation) of a relation is defined by means of the difference operator:

  • complement : If is defined as , then is the set of all tuples in (the Cartesian product) that are not contained in . So

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

hashtag
How to type boolean operators in your script

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

hashtag
Other explanation

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

a (r∪s) b ⇔ a r b ∨ a s ba\ (r ∪ s)\ b\ \Leftrightarrow\ a\ r\ b\ \vee\ a\ s\ ba (r∪s) b ⇔ a r b ∨ a s b
(a,b)(a,b)(a,b)
rrr
sss
rrr
sss
a (r−s) b ⇔ a r b ∧ ¬(a s b)a\ (r-s)\ b\ \Leftrightarrow\ a\ r\ b\ ∧\ \neg(a\ s\ b)a (r−s) b ⇔ a r b ∧ ¬(a s b)
r−sr-sr−s
rrr
sss
r[AxB]r_{[A x B]}r[AxB]​
rrr
rA×Br_{A\times B}rA×B​
r‾\overline{r}r
A×BA\times BA×B
rrr
r‾=V[A×B]−r\overline{r} = V_{[A\times B]} - rr=V[A×B]​−r
AAA
BBB
This page
This page