Abstract. We consider classes of functions uniquely determined by coefficients of their divergent expansions. Approximating a function in such a class by partial sums of its expansion, we study how the accuracy changes when we move within a given region of the complex plane. Analysis of these changes allows us to propose a theory of divergent expansions, which includes a duality theorem and the Stokes phenomenon as essential parts. In its turn, this enables us to formulate necessary and sufficient conditions for a particular divergent expansion to encounter the Stokes phenomenon. We derive explicit expressions for the exponentially small terms that appear upon crossing Stokes lines and lead to an improvement in the accuracy of the expansion. §1. IntroductionThe Stokes phenomenon plays an exceptional role in complex analysis, in particular, in asymptotic analysis. It is very important for applications in theoretical and mathematical physics.This phenomenon was a stumbling block for Poincaré's asymptotic theory, which failed to explain it and which could not be used to evaluate the exponentially small Stokes' discontinuities.The stream of papers developing various ideas in the explanation of the phenomenon is vast and continues to grow. See, for example, [1,3,4,5,6,7,8], and the list of publications can be continued. The title of the paper "Stokes phenomenon demystified", see [9], is indicative of its extraordinary nature. It is difficult to think of another discovery of the middle part of the 19th century which still needs to be demystified 150 years after it was reported for the first time.In evaluating the position of fringes of supernumerary rainbows, Stokes [10] came upon the problem of approximation of an entire function (the Airy function) in the complex z-plane by multivalued functions (generated by formal solutions of Airy's differential equation). He discovered the existence of certain rays, Stokes rays, such that upon crossing these rays, one needs to add a term, exponentially small in z as z → ∞, to the approximation in order to retain the previous accuracy.Nearly one hundred years later, Pokrovskiȋ and Khalatnikov published the paper [11] in which they computed an exponentially small reflection which is not detected by the WKB method, and which would come to be called "asymptotics beyond-all-orders"; see [5], especially the papers by M. Berry and M. Kruskal et al.,and [12].