Download free books at BookBooN.com
An Introduction to Relational Database Theory
72
Predicates and Propositions
In set-builder notation, the braces indicate that a set is being defined. The colon can be pronounced “such
that”. The elements of the set being defined, also known as its members, are all and only those objects that
satisfy the given predicate, sometimes referred to as a membership predicate for that set. The last three
definitions in Example 3.5 all define the same set, that being the set defined in Example 3.4.
Each of the definitions in Example 3.5 uses a monadic predicate, with parameter name x, n, p, x again, and
q, respectively. (The n appearing in the penultimate example is not a parameter, as will be explained
shortly.) The sets denoted by these examples are not relations, nor are they bodies of relations. The
elements of { 2, 3, 5 }, for example, are all numbers, and the body of a relation consists of tuples, not
numbers. We are very close to pinning down a method of interpreting a relation but we haven’t quite got
there yet. The light should dawn when we look at set-builder notation using predicates with more than one
parameter, such as those in Example 3.6.
Example 3.6: more intensional definitions
{ <a, b> : a < b }
{ <x, y, z> : x + y = z }
{ <StudentId, CourseId> : Student StudentId is enrolled on course CourseId }
The example { <a, b> : a < b } can be read as “the set consisting of pairs of a and b such that a is less than
b”. A pair is a tuple: a 2-tuple, to be precise. The body of a relation is a set of tuples. The tuples of the
body of a relation all have the same heading. The expression <a, b> can be thought of as specifying the
names of the attributes of a heading. The objects <a, b> that satisfy a < b are all tuples consisting of an a
value and a b value.
We need to be clear, now, about that important term satisfies:
x An object x satisfies monadic predicate P if and only if substitution of x
for the sole parameter of P, thus instantiating P, yields a true
proposition.
x An n-tuple t satisfies n-adic predicate P if and only if substituting each
element of t for the corresponding parameter of P, thus instantiating
P, yields a true proposition
And now we need to be clear about that correspondence between tuple elements and parameters.
In mathematics, notation such as <1, 2>, using angle brackets, is often used to denote a tuple. Using this to
instantiate the predicate a < b relies on an ordering of the parameters a and b, without which we would
not know whether <1, 2> is to be interpreted as 1<2 or, instead, 2<1. In relational databases we sometimes
deal with relations of quite high degree, when reliance on some specific ordering would give rise to
difficulty that is avoided by the use of attribute names. Thus, in Tutorial D, the tuple literals
TUPLE {a 1, b 2} and TUPLE {b 2, a 1} both denote the tuple <1, 2> in the present context
(and might instead denote <2, 1> in some other context). Whereas <1, 2> can represent an instantiation of
any dyadic predicate, TUPLE {a 1, b 2} can represent an instantiation only of a predicate whose
parameters are named a and b.