Problem: What mathematical notation for iterating over the same enumerated set $\{\dots\}$ twice is most consistent with existing conventions?
Context: The specific use is for pseudocode that describes the iteration using indices $i$ and $j$ over a square $n \times n$ matrix, so $\{\dots\}$ becomes $\{1, \dots, n\}$. The use of indices is needed for reference in the subsequent lines of the pseudocode.
The following notation uses ordered pairs and applies the Cartesian product operator on the set enumeration as inspired by the answer on this question:
$\forall (i,j) \in \{\dots\}^2$
And what about this notation:
$\forall i,j \in \{\dots\}$
What is 'better'? Would the latter be confusing because the reader may think that only $j$ iterates over the set?
I would prefer the latter ("for all $i, j\in\{\dots\}$"). But your first suggestion means the same; so it is also correct.