I have a very simple question with regards to the notation of sequences. To illustrate the question, consider the following pseudo-code:
procedure fun(P):
// input $P = \langle p_0,\ldots,p_{n-1}\rangle$
if $P == \langle \rangle$
return;
for all $p_i \in P$
fun($\langle p_i,\ldots,p_{n-1}\rangle$);
That is, the variable $P$ denotes a sequence of elements, where order matters.
Now the question is, can I check for an empty sequence like in the if statement ($P == \langle \rangle$)? If this is correct, do you still prefer another notation, e.g., $P == \emptyset$?
Is the call fun($\langle p_i,\ldots,p_{n-1}\rangle$) correct? or should I use something like e.g., fun($P \setminus \langle p_i \rangle$)? Is the latter correct at all, i.e., can I use the set notation with sequence, but instead of curly braces used angled braces, like $P \setminus \langle p_i \rangle$?
Thank you in advance
Somewhat awkwardly, there is a lack of universally agreed notational conventions for sequences. To circumvent this problem, I would recommend that you express a sequence as a set.
In particular, we can represent a sequence as a function, whose domain is a subset of the natural numbers. Additionally, a function is a sets of ordered pairs $(x,y)$, where $x$ is the input and $y$ is the output. By expressing a list as a set, we can apply the relevant notation for sets and would allow the reader to work with more familiar notation.
In sum, to answer both of your questions, by recasting the sequence as a set $P$, you can then make mathematically correct statements of the form $P == \emptyset$ and $P \setminus \{p_{i}\}$.