Representing a non-decreasing sequence using sets The sequence $(1,2,3,4)$ can be represented by the set $\left\{\{1\},\{1,2\},\{1,2,3\},\{1,2,3,4\}\right\}$ - it is obvious that it contains all the information required to generate the sequence.
Is there such a set that can represent the non-decreasing sequence $(1,2,2,3,4,4,4)$?
 A: For $(1,2,2,3,4,4,4)$:
$\left\{\{(1,1,1)\},\\ \{(1,1,1), (2,2,1)\},\\ \{(1,1,1), (2,2,2)\}, \\
\{(1,1,1), (2,2,2), (3,3,1)\},\\
 \{(1,1,1), (2,2,2), (3,3,1),  (4,4,1)\}\\
 \{(1,1,1), (2,2,2), (3,3,1),  (4,4,2)\}\\
 \{(1,1,1), (2,2,2), (3,3,1),  (4,4,3)\}
 \right\}$
First positions of triplets determines the index of same-number sequence, the second one - an element generating this sequence, the third one - the length of the sequence.
To show the idea, create a set for $(1,1,2,1,4,4,8)$:
$\left\{
\{(1,1,1)\},\\
\{(1,1,2)\},\\
\{(1,1,2), (2,2,1)\},\\
\{(1,1,2), (2,2,1), (3,1,1)\},\\
\{(1,1,2), (2,2,1), (3,1,1), (4,4,1)\},\\
\{(1,1,2), (2,2,1), (3,1,1), (4,4,2)\},\\
\{(1,1,2), (2,2,1), (3,1,1), (4,4,2), (5,8,1)\}
 \right\}$
A: Any sequence can be represented as a set just by creating a set of pairs, where each pair contains an element of the sequence along with its position in the sequence:
$$
\{(0,1) (1,2) (2,2) (3,3) (4,4) (5,4) (6,4)\}
$$
where we use the Kuratowski encoding for pairs $(a,b) = \{a, \{a,b\}\}$, so the set is:
$$
\{\{0, \{0,1\}\}, \{1, \{1,2\}\}, \{2, \{2\}\} \dots \{6, \{6, 4\}\} \}
$$
The Kuratowski encoding can also be used for $n$-tuples for any $n$, so if your sequence is finite you can actually create a set with just a single $n$-tuple, although it's a bit of a complex set to write and I'll leave as an exercise to the reader.
A: The usual way to represent finite sequences of variable length in set theory is to work with functions from $\{0,1,\ldots,n-1\}$ to the elements of the sequence.
So your sequence $(1,2,2,3,4,4,4)$ would be represented by
$$ \{(0,1),(1,2),(2,2),(3,3),(4,4),(5,4),(6,4)\} $$
(where the ordered pairs would themselves be Kuratowski pairs: $(a,b)=\{\{a\},\{a,b\}\}$).
If this representation is not adequate or convenient for your purposes, you probably need to explain in more details what your requirements are.
