Is it mathematically correct to write $a \bmod n \equiv b$?
We have two different, but related, notions:
-
The equivalence relation "congruent modulo $n$".
Let $n$ be a fixed integer. If $a$ and $b$ are integers, we say that "$a$ and $b$ are congruent modulo $n$" if and only if $n|b-a$. We write it this way: $$a\equiv b\pmod{n}.$$ The symbol $\equiv$ is read "is congruent to" (as opposed to the symbol $=$ which is read "is equal to").
-
The binary operator $\bmod$.
Let $n$ be a positive integer. If $a$ is an integer, then $a\bmod n$ is the remainder (from a distinguished set, see below) of dividing $a$ by $n$. This is read "$a$ modulo $n$".
In mathematics, $a\bmod n$ is usually defined to be the unique integer $r$ such that $a=nq + r$ for some integer $q$ and $0\leq r \lt n$. In other areas, such as computer science (and sometimes in mathematics), one often requires that $a\bmod n$ be the unique integer $r$ such that $-\frac{n}{2}\lt r\lt \frac{n}{2}+1$ and $a-r$ is a multiple of $n$.
More generally, one may specify a "distinguished set of remainders modulo $n$", a set $R_n=\{a_0,\ldots,a_{n-1}\}$ such that every integer $x$ is congruent modulo $n$ to one and only one element of $R_n$, and define $\bmod$ as the operator such that $x\bmod n$ is the unique element of $a\in R_n$ such that $x\equiv a\pmod{n}$.
The operator $\bmod$ is like any other infix notation operator such as $+$; we write $2+3 = 5$, because the result of doing the operation $+$ to $2$ and $3$ is $5$. We write "$a\bmod n = b$" to signify that $b$ is the result of performing the operation "modulo $n$" to $a$.
The two notions are related in that if $a\bmod n = b$, then $a\equiv b\pmod{n}$. The converse does not hold in general, since we have, for example, $5\equiv 9\pmod{4}$, but $5\bmod 4 = 1\neq 9$.
Writing "$a\bmod n \equiv b$" confuses the two notions and is syntactically incorrect. You should use $=$, not $\equiv$. With $=$, it would be "mathematically correct" if and only if $b$ is the result of computing $a\bmod n$ (so $5\bmod 4 = 5$ would be wrong, but $5\bmod 4=1$ would be correct).
Writing $a\equiv b\bmod n$ also invites confusion of the two notions.
(Note, however, that "$a\bmod n \equiv b \pmod{n}$" would be syntactically correct, and would be mathematically correct if $a\equiv b\pmod{n}$.)