Is Mazur's analogy between arithmetic and topology formal, in any sense? I preface my question by admitting I know no algebraic geometry nor algebraic number theory. I do know some algebraic topology. I'm a student.
Recently I learned about sheaf cohomology. Then a little bit of etale cohomology, as much as I could stomach having never studied algebraic geometry. Then I came across Artin-Verdier duality, in particular the notion that $\mathcal{O}_K$ is 'like a 3-manifold.' This led me to the interesting area of arithmetic topology that wants to understand some larger 'arithmetic $\leftrightarrow$ topology dictionary.'
Now I've done some reading to try to grasp the big picture of arithmetic topology. But I'm unclear on one point:

Is the analogy pursued by this arithmetic $\leftrightarrow$ topology dictionary formal, in any sense?

So far I've seen it said how this analogy gives a nice way of thinking about number-theoretic things with topology (e.g. prime ideals are like links, and their factors are like the constituent knots.) The words 'inspire' and 'motivate' are used a lot. And there are precise comparisons to be made between the objects on either side (e.g. the algebraic fundamental group of $\mathrm{Spec} ~\mathbb{Z}$ is isomorphic to the classical fundamental group of $S^3$.)
But I'd like to know whether there is some larger framework that rigorously explains why this analogy exists.
 A: For this analogy, like most analogies in mathematics, and indeed like most philosophical principles in mathematics, one can certainly make a part of it formal and rigorous, but I don't think any true formal statement could ever capture all of what we mean by the analogy.
In particular, by well-chosen definitions, one can write down statements of the form "If X is either a 3-manifold or the ring of integers of a number field, then something is true about X", where "something" is expressed the same way in each case. But there's no reason to expect that there is a single statement that implies all true such statements.
In particular, one can certainly not get an equivalence of categories between some category of 3-manifolds and some category of number fields (as Wojowu suggests in the comments), or any kind of correspondence between one 3-manifold and one number field, that respects the interesting structure like Artin-Verdier duality. (Thus I think the equivalence of fundamental groups between $S^3$ and $\mathbb Z$ is a red herring.)
Note that in Verdier duality, a pretty fundamental concept is an orientation. Any 3-manifold is either oriented or has a double cover to be oriented. But from the form of Artin-Verdier duality, for a number field to be oriented, it would have to contain the $n$th roots of unity for all $n$, which is impossible. So the "oriented double cover" in this setting is actually a cover of infinite degree! Covering spaces and dualizing sheaves are some of the concepts we absolutely do want to match up, so I don't think there's any way to wriggle out of this.
