This paper argues that the wall-crossing formula for (generalized) Donaldson-Thomas invariants,
written down by Kontsevich-Soibelman, governs the wall-crossing behavior of BPS degeneracies in 4d
N=2 supersymmetric gauge theories.

The main idea is to study the theory compactified on a circle of radius R. On general
grounds of supersymmetric field theory, the IR physics can then be described as a 3d
sigma-model with target space a hyperkahler manifold M. In one of the complex structures induced by
the hyperkahler structure (the "distinguished complex structure"),
M is the total space of an integrable system -- in other words it is
a complex symplectic manifold, fibered over the Coulomb branch of the 4d theory, with
complex Lagrangian fibers, the generic fiber topologically a compact torus.

The metric on M takes a simple and explicit form in the limit R \to \infty: it approaches a
"semiflat" metric, so called because it is flat when restricted to each torus fiber. The really
interesting part of the story is the deviations from the semiflat metric which appear
at finite R. These corrections come from a specific
kind of BPS instanton, namely a BPS particle of the 4d theory going around the compactification
circle. It turns out that they are weighted by the BPS index that counts these 4d particles.
This index should be thought of as a physicist's version of a generalized Donaldson-Thomas
invariant. The "wall-crossing phenomenon" is the fact that -- despite being protected
by supersymmetry -- these BPS indices can actually jump
as one varies parameters, in particular as one moves around the Coulomb branch.
In our context this leads to a puzzle: the BPS indices jump, but somehow the instanton corrections
to the metric on M should not jump! One of the main physical points of this paper is to explain how this
puzzle is resolved; the answer is that *the metric on M is actually smooth provided that the jump
of the BPS indices at the wall is constrained in a very specific way, namely, it
should obey the wall-crossing formula of Kontsevich-Soibelman*.

The instanton-corrected M can be described exactly, but the description is a little intricate.
In any complex structure except for the distinguished one, M is built by gluing together
patches. Each patch looks like an open subset of a complex symplectic torus.
The transition functions are certain distinguished
symplectomorphisms (the same ones which appear in the Kontsevich-Soibelman wall-crossing formula).
Roughly speaking we have one such symplectomorphism for each BPS particle of the theory.
This part of the construction is rather parallel to what had appeared in earlier work
by Kontsevich-Soibelman, in the context of the SYZ description of a K3 surface.
The really new part of our story is that we build
all the complex structures of M at once and keep track of how things depend on the complex
structure; or, better said, we give a construction of the twistor space Z of M.

Z has the topology of M \times CP^1, and
the trickiest step of our construction is to solve a certain Riemann-Hilbert problem on this CP^1.
This amounts to constructing a differential equation over CP^1, valued in an infinite-dimensional
bundle, with irregular singularities at the north and south poles of CP^1. (These two
singularities are related to one another by a real structure which acts on the whole story.)
At the irregular singularities one has Stokes phenomena, and the Stokes factors are precisely
the symplectomorphisms mentioned above, corresponding to BPS particles. We solve the Riemann-Hilbert
problem by relating it to finding a fixed point for a certain integral operator, which can be argued
to be a contraction at least for large enough R. The behavior at smaller R is less understood
although it is likely to be interesting; fortunately, if our goal is to understand the
geometry of the wall-crossing
formula, large R is enough.

A reader who is not interested in physics can interpret this paper as proposing a new construction
of hyperkahler metrics. The data that go into the construction are, roughly speaking,
a complex integrable system plus a set of integer invariants obeying the Kontsevich-Soibelman
wall-crossing formula. These invariants control the quantum corrections which deform the metric
away from the semiflat form. In particular, if the integer invariants are artfully chosen,
these quantum corrections smooth out the behavior near the points where the semiflat metric
is singular.

It may be useful to compare the output of our construction to what comes out of
Gross and Wilson's work on K3 surfaces.
They wrote down a metric which is not quite Ricci-flat, but a very good approximation:
it is exponentially close to the Ricci-flat one in the so-called "large complex structure" limit
(in our notation this is the limit of large R).
Their metric is the one we would get from our approach if we ignore
all of the quantum corrections except for the dominant one near each singularity
of the SYZ fibration. So our method morally amounts to specifying the "improvement" that is needed
to further correct their metric to the exact Ricci-flat one. I say "morally" because we have not
yet applied our approach to K3 surfaces; there are some possible convergence problems which need
careful consideration (although we optimistically believe they can be overcome.)