Tuple
Let \( I \) be an index set, and \( S \) a set then we say that a function \( t : I \to S \) is a tuple,
Empty Tuple
Suppose \( t: I \to S \) is a tuple such that \( I = \emptyset \) then \( t \) is said to be the empty tuple and is notated by \( \left( \right) \).
Tuple at an Index
Suppose that \( t \) is a tuple and \( i \in \operatorname{ dom } \left( t \right) \) , then we define that the tuple's value at index \( i \) as \( t \left( i \right) \)
Tuple Subscript Notation
Suppose that \( t \) is a tuple, then we define \( t _ i \) to be \( t \) at index \( i \)
Ordered Tuple Notation
Suppose that the index set has some natural ordering, then the notation \( \left( t _ { i _ 1 } , t _ { i _ 2 } , \ldots \right) \)
Finite Tuple
A finite tuple is a tuple with a finite index set
Integer Indexed Tuple
A integer indexed tuple is a tuple whose index set equals \( \left\{ a, \ldots , b \right\} \) for some \( a, b \in \mathbb{ Z } \) or is some \( I \subseteq \mathbb{ Z } \)

Note that a integer indexed tuple is represented using ordered tuple notation using \( \left( a _ 1, a _ 2, \ldots \right) \). When it's finite we get \( \left( a _ { - 2 } , a _ { -1 }, a _ 0, a _ 1, a _ 2, a _ 3, a _ 4 \right) \)

When an Integer Indexed Tuple is Empty
Suppose that \( i > j \in \mathbb{ Z } \) then \[ \left( a _ i, \ldots , a _ j \right) = \left( \right) \]
By definition we can see that it's index set is \( \left\{ i, \ldots , j \right\} \) which is equal to \( \emptyset \) and therefore it is the empty tuple.
Finite Tuple Equality
We define two \( n \) tuples \( (x_1, x_2, ..., x_n) \) and \( (y_1, y_1, ..., y_n) \) to be equal when \[ \forall i \in [1 \ldots n], x_i = y_i \]

Note that finite tuples tuples are indexed starting from 1

Length
Suppose that \( a = \left( a _ 1, a _ 2, \ldots , a _ n \right) \) then \( \operatorname{ len } \left( a \right) = n \)
Zero Indexed Tuple
A zero indexed tuple is a tuple of the form \( a = \left( a _ 0, a _ 1, \ldots a _ m \right) \)
Length of a Zero Indexed Tuple
Suppose that \( a = \left( a _ 0, a _ 1, \ldots a _ m \right) \) is a zero indexed tuple, then \( \operatorname{ len } \left( a \right) = m + 1 \)
Converting from Regular to Zero Indexing
Let \( a \) be a finite tuple and suppose \( \operatorname{ len } \left( a \right) = n \) , let \( r \) be \( a \) but indexed regularly, and let \( z \) be \( a \) but using zero indexing, then for all \( i \in [ 1 ... n ], r _ i = z _ { i - 1 } \)
Reverse of a Finite Tuple
Suppose that \(a = \left( a _ 1, a _ 2, \ldots , a _ n \right) \), is an \( n \) tuple, then we define \[ \operatorname{rev} \left( a \right) := \left( a _ n, \ldots , a _ 1 \right) \]
Reverse Cancels
For any \( n \) tuple \( a \) \[ \operatorname{ rev } \left( \operatorname{ rev } \left( a \right) \right) = a \]
Concatenation
Suppose that \( a = \left( a _ 1, \ldots , a _ n \right) \) and \( b = \left( b _ 1, \ldots , b _ m \right) \) are finite tuples, then \[ \operatorname{ concat } \left( a, b \right) = \left( a _ 1, \ldots a _ n, b _ 1, \ldots , b _ m \right) \]
Sorted in Ascending Order
Suppose that \(a = \left( a _ 1, a _ 2, \ldots , a _ n \right) \in \mathbb{ R } ^ n \), then we say that \( a \) is sorted in ascending order when for any \( i \in [ 1 \ldots n - 1 ] \) \( a _ i \le a _ { i + 1 } \)
Sorted in Strictly Ascending Order
Suppose that \(a = \left( a _ 1, a _ 2, \ldots , a _ n \right) \in \mathbb{ R } ^ n \), then we say that \( a \) is sorted in strictly ascending order when \[ \operatorname{ bop\_holds } \left( \lt , a \right) \]
A Binary Relation Holds Consecutively on a Tuple
Suppose that \( \star \) is a binary operation, then we say that it holds consecutively on a tuple \( a = \left( a _ 1, \ldots, a _ n \right) \) whenever we have \[ a _ i \star a _ { i + 1 } \] for each \( i \in \left[ 1, \ldots , n - 1 \right] \), we also define the predicate \( \operatorname{ bop\_holds } \) as follows: \[ \operatorname{ bop\_holds } \left( \star, a \right) = T \] iff the above property holds true.
Sorted Tuple Predicate
Suppose that \( a \in \mathbb{ R } ^ n \) then define the \( \operatorname{ sorted\_asc } : \mathbb{ R } ^ n \to \left\{ T, F \right\} \) such that \[ \operatorname{ sorted\_asc } \left( a \right) = \operatorname{ bop\_holds } \left( \le , a \right) \]
sorted_asc Holds iff It is Sorted in Ascending Order
\( \operatorname{ sorted\_asc } \left( a \right) = T \) iff \( a \) is sorted in ascending order
Sorted in Strictly Ascending order Predicate
Suppose that \( a \in \mathbb{ R } ^ n \) then we define \[ \operatorname{ strict\_asc\_sorted } \left( a \right) = \operatorname{ bop\_holds } \left( \lt , a \right) \]
Set of a Tuple
Suppose that \( a = \left( a _ 1, \ldots , a _ n \right) \) is a tuple, then we define the function \[ \operatorname{ set } \left( a \right) = \left\{ a _ i: i \in \left[ 1, \ldots , n \right] \right\} \]
Strictly Ascending Sorting Function
Suppose that \( a \in \mathbb{ R } ^ n \) then we define the function \( \operatorname{ strict\_asc\_sort } : \mathbb{ R } ^ n \to \mathbb{ R } ^ n \) such that if \( s = \operatorname{ strict\_asc\_sort } \left( a \right) \) then we have \[ \operatorname{ strict\_asc\_sorted } \left( s \right) = T \] such that \( \left\lvert a \right\rvert = \left\lvert s \right\rvert \) and \( \operatorname{ set } \left( a \right) = \operatorname{ set } \left( s \right) \)
Intersection of Two Sorted Tuples
Suppose that \( a, b \in \mathbb{ R } ^ n \) then \[ a \cap b \] is defined as the tuple \( s \) such that \[ s = \operatorname{ strict\_asc\_sort } \left( \operatorname{ concat } \left( a, b \right) \right) \] using the sorting function and concatenation
Ascending Tuple
Show that \( \left( 1, 2, 3, 4, 100 \right) \) is an ascending \( n \) tuple
Sorted in Descending Order
Suppose that \(a = \left( a _ 1, a _ 2, \ldots , a _ n \right) \in \mathbb{ R } ^ n \), then we say that \( a \) is sorted in descending order when for any \( i \in [ 1 \ldots n - 1 ] \) \( a _ i \ge a _ { i + 1 } \)
Descending Tuple
Show that \( \left( 8, 5, 3, 1, 0 \right) \) is a descending \( n \) tuple
The reverse of Ascending is Descending
Suppose that \( a \) is a finite tuple sorted in ascending order, then \( \operatorname{ rev } \left( a \right) \) is sorted in descending order.
Inversion
Suppose that \( \left( a _ 1, a _ 2, \ldots , a _ n \right) \in \mathbb{ R } ^ n \), then an inversion is a tuple \( i , j \in [ 1 \ldots n ] \times [ 1 \ldots n ] \) such that \( i \lt j \) but \( a _ i \gt a _ j \)

Given the tuple \( a := \left( 8, 9, 10, 11, 3 \right) \) then we can see that \( \left( 1, 5 \right) \) is an inversion because \( 1 \lt 5 \) but \( 8 \gt 3 \)