,
is called the cartesian
product of X and Y and is written
.
The
cartesian product
is often denoted by X2 . This
definition can be extended : if X1, X2, ...,Xn are
sets, then the set of all n-tuples
As an example, consider the cartesian product of the set of
natural numbers and the set of Boolean values. The cartesian
product is then the set of all ordered pairs of the form
(n,b) where
and
and is written
.
Typical members of
include
(3,true) ; (5,true) ; (9,false) ; (3,false).
The concept of a cartesian product may be more clearly understood
by considering the following situation. Suppose a young child is
given a list of natural numbers, e.g.
and has
to state whether or not they are odd. Suppose further that
the child is
required to submit the answers at a computer terminal by typing
in successive natural number, boolean value pairs, for example
``3 true'' ; ``5 true'' ; ``8 false'' ; ``2 true'';
...and that after each pair is
entered, the system responds with an appropriate message : ``Your answer is correct'' or ``Your answer is wrong!''.
A Boolean-valued Pascal function is_correct_pair and its
use in a program which will accomplish this task is shown in Fig.
2.1.