{'fraction_non_alphanumeric': 0.03475569139140316, 'fraction_numerical': 0.008150150856157674, 'mean_word_length': 4.072947724110515, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
When Left and Right Turns Inside Out: A Geometric and Categorical Introduction to an Inverse Problem in Persistence

In this paper we introduce the problem of counting embedded spheres in R^3 whose projection to the z-axis yields a level set barcode of a particular type. Two embedded spheres are considered height equivalent if they are related by a z-level set preserving isotopy. A formula previously used to count functions on the interval with the same sub-level set persistence barcode provides a lower bound on height equivalence classes with the same level set persistence. A conjectured upper bound is provided as well.


A Geometric Introduction
One of the beautiful things about persistent homology is that it gives a new perspective on very basic objects of study, such as functions on the interval. In fact, one could very easily take any one of the common graphs we draw in pre-calculus courses and ask what the sub-level set barcode of the associated function is. The only reason this is not done in precalculus courses is that the construction of the barcode is somewhat opaque and requires ideas normally only encountered in a first year Ph.D. program in mathematics or perhaps an advanced undergraduate sequence.
In the setting of functions on the interval, the definition of the sub-level set barcode is somewhat easier and we content ourselves here with a fast-and-loose treatment. Given a reasonable 1 function f : X → R, one can first consider the persistent set of path components associated to it.
This is simply a 1-parameter family of sets indexed by the real line where S(r) := π 0 (f −1 (∞, r]) is the set of path components of the sub-level set at r and the map S(r) → S(t) describes how these components merge as we increase the value. We can then linearize the above 1 A "reasonable" function could mean one with finitely many critical values, but we need not assume the function is differentiable. In general, a reasonable function is one that is tame with respect to some o-minimal structure.
persistent set by considering for every real value r the vector space whose basis is given by S(r). This defines the associated freely generated persistent vector space, which for nice spaces coincides with the zeroth homology of each of the sub-level sets.
A surprising fact [Cur17,Thm. 3.8] is that there exists a suitable global change of basis of this persistent vector space where basis vectors trace out intervals before they (possibly) die. The tracing out of these basis vectors is the barcode. We note that in the first figure we see how sub-level set persistence detects two things: the local minima at each of the end points and the maximum value of the function. A logical question to then ask is "To what extent does the barcode determine the function?" If we now think of persistent homology as a map from the space of functions to the space of barcodes, then the above question asks us to consider the fiber of this map over a point, which is one possible interpretation of the inverse problem in persistence.
There are many reasons to write off this question as silly, since the fiber is obviously uncountable. After all, one can take any horizontal distortion of the function and the sublevel sets will experience no topological change. Additionally, one can reflect or modify the function by adding little "kinks" to the graph of the function at either endpoint and the persistence will go unchanged. However, if we introduce two extra pieces of structure (1) a Dirichlet-type boundary condition-assume the functions under consideration have local minima at each endpoint-and (2) a notion of equivalence-two functions are deemed graph equivalent if there is an orientation-preserving homeomorphism of the domain taking one function to the other-then the inverse problem for functions on the interval is both tractable and interesting, as the following theorem illustrates.
Theorem 1.1 (Theorem 6.11 of [Cur17]). Let B = {I j } N j=1 be a collection of intervals ("barcode") of the form I 1 = [b 1 , ∞) and I j = [b j , d j ) ⊂ I 1 where d j > d j+1 for j = 2. Let µ B (I j ) be the number of intervals I k in B containing I j as a strict subset. The number of graph equivalence classes of functions on the interval obtaining minima at their boundary is It should be noted that the exponential pre-factor of 2 N −1 comes from a wish to distinguish time series (viewed as functions on the real line) with up-trending versus down-trending behavior. Up-trending and down-trending behavior is detected for generic functions on the real line by specifying which component is to the left and which is to the right when a merge event occurs.
Remark 1.2. It should be noted that the idea of using this "chirality" to distinguish time series via persistence is due to Yuliy Baryshnikov, who introduced the idea publicly during an invited lecture at a conference on geometry and data analysis, held at the Stevanonich Center at the University of Chicago in June 2015.
Since the existence of N − 1 bars of finite length indicates there were N − 1 local maxima, this left-right designation occurs N − 1 times and hence requires specifying a binary string of length N − 1, thus the information encoding of 2 N −1 . One can ask to what extent this result extends to functions defined on different domains and this is the goal of the present paper.
1.1. Generalizing to Embedded Spheres. One of the immediate obstacles to generalizing the above result is that on other domains-the circle, graphs, or surfaces-there is not a well-defined notion of "left" or "right." Since our program is to take visually distinct objects with the same persistence, we present our fundamental examples of interest, which we call "the shotglass" and "the worm." "The Shotglass" "The Worm" BC There are several things to observe about the shotglass and the worm. These are embedded spheres whose projections to the z-axis contain identical topological information in their respective fibers. In both examples, the level sets of the projections are-working from bottom to top-a point, a circle, a point and a circle, two circles, a wedge of circles, a single circle, and a point. The only distinction between these two shapes is that in the shotglass the circles nest inside one another (the inside rim of the glass "nests inside" the outside rim of the glass) and in the worm both circles are disjoint with no nesting relationship. This is the qualitative feature that we'd like to be able to distinguish, by setting up a category where the shotglass and the worm belong to different isomorphism classes.

A Categorical Introduction to the Inverse Problem at Hand
It was pointed out to the author by Dmitriy Morozov that the height function on the shotglass and the worm can actually be regarded as the same function on the two-sphere, perhaps after an orientation-preserving change of coordinates. As such the notion of graph equivalence used in [Cur17] and recalled above will not distinguish these two objects. This motivates the following delineation of a new category and a new notion of equivalence.
Definition 2.1 (The Groupoid of Height-Equivalent Spheres). Let E be the category whose objects are compositions of the form where ι : S 2 → R 3 is a topological embedding and π z = •,ẑ is the projection onto the unit normal vectorẑ = [0, 0, 1] t . A morphism between two of these objects is a commutative diagram of the form where ϕ : R 3 → R 3 is a homeomorphism that is isotopic to the identity. Note that commutativity of the diagram implies that ϕ is a level-set preserving homeomorphism. By being isotopic to the identity, we mean isotopic in a way that preserves the level sets of π z . Since every morphism is invertible, E is clearly a groupoid. If two objects belong to the same component of E, then we say the objects are height equivalent. Remark 2.3. Of course, since N − S + M = χ(S 2 ) = 2 it suffices to specify any two of these numbers since the third will be determined by this equation for the Euler characteristic.
We observe that any two height equivalent objects in E necessarily has the same sublevel persistence barcodes because all of the fibers are homeomorphic in a level-set and orientation-preserving way. However, sub-level set persistence is already too coarse of an invariant since the definition of E is most clearly directed at level set persistence, which requires brief explanation.
2.1. Level Set Persistence. Intuitively, level set persistence for Morse functions f : M → R provides a continuously varying "barcode-like basis" for the homology groups of the fibers H i (f −1 (t); k). Of course any reference to a continuously varying family of vector spaces indexed over a base space portends the use of sheaf theory. We will not introduce the basics of sheaf theory here and instead content ourselves to a statement of what level-set persistence is.
Definition 2.4. Let X be a topological space and let k X be the locally constant sheaf on X with value the field k. Given a proper map f : X → Y , the i th Leray sheaf associated to f is the sheafification of the assignment and is usually denoted R i f * k X since it agrees with the i th right-derived functor associated to the pushforward evaluated on k X .
Remark 2.5 (Alternative Definitions of Level Set Persistence). In the event that f : X → Y is not proper one could use the i th right derived direct image functor with compact supports R i f ! k X to capture the cohomology of the fiber using stalks-this is perhaps the proper generalization of the Leray sheaves to non-proper maps. Either way, we believe that Leray sheaves provide the most natural formalism for treating level set persistence, cf. [Cur14,KS18], but there are other choices, e.g. zig-zag persistence [CdS10] or parametrized homology [Kal13,CdSVM16], the latter one having a measure-theoretic flavor.
Definition 2.6 (Level Set Barcode). If f : X → R is reasonable-a Morse function or a tame function-then R i f * k X is isomorphic to a direct sum of locally constant sheaves k n j I j where I j is some interval contained in the image of f and k n j I j is the locally constant sheaf with value the n j dimensional k-vector space k n j . Here k n j I j is the sheaf whose stalk is k n j on I j and 0 elsewhere, see [KS90,p. 93] for a precise definition. The multi-set of intervals {(I j , n j )}, where n j indicates the number of times I j repeats, is the i th level set barcode associated to f . We note that the map establishing the isomorphism is what provides the "barcode-like basis" for the cohomology of the fibers. Assuming the barcode is finite implies that the cohomology of the fibers is finitely generated, so the universal coefficient theorem implies that the homology and cohomology of the fibers agree.
2.2. Truncated Merge Trees and their Persistence. Since we are interested in Morse functions on the sphere S 2 , all the topological content of the fibers is contained in the Reeb graph, which we now recall.
Definition 2.7 (Reeb Graph). Let f : X → R be a function. Consider the equivalence relation on X that identifies x ∼ x if and only if f (x) = f (x ) = t and x is connected to x by a path contained in the fiber f −1 (t). Clearly the function f is constant on equivalence classes so it factors X Under the assumption that f : X → R is a tame proper map, such as a Morse function, then the quotient space R f has the structure of a graph with vertices corresponding to critical points and edges corresponding to components of flow lines connecting two critical points. The graph with its function π f : R f → R is the Reeb graph associated to f : X → R.
Reeb graphs for Morse functions can also be described more categorically as a diagram of sets indexed by critical values and non-critical intervals. Specifically, if f : M → R is a Morse function with n critical values τ 1 < · · · < τ n , then we can choose a collection of non-critical values intertwining with the critical ones: Since f : M → R is a Morse function we have the following diagram of spaces for every i = 1, . . . , n where the vertical inclusion of the critical fiber induces a homotopy equivalence. Applying the path components functor π 0 yields a diagram of sets of the form Letting S(α i ) = π 0 (f −1 (α i )) and S(τ i ) = π 0 (f −1 (τ i )), then the Reeb graph for f is determined by the diagram of sets and set maps We will refer to the maps ρ i as right attaching maps and the maps i as left attaching maps since they describe how to attach the edges over non-critical intervals to points in the critical fiber on the right and left, respectively.
Remark 2.8 (Constructible Cosheaves and the Entrance Path Category). The above reformulation of the Reeb graph is actually an instance of a deeper story, which we briefly recall.
The proper structure for organizing the path components π 0 (f −1 (y)) of a map f : X → Y is the Reeb cosheaf, cf. [dSMP16]. Under the assumption that f is stratifiable, then the Reeb cosheaf is constructible. An equivalence first witnessed by Robert MacPherson is that constructible cosheaves are equivalent to functors from the entrance path category, which is also sometimes called the fundamental category of a stratified space (perhaps after taking the opposite category). Since a Morse function f : M → R induces a very simple stratification of the real line into critical values and non-critical intervals, the entrance path category for this stratification of the real line has an equivalent subcategory given by choosing the representative non-critical values α i . Restricting the representation of the entrance path category to this equivalent subcategory gives the diagram of sets show above. The interested reader can consult [CP16] for more details.
With the above reformulation of a Reeb graph, we can now define merge trees, which served a critical role in enumerating the graph-equivalence classes considered in [Cur17]. Here we are assuming that n is the minimal number of critical values needed to detect changes in π 0 of the fiber.
One of the reasons that merge trees are nicer than Reeb graphs is that their persistence is easy to determine by virtue of the Elder Rule, which essentially gives a rule for determine the persistence (sub-level or level set) via a branch decomposition of the merge tree. This rule says that while sweeping from −∞ to +∞ at each leaf node one should start drawing an interval and when two branches merge the interval that started being drawn earlier ("the elder" of the two) continues, while the younger interval should be stopped and with an open right hand endpoint. With this rule each interval in the barcode defines a continuous section of the merge tree over this interval. Collectively these sections define a partition of the merge tree into subsets each of which are topologically equivalent to the interval they "lift." This property holds for merge trees, but does not hold for general Reeb graphs. However, since a truncated merge tree is a Reeb graph that uniquely extends to a merge tree, we can use the formula in [Cur17, Thm. 4.8] to count the number of truncated merge trees with a fixed level set barcode B.
Proposition 2.10 (cf. [Cur17]). Let B = {I j } N j=1 be a collection of intervals with I 1 = [b 1 , d 1 ] and for j ≥ 2 we have a strict containment I j = [b j , d j ) ⊂ I 1 with d j > d j+1 . If we let µ B (I j ) = #{I k ∈ B | I k ⊃ I j } then the number of TMTs having B as its level set barcode is Proof. Given a truncated merge tree we can turn it into a persistent set by inverting the left attaching arrows that are isomorphisms and extending to something defined over all of R. In more detail, given we have by inverting isomorphisms and extending the value of S(τ n ) to the right the skeleton for a persistent set.
We note that this specifies an actual persistent set S : (R, ≤) → Set by assuming the functor is constant between critical values {τ i }.
Consider the collection of persistent sets of the above form with barcode B ext , which is identical to the B specified in the hypothesis, but with the exception that I 1 is replaced with [b 1 , ∞). The number of persistent sets with barcode B ext is equal to the declared formula N j=2 µ B (I j ) as shown in [Cur17,Thm. 4.8]. Truncating each persistent set at d 1 , which a fortiori must be τ n , and reversing the arrows pointing to each τ i , which again must correspond to left hand endpoints in the barcode B, gives the claim.   ). We can endow a barcode B = {I j } N j=1 of the form described above with the structure of a poset by declaring I j ≤ I k whenever I j ⊆ I k . Consider for each I j ∈ B the strict upset of I j in B U j = {I k ∈ B | I j ≤ I k and I j = I k }.
Note that since I 1 is the largest bar and is contained in no other U 1 = ∅. Let B >1 denote B \ I 1 . One way of interpreting the counting formula given in Proposition 2.10 is that it counts the number of sections of the natural projection map from the disjoint union of U j to the corresponding interval I j in B.
Thus under this interpretation, every tree with barcode B is in 1-to-1 correspondence with a section of this map and we can think of the value of the section s(I j ) as the branch I k that I j attaches to.
One thing Proposition 2.10 does not take into account is the possibility that a Reeb graph could conceivably have B as its barcode without being a TMT. The following lemma shows this is not possible.
Lemma 2.12. Any Reeb graph π : R → R with level set barcode B of the form described in Proposition 2.10 is a TMT.
Proof. The only way in which the Reeb graph R cannot be a TMT is if one of the left attaching maps is non-bijective. First we show that having barcode B implies that the left attaching maps of importance are surjective. If one is not surjective then this would imply that there would be a pair of values t ≥ s lower than the max value d 1 where the map H 0 (π −1 [t, ∞)) → H 0 (π −1 [s, ∞)) is not surjective, but this would imply the existence of another bar in the super-level set filtration of R other than (−∞, d 1 ]. However, since level set persistence determines super and sub-level set persistence [Cur15], this is not the case. Now if there were a non-injective left attaching map, surjectivity would imply that the Reeb graph is non-simply connected, but we know this is not the case because H 1 (R) is determined by open bars in the level set barcode, again by [Cur15].

The Nesting Poset and Bounds on Height Equivalence Classes
Given an object f := π z • ι : S 2 → R 3 → R of M, i.e. an embedded sphere whose projection to the z-axis is height-equivalent to a Morse function, the Reeb graph of π z • ι : S 2 → R naturally comes equipped with extra structure, which we now describe. This structure comes from the fact that the non-critical fibers of π z •ι are all compact 1-manifolds, which are necessarily disjoint unions of circles and by using the fact that these fibers are contained in vertical translates of the x − y plane, we can define a nesting poset on each fiber.
Definition 3.1. Suppose γ : n i=1 S 1 i → R 2 is an embedding of n disjoint circles in the plane. We define the nesting partial order associated to γ, written N (γ), as follows.
• The elements of N (γ) are the labels of the disjoint circles i = 1, . . . , n.
• We say that i ≤ j if γ(S 1 i ) is contained in the bounded component of the complement of γ(S 1 j ).
We now define an enrichment of the Reeb graph associated to any object of M-the groupoid of Morse spheres.
Definition 3.2 (The Nesting Reeb Graph). Let f := π z • ι : S 2 → R be an object of M. Consider the Reeb graph of f , written π f : R f → R. For each non-critical value t ∈ R, we have a poset structure on the fiber of π −1 f (t) given by the nesting poset structure of N (ι(f −1 (t))) given by embedding the fiber in the plane π −1 z (t). We call the resulting Reeb graph with nesting poset on the non-critical fibers the Nesting Reeb Graph (NRG) associated to f , written N R(f ) Again consider an object f = π z • ι of M. Since we've assumed that one of the defining properties of a Morse function is that each critical value corresponds to a unique critical point, consider a critical value t c that corresponds to an index one critical point, i.e. a saddle. By choosing a sufficiently small ε, consider the unique component of f −1 ([t c − ε, t c + ε]) that contains the index one critical point corresponding to t c . Using the embedding of the level sets in that component in R 2 given by ι, we see that there are two basic moves that are differentiated by the nesting poset-"the meet" and "the kiss"-each of which are drawn below.  It now remains to show that every labeled TMT actually arises as an embedded sphere. To see this, we take a labeled TMT and lay it in the x -z plane so that projection to the z axis gives the correct barcode B. We then take an embedded sphere with a unique maximum at height d 1 and a unique minimum at b 1 so that the projection onto the x -z plane is a circle. Call this space X 1 . Now proceeding in order of decreasing death times d 2 > d 3 > · · · > d N , we inductively construct an embedded sphere as follows: Each d j corresponds to a unique to a unique component of X j−1 ∩ π −1 z (d j ) that [b j , d j ) attaches to. At height d j we make an incision (remove a closed interval) on the right most portion of the component of X j−1 we're attaching to so that the incision occurs along a the level set z = d j . Here we use the projection of X j−1 to the x -z plane to make "right most" corresponds to larger x value. If the label of the internal node corresponding to d j is an M , then we stretch this incision so that the top portion stretches to the right and the bottom portion is to the left. Dually, if the label on our TMT is a K then we stretch the top portion to the left so that the bottom portion is to the right. In either case, our incision has topologically become the removal of an S 1 with constant z value. We now attach an embedded disk whose boundary is the now removed value and which has a unique minimum z value corresponding to b j . In the M attaching move we say that we've added a "worm" to X j−1 and in the K attaching move we say that we've added a "shotglass" to X j−1 . The final space X N is clearly an embedded sphere that is height equivalent to a Morse function. Using this construction one can see that each labeled TMT gives rise to a TMT with a distinct nesting poset structure on its non-critical fibers, thus proving that the map from the space of labeled TMTs to π 0 (M (N, N − 1, 1) ↓ B) is injective. This proves the lower bound.
Unfortunately, the lower bound in Theorem 3.3 is not tight since "meets" and "kisses" do not suffice to determine the nesting Reeb graph. Indeed in the figure above we see that there are six isotopy classes with the drawn barcode, whereas the formula given provides a lower bound of four. The issue not considered is that every time a "meet" index one critical point is passed through-going from above to below-one has to choose how to partition circles contained in the original circle among the two newly created circles. Similarly, whenever a "kiss" is passed through there is a choice as to which circles enter the mouth and which ones remain outside. As such, the proper generalized analogy for a "meet" is binary fission, as if the cell needs to decide which organelles go where, and the proper generalized analogy of a "kiss" is phagocytosis, as an amoeba digests food from its environment by forming an internal compartment known as a phagosome.
Enumerating all of these possible redirects of internal organelles or food consumption would provide an upper bound on the possible phagocytosis or fission moves of 2 j where j is the number of components, but this doesn't guarantee that every isotopy class is completely determined by this classification of index one critical points. Moreover in the situation under consideration it should be possible to classify phagocytosis and fission events in terms of leftright partitions of food or organelles. As such we believe the following conjecture is true, but leave it to future work to come up with a complete proof.

Acknowledgements
The author is thankful for the many opportunities that have been given to him throughout his life, many of which feel undeserved. To pick one opportunity in particular, the author would like to thank the entire organizing committee of the 2018 Abel Symposium on Topological Data Analysis-Nils Baas, Gunnar Carlsson, Herbert Edelsbrunner, Kathryn Hess, Gereon Quick, Raul Rabadan, Markus Syzmik, and Marius Thaule-for inviting him to speak in Geiranger, Norway in June 2018. The author hopes that Nils in particular will appreciate the close connection between cobordism theory and the author's analytical and combinatorial study of persistence. Nils was in residence at the Institute for Advanced Study in 2013 when the author was also there finishing his thesis. The author recalls fondly several inspirational discussions that occurred during that time.
Additionally, the author would like to thank Michael Catanzaro, Brittany Fasy, Jānis Lazovskis, Greg Malen, Hans Riess, Mikael Vejdemo-Johansson, Bei Wang, and Matthew Zabka for their contributions to an online working group that emerged as a result of the IMA Special Workshop on Bridging Statistics and Sheaves. Some of the results described in this paper are directly due to the conversations that occurred during those meetings.