In a very interesting blog discussion at the $n$-category cafe, an anonymous poster made the following remark: "... using the dictionary between number fields and function fields, Weil suggested that G-with-adelic-entries is analogous to the group of gauge transformations of a principal G-bundle over a Riemann surface."
I would like to know how this particular piece of the number field / function field analogy is made precise. As a preliminary question, does anyone know a reference to where Weil (or someone else) explains it? I have a suspicion that it might be discussed in the notes from Weil's 1959-1960 lectures on "Adeles and algebraic groups", but the copy in my local library is checked out so I'm not sure.
My next question is for an explanation of the analogy in what I assume is the simplest case: holomorphic vector bundles on a compact Riemann surface. There are two obstacles here. First, I don't know what a gauge transformation is, and the "Mathematical Formalism" section of the Wikipedia page seems nonsensical to me. What is being transformed, and what is the transformation itself? Can anyone provide a physics-free definition, purely in the language of geometry?
Now given a curve $X$ over the complex numbers (or any field), we can form a topological ring $\mathbf{A}_X$ as the restricted product of the completed local rings at the closed points of $X$. The second obstacle is that when the ground field is infinite, these completions are not locally compact, so it seems unlikely that $\mathbf{A}_X$ is a good thing to consider.
Nonetheless, can one put the constructions of the previous two paragraphs together to produce, for any rank $n$ holomorphic vector bundle $\mathcal{E}$ on $X$, a bijection as follows?
$${\text{gauge transformations of }\mathcal{E}}\stackrel{?}{\leftrightarrow} \mathrm{GL}_n(\mathbf{A}_X)$$
My final question is, what is the correct version of this when the complex numbers are replaced by a finite field? Now we can consider algebraic vector bundles, and even better the adeles of $X$ are now a good thing to consider. So in trying to extend the putative bijection above to this case, the content seems to be in algebraizing the notion of gauge transform. Thus, I'm asking for a (second?) definition of gauge transformation which is native to algebraic geometry, if such exists.