Question about SL(2,Z) duality of string theory/N=4 SYM

$\mathcal N=4$ SYM has an $\mathrm{SL}(2,\mathbb Z)$ duality group. This can be thought of in two ways: 1. This theory can be obtained by compactifying the 6D $\mathcal N=(2,0)$ theory on a torus, and this group comes from the group of large diffeomorphisms of the torus.

1. The theory can also be obtained as the low energy theory of D3 branes in type IIB string theory. This theory has an $\mathrm{SL} (2,\mathbb Z)$ duality exchanging, eg, strings and D1 branes, but preserving D3 branes, and so this descends to an action on their low energy theory.

If both ways of thinking are valid, I'm confused about what exactly this $\mathrm{SL}(2,\mathbb Z)$ symmetry of type IIB is. It seems to be related to torii, but isn't it present even if there are no torii around? How are the two descriptions related?

There are hidden tori in type IIB string theory! One may describe type IIB string theory as a formally 12-dimensional theory called F-theory (due to Cumrun Vafa) whose 2 dimensions must be immediately compactified on a two-torus or, using the F-theory algebraic geometry jargon, an elliptic curve. In fact, what's important about F-theory is that it allows the $\tau$ parameter labeling the complex structure of the torus to undergo SL(2,Z) monodromies when you go around real-codimension-two objects, the 7-branes in type IIB string theory. This monodromy corresponds to the reparameterization of the periodic vectors that define the two-torus, something that is allowed at the level of (12-dimensional) geometry but something that one could forget about if he just considered a field $\tau$ in the 10-dimensional type IIB string theory.

The derivation of the S-duality group from the 12-dimensional theory is then totally analogous to the derivation from the (2,0) theory. There's only one difference: the 12-dimensional theory apparently doesn't allow us to decompactify the two toroidal dimensions: they're intrinsically different, infinitesimal dimensions. However, as far as complex structure on manifolds goes, they may be treated together with the remaining 10 spacetime dimensions.

The two-tori in the two constructions above aren't quite independent from one another. After all, an M5-brane wrapped on a 2-torus in an M-theory spacetime may be interpreted as a D4-brane in a type IIA theory (obtained by reinterpreting one of the wrapped dimensions as the 11th M-theory circular dimension) and then T-dualized to a D3-brane in type IIB string theory. The (2,0) SCFT may also be obtained by compactifying type IIB on ALE singularities which is harder to relate by dualities but I don't want to say everything about the (2,0) theory here.

M-theory (name linked to mother) has 11 dimensions and all of them may be decompactified; F-theory (name linked to father) has 12 dimensions but two of them can't be quite decompactified. Which of them has a higher number of spacetime dimensions (and is therefore a "more geometric description" of string/M-theory vacua) is therefore a bit subjective question; it's similar to the question whether mothers or fathers are more important parents. They play different enough roles in the structure of string/M-theory but both of them are comparably important.

There's always a torus in type IIB theory, it is hidden in the reduction from M-theory. The F-theory makes this torus a dynamical geometrical entity, but it is not like M-theory, it isn't a physical 12 dimensional theory.

To get the IIA theory, you put the M-theory compactified on a very small circle, where weak coupling is small circle (heavy D0 branes, which are KK charged black holes--- they have momentum in the 11th direction). The IIB theory is found by T-dualizing IIA, so you put the IIA on a small circle. This means that the IIB theory is M-theory on an infinitesimal torus, and the large diffeomorphisms of this torus are the coupling SL(2,Z).

The F-theory is reversed engineered from this, by considering the torus as like the circle in IIA. The result is a not particulary physical 12 dimensional theory, unlike M-theory which is a completely physical 11 dimensional space-time theory.