arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Boolean operators in algebra

The boolean operators of Ampersand behave as one would expect in any boolean algebra. Union (∪\cup∪) and intersection (∩\cap∩) are both idempotent, commutative, and associative operators. In Ampersand we use a binary difference operator over with the usual semantics: (r−s)∪(r∩s)=r(r-s)\cup(r\cap s) = r(r−s)∪(r∩s)=r. The (more customary) complement operator is a partial function, because Ampersand supports heterogeneous relation algebra.

hashtag
Union

The operator ∪\cup∪ (union) satisfies the following axioms:

  1. (commutativity of )

  2. (associativity of )

  3. (idempotence of )

hashtag
Difference

The difference is the smallest relation that satisfies . Smallest means: If there is a for which , this implies that .

hashtag
Intersection

The intersection is defined as:

hashtag
Complement

The complement operator is defined as . The type comes from the term(s) in which is embedded. If that type does not exist or if it is ambiguous, Ampersand will refuse to compile with an appropriate error message.

hashtag
How to type boolean operators in your script

shows how you can write these things in your Ampersand script.

hashtag
Other explanation

∪\cup∪
r∪s = s∪rr\cup s\ =\ s\cup rr∪s = s∪r
∪\cup∪
r∪(s∪t) = (r∪s)∪tr\cup (s\cup t)\ =\ (r\cup s)\cup tr∪(s∪t) = (r∪s)∪t
∪\cup∪
r∪r = rr\cup r\ =\ rr∪r = r
r−sr-sr−s
ttt
r ⊆ s∪tr\ \subseteq\ s\cup tr ⊆ s∪t
t′t't′
s∪t′=rs\cup t'=rs∪t′=r
t∪t′=t′t\cup t'=t't∪t′=t′
∩\cap∩
r∩s=r−(r−s)r \cap s = r-(r-s)r∩s=r−(r−s)
t‾=V[A×B]−t\overline{t} = V_{[A\times B]} - tt=V[A×B]​−t
[A×B][A\times B][A×B]
ttt
This page