[Math] Notation for inserting element in “ordered set”

notation

I would like to write down an algorithm in mathematical notation. Now, I have some "ordered set" and remove some element $i$ and want to insert some element $k$ at the same position! So, $M \setminus i \cup k $ does not work because it "looks like" we inserted k at the end. It should just be at the position of i.

Best Answer

"Ordered set" that you speak about is a totally ordered set, i. e. a set with a antisymmetric, transitive binary relation $\le$ such that any pair of elements are comparable. Antisymmetric mean that from $a\le b$ and $b\le a$ it follows that $a=b$. Transitive mean that from $a\le b$ and $b\le c$ it follows that $a\le c$ (for example, relation "beats" in the rock-paper-scissors game is not transitive).

Let $(T,\le)$ be a totally ordered set (examples: integers with the "less or equal" relation, English words with the lexicographic order), $M$ be a subset of $T$.

After removing $i\in M$ from $M$ you get $M\setminus\{i\}$ with the total order $\le$ restricted to this set. After adding $k\in T$ into $M$ you get $M\cup \{k\}$ with the total order $\le$ restricted to this set.

So, once you define a totally ordered set $(T,\le)$ you can simply add and remove elements using $\cup$ and $\setminus$without any extra conditions.

Related Question