TITLE: Specific order sequence as subset of other sequence
QUESTION [0 upvotes]: I have a certain fitness function that evaluates a sequence. An example of such a sequence is: $h = [2\ 3\ 7\ 5\ 4\ 6]$. The fitness function is defined to be $0$ if the route $h$ does not include the subset $\{3, 7\}$ in that order. Else, the fitness function is defined to be $\frac{1}{d_{route}}$. What is the correct notation for to evaluate $f(h)$ to $0$ if the subset $\{3, 7\}$ is not present in the route in that specific order? Currently I have:
\begin{align}
f(h) = \left\{ 
  \begin{array}{l l l}
    0 & \quad \text{if} \quad \{3,7\} \nsubseteq h \\
    \frac{1}{d_{route}} & \quad \text{otherwise}\\
  \end{array}
\right.
\end{align}
But I think this means that if either $3$ or $7$ are not part of the route $h$, the fitness evaluates to zero.
Any help is much appreciated!

REPLY [1 votes]: Usually sequences are written as ordered tuple. So if your (possibly infinite) sequence is $h = (h_1,h_2,\dotsc)$ and the sequence you're looking for is $(a_1,\dotsc,a_n)$ you could simply write
$$
f(h) =
\begin{cases}
\frac{1}{d_{route}} & \text{if } h_i = a_1, \dotsc, h_{i+n-1} = a_n \text{ for some } i \geq 1 \\
0 & \text{otherwise}
\end{cases}
$$
{"set_name": "stack_exchange", "score": 0, "question_id": 1212818}