Inference of a measure for a decreasing chain Set $I_n = \{0,\ldots,n-1\}$.
Given integers $v_0,\dots,v_{n-1} \in \mathbb{N}$, find an integer $t&gt;0$, a map $f:\mathbb{N} \times I_n \to \mathbb{N}^t$, and a well-founded order $&gt;_t$ on $\mathbb{N}^t$ such that: $$\forall i \in I_n, m \in \mathbb{N}. f(m,i) &gt;_t f(m+v_i,i+_n 1)$$
where $+_n$ is addition in $\mathbb{Z}_n$ and $v_0+\dots+v_{n-1}&lt;0$.  Is there an efficient algorithm to do that?
Explanation and motivation
The directed weighted graph $0 \stackrel{v_0}\to 1 \stackrel{v_2}\to \ldots \stackrel{v_{n-2}}\to n-1 \stackrel{v_{n-1}}\to 0$ describes how a magnitude $m \in \mathbb{N}$ varies. For transition $i \stackrel{v}{\to} j$, $m$ gets updated with $m+v$. It must hold that $\sum_{i = 1}^n v_i &lt; 0$. Consider the following problem:
Give an assignment of values in $\mathbb{N}^t$ to nodes and an order that decreases at each transition. That is, if $\text{nodes} = \{0,\ldots,n-1\}$, I want to build a map $f:\mathbb{N} \times \text{nodes} \to \mathbb{N}^t$ with $t &gt; 0$ satisfying: $\forall i \in \text{nodes}. f(m,i) &gt;_t f(m+v_i, i +_n 1)$ where $&gt;_t$ is a well-founded order on $\mathbb{N}^t$.
Is there an algorithm that can built such an $f$ and $&lt;_t$?
Example (my try):
Assume you have the following chain is given:
$1 \stackrel{+3}{\to} 2 \stackrel{-2}{\to} 3 \stackrel{-2}{\to} 1$
In this case, $+3-2-2 = -1 &lt; 0$.
Let's start at 1.
Since $m$ increases, I will annotate measure $(2,m)$ in $1$ and measure $(1,m)$ in $2$ so that lexicographic order decreases.
At $2$, measure $m$ decreases so I can leave annotation $(1,m)$ as it was.
At $3$, measure $m$ decreases so I can copy annotation $(1,m)$ from $2$.
Coming back to $1$, I have a problem, since I had annotated $(2,m)$ before, but now I have annotated $(1,m)$ and these are clearly different measures.
Can you help me out of this problem?
Note on the meaning of the specification
Just to make sure the specification matches my needs, the problem tries to  model how some quatity $m$ varies in a loop of successive function applications. The functions form a loop that ends at $0$. It is guaranteed  that when traversing the whole loop, quantity $m$ decreases (according to the variations $v_i$). In each function one have to check that in the next call certain measure $f$ (depending on the parameter $m$) decreases.
Yes.  This is possible.  $t=1$ suffices.  Take

$$\begin{align*}
f(m,n-1) &amp;= Cm + D\\
f(m,n-2) &amp;= f(m+v_{n-2},n-1) + 1 = Cm + C v_{n-2} + D + 1\\
f(m,n-3) &amp;= f(m+v_{n-3},n-2) + 1 = Cm + C v_{n-3} + C v_{n-2} + D + 2\\
&amp;\ldots\\
f(m,i) &amp;= Cm + C v_{i} + \dots + C v_{n-2} + D + n-1-i
\end{align*}$$

where we take the constant $C&gt;0$ to be at least $n$; we choose a constant $D&gt;0$ that's large enough that the output of $f$ is always positive; we take $t=1$; and we use the standard order on $\mathbb{N}$.  Then you can verify that this satisfies all the conditions.

How do you find this?  As always, start with small cases.  Start with $n=2$ and see what has to hold of $f$, and try to construct a $f$ that meets the conditions.  (One way to ensure that $x&gt;_t y$ is to set $x=y+1$; in the construction above, I used that to construct $f$ that satisfies the condition by definition.)  Then try $n=3$.  Then generalize.  The above definition follows as a straightforward consequence of your requirements; if you choose elements of $f$ in the right order, it becomes routine to fill out the truth table of $f$ so all the requirements are met.