Relabel According to the Order of First Occurrence

27 Views Asked by At

Let $a\in\mathbb R^n$ be a tuple of length $n\in\mathbb Z_{>0}$. Let $X=\{a_i:1\le i\le n\}$ be the set of elements of $a$ for $x\in X$ let $$i(x)=\min\{j:a_j=x\}$$ be the first occurence of $x$ in $a$. Now, for $x,y\in X$ let $x<y$ if $i(x)<i(y)$. This order is known as order of first occurrence.

Let $x:\{1,\dots,|X|\}\to X$ be the enumeration of $X$ with respect to the order of first occurrence (which is the subsequence $x\in X^{|X|}$ of $a$ obtained by removing all elements which already occurred). Then the relabeling of $a$ according to the order of first occurrence is the tuple $a^\circ\in \mathbb Z_{>0}^n$ defined by $$a^\circ_i=x^{-1}(a_i).$$ That is, we replace each $a_i$ by its unique index in $x$. For example, if we let $a=(\pi, e, e,5,\pi)$, then we have $x=(\pi,e,5)$ and $a^\circ =(1,2,2,3,1)$.

QUESTION: I'm convinced that the relabeling $a\mapsto a^\circ$ is a fairly basic tool in discrete mathematics. Do you know a reference where this map is defined or even named?