Go backward to 3.1 The Datatype Set Go up to 3 Sets, Relations, and Functions Go forward to 3.3 Predicates as Sets |
We call < x0, x1, ..., xn-1> an n- tuple (Tupel).
<x0, x1, ..., xn-1>0 = x0; <x0, x1, ..., xn-1>1 = x1; ... <x0, x1, ..., xn-1>n-1 = xn-1.
Please do not confuse in above proposition a variable name xi with the application of the tuple selector .i to a tuple t, denoted as ti. Please also note that we use the same symbol < > for the tuple constructors of all arities and the same function symbol .i for the selection of the i-th component of every n-tuple with i<n. Frequently, tuple construction is just denoted by (x0, x1, ..., xn-1).
Let U:=< 2, T, {1}>. Then
T0 = 1; T1 = 2.
U0 = 2; U1 = T; U2 = {1}.
<x0, x1, ..., xn-1> = <y0, y1, ..., yn-1> <=> (x0 = y0 /\ x1 = y1 /\ ...xn-1 = yn-1).
<1, 2> != <2, 1>; <1, 2> != <1, 2, 2>.
Construction from Sets Tuples are not a basic concept: they can be built from sets as follows. First, we define the constructor for 2-tuples as
<x, y> := {{x}, {y, x}}.If x=y, then t has a single element {x} that determines both x and y. If x != y, then t contains two elements {x} and {x, y}. The 1-element set determines x and its complement in the 2-element set determines y. Thus the selectors can be uniquely defined as:
An n-ary tuple is then constructed from 2-tuples as
t0 := such x: exists y: t = <x, y>; t1 := such y: exists x: t = <x, y>.
<x0, x1, ..., xn-1> := <x0, < x1, < ..., <xn-2, xn-1>>>>with the selectors being defined accordingly.
Logic Evaluator The constructor < > is
represented by the function tuple
with selector .i being
represented as (prefix) .i
; the predicate =
can be also
applied to tuples. The unary predicate Tuple
returns true for tuples
only.
S0 x ... x Sn-1 := {<x0, ..., xn-1>: x0 in S0 /\ ... /\ xn-1 in Sn-1}.
In the Logic Evaluator, we define the binary Cartesian product as follows: