The boolean operators of Ampersand behave as one would expect in any boolean algebra. Union () and intersection () are both idempotent, commutative, and associative operators. In Ampersand we use a binary difference operator over with the usual semantics: . The (more customary) complement operator is a partial function, because Ampersand supports heterogeneous relation algebra.
The operator (union) satisfies the following axioms:
(commutativity of )
(associativity of )
(idempotence of )
The difference is the smallest relation that satisfies . Smallest means: If there is a for which , this implies that .
The intersection is defined as:
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.
This page shows how you can write these things in your Ampersand script.