What is a formal definition of the unique values in an array? Let the term unique be defined as all other values of this object are numerically different from one value of this object.
Let $v$ be a vector with 5000 observations with each observation may or may not be unique.
What is a formal way to state that one only considers the unique values of $v$?

Although it is sometimes convenient to think of (and represent) a data set as a mathematical set, this mathematical concept is not rich enough for many uses, because the values of observations can be repeated.  That is the very source of the question: the possibility of repetitions is the same as the possibility that the set (a true set now!) of unique values of the observations might be smaller than the number of observations.
I will briefly describe two general, powerful, yet sufficiently simple mathematical models of statistical observations (each of which has a characteristic notation) and give a solution for each model.
Tuples/arrays/vectors/sequences
These kinds of objects are mathematically nearly the same.

*

*A tuple can be defined as a function from a "index" set $\mathcal I$ (such as a subset of the natural numbers $\mathbb N = \{0,1,2,\ldots\}$) into a "value" set $X$ of possible values.  (Wikipedia stipulates that $\mathcal I$ is finite, but this requirement is neither conceptually nor mathematically necessary.)


*When we refer to an array we mean the index set $\mathcal I$ is a subset of $\mathbb{Z}^k$ for a finite number $k:$ that is, it has "multiple subscripts" (possibly negative, as allowed in the Fortran language for instance).  The richest concept of arrays appears in the computer science literature.


*A tuple can be considered a vector when its value set $X$ is a field of numbers, for then such objects can be added to each other and scaled by values in $X$ component by component, thereby satisfying all the vector space axioms.


*A sequence requires $\mathcal I$ to be totally ordered.  See Wikipedia for a discussion.
Although a standard notation for functions $v:\mathcal I\to X$ is to write "$v(i)$" for the value assigned by $v$ to $i\in\mathcal I,$ when we refer to it as a "tuple," "array," "vector," or "sequence," we usually adopt a different notation.  First, the value $v(i)$ is written instead with a subscript as $v_i.$  Second, the entire tuple may be written as $(v_i)_{i\in\mathcal I}.$  The fact that $v$ is a function is usually not even mentioned, even though (in retrospect) that is clear from the notation.
For statistical applications, observations usually come in some order: the first, the second, the third, and so on. We therefore may take the indexing set to be a set of ordered whole numbers $1,2,3,\ldots, n.$ $v$ often is referred to as a "variable," a word suggesting the values of $v = (v_1, v_2, \ldots, v_n)$ needn't all be the same.  The set of all these distinct values is, of course, the usual image of $v,$ defined as

$$\operatorname{Im}(v) = \{v(i)\mid i\in\mathcal I\} = \{x\in X \mid \exists_{i\in\mathcal I}: v(i)=x\}.$$

Be careful: this notation and terminology might surprise any reader who hasn't yet learned of the functional representation of tuples.  Some preparatory explanation is helpful.  But as a notation it's perfectly fine and conventional.
Multisets
A multiset generalizes a set by allowing for repetition.  Formally, you may consider a multiset to be a function $S:X\to \mathcal N$ whose value at any $x\in X$ tells you how many times $x$ is intended to appear in $S.$  (The role of the value set $X$ has changed from the range of a function to the domain of another function.)
Multiset notation usually looks something like $\{x^{[2]}, y^{[3]}, z, \ldots\}$ where "$x^{[k]}$" means $k$ instances of $x$ appear in $S$ (that is, $S(x)=k$), "$z$" is just shorthand for "$z^{[1]},$" and we understand that distinct symbols "$x,$" "$y,$" "$z,"$ etc. refer to distinct objects.  As with set notation, the order in which the elements are written has no inherent meaning.  This multiset is identical to $\{z, y^{[3]}, x^{[2]}, \ldots\}$ for example.
The unique values in a multiset form a (usual) set.  I am not aware of any generally understood term or notation for these values.  You might refer to them as the "base set" of $S.$  (Wikipedia calls the base set the "support," but be cautious with that, because "support" has a commonly understood meaning for random variables that differs from this--and it's likely you will be referring to random variables whenever you are discussing datasets.)
You can define the base set in various ways.  For instance, you could insist (by means of a definition) that the values of $S$ be whole numbers $\{1,2,3,\ldots\},$ in which case

the base set is the domain of $S$ (qua function).

That's probably the simplest way to approach this question from a multiset perspective, provided the order of the observations does not matter.  If you do allow for $0$ to be a possible value of $S$ (explicitly indicating a value that has not appeared in the data), you could define the base set to be the inverse image of the nonzero values,

$$S^{-1}(X\setminus \{0\}) = \{x\in X\mid S(X) \ne 0\}.$$

Once again, providing explicit definitions for your reader is needed if you wish to communicate your ideas reliably.

Examples
Consider administering a survey in which one question is "what is your gender?," with the possible answers being "Male," "Female," "Other," "Prefer not to say," and missing.  These answers comprise the set $X.$  As the survey results come in, you record the answers.  Perhaps, in order, they are "Other", "Female", "Female", missing, "Prefer not to say".
For vector notation, statisticians usually start indexing at $1$ and we have $n=5$ results.  Thus, we can take $\mathcal I = \{1,2,3,4,5\}$ for the index set (with its usual order $1\lt 2 \lt \cdots \lt 5$).
For instance, $v_1 = \text{Male}$ and $v_4 = \text{missing}.$
In multiset notation, $v = \{\text{Female}^{[2]},\text{missing},\text{Prefer not to say}, \text{other}\}$  Notice that the order in which the values appear in this notation does not have to match the order in which the values first appeared in the sequence of survey results: that information is lost.

References
For rigorous definitions and many good examples, see Paul Halmos Naive Set Theory on functions and total orderings and Richard Stanley Enumerative Combinatorics (Vol 1, chapter 1) about multisets.
