REL
Union and Disjunction
Expr := Expr ";" Expr
The semicolon is a generalized union operator.
For example:
// read query
def P = (1, 2); (3, 4); (5, 6)
def Q = ("a", 41, "A", 61 ); ("b", 42, "B", 62)
def output = P; Q
Examples:
- For any relation
p
,{}; p
is equivalent top
. 1; 3
is equivalent tox: x = 1 or x = 3
.- If
p
andq
are unary relations, then:p(x); q(x)
is equivalent top(x) or q(x)
.p; q
is equivalent tox: p(x) or q(x)
.
The semicolon operator is equivalent to or
when its arguments are restricted to relations of arity 0.
To illustrate this, here is the table of all possible combinations of two relations with arity 0:
Left | Right | Left ; Right |
---|---|---|
{} | {} | {} |
{()} | {} | {()} |
{} | {()} | {()} |
{()} | {()} | {()} |
Next: Precedence
Was this doc helpful?