# Formally writing about lists (tuples), and notation analogous to set notation

Is there any formal notation for dealing with lists, rather than sets?

e.g. if I have a set $X=\{x_1,\dots,x_n\}$ and I want to add a new item to the set, say $x_{n+1}$, I can say "Let $X = X \cup \{x_{n+1}\}$" and it is clearly understood that I want to add $x_{n+1}$ to my set.

However, if $X$ is not a set but rather a list, or tuple (i.e. the elements are ordered and duplicates are allowed), is there any way of indicating that I am adding an element to the end of the list?

e.g. given $X=(x_1,\dots,x_n)$, how do I say add an element to $X$ such that $X=(x_1,\dots,x_n,x_{n+1})$? i.e. how do I formally denote appending an element to $X$?

-
When you say "Let $X=X\cup x_{n+1}$" you are (i) using programmer's lingo, not mathematical notation (mathematically, that only works if $x_{n+1}$ is a subset of $X$) and (ii) formally incorrect (you really want $X\cup\{x_{n+1}\}$, not $X\cup x_n$). – Arturo Magidin May 5 '11 at 17:13
To answer your actual question, we talk about "appending" $x_{n+1}$ to the tuple. – Arturo Magidin May 5 '11 at 17:13
Correct; actually I just messed up my latex and forgot to escape the brackets; i meant to write $X = X\cup \{x_{n+1}\}$. – TJ Ellis May 5 '11 at 17:31
Also, I purposefully didn't use the word "appending" because I thought that was programming lingo :-P – TJ Ellis May 5 '11 at 17:34

What you call a list is formally known as sequence. There was a question which symbol is for sequence concatenation. Unfortunately there is no accepted answer. Symbols ⋅, ⌒ (commentator actually used u2322, "frown" symbol but it's resisting my attempt to copy it) and ∥ are mentioned in comments.

According the Wikipedia article ∥ is an operator for concatenation of numbers (doesn't specify which set of numbers, probably ℕ) but doesn't say much about sequences. The same symbol is in my opinion more commonly used for parallelism so it may confuse the reader.

I haven't seen ⌒symbol before but commentators agree about it.

-

I don't think there is any standard notation.

One alternative would be to not use $(a,b)$ for ordered pairs but $a \times b$, which is the notation suggested by category theory. The $\times$ allows you to sweep lots of assocativity isomorphisms under the rug: it looks perfectly natural to write $(a \times b) \times c = a \times (b \times c) = a \times b \times c$, but not $((a,b),c) = (a,(b,c)) = (a,b,c)$.

Then if you have an $n$-tuple $x$ in $X^n$, you can write $x \times a$ for the $(n+1)$-tuple in $X^{n+1}$ obtained by appending $a$.

-