Symmetry, Integrability and Geometry: Methods and Applications Teichmüller Theory of Bordered Surfaces ⋆

We propose the graph description of Teichm\"uller theory of surfaces with marked points on boundary components (bordered surfaces). Introducing new parameters, we formulate this theory in terms of hyperbolic geometry. We can then describe both classical and quantum theories having the proper number of Thurston variables (foliation-shear coordinates), mapping-class group invariance (both classical and quantum), Poisson and quantum algebra of geodesic functions, and classical and quantum braid-group relations. These new algebras can be defined on the double of the corresponding graph related (in a novel way) to a double of the Riemann surface (which is a Riemann surface with holes, not a smooth Riemann surface). We enlarge the mapping class group allowing transformations relating different Teichm\"uller spaces of bordered surfaces of the same genus, same number of boundary components, and same total number of marked points but with arbitrary distributions of marked points among the boundary components. We describe the classical and quantum algebras and braid group relations for particular sets of geodesic functions corresponding to $A_n$ and $D_n$ algebras and discuss briefly the relation to the Thurston theory.


Introduction
Recent advances in the quantitative description of the Teichmüller spaces of hyperbolic structures were mainly based on the graph (combinatorial) description of the corresponding spaces [19,7]. The corresponding structures not only provided a convenient coordinatization together with the mapping class group action, they proved to be especially useful when describing sets of geodesic functions and the related Poisson and quantum structures [3]. Combined with Thurston's theory of measured foliations [22,20], it led eventually to the formulation of the quantum Thurston theory [5]. The whole consideration was concerning Riemann surfaces with holes. A natural generalization of this pattern consists in adding marked points on the boundary components. First, Kaufmann and Penner [15] showed that the related Thurston theory of measured foliations provides a nice combinatorial description of open/closed string diagrammatic. Second, if approaching these systems from the algebraic viewpoint, one can associate a cluster algebra (originated in [10] and applied to bordered surfaces in [11]) to such a geometrical pattern.
The aim of this paper is to provide a shear-coordinate description of Teichmüller spaces of bordered Riemann surfaces, to construct the corresponding geodesic functions (cluster variables), and to investigate the Poisson and quantum relations satisfied by these functions in classical case or by the correspondent Hermitian operators in the quantum case.
In Section 2, we give a (presumably new) description of the Teichmüller space of bordered (or windowed) surfaces in the hyperbolic geometry pattern using the graph technique supporting it by considering a simplest example of annulus with one marked point. It turns out that adding each new window (a new marked point) increases the number of parameters by two resulting in adding a new inversion relation to the set of the Fuchsian group generators. We explicitly formulate rules by which we can construct geodesic functions (corresponding to components of a multicurve) using these coordinates; the only restriction we impose and keep throughout the paper is the evenness condition: an even number of multicurve lines must terminate at each window.
In Section 3, we construct algebras of geodesic functions postulating the Poisson relations on the level of the (old and new) shear coordinates of the Teichmüller space. We construct flip morphisms and the corresponding mapping class group transformations and find that in the bordered surfaces case we can enlarge this group allowing transformations that permute marked points on one of the boundary components or transfer marked points from one component to another thus establishing isomorphisms between all the Teichmüller spaces of surfaces of the same genus, same number of boundary components, and the same total number of marked points. In the same section, we describe geodesic algebras corresponding (in the cluster terminology, see [11]) to A n and D n systems. Whereas the A n -algebras have been known previously as algebras of geodesics on Riemann surfaces of higher genus [16,17] (their graph description in the case of higher-genus surfaces with one or two holes see in [4]) or as the algebra of Stockes parameters [6,23], or as the algebra of upper-triangular matrices [2], the D n -algebras seem to be of a new sort. Using the new type of the mapping class group transformations, we prove the braid group relations for all these algebras. Section 4 is devoted to quantization. We begin with a brief accounting of the quantization procedure from [3] coming then to the quantum geodesic operators and to the corresponding quantum algebras. Here, again, the quantum D n -algebras seem to be of a new sort, and we prove the Jacobi identities for them in the abstract setting without appealing to geometry. We also construct the quantum braid group action in this section.
In Section 5, we describe multicurves and related foliations for bordered surfaces, that is, we construct elements of Thurston's theory. There we also explicitly construct the relevant doubled Riemann surface, which, contrary to what one could expect, is itself a Riemann surface with holes (but without windows). We transfer the notion of multicurves to this doubled surface. Note, however, that the new mapping class group transformations, while preserving the multicurve structure on the original bordered surface, change the topological type of the doubled Riemann surface, which can therefore be treated only as an auxiliary, not basic, element of the construction. Using this double, we can nevertheless formulate the basic statement similar to that in [5], that is, that in order to obtain a self-consistent theory that is continuous at Thurston's boundary, we must set into the correspondence to a multicurve the sum of lengths of its constituting geodesics (the sum of proper length operators in the quantum case). In the same Section 5, we describe elements of Thurston's theory of measured foliations for bordered Riemann surfaces and the foliation-shear coordinate changings under the "old" and "new" mapping class group transformations.
We discuss some perspectives of the proposed theory in the concluding section. We tried to make the presentation as explicit and attainable as possible, so there are many figures in the text.
2 Graph description and hyperbolic geometry 2.1 Hyperbolic geometry and inversion relation

Graph description for nonbordered Riemann surfaces
Recall the graph description of the Fuchsian group, or the fundamental group of the surface Σ g,s , which is a discrete finitely generated subgroup of P SL(2, R). We consider a spine Γ g,s corresponding to the Riemann surface Σ g,s with g handles and s boundary components (holes). The spine, or fatgraph Γ g,s is a connected graph that can be drawn without self-intersections on Σ g,s , has all vertices of valence three, has a prescribed cyclic ordering of labeled edges entering each vertex, and is a maximum graph in the sense that after cutting along all its edges, the Riemann surface decomposes into the set of polygons (faces) such that each polygon contains exactly one hole (and becomes simply connected after plumbing this hole). Since a graph must have at least one face, we can therefore describe only Riemann surfaces with at least one hole, s > 0. The hyperbolicity condition also implies 2g − 2 + s > 0. We do not impose restrictions, for instance, we allow edges to start and terminate at the same vertex, allow two vertices to be connected with more than one edge, etc. We however demand a spine to be a cell complex, that is, we do not allow loops without vertices.
Then, we can establish a 1-1 correspondence between elements of the Fuchsian group and closed paths in the spine starting and terminating at the same directed edge. Since the terms in the matrix product depend on the turns in vertices (see below), it is not enough to fix just a starting vertex. To construct an element of the Fuchsian group ∆ g,s , we select a directed edge (one and the same for all the elements; see the example in Fig. 4 where it is indicated by a short fat arrow), then move along edges and turns of the graph without backtracking and eventually turn back to the selected directed edge 1 .
We associate with the αth edge of the graph the real Z α and set [7] the matrix of the Möbius transformation each time the path homeomorphic to a geodesic γ passes through the αth edge. We also introduce the "right" and "left" turn matrices to be set in the proper place when a path makes the corresponding turn, and define the related operators R Z and L Z , An element of a Fuchsian group has then the structure P γ = LX Zn RX Z n−1 · · · RX Z 2 RX Z 1 , 1 If the last edge was not the selected one but its neighboring edge, the very last move is turning to the selected edge, that is, we add either R-or L-matrix; if the last edge coincides with the selected edge, we do not make the last turn through the angle 2π. This results in the ambiguity by multiplication by the matrix −Id = R 3 , but it is inessential as we deal with the projective transformations. and the corresponding geodesic function is related to the actual length ℓ γ of the closed geodesic on the Riemann surface.

Generalization to the bordered surfaces case
We now introduce a new object, the marking pertaining to boundary components. Namely, we assume that we have not just boundary components but allow some of them to carry a finite number (possibly zero) of marked points. We let δ i , i = 1, . . . , s, denote the corresponding number of marked points for the ith boundary component. Geometrically, we assume these points to lie on the absolute, that is, instead of associating a closed geodesic to the boundary component in nonmarked case, we associate to an ith boundary component a collection comprising δ i infinite geodesic curves connecting neighbor (in the sense of the surface orientation) marked points on the absolute (can be the same point if δ i = 1) in the case where δ i > 0. All these additional geodesic curves are disjoint with each other and disjoint with any closed geodesic on the Riemann surface. In [15], these curves were called windows. We denote the corresponding windowed surface Σ g,δ , where is the multiindex counting marked points on the boundary components (δ i can be zero) whereas s is the number of boundary components. We call such Riemann surfaces the windowed, or bordered Riemann surfaces.
We want now to generalize the graph setting to the case where we have boundary components with marked points. However, as the example below shows, in order to define inambiguously the corresponding hyperbolic geometry, when introducing a marked point on the boundary, we must simultaneously introduce one more additional parameter. This is because, as we shall demonstrate, introducing a marked point adds a new inversion relation that preserves the orientation but not the surface itself, that is, we invert a part of the Riemann surface through a boundary curve without taking care on what happen to the (remaining) part of the surface because, in our description, this (outer) part is irrelevant. Such an inversion relation leaves invariant the new added geodesic, that is, the window. However, there is a one-parameter family of such inversions for every window, and in order to fix the ambiguity we must indicate explicitly which point on the new geodesic is stable w.r.t. such an inversion. Recall that because of orientation preservation, two ends (on the absolute) of this new geodesic must be interchanged by the inversion relation; it is therefore a unique point that is stable.
We describe this situation by considering new types of graphs with pending vertices. Assume that we have a part of graph having the structure as in Fig. 1.
Then, if a geodesic line comes to a pending vertex, it undergoes the inversion, which stems to that we insert the inversion matrix F , into the corresponding string of 2×2-matrices. For example, a part of geodesic function in Fig. 1 that is inverted reads whereas the other geodesic that does not go to the pending vertex reads merely We call this new relation the inversion relation, and the inversion element is itself an element of P SL(2, R). We also call the edge terminating at a pending vertex the pending edge. Note the simple relation 2 , We therefore preserve the notion of the geodesic function for curves with inversions as well. We consider all possible paths in the spine (graph) that are closed and may experience an arbitrary number of inversions at pending vertices of the graph. As above, we associate with such paths the geodesic functions (here, we let Z i denote the variables of pending edges and Y j all other variables) G γ ≡ tr P γ = 2 cosh(ℓ γ /2) = tr LX Zn F X Zn RX Y n−1 · · · RX Z 1 F X Z 1 . (2.5) We have that, for the windowed surface Σ g,δ , the number of the shear coordinates Z α is and adding a new window increases this number by two. Before describing the general structure of algebras of geodesic functions, let us clarify the geometric origin of our construction in the simplest possible example.

Annulus with one marked point
The simplest example is the annulus with one marked point on one of the boundary components (another example of disc with three marked points will be considered later). Here, the geometry is as in Fig. 2 where we let the closed line around the neck (the blue line) denote a unique closed geodesic corresponding to the element P I of the Fuchsian group to be defined below, the winding to it line (the red line) is the boundary geodesics from the (ideal) triangle description due to Penner and Fock, and the lower geodesic (the green line) is the new line of inversion (the window). We indicate by bullet the stable point and by cross the point of the inversion line that is closest to the closed geodesic. Geodesic lines on the hyperboloid: dotted vertical line is the asymptote going to the marked point on the absolute, closed blue line is a unique closed geodesic; red line is the line from the ideal triangular decomposition asymptotically approaching the asymptote by one end and the closed geodesic by the other; green line is the line of inversion whose both ends approach the marked point; we let the bullet on this line denote the unique stable point under the inversion and the cross denote the point that is closest to the closed geodesic.
The same picture in the Poincaré upper half-plane is presented in Fig. 3. There, the whole domain in Fig. 2 bounded below by the bordered (green) geodesic line and above by the neck geodesic (blue) line is obtained from a single ideal triangle with the vertices {e Z+Y , ∞, 0} upon gluing together two (red) sides of this ideal triangle. We now construct two (hyperbolic) elements: P I that is the generating element for the original hyperbolic geometry and the new element P II that corresponds to the inversion w.r.t. the lower (green) geodesic line in Figs. 2 and 3. Adding this new element obviously changes the pattern, but because the Fuchsian property retains, the quotient of the Poincaré upper half-plane under the action of this new Fuchsian group must be again a Riemann surface with holes. As we demonstrate below, this new Riemann surface is just the double of the initial bordered Riemann surface.
For this, we use the graph representation. The corresponding fat graph is depicted in Fig. 4. This graph with one pending edge and another edge that starts and terminates at the same vertex is dual to an ideal triangle {e Z+Y , ∞, 0} in which two (red) sides are glued one to another (the resulting curve is dual to the loop) and the remaining (green) side is the boundary curve (dual to the pending edge). We mark the starting direction by the fat arrow, so the element P I is Apparently, the corresponding geodesic function G I is just e −Y /2 + e Y /2 , so the length of the closed geodesic is |Y | as expected. We now construct the element P II . Note that this element makes the inversion w.r.t. the geodesic between 0 and ∞, so we set the matrix F first (since the multiplication is from right  Fig. 2: preimages of red boundary line are red half-circles, preimages of the inversion line are green half circles (the selected one connects the points ∞ and 0 on the absolute), and the preimage of the closed geodesic is the (unique) blue half-circle; the points e Z and e Z+Y on the absolute are stable under the action of the corresponding Fuchsian element P I (2.6); the bullet symbols are preimages of the point that is stable upon inversion (the one that lies on the geodesic line between ∞ and 0 is i in the standard coordinates on the upper half-plane) and the dotted half-circles connect the point e Z+Y with its images (one of which is −e −Z−Y ) under the action of the inversion element F . We also mark by cross the point ie Z+Y /2 of the green geodesic line that is closest to the closed geodesic. The invariant axis of the new element P II (2.7) and some of its images under the action of (2.6) are depicted as cyan half-circles; ξ 2 is from (2.8).
to left, this matrix will be rightmost). Then, the rest is just the above element P I : and the corresponding geodesic function G II is 2 cosh(Z +Y /2) so the length of the corresponding geodesic (but in a geometry still to be defined!) is |2Z + Y |. We now consider the action of these two elements in the geometry of the Poincaré upper halfplane in Fig. 3. It is easy to see that the element P I has two stable points: e Z (attractive) and e Z+Y (repulsive). It also maps ∞ → 0, e Z + e Z+Y → ∞, etc. thus producing the infinite set of preimages of the red geodesic line in Fig. 2 upon identification under the action of this element.
The element F first interchanges 0 and ∞ and e Z+Y and −e −Z−Y thus establishing the inversion (inversion) w.r.t. the green geodesic line. The only stable point of this inversion is the point of intersection of the two above geodesic lines, and it is the point i in the upper complex half-plane for every Z + Y . Further action is given by P I and, in particular, it maps ∞ back to 0, so ξ 1 = 0 is a stable point of P II . Another stable point is and it is easy to see that the two invariant axes of P I and P II never intersect. Adding the element P II to the set of generators of the new extended Fuchsian group we therefore obtain a new geometry. First, let us consider the special case where the stable point on the inversion curve coincides with the point that is closest to the closed geodesic. Then, apparently, the inversion process exhibits a symmetry depicted in Fig. 5. Considering the Riemann surface depicted in Fig. 2,  we chop out all its part that is below the green (inversion) line. We then obtain the double of the Riemann surface merely by inverting it w.r.t. the green line taking into account the obvious (mirror) symmetry that takes place in this case. We then obtain from the hyperboloid with marked point at the boundary component the sphere with two identical cycles (images of the closed geodesic) and one additional puncture (hole of zero length), as shown in Fig. 5.
What happens if, instead of the stable point marked by cross, we have arbitrary stable point (bullet in Figs. 2 and 3)? Actually, we can answer this question just from the geometrical standpoint. Indeed, since in the pattern in Fig. 2, points on the inversion geodesics that lie to both sides from the asymptote are close, they must remain close in the new geometry. But the image of each such point is shifted by a distance that is twice the distance D (along the inversion line, which is a geodesic line) between the stable point (bullet) and the symmetric point (cross). This means that, in the new geometry, the points on the inversion line separated by a distance 2D must be asymptotically close as approaching the absolute in the pattern of Fig. 3. This means in turn that the corresponding geodesic in the new geometry is just a geodesic approaching the new closed geodesic of length 2D.
It remains just to note that, from the pattern in Fig. 3, . We let two crosses denote the points on the inversion line that are closest to the two copies of the initial closed geodesic line; the geodesic distance between them is also |2Z + Y |.
that is, the perimeter of the new hole is |2Z + Y |, and it coincides with the length of the new element P II (2.7), which is therefore the element of the new, extended, Fuchsian group corresponding to going round the new hole. In Fig. 6, we depict this new geometry. It is also interesting to note that we now again, as in the symmetrical case, have two (homeomorphic) images of the initial bordered surface, but the union of these two images in Fig. 6 constitutes only the part of the corresponding Riemann surface that is above the new closed geodesics (the cyan line); two ends of the green geodesics constitute the double helix approaching the new geodesic line but never reaching it, and we always have one copy of the initial surface on one side of coils of this helix and the other copy -on the other side.
3 Algebras of geodesic functions

Poisson structure
One of the most attractive properties of the graph description is a very simple Poisson algebra on the space of parameters Z α . Namely, we have the following theorem. It was formulated for surfaces without marked points in [7] and here we extend it to arbitrary graphs with pending vertices.
Theorem 1. In the coordinates (Z α ) on any fixed spine corresponding to a surface with marked points on its boundary components, the Weil-Petersson bracket B WP is given by where the sum is taken over all three-valent (i.e., not pending) vertices v and v i , i = 1, 2, 3 mod 3, are the labels of the cyclically ordered edges incident on this vertex irrespectively on whether they are internal or pending edges of the graph.
The center of this Poisson algebra is provided by the proposition.
Proposition 1. The center of the Poisson algebra (3.1)) is generated by elements of the form Z α , where the sum is over all edges of Γ in a boundary component of F (Γ) taken with multiplicities. This means, in particular, that each pending edge contributes twice to such sums.
Proof . The proof is purely technical; for the case of surfaces without marked points on boundary components it can be found in Appendix B in [5]. When adding marked points, it is straightforward to verify that the sums in the assertion of the proposition are central elements.
In order to prove that no extra central elements appear due to the addition process, it suffices to verify that the two changes of the part of a graph shown below, do not change the corank of the Poisson relation matrix B(Γ g,s,δ ).
and with all other brackets equal to zero.

Classical flip morphisms and invariants
The Z α -coordinates (which are the logarithms of cross ratios) are called (Thurston) shear coordinates [22,1] in the case of punctured Riemann surface (without boundary components). We preserve this notation and this term also in the case of windowed surfaces.
In the case of surfaces with holes, Z α were the coordinates on the Teichmüller space T H g,s , which was the 2 s -fold covering of the standard Teichmüller space ramified over surfaces with punctures (when a hole perimeter becomes zero, see [8]). We assume correspondingly Z α to be the coordinates of the corresponding spaces T H g,δ in the bordered surfaces case. Assume that there is an enumeration of the edges of Γ and that edge α has distinct endpoints. Given a spine Γ of Σ, we may produce another spine Γ α of Σ by contracting and expanding edge α of Γ, the edge labelled Z in Fig. 7, to produce Γ α as in the figure; the fattening and embedding of Γ α in Σ is determined from that of Γ in the natural way. Furthermore, an enumeration of the edges of Γ induces an enumeration of the edges of Γ α in the natural way, where the vertical edge labelled Z in Fig. 7 corresponds to the horizontal edge labelled −Z. We say that Γ α arises from Γ by a Whitehead move along edge α. We also write Γ αβ = (Γ α ) β , for any two indices α, β of edges, to denote the result of first performing a move along α and then along β; in particular, Γ αα = Γ for any index α.

Whitehead moves on inner edges
Proposition 2 ([3]). Setting φ(Z) = log(e Z + 1) and adopting the notation of Fig. 7 for shear coordinates of nearby edges, the effect of a Whitehead move is as follows: In the various cases where the edges are not distinct and identifying an edge with its shear coordinate in the obvious notation we have: . Any variety of edges among A, B, C, and D can be pending edges of the graph.
We also have two simple but important lemmas establishing the properties of invariance w.r.t. the flip morphisms.  That the Poisson algebra for the bordered surfaces case is invariant under the flip transformations follows immediately because we flip here inner, not pending, edges of a graph, which reduces the situation to the "old" statement for surfaces without windows.
We also have the statement concerning the polynomiality of geodesic functions.
Proposition 3. All G γ constructed by (2.5) are Laurent polynomials in e Z i and e Y j /2 with positive integer coefficients, that is, we have the Laurent property, which holds, e.g., in cluster algebras [10]. All these geodesic functions preserve their polynomial structures upon Whitehead moves on inner edges, and all of them are hyperbolic elements (G γ > 2), the only exception where G γ = 2 are paths homeomorphic to going around holes of zero length (punctures).

Whitehead moves on pending edges
In the case of windowed surfaces, we encounter a new phenomenon as compared with the case of surfaces with holes. We can construct morphisms relating any of the Teichmüller spaces T H g,δ 1 and T H g,δ 2 with δ 1 = {δ 1 1 , . . . , δ 1 n 1 } and δ 2 = {δ 2 1 , . . . , δ 2 n 2 } providing n 1 = n 2 = n and δ 2 i , that is, we explicitly construct morphisms relating any two of algebras corresponding to windowed surfaces of the same genus, same number of boundary components, and with the same total number of windows; the window distribution into the boundary components can be however arbitrary.
This new morphism corresponds in a sense to flipping a pending edge. Fig. 9 is the morphism between the spaces T H g,δ 1 and T H g,δ 2 . These morphisms preserve both Poisson structures (3.1) and the geodesic length functions. In Fig. 9 any (or both) of Y -variables can be variables of pending edges (the transformation formula is insensitive to it).  Proof . Verifying the preservation of Poisson relations (3.1) is simple, whereas for traces over paths we have four different cases of path positions in the subgraph in the left side of Fig. 9, and in each case we have the corresponding path in the right side of this figure 3 . In each of these cases we have the following matrix equalities (each can be verified directly)

Lemma 3. Transformation in
From the technical standpoint, all these equalities follow from flip transformation (3.2) upon the substitution A = C = Y 2 , B = D = Y 1 , and Z = 2Z. The above four cases of geodesic Using flip morphisms in Fig. 9 and in formula (3.2), we may establish a morphism between any two algebras corresponding to surfaces of the same genus, same number of boundary components, and same total number of marked points on these components; their distribution into the boundary components can be however arbitrary. And it is again a standard tool that if, after a series of morphisms, we come to a graph of the same combinatorial type as the initial one (disregarding marking of edges), we associate a mapping class group operation with this morphism therefore passing from the groupoid of morphisms to the group of modular transformations. where Z 1 and Z 2 are the pending edges, generates the (unitary) mapping class group transformation on the corresponding Teichmüller space T H g,δ . This is a particular case of braid transformation to be considered in detail in Section 3.6.

New graphical representation
In the case of usual geodesic functions, there exists a very convenient representation in which one can apply classical skein and Poisson relations in classical case or the quantum skein relation in the quantum case and ensure the Riedemeister moves when "disentangling" the products of geodesic function representing them as linear combinations of multicurve functions. However, in our case, it is still obscure what happens when geodesic lines intersect in some way at the pending vertex. In fact, we can propose the comprehensive graphical representation in this case as well! For this, let us come back to Fig. 1 and resolve now the inversion introducing a new dot-vertex at a pending vertex inside the fat graph and assuming that the inversion matrix F corresponds to winding around this dot-vertex as shown in Fig. 10.
We now formulate the rules for geodesic algebra that follow from relations (3.1) and classical skein relations. They coincide with the rules in the case of surfaces with holes except the one new case depicted in Fig. 11. Note that all claims below follow from direct and explicit calculations involving representations from Section 2.

Classical skein relation
The trace relation tr (AB) + tr (AB −1 ) − tr A · tr B = 0 for arbitrary 2 × 2 matrices A and B with unit determinant allows one to "disentangle" any product of geodesic functions, i.e., express it uniquely as a finite linear combination of generalized multicurves (see Definition 2 below). Introducing the additional factor #G to be the total number of components in a multicurve, we can uniformly present the classical skein relation as (3.4) We assume in (3.4) that the ends of lines are joint pairwise in the rest of the graph, which is the same for all three items in the formula. Of course, we perform there algebraic operations with the algebraic quantities -with the (products of) geodesic functions corresponding to the respective families of curves.

Poisson brackets for geodesic functions
We first mention that two geodesic functions Poisson commute if the underlying geodesics are disjointly embedded in the sense of the new graph technique involving dot-vertices. Because of the Leibnitz rule for the Poisson bracket, it suffices to consider only "simple" intersections of pairs of geodesics with respective geodesic functions G 1 and G 2 of the form where the superscripts 1 and 2 pertain to operators and traces in two different matrix spaces. The positions of edges A, B, C, D, and Z are as in Fig. 7. Dots in (3.5), (3.6) refer to arbitrary sequences of matrices R 1,2 , L 1,2 , X 1,2 Z i , and F 1,2 belonging to the corresponding matrix spaces; G 1 and G 2 must correspond to closed geodesic lines, but we make no assumption on their simplicity or graph simplicity, that is, the paths that correspond to G 1 and G 2 may have self-and mutual intersections and, in particular, may pass arbitrarily many times through the edge Z in Fig. 7.
Direct calculations then give where G I corresponds to the geodesic that is obtained by erasing the edge Z and joining together the edges "A" and "D" as well as "B" and "C" in a natural way as illustrated in the middle diagram in (3.4); G H corresponds to the geodesic that passes over the edge Z twice, so it has the form tr · · · X C R Z R D · · · · · · X B L Z L A · · · as illustrated in the rightmost diagram in (3.4). These relations were first obtained in [12] in the continuous parametrization (the classical Turaev-Viro algebra).
Having two curves, γ 1 and γ 2 , with an arbitrary number of crossings, we now find their Poisson bracket using the following rules: • We take a sum of products of geodesic functions of non(self)intersecting curves obtained when we apply Poisson relation (3.7) at one intersection point and classical skein relation (3.4) at all the remaining points of intersection; we assume the summation over all possible cases. • If, in the course of calculation, we meet an empty (contractible) loop, then we associate the factor −2 to such a loop; this assignment, as is known [5], ensures the Riedemeister moves on the set of geodesic lines thus making the bracket to depend only on the homotopical class of the curve embedding in the surface.
• If, in the course of calculation, we meet a curve homeomorphic to passing around a dotvertex, then we set tr F = 0 into the correspondence to such curve thus killing the whole corresponding multicurve function.
These simple and explicit rules are an effective tool for calculating the Poisson brackets in many important cases below.
Because the Poisson relations are completely determined by homotopy types of curves involved, using Lemma 3, we immediately come to the following theorem Theorem 2. Poisson algebras of geodesic functions for the bordered Riemann surfaces Σ g,δ 1 and Σ g,δ 2 that differ only by distributions of marked points among their boundary components are isomorphic; the isomorphism is described by Lemma 3.
It follows from this theorem that we can always collect all the marked points on just one boundary component. Figure 12. Generating graphs for A n algebras for n = 3, 4, . . . . We indicate character geodesics whose geodesic functions G ij enter bases of the corresponding algebras.

The A n algebras
Consider the disc with n marked points on the boundary; examples of the corresponding representing graph Γ n are depicted in Fig. 12 for n = 3, 4, . . . . We enumerate the n dot-vertices clockwise, i, j = 1, . . . , n. We then let G ij with i < j denote the geodesic function corresponding to the geodesic line that encircles exactly two dot-vertices with the indices i and j. Examples are in the figure: for n = 3, red line corresponds to G 12 , blue -to G 23 and green -to G 13 . Note that in the cluster terminology (see [11]) these algebras were called the A n−2 -algebras.
Using the skein relation, we can close the Poisson algebra thus obtaining for A 3 : {G 12 , G 23 } = G 12 G 23 − 2G 13 and cycl. permut. (3.8) Note that the left-hand side is doubled in this case as compared to Nelson-Regge algebras recalled in [5]. In the A 3 , case this is easily understandable because, say, and this expression literally coincides with the one for the algebra of geodesics in the case of higher genus surfaces with one or two holes (see [4]) but the left-hand side of the relation is now doubled (the analogous expression for G 12 in [4] was the same as in (3.9) upon the substitution Z 1 = X 1 /2 and Z 2 = X 2 /2, but with the X-variables having the doubled Poisson brackets {X 2 , X 1 } = 2). In higher-order algebras (starting with n = 4), we meet a more complicate case of the fourth-order crossing (as shown in the case n = 4 in Fig. 12). Using our rules for Poisson brackets, we find that those for these geodesic functions are (note that the items in the products in the r.h.s. mutually commute). It is also worth mentioning that after this doubling that occurs in the right-hand sides of relations (3.8) and (3.10), we come exactly to algebras appearing in the Frobenius manifold approach [6].

The D n -algebras
We now consider the case of annulus with n marked points on one of the boundary component (see the example in Fig. 8. Here, again, the state of art is to find a convenient (finite) set of geodesic functions closed w.r.t. the Poisson brackets 4 . In the case of annulus, such a set is given by geodesic functions corresponding to geodesics in Fig. 13.
We therefore describe a set of geodesic functions by the matrix G ij with i, j = 1, . . . , n where the order of indices indicates the direction of encompassing the second boundary component of the annulus.   Fig. 13 is Poisson closed.
The relevant Poisson brackets are too cumbersome and we omit them here because one can easily read them from the corresponding quantum algebra in formula (4.13) below in the limit as → 0.

Braid group relations on the level of Z-variables
We have already demonstrated in Example 2 a m.c.g. relation interchanging two pending edges of a graph. In a more general case of A n -algebra, we have a graph depicted in Fig. 12 and another intertwining relation arises from the three-step flipping process schematically depicted in Fig. 14.
The graph for the A n algebra has the form in Fig. 12 with Y i , 2 ≤ i ≤ n − 2, being the variables of internal edges and Z j , 1 ≤ j ≤ n, being the variables of the pending edges and we identify Y 1 ≡ Z 1 and Y n−1 ≡ Z n to make formulas below uniform.
We let R i,i+1 denote the intertwining transformation in Fig. 14 and 12) Figure 14. Three-step flip transformation of intertwining pending edge variables Z i and Z i+1 that results in the same combinatorial graph. The rest of the graph denoted by dots remains unchanged.
Lemma 5. For any n ≥ 3, we have the braid group relation

Braid group relations for geodesic functions of A n -algebras
Here we, following Bondal [2], propose another, simpler way to derive the braid group relations using the construction of the groupoid of upper-triangular matrices. It was probably first used in [6] to prove the braid group relations in the case of A 3 algebra. In the case of A n algebras for general n, let us construct the upper-triangular matrix A associating the entries G i,j with the geodesic functions. Using the skein relation, we can then present the action of the braid group element R i,i+1 exclusively in terms of the geodesic functions from this, fixed, set: A very convenient way to present this transformation is by introducing the special matrices B i,i+1 of the block-diagonal form Then, The action of the braid group generator R i,i+1 on A is merely with B T i,i+1 the matrix transposed to B i,i+1 . The proof [2] of Lemma 5 in this setting is much simpler than in terms of the Teichmüller space variables; moreover, using this approach, we can attack another important issue related to the second braid group relation 5 .
We consider the action of the chain of transformations R n−1,n R n−2,n−1 · · · R 2,3 R 1,2 A. Note that, on each step, the item G (i−1) i,i+1 in the corresponding matrix B i,i+1 is the transformed quantity (we assume G (0) ij to coincide with the initial G ij in A). However, it is easy to see that for just this chain of transformations, G , and the whole chain of matrices B can be then expressed in terms of the initial variables G i,j as , and the whole action on A gives and we see that it boils down to a mere permutation of the elements of the initial matrix A. It is easy to see that the nth power of this permutation gives the identical transformation, so we obtain the last braid group relation.

Braid group relations for geodesic functions of D n -algebras
It is possible to express readily the action of the braid group on the level of the geodesic functions G i,j , i, j = 1, . . . , n, interpreted also as entries of the n × n-matrix D (the elements that are not indicated remain invariant): (3.16) The first braid group relation follows in this case as well from the three-step process, but it can be verified explicitly that the following lemma holds.
Lemma 7. For any n ≥ 3, we have the braid group relation for transformations (3.16): Note that the second braid-group relation (see Lemma 6) is lost in the case of D n -algebras.
To present the braid-group action in the matrix-action (covariant) form (3.15) note that the combinations G k,j , G j,k , and G k,k G j,j have similar transformation laws in (3.16) in the case where at least one of the indices j and k is neither i nor i + 1, so we can try to construct globally covariantly transformed matrices from linear combinations of the above (coefficients of these combinations can be different above and below the diagonal). Note that (since the braid-group transformation acts on the A n subgroup of D n in the same way as before), the matrices A (3.14) and A T are transformed as in (3.15); the analysis shows that we also have two new matrices, R and S, with the same transformation law as in (3.15): where R is skewsymmetric (R T = −R) and S is symmetric (S T = S).
Lemma 8. Any linear combination w 1 A + w 2 A T + ρR + σS with complex w 1 , w 2 , ρ, and σ transforms in accordance with formula (3.15) under the braid-group action.
We postpone the discussion of modular invariants constructed from these four matrices till the discussion of the quantum D n braid-group action in Section 4.5.2.

Quantum Teichmüller spaces of windowed surfaces 4.1 Canonical quantization of the Poisson algebra
A quantization of a Poisson manifold, which is equivariant under the action of a discrete group D, is a family of * -algebras A depending on a positive real parameter with D acting by outer automorphisms and having the following properties: 1. (Flatness.) All algebras are isomorphic (noncanonically) as linear spaces.  Fix a cubic fatgraph Γ g,δ as a spine of Σ g,δ , and let T = T (Γ g,δ ) be the algebra generated by Z α , one generator for each unoriented edge α of Γ g,δ , with relations (cf. (3.1)) and the * -structure where Z α and {·, ·} denotes the respective coordinate functions and the Poisson bracket on the classical Teichmüller space. Because of (3.1), the right-hand side of (4.1) is a constant taking only five values 0, ±2πi , and ±4πi depending upon five variants of identifications of endpoints of edges labelled α and β.
All the standard statements that we have in the case of Teichmüller spaces of nonwindowed Riemann surfaces are transferred to the windowed surface case.
Lemma 9. The center Z of the algebra T is generated by the sums α∈I Z α over all edges α ∈ I surrounding a given boundary component, the center has dimension s, and the Poisson structure is nondegenerate on the quotient T /Z .
The examples of such boundary-parallel curves are again in Fig. 8. Of course, those are the same curves that provide the center of the Poisson algebra.
A standard Darboux-type theorem for nondegenerate Poisson structures then gives the following result.

Quantum flip transformations
The Whitehead move becomes now a morphism of (quantum) algebras. The quantum Whitehead move or flip along an edge of Γ by equation (3.2) is described by the (quantum) function [3] φ(z) ≡ φ (z) = − π 2 Ω e −ipz sinh(πp) sinh(π p) dp, where the contour Ω goes along the real axis bypassing the origin from above. For each unbounded self-adjoint operator Z on H, φ (Z ) is a well-defined unbounded self-adjoint operator on H. The function φ (Z) satisfies the relations (see [3]) and is meromorphic in the complex plane with the poles at the points {πi(m + n ), m, n ∈ Z + } and {−πi(m + n ), m, n ∈ Z + }.
• A flip W Z satisfies W 2 Z = I, (3.2), and flips satisfy the commutativity relation. • Flips satisfy the pentagon relation.

Geodesic length operators
We next embed the algebra of geodesic functions (2.2) into a suitable completion of the constructed algebra T . For any γ, the geodesic function G γ can be expressed in terms of shear coordinates on T H : where m j (γ, α) are integers and J is a finite set of indices.
In general, sets of integers {m j (γ, α)} 6g−6+3s+2#δ α=1 may coincide for different j 1 , j 2 ∈ J; we however distinguish between them as soon as they come from different products of exponentials e ±Z i /2 in traces of matrix products in (4.3).
For any closed path γ on Σ g,δ , define the quantum geodesic operator G γ ∈ T to be where the quantum ordering × × · × × implies that we vary the classical expression (4.3) by introducing additional integer coefficients c j (γ, α), which must be determined from the conditions below.
That is, we assume that each term in the classical expression (4.3) can get multiplicative corrections only of the form q n , n ∈ Z, with q ≡ e −iπ .
We often call a quantum geodesic function merely a quantum geodesic because quantum objects admit only a functional description.
We now formulate the defining properties of quantum geodesics.
1. If closed paths γ and γ ′ do not intersect, then the operators G γ and G γ ′ commute.
2. Naturality. The mapping class group M C(Σ g,δ ) (3.2) acts naturally, i.e., for any {G γ }, W ∈ M C(Σ g,δ ), and closed path γ in a spine Γ g,δ of Σ g,δ , we have 3. Geodesic algebra. The product of two quantum geodesics is a linear combination of quantum multicurves governed by the (quantum) skein relation below.
4. Orientation invariance. Quantum traces of direct and inverse geodesic operators coincide.

5.
Exponents of geodesics. A quantum geodesic G nγ corresponding to the n-fold concatenation of γ is expressed via G γ exactly as in the classical case, namely, where T n (x) are Chebyshev's polynomials.
6. Hermiticity. A quantum geodesic is a Hermitian operator having by definition a real spectrum.
We shall let the standard normal ordering symbol :e a 1 e a 2 · · · e an : denote the Weyl ordering e a 1 +···+an , i.e., :e a 1 e a 2 · · · e an : = 1 + (a 1 + · · · + a n ) + 1 2! (a 1 + · · · + a n )(a 1 + · · · + a n ) + · · · for any set of exponents with a i = −a j for i = j, In particular, the Weyl ordering implies total symmetrization in the subscripts. We have [3] the proposition, which can be extended to the case of windowed surfaces assuming the modification of the "old" notion of graph simple geodesics.
Definition 1. For a spine Γ g,δ , we call a geodesic graph simple if it does not pass twice through any of inner edges of the graph and has at most one inversion at any of pending edges.
Proposition 4. For any graph simple geodesic γ with respect to any spine Γ, the coefficients c j (γ, α) in (4.4) are identically zero, i.e., the quantum ordering is the Weyl ordering.
Proof . Let us again denote by Y i , i = 1, . . . , 6g − 6 + 3s + #δ, the quantum shear coordinates of inner edges and by Z j , j = 1, . . . , #δ the quantum shear coordinates of pending edges. But the latter always come in the combination X Z j F X Z j = X 2Z j , so, considering term-by-term the trace of the matrix product for a quantum graph simple geodesic, we find that we can expand it in Laurent monomials in e Y i /2 and e Z j . It is easy to see that each term e Y i /2 and e Z j comes either in power +1, or −1 in the corresponding monomial and there are no equivalent monomials in the sum. This means that in order to have a Hermitian operator, we must apply the Weyl ordering with no additional q-factors (by the correspondence principle, each such factor must be again a Laurent monomial in q standing by the corresponding term, which breaks the selfadjointness unless all such monomials are unity). Since quantum Whitehead moves must preserve the property of being Hermitian, if a graph-simple geodesic transforms to another graph-simple geodesic, then a Weyl-ordered expression transforms to a Weyl-ordered expression, and only these expressions are self-adjoint.
Example 3. For the A 3 algebra graph in Fig. 12, we have exactly three graph simple geodesics with the corresponding geodesic functions G 12 , G 23 , and G 13 given by formulas (3.9) (which are written already in the Weyl-ordered form), and if we consider, for instance, the product where G 1232 and G 13 correspond to respective cases (a) and (b) of resolving crossing of the geodesics γ 23 and γ 12 near the dot-vertex 2 in Fig. 11. Note that G 13 is also Weyl-ordered, apparently is not Weyl-ordered. Product of the same operators as in (4.6) but taken in opposite order gives G 12 G 23 = qG 1232 + q −1 G 13 , so, introducing the q 2 -commutator [A, B] q 2 ≡ qAB − q −1 BA and ξ = q 2 − q −2 , we have the quantum A 3 -algebra:

Quantum skein relations
We now formulate the general rules that allow one to disentangle the product of any two quantum geodesics. Let G 1 and G 2 be two quantum geodesic operators corresponding to geodesics γ 1 and γ 2 where all the inversion relations are resolved using the dot-vertex construction (see Fig. 10). Then • We must apply the quantum skein relation 6 (4.7) simultaneously at all intersection points.
• After the application of the quantum skein relation we can obtain empty (contractible) loops; we assign the factor −q − q −1 to each such loop and this suffices to ensure the quantum Riedemeister moves.
• We can also obtain loops that are homeomorphic to going around a dot-vertex; as in the classical case, we claim the corresponding geodesic functions to vanish, so we disregard all such cases of geodesic laminations in the quantum case as well.
The main lemma is in order.
Lemma 10 ( [3,21]). There exists a unique quantum ordering × × · · · × × (4.4), which is generated by the quantum geodesic algebra (4.7) and is consistent with the quantum mapping class groupoid transformations (3.2), i.e., so that the quantum geodesic algebra is invariant under the action of the quantum mapping class groupoid.

Quantum A n -algebra
We now consider the quantum geodesic functions associated with paths in the A n -algebra pattern in Fig. 12. From the quantum skein relation, it is easy to obtain quantum transformations for the quantum geodesic functions G i,j . We introduce the A -matrix associating the Hermitian operators G i,j with the quantum geodesic functions. Using the skein relation, we can then present the action of the braid group element R i,i+1 exclusively in terms of the geodesic functions from this, fixed set: We can again present this transformation via the special matrices B i,i+1 of the block-diagonal form Then, the action of the quantum braid group generator R i,i+1 on A can be expressed as the matrix product (taking into account the noncommutativity of quantum matrix entries) with B i,i+1 † the matrix Hermitian conjugate to B i,i+1 (its nontrivial 2 × 2-block has the form qG i,i+1 1 q 2 0 ). Using the same technique as above, it is then straightforward to prove the following lemma.
Lemma 11. For any n ≥ 3, we have the quantum braid group relations

Quantum D n -algebra
We now quantize the Poisson algebra of geodesic functions G ij corresponding to paths as shown in Fig. 13. We have there eight possible variants of nontrivial intersections shown in Fig. 15. The corresponding quantum permutation relations read Deriving these relations requires a tedious combinatorial analysis based on quantum skein relations formulated in Section 4.4. Figure 15. Eight cases of nontrivial intersections of geodesics from the set G ij , i, j = 1, . . . , n in the case of the D n -algebra.
Although these relations not only contain triple terms in the r.h.s. but also noncommuting terms (this is the price for closing the algebra), they nevertheless establish the lexicographic ordering on the corresponding set of quantum variables {G ij }.
Lemma 12. Permutation relations treated as an abstract algebra postulated by (4.13) satisfy the commutation Jacobi identities.
The proof is tedious but straightforward calculations. Note that algebra (4.13) is selfconsistent even without relation to geometry of modular spaces; the similar phenomenon was already observed in the case of A n -algebras. As regarding the classification of cluster algebras in [11], we produced the corresponding algebras for disc and annulus with arbitrary number of marked points (in our approach, a punctured disc is just an annulus with one hole of zero perimeter; using the isomorphism in Theorem 2 we can move all marked points to one boundary component). We do not know however as yet an example of such an algebraically closed set for a disc with two punctures (holes); this case deserves a separate investigation.
We now provide the quantum version of the braid group transformations (3.16). They are similar to (4.9), the only actual distinction is in the corresponding 2 × 2-block of the matrix D. It is however that distinction that prevents us from writing these transformations in a form similar to (4.10).
We therefore have for the quantum braid group transformation for the D n -algebrã (4.14) Lemma 13. For any n ≥ 3, we have the quantum braid group relations (4.11) for transformations (4.14) of quantum operators subject to quantum algebra (4.13).
Again, it the second identity (4.12) is lost in the case of D n algebras.

Matrix representation for D n -algebra and invariants
We now construct the quantum analogues of (3.17) and (3.18).
Remark 1. We took particular form 8 (4.15) of the matrix R because, in the case n = 2, the combination is a central element of the (quantum) algebra D 2 ; the other central element is Also, exactly with such a combination, diagonal elements remain zeros acquiring no q-corrections. And, eventually, only this matrix possesses the (quantum) cyclic symmetry below.
A cyclic permutation of indices P : i → i + 1 mod n; j → j + 1 mod n destroys the structure of the matrix A and results in the following transformations for R and S : These transformations together with (4.10) generate a full modular group. This means that, at least in the classical case, det R is the mapping-class group invariant and lies therefore in the center of the Poisson algebra. Same is true for S, but det S ≡ 0 whereas det R is nonzero for even n = 2m (and vanishes for odd n): denoting Q i,j := (R) i,j for i < j, we have that det R = Pf (R) 2 , where the Pfaffian Pf (R) is given by the Grassmann-variable integral Pf (R) = · · · dθ 1 · · · dθ 2m e P 1≤i<j≤2m θ i Q i,j θ j and is described by all possible (signed) pairings in the set θ 1 θ 2 · · · θ 2m−1 θ 2m where θ i θ j = Q i,j for i < j.
For example, for m = 2, we have In the quantum case, these elements obviously get q-corrections to be calculated explicitly since the notion of a quantum determinant is ambiguous; we hope to return to this problem elsewhere. Also, this construction provides just one central element of the algebra D 2m ; finding other central elements in a regular way (similar to the one in [2] where all the central elements of the A n -algebra were generated by det(λ −1 A + λA T )) needs further investigation.
5 Multicurves and the double of windowed surface

Multicurves for bordered surfaces
It is a standard notation that a multicurve (lamination) is a collection of non(self)intersecting curves. Apparently, in a new formulation with dot-vertices, this definition can be literally transferred to the case of surfaces with marked points on boundary components. Definition 2. Consider the homotopy class of a finite collection C e = {γ 1 , . . . , γ n } of disjointly embedded (unoriented) simple curves γ i in a topological windowed surface Σ g,δ . These curves are either closed or terminate at windows. We impose the only restriction that we have an even (can be zero) number of endpoints of these curves at each window. An even-based generalized multicurve (eGMC) C e in Σ g,δ is a multiset based on C; we then have s i ≥ 1 parallel copies of components of C, or in other words, positive integral weights s i on each component of C, where s i is the multiplicity of γ i in C e . Further, given a hyperbolic structure on Σ g,δ , we associate to C e the product G Ce = G s 1 γ 1 · · · G sn γn of geodesic operators (2.2) of all geodesics constituting a GMC; these operators Poisson commute in the classical case since the components of C are disjoint. We therefore extend the standard definition by introducing nonclosed curves that terminate at the boundary components. The only restriction we impose is the evenness of the number of curves terminating at each connected part of a boundary component (passing through an inversion geodesic line). Now in order to obtain the multicurve, we connect pairwise the ends of these curves (below the inversion, or bounding, geodesic line) as shown in Fig. 16 obtaining therefore the collection of topologically closed curves.
Each curve that is homeomorphic to the path encircling a single dot-vertex (see, e.g., case (d) in Fig. 11) has zero geodesic function G = tr F , and we therefore exclude all such multicurves. At the same time, as before, a eGMC containing a contractible component (of length zero) is minus twice the eGMC with this curve removed.

The double of the Riemann surface
In order for our procedure to have a geometrical sense, we now construct the double of the Riemann surface and transfer to this double the structure of multicurves. Note that it is often easier to prove properties of the geodesic function using the structure of the doubled Riemann surface without boundary components.
We first describe the doubled surface itself. Nonintersecting curves must remain nonintersecting in the picture of double when we replace inversions merely by (doubled) variables 2Z i on the corresponding edges. To attain this, let us consider the example of a geodesic line in Fig. 17. If we clone this surface, drift apart the copy of it and then connect all the pending ends with their twins preserving the orientation (as shown in Fig. 18), then we obtain the new Riemann surface without pending edges (and, correspondingly, without windows). Having the initial Riemann surface Σ g,δ where δ is from (2.3), s the number of boundary components, and δ j the number of marked points on the jth component (can be zero), we obtain that upon the joining as shown in Fig. 18, each boundary component with even δ j (including the zero one) generates two boundary components without marked points (holes) in the doubled Riemann surface, whereas each boundary component with odd δ j generates exactly one hole in the new doubled Riemann surface. Then, easy calculation using the Euler characteristic formula gives the answer for the genusĝ and number of holesŝ of the doubled Riemann surface Σĝ ,ŝ : Note that while flip morphisms on inner edges of the initial graph pertain to flipping simultaneously two (disjoint) copies of this edge in the double graph, flip morphisms on pending edges (see Fig. 9) change the topological structure of the double graph (the genus and the number of holes of the doubled Riemann surface may then change; only the total Poisson dimension must remain invariant).
As in the case of dual Teichmüller spaces in [8], the coordinates Z α describe the linear subspace of the Teichmüller space T Ĥ g,ŝ , which is again a 2ŝ-fold covering of the Teichmüller space ramified over punctured surfaces (with old and new boundary components). This subspace comprises surfaces admitting the involution interchanging two halves of the doubled Riemann surface.
It seems that no closed geodesic line corresponds to an initial closed geodesic with odd number of inversions (the corresponding line on the doubled Riemann surface is nonclosed). To understand how to overcome this trouble and to formulate the general procedure of constructing the "doubled" multicurve, let us consider the example in Fig. 19. There, we have the multicurve with two components, geodesic curves I and II, on the windowed Riemann surface. Curve I Figure 17. An example of geodesic curve with even number of inversions. experiences two inversions while curve II has one inversion. To produce a multicurve on the doubled surface, we first merely double the pattern (first stage in Fig. 19) and then connect each pending edge of the original graph with its copy on the clone of this graph in a natural way, that is, preserving the orientation and without introducing intersections of threads of the multicurve (second stage in Fig. 19).
We note, first, that the pattern in the doubled surface thus obtained is always a multicurve (since we did not introduce any new intersection). We now turn to its content.
It is easy to see that a geodesic line I with the geodesic function G I and the length ℓ I on the original surface that has even number of inversions produces two disjoint nonselfintersecting (albeit not parallel) geodesic lines I 1 and I 2 on the doubled Riemann surface, and these two new lines has the respective geodesic functions G I 1 and G I 2 and lengths ℓ I 1 and ℓ I 2 such that On the contrary, for a geodesic line II with the geodesic function G II and the length ℓ II that has an odd number of inversions, this geodesics produces one nonselfintersecting geodesic line II 1,2 on the doubled Riemann surface with the geodesic function G II 1,2 and length ℓ II 1,2 , and it is easy to see that they satisfy the relations that is, we have then a single geodesic of doubled length. From (5.2) and (5.3) it follows that we must take as the characteristic of a multicurve, or a rational lamination, the sum of lengths of the constituent geodesics. We must be able to construct this sum from the geodesic function or from a quantum geodesic function ensuring the positiveness property: the length must be nonnegative function in the classical case or positivedefinite operator in the quantum case. This is ensured by the following construction proposed in [5]. We then obtain an oriented surface whose genus is given by (5.1). To each nonselfintersecting geodesic line that has an even number of inversions in the original picture, we may set into the correspondence a unique (nonselfintersecting) line on the doubled Riemann surface (dashed line for the geodesic line in Fig. 17).
where we take the principal branch of the logarithm and T n are Chebyshev's polynomials (cf. (4.5)). Since T n (cosh t 2 ) = cosh nt 2 , it follows that p.l.(γ) is the hyperbolic length of γ in the Poincaré metric in the classical case.
In the operatorial case, we can determine p.l.(γ) explicitly in terms of the spectral expansion of the operator G γ , which is known exactly [14]. Namely, the basis of eigenfunctions of G γ is labeled by the positive number S whereas the eigenvalue corresponding to the eigenfunction |α S has the form e S/2 + e −S/2 and the both limits S → +∞ and S → 0 are singular in the functional sense. Eigenfunctions |α S constitute an orthogonal and complete basis, so we can define the proper length operator to be the one with the same eigenfunctions α S and with positive eigenvalues S/2. The operator p.l.(γ) is then a well-defined operator on any compactum in the function space H.
The proper length of a QMC or GMCĈ, which we denote as p.l.(Ĉ) ≡ ℓĈ, is the sum of the proper lengths of the constituent geodesic length operators (or the sum of geodesic lengths calculated in the Poincaré metric in the classical case) weighted by the number of appearances in the multiset.
Lemma 15. Given a general even-based multicurve C e , its proper length satisfies the general relation: denoting by C 1,2 the GMC generated on the doubled Riemann surface, we have irrespectively on the content of this multicurve: how many geodesic curves constitute the corresponding multicurve, what is the number of inversions experienced by individual curves, etc. Figure 19. A general procedure of doubling a multicurve. We first produce two copies of the original pattern, then sew together pairwise (with orientation preserving and with parallel transport of the multicurve threads) copies of dead ends forgetting about dot-vertices. In the doubled surface, we then obtain two copies (I 1 and I 2 ) of those original geodesic lines (I) that experienced even number of inversions in the original pattern (although these copies are not parallel, their lengths coincide in the new pattern), whereas each original geodesic (II) that experienced odd number of inversions, generates one new geodesic (II 1,2 ) of doubled length in the doubled surface.
We therefore see that the only object for which the Thurston theory can be elaborated are sums (5.4) of lengths of curves entering a multicurve. Note that we have the convergency theorem [5] only for this characteristic.
But if we want to consider algebraic structures in a consistent way, it is better to do in the original pattern (as was done above) because geodesic algebras on a doubled surface do not satisfy the standard relations due to the additional involutional symmetry.

Elements of Thurston theory of bordered surfaces
We now extend the notion of train tracks and foliation-shear coordinates to the case of bordered surfaces. (In this section, we use the terminology of Thurston's school.) For a comprehensive research into the subject, see [20]; an introductory description close to the one in the present paper is contained in [5].

Decorated measured foliations and freeways
We recall material from [18]. If Γ g,δ ⊆ Σ g,δ is a cubic fatgraph spine of Σ g,δ , then we may blow-up each three-valent vertex of Γ g,δ into a little trigon as illustrated in Fig. 20. The resulting object τ = τ Γ g,δ has both a natural branched one-submanifold structure and a fattening, and furthermore, components of Σ g,δ \τ are either little trigons, or once-holed (once-punctured) nullgons, or bigons with one marked point on one of the edges (we therefore forbid monogons). Thus, τ is not a train track, but it is almost a train track, and is called the freeway associated to Γ g,δ . Notice that each edge of Γ g,δ gives rise to a corresponding large branch of τ , and each vertex gives rise to three small branches. It is easy to see that every measured lamination in Σ g,δ is carried by the freeway τ .
The frontier of a once-holed nullgon component of Σ g,δ \τ is a puncture-parallel curve called a collar curve of Σ g,δ (curve I in Fig. 8). We also introduce collar curves that are unions of bigon edges constituting a path homeomorphic to a boundary component (curve II in Fig. 8). We have exactly s nonhomeomorphic types of collar curves. A small branch is contained in exactly one collar curve, while a large branch may be contained in either one or two collar curves (and each pending branch is contained in exactly one collar curve).
A measure on a freeway τ is a function µ ∈ R #B(τ ) (B(τ ) is the set of all branches, long and short) satisfying the natural switch conditions provided that for each switch v of τ , we have Such a function satisfying the switch conditions is commonly called a (transverse) measure on τ , and τ itself is said to be recurrent train track if it supports a positive measure µ with µ(b) > 0 for each branch of τ .
For freeways, however, the measure is not necessarily nonnegative (as it is for train tracks). Let U (τ ) denote the vector space of all measures on τ . Notice that µ ∈ U (τ ) is uniquely determined by its values on the short branches (the switch conditions are equivalent to the "coupling equations" for any long branch e whose closure contains the switches v 1 = v 2 and a i , b i are the short branches incident on v i for i = 1, 2). And, simultaneously, the values on the long branches alone also uniquely determine µ. At the same time, the both sets of transverse measures on short and long branches are subject to constraints imposed by the positivity condition in the case of recurrent train tracks (the triangle inequality in the case of measures on long branches), so the problem is to propose new variables describing the transverse measures that are unconstrained. We then identify U (τ ) ≈ R LB(τ ) , where LB(τ ) denotes the set of long branches of τ .
Recall that, having nonnegative transverse measures on edges of a train track τ , we can canonically associate to τ the corresponding measured foliation MF 0 (Σ g,δ ), which is determined up to the equivalence relation that claims that if two foliations differ only by their "collar weights", i.e., the transverse measures of boundary-parallel arcs, then they are equivalent, and in each equivalence class we find a unique measured foliation with all collar weights equal to zero.
A nonnegative measure on τ then canonically determines a point of MF 0 (F ) together with a nonnegative "collar weight", and we can define the space MF 0 (F ) = MF 0 (F ) × R s of decorated measured foliations.
We then have the theorem.
Theorem 4 ( [18]). The space U (τ ) ≈ R LB(τ ) gives global coordinates on MF 0 , and there is a canonical fiber bundle Π : MF 0 → MF 0 , where the fiber over a point is the set R s of all collar weights on F .
Remark 2. The natural action of mapping class group M C s g is by bundle isomorphisms of Π. Furthermore, Π admits a natural M C s g -invariant section σ : MF 0 → MF 0 which is determined by the condition of identically vanishing collar weights. The restriction of σ to MF 0 ⊆ MF 0 gives a piecewise-linear embedding of the piecewise-linear manifold MF 0 into the linear manifold (vector space) MF 0 ≈ U (τ ) ≈ R LB(τ ) .

Shear coordinates for measured foliations
We now give an equivalent parametrization of measured foliations in terms of "Thurston's shear coordinates" that are closest analogues of Thurston's shear coordinates Z α on T H (Σ).
We assign a corresponding signed quantity (positive for right, negative for left) as follows. Given a measure µ on the long branches of the freeway τ associated to the fatgraph spine Γ ⊆ Σ, define the (Thurston's foliation-)shear coordinate of the edge indexed by α to be ζ α = 1 2 (µ(A) − µ(B) + µ(C) − µ(D)), (5.5) in the notation of Fig. 7 for nearby branches.
If αth edge is a pending edge, we use also formula (5.5) but with, say, µ(C) = µ(D) = 0 because the edge α has then just one switch v 1 at its upper end.
From the very definition, ζ α is independent of collar weights. The shear coordinates ζ α are not independent, but the only restrictions imposed are α∈I ζ α = 0 for the sums over edges α ∈ I surrounding any given boundary component; we call these conditions the face conditions for shear coordinates. Thus, the space of foliation-shear coordinates is of dimension LB(τ ) − s and coincides, in particular, with the dimension of the nondegenerate Poisson leaf. For any assignment of shear coordinates, there is a well-defined point of MF 0 realizing them, thereby establishing a homeomorphism between MF 0 and this sub-vector space R LB(τ )−s ⊆ R LB(τ ) of shear coordinates on the long branches of τ .
Remark 3. Note that for arbitrary integer measures µ(Z α ) on long edges, the foliation-shear coordinates ζ α on pending (long) edges can be half-integer! They are integers only if we claim the evenness condition. In the picture of the double, these coordinates are halves of the corresponding would-be foliation-shear coordinates ζ α on Σĝ ,ŝ (where the foliation is induced from the one in Σ g,δ in a natural way described in Fig. 19). That we take halves of them follows from the doubling of the corresponding shear coordinate Z α . For example, the value of the foliation-shear coordinate on the pending edge for the pattern in Fig. 16 is +2; it is half-integer only if we have originally nonclosed curves.  We now describe the action of the mapping class group (the Whitehead moves) on foliationshear coordinates, that is, derive the analogue of formula (3.2) for measured foliations, which is an elementary calculation using the formulas for splitting. Lemma 16. Under the Whitehead move in Fig. 7, the corresponding foliation-shear coordinates of the edges A, B, C, D, and Z situated as in that figure are transformed according to formula (3.2) with φ H (ζ Z ) = (ζ Z + |ζ Z |)/2, (5.7) i.e., φ H (x) = x, for x > 0, and zero otherwise. All other shear coordinates on the graph remain unchanged. Formula (5.6) holds irrespectively on whether some of edges A, B, C, and D are pending edges.
When flipping a pending edge as shown in Fig. 9, the corresponding foliation-shear coordinates of the edges Y 1 , Y 2 , and Z undergo the transformation with φ H (x) from (5.7). The corresponding transformations for the transverse measures are depicted in Fig. 22.

Remark 4.
Comparing expressions for the classical function φ(x) = log(1 + e x ) and (5.7), one finds that the latter is a projective limit of the former: that is, all three transformations coincide asymptotically in the domain of large absolute values (or large eigenvalues for the corresponding operators) of Teichmüller space coordinates {Z α }. This property was crucial for constructing quantum Thurston theory of surfaces with holes in [5].
Presumably, the corresponding construction can be transferred almost literally to the case of bordered surfaces. We do not however consider it in this paper postponing the description of quantum Thurston theory of bordered surfaces for future publications.

Conclusion
We have proposed a (novel) graph description of moduli spaces of Riemann surfaces with windows (marked points on the boundary) and demonstrated that it provides all the necessary ingredients, including the construction of the double Riemann surface with holes (and without windows). The approach in this paper might be close to the one in [11] where mutations pushing marked points from one boundary component to another have been considered as well. There, however, the corresponding points can be transferred only in pairs, which apparently differs from the procedure in this paper. Establishing a correspondence between these two approaches definitely deserves further studies.
Worth mentioning is the open/closed string diagrammatics proposed recently in [15]. We hope that introducing new variables (on pending edges) may allow attaining a comprehensive quantitative description of string theories and, in its possible quantum version, may provide a bridge to a string field theory description of the related objects.
Also note the algebras A n and D n , which play an important role in classification of finitetype cluster algebras [11]. Eventually, it seems interesting to generalize the construction in this paper to higher Teichmüller spaces introduced by Fock and Goncharov [9].