I am interested in binary operations $\mid: \mathbb{Z} \times \mathbb{Z} \to \mathbb{Z}$ which satisfy:
- Associativity: $a \mid (b \mid c) = (a \mid b) \mid c$
- $+$ distributes over $\mid$: $(a \mid b) + c = (a + c) \mid (b + c)$.
I know of the following such operations: $\max, \min, (x, y) \mapsto x,$ and $(x, y) \mapsto y$. Are there others?
Over the reals, there is also an infinite family of such operations $(x, y) \mapsto \log_a (a^x + a^y)$, for any base $a$. But this operation doesn't restrict to the integers.
Answering my own question: I prove that there are only the four such operations: $\max(x, y)$, $\min(x, y)$, $\text{first}(x, y) = x$, and $\text{last}(x, y) = y$.
In the following lemmas, we first show idempotence $x \mid x = x$, with some work. Then we look at chains of sums of $(0 \mid 1)$ to find $0 \mid n = n (0 \mid 1)$, and finally we determine that $(0 \mid 1)$ is either $0$ or $1$. Combining this with the symmetric observation that $(1 \mid 0)$ is either $0$ or $1$ will give us the four cases.
Lemma 1: $x \mid x = x$.
Since $x \mid x = x + (0 \mid 0)$, it suffices to show $0 \mid 0 = 0$. Consider the map $\phi: \mathbb{Z}^+ \to \mathbb{Z}$ defined by $\phi(n) = \underbrace{0 \mid 0 \mid \cdots \mid 0}_{n \text{ zeros}}$. Then I claim $$ \phi(mn) = \phi(m) + \phi(n) $$ This is by rewriting the right-hand side as $$ \underbrace{0 \mid 0 \mid \cdots \mid 0}_{m} + \phi(n) = \underbrace{\phi(n) \mid \cdots \mid \phi(n)}_{m} $$ and expanding. In particular, we have that $\phi(p^a) = a \phi(p)$ for any prime $p$.
Now I claim that $\phi(x) = \phi(y)$ for some $0 \le x < y$. If $\phi(p) = 0$ for any prime, then $\phi(1) = \phi(p)$. Otherwise, there must be primes $p_1$ and $p_2$ such that $\phi(p_1)$ and $\phi(p_2)$ have the same sign. Examining $\phi(p_1^a) = a \phi(p_1)$ and $\phi(p_2^b) = b \phi(p_2)$, we see that we can choose $a, b > 0$ to make these equal: in particular, $a = |\phi(p_2)|$ and $b = |\phi(p_1)|$.
To complete the proof of Lemma 1, $\phi(x) = \phi(y)$ implies that $\phi(n)$ is periodic for $n$ sufficiently large, since $\phi(n) = \phi(n - x) \mid \phi(x) = \phi(n - x) \mid \phi(y) = \phi(n - x + y)$, and hence bounded. But $\phi(2^a) = a \phi(2)$ is not bounded unless $\phi(2) = 0$, so $\phi(2) = 0 \mid 0 = 0$, and in fact, $\phi(n) = 0$ for all $n$.
Lemma 2: for $n \ge 0$, $0 \mid 1 \mid \cdots \mid n = n (0 \mid 1)$.
Proof by induction: \begin{align*} 0 \mid 1 \mid \cdots \mid (n + 1) &= 0 \mid (1 \mid 1) \mid (2 \mid 2) \mid \cdots \mid (n \mid n) \mid (n + 1) \quad\text{by Lemma 1} \\ &= (0 \mid 1) \mid (1 \mid 2) \mid \cdots \mid (n \mid (n + 1)) \\ &= (0 + (0 \mid 1)) \mid (1 + (0 \mid 1) \mid (2 + (0 \mid 1)) + \cdots \\ &= (0 \mid 1 \mid \cdots \mid n) + (0 \mid 1). \end{align*}
Lemma 3: for $n \ge 0$, $0 \mid n = n (0 \mid 1)$.
Note that: \begin{align*} (0 \mid n) + (0 \mid 1 \mid 2 \mid ... \mid n) &= (0 + (0 \mid 1 \mid 2 \mid ... \mid n)) \mid (n + (0 \mid 1 \mid 2 \mid ... \mid n)) \\ &= 0 \mid 1 \mid 2 \mid ... \mid (2n) \quad\text{by Lemma 1: } n \mid n = n \end{align*} Applying Lemma 2, $(0 \mid n) + n (0 \mid 1) = 2n (0 \mid 1)$, and the result follows.
Lemma 4: $(0 \mid 1) \in \{0, 1\}$.
Let $k = (0 \mid 1)$. By idempotence, $0 \mid 1 = 0 \mid 0 \mid 1 \mid 1$, and we consider different ways to evaluate this associatively. First, $(0 \mid 1) \mid 1 = k \mid 1$, and second, $0 \mid (0 \mid 1) = 0 \mid k$. Thus, $$ k = k \mid 1 = 0 \mid k $$ Now we have two cases. If $k \ge 0$, then $$ 0 \mid k = k (0 \mid 1) = k^2, $$ so $k = k^2$ and $k \in \{0, 1\}$. Second, if $k < 0$, then subtracting $k$ from $k = k \mid 1$ we get $$ 0 = (k - k) \mid (1 - k) = 0 \mid (1 - k) = (1 - k) (0 \mid 1) = (1 - k) k $$ so again $k = 0$ or $k = 1$ (actually a contradiction since $k < 0$), and we are done.
Putting things together
All of lemmas 2-4 can be proven identically for the symmetric case of $b \mid a$ instead of $a \mid b$, from which we get that $1 \mid 0 \in \{0, 1\}$. So there are two cases for $0 \mid 1$ and two cases for $1 \mid 0$. Together with Lemma 3 we can then calculate $m \mid n$ for any $m, n$: $$ m \mid n = \begin{cases} m + (0 \mid (n - m)) = m + (n - m) (0 \mid 1) \text{ if } n \ge m \\ n + ((m - n) \mid 0) = n + (m - n) (1 \mid 0) \text{ if } m \ge n. \end{cases} $$
In particular: